Bug 295828 - security/strongswan: enable KERNELLIBIPSEC option by default for vnet jail support
Summary: security/strongswan: enable KERNELLIBIPSEC option by default for vnet jail su...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-06-03 19:18 UTC by ИБ Илья Батраков
Modified: 2026-06-10 20:42 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (strongswan)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ИБ Илья Батраков 2026-06-03 19:18:37 UTC
Summary
=======
The security/strongswan port has KERNELLIBIPSEC=off by default. This makes it impossible to run strongSwan as a VPN client inside a FreeBSD vnet jail, which is a legitimate and increasingly common use case.

Problem
=======
In a vnet jail, the pfkey socket is isolated to the jail's own vnet instance. It cannot install SAD/SPD entries into the host kernel's IPsec stack. This causes phase 2 to fail with:

  [KNL] unable to add SAD entry with SPI xxxxxxxx: Invalid argument (22)
  [IKE] unable to install inbound and outbound IPsec SA (SAD) in kernel

The kernel-libipsec plugin bypasses this limitation by handling IPsec entirely in userspace via a TUN device. However, since KERNELLIBIPSEC=off in the default pkg build, the plugin .so is not installed (@comment in plist).

Environment
===========
- FreeBSD 15.0-RELEASE-p9, GENERIC kernel (VIMAGE present)
- strongSwan 6.0.6 from pkg
- vnet jail with epair interface
- IKEv1 Aggressive Mode + XAuth PSK (FortiGate)
- IKE phase 1 and XAuth complete successfully; phase 2 fails as described above

Proposal
========
Enable KERNELLIBIPSEC in OPTIONS_DEFAULT so that the plugin is available in the pkg binary. It is already a documented, supported plugin on FreeBSD/macOS (uses kernel-pfroute for routing). Users who do not need it incur no functional regression.

Alternatively, document the recommended devfs ruleset and jail.conf configuration required to use kernel-libipsec with TUN inside a vnet jail.

A detailed technical write-up including logs has been posted to the FreeBSD Forums:
https://forums.freebsd.org/forums/networking.7/

This bug report and the forum post were prepared with the assistance of Claude (Anthropic), based on actual debugging sessions on FreeBSD 15.0.
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2026-06-03 20:53:25 UTC
Waiting maintainer approval or timeout 2 weeks.
Comment 2 R. Christian McDonald freebsd_committer freebsd_triage 2026-06-10 13:44:55 UTC
(In reply to Vladimir Druzenko from comment #1)

Is nanoteq still actively maintaining strongswan port? Seems like there is some consistent history of maintainer timeout here.
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2026-06-10 20:42:26 UTC
(In reply to R. Christian McDonald from comment #2)
About a year ago the maintainer was active.