Libreswan Documentation

Logo

Libreswan's Online Documentation

View the Project on GitHub libreswan/libreswan.github.io

Support
FAQ Common Error Messages
History
Implemented Standards
Kernel Support
HOWTO Additional ipsec.conf documentation
AWS Mesh
brendans Road Warrior Setup at Home
Configuration examples
Confuse !?@: github wiki
Enterprise cloud encryption
Entropy matters
EoIP shared ethernet LAN using IPsec
High Availability Fallover VPN in AWS
Host to host VPN
Host to host VPN with PSK
Libreswan as client to a Cisco ASA or VPN3000 server
Microsoft Azure configuration
Migrate from IKEv1 DPD to IKEv2 LIVENESS
Opportunistic IPsec
Opportunistic IPsec using LetsEncrypt
Pluto and DNSSEC
Read status output
Route based VPN
SElinux and Labeled IPsec VPN
Subnet extrusion
Subnet to subnet using NAT
Subnet to subnet VPN
Subnet to subnet VPN with PSK
Unauthenticated Opportunistic IPsec
Using Apache to serve PKCS
Using NSS Hardware Tokens
Using NSS with libreswan
VPN server for remote clients using IKEv2
VPN server for remote clients using IKEv2 split VPN
GSoC 2027 Code Project Ideas DRAFT
Contributor Guidance DRAFT
Completed Projects 2026 RFC 9593 Announcing Supported Authentication Methods in IKEv2
2026 Improve the ACQUIRE to IKE policy lookup
2026 Add HOST TO HOST Support on BSD
2021 RFC 8420 Add EdDSA Signature Authentication Support to IKEv2
2020 Session Resumption
2020 IKEv2 Interop testing with OpenBSD
2020 IKE Intermediate Exchange
2019 Libreswan Opportunistic IPsec using LetsEncrypt
2018 RSA PSS Support in compliance with RFC 7427 and RFC 8247
2018 RFC 7427 Add ECDSA Signature Authentication Support to IKEv2
2018 RFC 5685 Redirect Mechanism
2018 Managing Interface
2017 TCP encapsulation of IKE and IPsec
2017 RFC 7427 Add Signature Authentication Support to IKEv2
2017 Postquantum Preshared Keys
Presentations
IRC
Hacking Documentation
Git, GitHub, and Pull Requests
Merging GitHub Pull Requests
Programming Conventions
Testing Docker
KVM 1. Setup The Host
2. Configure Testing
3. Compile Libreswan
4. Test Libreswan
5. Accessing The Console
6. Maintenance and Internals
Bisecting
Debugging Pluto
Logging In Using SSH
Performance
Running A Custom Kernel
Running A Single Test
Running In The Background
Setup a Web Server
Testing Old Branches
Updating Test Results
Namespace Magic
Namespaces
Topology
Internals 3.14 X509
Benchmarking and Performance testing
Cipher suites and algorithm support
Cloud OE ideas
Compiling with AddressSanitizer
Compliance of RFC 7427 Signature Authentication in IKEv2
Coverity
Cryptographic Acceleration
Developer links strongswan android
Discouraged or forbidden C functions
IKEv2 Child SA
IKEv2 CP and EAP support
Introduction
Libreswan xfrm kernel support
Logging cleanup
New OE
Pluto
Pluto packet processing
Proposed ipsec ca command
Retransmit timings
Road Map
SAref code
Setting up system for debug logging
stf status
Testing 2017 Next Generation
Unbound
Uncrustify
Use Cases and Requirements document for ECC ECDSA support
Use Cases and Requirements document
XFRM Interface Development Notes
XFRM pCPU
XFRM pCPU RSS
Security Crypto boundary and certification
Libreswan and Heartbleed
Libreswan and TunnelCrack
Reporting a Vulnerability
Vulnerabilities
Meetups 2013 Helsinki
2014 San Francisco
2014 Toronto
2018 Toronto
Obsolete HOWTOs IKEv1 XAUTH with FreeOTP and FreeIPA
IKEv1 XAUTH with Google Authenticator One Time Passwords
Route based VPN using VTI
Testing Namespace
VPN server for remote clients using IKEv1 with L2TP
VPN server for remote clients using IKEv1 XAUTH with Certificates
VPN server for remote clients using IKEv1 XAUTH with PSK

The KVM test framework, with a bit of tweaking, supports having multiple source trees, each running tests independently.

TL;DR?

Try running:

