-
Notifications
You must be signed in to change notification settings - Fork 3
Description
The current version of libreswan check for active connections looks as follows:
def get_active_conns(self):
return self.get_conns_from_status(r"#\d+: .*\"(.*)\".*")
It looks for the following in the output of ipsec status:
#1831: "ovn-8cd020-0-out-1":500 ESTABLISHED_CHILD_SA ...
#1831: "ovn-8cd020-0-out-1" esp.c17d497a@10.0.54.91 esp.a1627f5e@10.0.91.148 Traffic: ...
#2308: "ovn-8cd020-0-out-1":500 ESTABLISHED_IKE_SA ...
Any of the aforementioned three lines will mark ovn-8cd020-0-out-1 as active but in reality only the first or second line means that this connection is actice - a Child SA must be established. The following connection will be incorrectly marked as active even though it only contains orphaned IKE SA and no Child SA (ie. there is no IPsec SA in kernel for this connection):
#2308: "ovn-8cd020-0-out-1":500 ESTABLISHED_IKE_SA ...
I suggest to update the check to look for ESTABLISHED_CHILD_SA. Notice that even though there is a difference between libreswan-4 and libreswan-5 output "#\d+: .*\"(.*)\".*ESTABLISHED_CHILD_SA.*" should match correctly using either version.