Hello,

I’ve upgraded PacketFence from 9.2 to 10.1.  Since then, I’ve had trouble 
getting the Captive Portal to function.  Since I noticed a newer version is 
available, I have now upgraded to 10.2 before writing this.

In the web interface, under Status -> Services, the haproxy-portal is enabled 
and running.  All green.  Except, the pid is 0.

Also in the web interface, under Advanced Access Configuration -> Captive 
Portal, the haproxy-portal dropdown is showing green.  But, looking further by 
clicking the dropdown, I notice Enabled and Managed are green, but Alive is red.

Systemctl status packetfence-haproxy-portal returns the following result:

● packetfence-haproxy-portal.service - PacketFence HAProxy Load Balancer for 
the captive portal
   Loaded: loaded (/lib/systemd/system/packetfence-haproxy-portal.service; 
enabled; vendor preset: enabled)
   Active: activating (start-pre) since Fri 2020-10-09 10:57:14 EDT; 2s ago
  Process: 230643 ExecStart=/usr/sbin/haproxy -Ws -f 
/usr/local/pf/var/conf/haproxy-portal.conf -p 
/usr/local/pf/var/run/haproxy-portal.pid (code=exited, status=1/FAILU
Main PID: 230643 (code=exited, status=1/FAILURE); Control PID: 230652 (perl)
    Tasks: 1 (limit: 36864)
   CGroup: /packetfence.slice/packetfence-haproxy-portal.service
           └─control
             └─230652 /usr/bin/perl -I/usr/local/pf/lib 
-Mpf::services::manager::haproxy_portal -e 
pf::services::manager::haproxy_portal->new()->generateConfig()

Oct 09 10:57:16 nadc1-pfence-01 haproxy[230643]: [ALERT] 282/105714 (230643) : 
Starting frontend portal-http-66.70.255.147: cannot bind socket 
[66.70.255.147:80]
Oct 09 10:57:16 nadc1-pfence-01 haproxy[230643]: [ALERT] 282/105714 (230643) : 
Starting frontend portal-https-66.70.255.147: cannot bind socket 
[66.60.255.147:443]
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: packetfence-haproxy-portal.service: 
Main process exited, code=exited, status=1/FAILURE
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: Failed to start PacketFence HAProxy 
Load Balancer for the captive portal.
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: packetfence-haproxy-portal.service: 
Unit entered failed state.
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: packetfence-haproxy-portal.service: 
Failed with result 'exit-code'.
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: packetfence-haproxy-portal.service: 
Service hold-off time over, scheduling restart.
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: Stopped PacketFence HAProxy Load 
Balancer for the captive portal.
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: Starting PacketFence HAProxy Load 
Balancer for the captive portal...


In /var/log/haproxy.log, I find the following:

Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: Proxy proxy started.
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: Proxy static started.
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: [ALERT] 282/114838 (17789) : 
Starting frontend portal-http-66.70.255.147: cannot bind socket 
[66.70.255.147:80]
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: [ALERT] 282/114838 (17789) : 
Starting frontend portal-https-66.70.255.147: cannot bind socket 
[66.70.255.147:443]
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: Proxy portal-http-10.30.247.1 
started.
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: Proxy portal-https-10.30.247.1 
started.
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: Proxy 10.30.247.1-backend 
started.
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: Proxy portal-http-10.30.3.162 
started.
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: Proxy portal-https-10.30.3.162 
started.
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: Proxy 10.30.3.162-backend 
started.
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: Proxy portal-http-10.30.248.1 
started.
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: Proxy portal-https-10.30.248.1 
started.
Oct  9 11:48:38 nadc1-pfence-01 haproxy[17789]: Proxy 10.30.248.1-backend 
started.

I notice the error about binding to 66.70.255.147.  That is not an IP I 
recognize, it is certainly not assigned to any of the interfaces on my system.

I find the address 66.70.255.147 in the pf.conf.defaults file with the header

# The IP address the portal uses in the registration and isolation networks.
# This IP address should point to an IP outside the registration and isolation 
networks.
# Do not change unless you know what you are doing.
ip_address=66.70.255.147

I found a github entry that discusses the captive portal IP here 
https://github.com/inverse-inc/packetfence/pull/5682 .  It says the previous 
hardcoded address of 192.0.2.1 is removed and an Inverse owned IP is put in its 
place.  I see that 66.70.255.147 is owned by Ovh Hosting in Montreal, not 
Inverse specifically, but I believe this github entry is talking about the 
captive portal section of pf.conf.defaults.

So, I set the address in the Captive Portal web page to 192.0.2.1 and 
experience the same results.  No captive portal and the error with the 
haproxy-portal service still exists.

Systemctl status packetfence-haproxy-portal now returns the following result:

● packetfence-haproxy-portal.service - PacketFence HAProxy Load Balancer for 
the captive portal
   Loaded: loaded (/lib/systemd/system/packetfence-haproxy-portal.service; 
enabled; vendor preset: enabled)
   Active: activating (start-pre) since Fri 2020-10-09 10:57:14 EDT; 2s ago
  Process: 230643 ExecStart=/usr/sbin/haproxy -Ws -f 
/usr/local/pf/var/conf/haproxy-portal.conf -p 
/usr/local/pf/var/run/haproxy-portal.pid (code=exited, status=1/FAILU
Main PID: 230643 (code=exited, status=1/FAILURE); Control PID: 230652 (perl)
    Tasks: 1 (limit: 36864)
   CGroup: /packetfence.slice/packetfence-haproxy-portal.service
           └─control
             └─230652 /usr/bin/perl -I/usr/local/pf/lib 
-Mpf::services::manager::haproxy_portal -e 
pf::services::manager::haproxy_portal->new()->generateConfig()

Oct 09 10:57:16 nadc1-pfence-01 haproxy[230643]: [ALERT] 282/105714 (230643) : 
Starting frontend portal-http-192.0.2.1: cannot bind socket [192.0.2.1:80]
Oct 09 10:57:16 nadc1-pfence-01 haproxy[230643]: [ALERT] 282/105714 (230643) : 
Starting frontend portal-https-192.0.2.1: cannot bind socket [192.0.2.1:443]
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: packetfence-haproxy-portal.service: 
Main process exited, code=exited, status=1/FAILURE
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: Failed to start PacketFence HAProxy 
Load Balancer for the captive portal.
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: packetfence-haproxy-portal.service: 
Unit entered failed state.
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: packetfence-haproxy-portal.service: 
Failed with result 'exit-code'.
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: packetfence-haproxy-portal.service: 
Service hold-off time over, scheduling restart.
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: Stopped PacketFence HAProxy Load 
Balancer for the captive portal.
Oct 09 10:57:14 nadc1-pfence-01 systemd[1]: Starting PacketFence HAProxy Load 
Balancer for the captive portal...

/var/log/haproxy.log now shows:

Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: Proxy proxy started.
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: [ALERT] 282/104756 (223396) : 
Starting frontend portal-http-192.0.2.1: cannot bind socket [192.0.2.1:80]
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: [ALERT] 282/104756 (223396) : 
Starting frontend portal-https-192.0.2.1: cannot bind socket [192.0.2.1:443]
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: Proxy static started.
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: Proxy portal-http-10.30.247.1 
started.
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: Proxy portal-https-10.30.247.1 
started.
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: Proxy 10.30.247.1-backend 
started.
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: Proxy portal-http-10.30.3.162 
started.
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: Proxy portal-https-10.30.3.162 
started.
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: Proxy 10.30.3.162-backend 
started.
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: Proxy portal-http-10.30.248.1 
started.
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: Proxy portal-https-10.30.248.1 
started.
Oct  9 10:47:56 nadc1-pfence-01 haproxy[223396]: Proxy 10.30.248.1-backend 
started.


In the pf.conf.defaults file, I commented out the IP.  This produces a warning 
when restarting the services “pf.conf value captive_portal.ip_address is not 
defined!”.

The haproxy-portal service is now started and I successfully performed guest 
registration.

Sorry to trouble you with all of this, but the first time I performed these 
steps, I was still experiencing trouble with the captive portal.  It’s not 
until I went through it all again to collect the information to include with my 
question that I found the captive portal to be working.  It is working with the 
captive_portal.ip_address section of pf.conf.defaults commented out.  I’m not 
certain commenting this line is the correct solution.  It must be there for a 
reason, no?

I will leave these questions for the group then…

Why is the haproxy-portal showing green in the web interface when, in fact, it 
is not successfully started?

What is the story with the captive_portal.ip_address section of 
pf.conf.defaults?  Is it a mistake to leave it commented?

Thank you,

Jeff

PRIVACY NOTICE: The information contained in this e-mail, including any 
attachments, is confidential and intended only for the named recipient(s). 
Unauthorized use, disclosure, forwarding, or copying is strictly prohibited and 
may be unlawful. If you are not the intended recipient, please delete the 
e-mail and any attachments and notify us immediately by return e-mail.
_______________________________________________
PacketFence-users mailing list
PacketFence-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/packetfence-users

Reply via email to