Error with command 'ipsec leases'

Started by fog, March 16, 2023, 08:38:23 PM

Previous topic - Next topic
Hi,
In a script I use the command 'ipsec leases' to get all ip of the mobile ipsec vpn.

After update to 23.1.4 I get now the error message of the command: ipsec leases
no files found matching '/usr/local/etc/strongswan.opnsense.d/*.conf'
no pools found

In the Dashboard, Tile IPsec, Tab mobile I see the connected users and ip.

What happend with the command 'ipsec leases' ? In Version 22.7 the call 'ipsec leases' had the output:
no files found matching '/usr/local/etc/strongswan.opnsense.d/*.conf'
Leases in pool '172.16.0.0/16', usage: 2/65534, 2 online
       172.16.0.1   online   'gateway2'
       172.16.0.2   online   'gateway1'

Why is now no pool found?
In the GUI VPN/IPsec/Lease Status I see as pool defaultv4.

But the command 'ipsec leases defaultv4' bring also the error:
no files found matching '/usr/local/etc/strongswan.opnsense.d/*.conf'
pool 'defaultv4' not found


Regards,
fog

The interface and configuration files of strongswan have changed. Please try the following command:

# swanctl --list-pools
OPNsense 24.7.11_2-amd64

March 17, 2023, 07:59:13 AM #2 Last Edit: March 17, 2023, 08:40:23 AM by fog
thank you. The command is:
# swanctl --list-pools --leases
no files found matching '/usr/local/etc/strongswan.opnsense.d/*.conf'
defaultv4            172.16.0.0                        7 / 0 / 65534
  172.16.0.1                     online   'UserA'
  172.16.0.2                     online   'UserB'
  172.16.0.3                     online   'UserC'
  172.16.0.4                     online   'UserD'


Now I can modify my script https://forum.opnsense.org/index.php?topic=24887.msg125557 which assign A records with Unbound DNS:
Replace the line
ipsec leases | grep " 172.16" |sed "s/'//g" | while read line
with
swanctl --list-pools --leases 2>nul | grep "172.16.*online" |sed "s/'//g" | while read line