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

Nightly Test Tesults

Libreswan’s testsuite is run nightly. The results are published here, with the most recent result here. The tests are categorized as:

To run tests locally, read on.

Running tests

The libreswan tests, in testing/pluto, can be run using several different mechanisms:

Framework KVM Namespaces
Full Test Run Yes
Under 5 fails
No
100+ fails
Individual Tests Yes Most
Interop Testing Yes
Linux: strongSwan, Libreswan
FreeBSD: strongswan, Libreswan
NetBSD: racoon, racoon2, Libreswan
OpenBSD: iked, Libreswan
Limited
Linux: strongSwan, Libreswan
Init System Testing yes no
FIPS testing yes no
Post-mortem
(core, memory leak, shutdown)
yes support missing
all.*.sh tests yes support missing
Speed slower fast
Host OS Fedora, Debian Linux (but a Fedora VM is strongly recommended)
Notes gold standard</b>
ideal for building on obscure platforms
idea for testing custom kernels
used by the testing machine
requires 9p (virtio anyone?)
Creating a per-build Fedora VM is strongly recommended; and on iOS and Windows it is a requirement

How tests work

Consider the test:

$ ls -1F testing/pluto/ikev2-05-basic-psk
description.txt   OUTPUT/
east.conf         west.conf
east.console.txt  west.console.txt
eastinit.sh       westinit.sh
east.secrets      westrun.sh
final.sh          west.secrets

which can be run using:

./kvm install # only once
./kvm check testing/pluto/ikev2-05-basic-psk

The following happens:

Test Files

Each test case consists of a few files:

Commands to Run

The domains to use, and the scripts to run, are determined by the file names in the test directory. There’s several options.

Simple scripts: nicinit.sh, eastinit.sh, westinit.sh, westrun.sh, final.sh et.al.

This is the original script structure and is used by most tests. It turns out it isn’t sufficient for robustly testing IKEv1’s three message Quick mode exchange.

Most often a test involves a simple interop from a domain such as west to east.

For the above, the scripts are run in the order:

Technical nit: the scripts nicinit.sh then eastinit.sh are always run first, the others are ordered alphabetically.

Numbered scripts: 00-nic-init.sh, 01-east-init.sh, 02-west-init.sh, 03-west-run.sh, 04-east-up.sh, final.sh

This is the second attempt at script structure. It should be used by IKEv1 tests.

Sometimes more complex sequences are required. For instance:

Scripts, matching NN-*.sh are run in lexicographic order of the files. As a bonus, final.sh is also run on all test machines except nic.

Multi-platform: all.netbsdwest-linuxeast.sh

This is the fourth script framework (the third attempt was removed). It should be used when testing OS interops.

Sometimes tests need to run on different platforms (OS, …). For instance:, an interop between NetBSD and Linux.

These tests use a file matching all.*.sh. The files name defines which hosts and platforms to use. Each line of the file specifies where the command should be run.

For instance, the file all.netbsdwest-linuxeast.sh may contain:

east# ipsec start
west# ipsec up

so linuxeast runs ipsec start, then netbsdwest runs ipsec up.

Draft: Multi-platform single test: all.east-west.sh, all.linuxeast-netbsdwest.txt, all.netbsdwest-linuxeast.txt

This is is a proposal for a fifth script framework. The testsuite has a growing list of tests which, other than the platforms they run between, are identical. Currently this is achieved by generating the tests using scripts. The proposal is to instead have a single test containing a reference output for each platform that the test should be run on.

Adding A Test

There are several steps to adding a test:

Sanitizers

The raw output from each domain is sanitized (removing non-deterministic output such as NONCES and timers) before being compared to the expected output.

For instance, the raw output from east is written to new-test/OUTPUT/east.console.verbose.txt. It is then sanitized creating new-test/OUTPUT/east.console.txt and finally it is compared against the reference output new-test/east.console.txt.

Occasionally new sanitizers need