OPNsense Forum

Archive => 19.7 Legacy Series => Topic started by: rainerle on September 16, 2019, 10:35:09 AM

Title: 19.7.4: After HA failover mobile IPsec users stay connected to the now backup FW
Post by: rainerle on September 16, 2019, 10:35:09 AM
Hi,

after a few failovers I realised that a via IPsec connected users (with MOBIKE enabled) stays connected to the firewall he initially connected to. The connection itself becomes unusable since the routing is not working anymore, but the VPN client does not reconnect to the new master HA device.

If one of the firewall reboots the client reconnects properly. Above scenario is only valid if the failover is triggered by disabling the CARP interfaces in /carp_status.php .

Is there already an existing best practise/work around for this? From my point of view a CARP failover should trigger service restarts on the old master HA device...
Title: Re: 19.7.4: After HA failover mobile IPsec users are connected to the backup FW
Post by: rainerle on September 16, 2019, 11:43:37 AM
Can I somehow use
/usr/local/opnsense/service/configd_ctl.py
to restart strongswan as soon as an active master becomes backup?


root@opnsense01:~ # cat /usr/local/etc/devd/carp.conf
#
# CARP notify hooks. This will call carpup/carpdown with the
# interface (carp0, carp1) as the first parameter.
#

notify 101 {
    match "system"          "CARP";
    match "subsystem"       "[0-9]+@[0-9a-z]+";
    match "type"            "(MASTER|BACKUP)";
    action "/usr/local/opnsense/service/configd_ctl.py interface carp $subsystem $type";
};
root@opnsense01:~ #
Title: Re: 19.7.4: After HA failover mobile IPsec users are connected to the backup FW
Post by: mimugmail on September 16, 2019, 12:18:17 PM
Does the VPN Client connects to the CARP IP?
Title: Re: 19.7.4: After HA failover mobile IPsec users are connected to the backup FW
Post by: rainerle on September 16, 2019, 01:03:21 PM
Yes, it does. It uses a DNS name that points to the CARP IP.

I have no test cluster available yet, but from all the HA woes I think I have to build one...
Title: Re: 19.7.4: After HA failover mobile IPsec users are connected to the backup FW
Post by: rainerle on September 16, 2019, 01:39:50 PM
Reading up on
https://wiki.strongswan.org/projects/strongswan/wiki/MobIke
https://tools.ietf.org/html/rfc4555


So either disable MobIke or restart the IPsec service when a manual failover occurs that leaves the previous master HA device alive.

MobIke is fantastic for roaming mobile clients, so I would prefer the second option.
Title: Re: 19.7.4: After HA failover mobile IPsec users are connected to the backup FW
Post by: mimugmail on September 16, 2019, 02:59:45 PM
I remember a discussion in a github issue about restart daemon after failover, I think you were also involved.

Maybe worth open a feature request, but no guarantee.
Title: Re: 19.7.4: After HA failover mobile IPsec users are connected to the backup FW
Post by: franco on September 16, 2019, 03:33:48 PM
rc.syshook "carp" event with "pluginctl -s strongswan restart" should do the trick.


Cheers,
Franco
Title: Re: 19.7.4: After HA failover mobile IPsec users stay connected to the now backup FW
Post by: rainerle on September 16, 2019, 03:58:54 PM
Created a github issue https://github.com/opnsense/core/issues/3708
Title: Re: 19.7.4: After HA failover mobile IPsec users stay connected to the now backup FW
Post by: rainerle on September 23, 2019, 08:11:31 PM
Quote from: franco on September 16, 2019, 03:33:48 PM
rc.syshook "carp" event with "pluginctl -s strongswan restart" should do the trick.

So apparently there is a bug:
- created a script 20-ipsec as a copy from the 50-frr script
- added logging output as the stop/start command was never executed
- realised that /usr/local/etc/devd/carp.conf never picks up on my CARP interfaces since they are all on lagg devices...

Created a PR https://github.com/opnsense/core/pull/3721