./kvm install check testing/pluto/ikev2-05-psk

It will use a very simple configuration; but is likely sufficient for running one or two tests manually.

Create Makefile.inc.local

Make variables set in the file Makefile.inc.local control how KVM is configured to run tests.

If you haven’t already, create a local clone of libreswan:

git clone https://github.com/libreswan/libreswan
cd libreswan

and create an empty Makefile.inc.local:

touch Makefile.inc.local

(packaging systems should not use this, and instead explicitly pass the make variables to the make command)

Create $(KVM_POOLDIR) for storing VM disk images

The pool directory is used used to store:

The directory can get large. It can and should be shared between build trees (this reflects libvirt which has a single name space for domains).

The default is ../pool. i.e., adjacent to your source tree. It will need to be created:

cd libreswan
mkdir -p ../pool

To change the pool directories location, set $(KVM_POOLDIR) in Makefile.inc.local.

Configure $(KVM_PREFIX) to allow allow multiple build trees on a machine

Optional, but highly recommended.

By default the domains and networks are assigned names such as linux, east, 198_18_1, et.al.. The problem is that these names are not unique between build trees, and as a result, all build trees try to use the same domains and networks.

The “fix” is to set $(KVM_PREFIX) to a unique (but short) value in Makefile.inc.local in each build tree. All test specific files will then use that as a prefix, vis:

$ cat libreswan-alpha/Makefile.inc.local
KVM_PREFIX=a.
$ cat libreswan-beta/Makefile.inc.local
KVM_PREFIX=b.

The first build tree libreswan-alpha will use the prefix a., for instance a.linux; and the second build tree libreswan-beta will use b.linux et.al.

For convenience, commands such as:

libreswan-a$ ./kvm sh linux

will log into the current build tree’s domain (here a.linux).

Note: due to limitations in the network stack (interfaces have a limit of 16 characters) (the prefix needs to be really short).

Configure $(KVM_$(PLATFORM)) to enable additional Platforms

By default, ./kvm builds and tests using a generic Linux platform (it just happens to be Fedora).

Normally this is sufficient.

To help fix build problems, aid BSD development, and performing more complex interop tests, the following additional platforms are available:

Make Variable Runs Main Use
KVM_APLINE Latest 32-bit Alpine Building 32-bit
Building against MUSL libc
KVM_DEBIAN Debian 64-bit LTS, as old as possible Trailing edge builds (for instance, acient NSS)
Trailing edge linux kernel
KVM_FREEBSD Latest 64-bit FreeBSD Building (clang)
Interop testing with strongSwan
KVM_FEDORA Latest 64-bit Fedora release Bleading edge builds
Leading edge linux kernel
KVM_LINUX Generic Linux Enabled by Default
Generic Testing (the linux flavour happens to be Fedora)
KVM_OPENBSD Latest 64-bit Building (clang)
Interop testing with iked
KVM_NETBSD Latest 64-bit Building (gcc)
Interop testing with racoon and racoon2

To include these additional platforms in the defaults when building and testing, set the corresponding Make variable to true in Makefile.inc.local. For instance,

KVM_NETBSD=true

To override the defaults, specify the platforms on the command line For instance:

./kvm install check netbsd

will only install on, and limit tests to those requiring NetBSD.

Tuning

The following tweaks, while not necessary, speed up test runs.

Configure $(KVM_WORKERS) to run things in parallel

By default all operations (building and testing) is serialized (even the VMs are given only one CPU!). If the host has plenty of cores then the parallelism can be increased using $(KVM_WORKERS). It does the following:

For instance:

KVM_PREFIX=a.
KVM_WORKERS=3

(the prefixes a., a2, a3 are used to make test VMs unique).

Note: there’s a diminishing return on adding cores. The rule-of-thumb (we do have data) is two-cores and 2gb per worker.

Configure $(KVM_LOCALDIR) store disks in tmpfs (/tmp/pool)

DANGER: this assumes you’re using a dedicated machine (look up problems with /tmp and security).

Note: it isn’t clear if this option improves testsuite performance.

By default, all KVM disk images are stored in $(KVM_POOLDIR) which is assumed to be permanent storage.

Since the build and test VMs are transient, their disk images can instead be kept in temporary storage, namely /tmp.

In Makefile.inc.local, point the make variable $(KVM_LOCALDIR) at /tmp/pool vis:

echo KVM_LOCALDIR=/tmp/pool >> Makefile.inc.local

This helps eliminate some of the physical disk IO.