strongSwan on FreeBSD¶
- Table of contents
- strongSwan on FreeBSD
Please note that releases before 5.0.0 don't support IKEv1 because the old pluto IKEv1 daemon was not ported to FreeBSD.
Starting with FreeBSD 11, IPsec is now enabled in the kernel, by default. However, if you need NAT Traversal you will still have to enable the
IPSEC_NAT_T option and build your own kernel (see below).
FreeBSD 11.1 and above now has NAT-T included as well and GENERIC kernel will work.
In versions older than FreeBSD 11.0 the generic kernel does not come with IPsec support enabled. So you will have to compile your own kernel.
The NAT Traversal patch is included in the kernel sources since FreeBSD 8, so you don't have to apply any patches yourself, if you need that feature.
Build the Kernel¶
Basic documentation on how to build a custom kernel can be found in the FreeBSD Handbook.
To enable IPsec you'll need to add the following options to your kernel configuration file:
options IPSEC device crypto
You can verify that your kernel has IPsec support using the following command, which should print a list of ipsec specific kernel state.
/sbin/sysctl -a | grep ipsec
If you need NAT Traversal, add the following option to your kernel config:
Install FreeBSD Port / Package¶
The easiest way to install strongSwan on FreeBSD is to use the security/strongswan port
cd /usr/ports/security/strongswan/ && make install clean
or to install the binary package with
pkg install strongswan
or in earlier FreeBSD releases with
pkg_add -r strongswan
Our test-system was installed using the Developer and Kern-Developer distributions in sysinstall. So there are maybe additional packages required on your system.
The packages required to build strongSwan are as follows:
- libgmp (optional, depending on configuration)
- openssl (optional, depending on configuration)
- The printf-Bug in earlier FreeBSD releases has been fixed and backported to FreeBSD 8. Thus, the vstr string library is not required anymore (check the history of this wiki page for details).
./configure --enable-kernel-pfkey --enable-kernel-pfroute --disable-kernel-netlink \ --disable-scripts --with-group=wheelNotes:
- For releases before 5.0.0 you also need to add
- Before 5.1.0 virtual IPs could not be used on clients due to the lack of policy based routing. Since 5.1.0 TUN devices are created to implement this, so that FreeBSD can be used as client in road-warrior setups.
- Before 5.1.0 the kernel-pfroute interface lacked several features to properly support MOBIKE.
- Because there is currently no way to change the IP addresses of an installed IPsec SA in the FreeBSD kernel IPsec SAs are rekeyed when a client's IP address changes. This discussion on the FreeBSD forums has more on this.
- Before strongSwan 4.6.0 starter did not use the modular kernel interfaces, thus, when it tried to detect an IPsec stack it failed:
Starting strongSwan 4.x.x IPsec [starter]... no netkey IPsec stack detected no KLIPS IPsec stack detected no known IPsec stack detected, ignoring!Fortunately, this detection is not really needed on FreeBSD so simply ignore this message.