Commit Graph
19705 Commits
Author SHA1 Message Date
Tobias Brunner 110fbcbe65 child-cfg: Add flag to enable ICMP forwarding 2026-02-12 14:23:44 +01:00
Tobias Brunner 11351f24ef kernel-netlink: Enable ICMP forwarding on inbound SA and out/fwd policies 2026-02-12 14:23:44 +01:00
Tobias Brunner 21e5edab10 kernel-ipsec: Add flags to enable ICMP error forwarding
For the Linux kernel, this has to be enabled on the inbound SA and the
out and fwd policies.
2026-02-12 14:23:44 +01:00
Tobias Brunner f10b9adec9 ipsec-types: Add a proper hash function for ipsec_sa_cfg_t
While 3c12905103 ("ipsec: Add function to compare two ipsec_sa_cfg_t
instances") added a comparison function to avoid issues with non-zeroed
padding, hashes were still calculated using chunk_hash().
2026-02-12 14:23:44 +01:00
Martin Willi 3df3af8eb7 bus: Prevent redundant down event on rekeyed CHILD_SA delete timeout
If a CHILD_SA is rekeyed using a CREATE_CHILD_SA request, a subsequent
DELETE for the old CHILD_SA may time out. Before sending this DELETE,
a CHILD_REKEYED state CHILD_SA set from child_rekey::process_i() is
immediately set to CHILD_DELETING from child_delete::build_i(). If the
IKE_SA dies due to a retransmission timeout of this DELETE, a redundant
child-down event is issued for the rekeyed CHILD_SA that has already seen a
child-rekey event.

A reproducer shows the following log and events:

    [CFG] vici rekey CHILD_SA #533
    [IKE] establishing CHILD_SA XXX{534} reqid 20
    [ENC] generating CREATE_CHILD_SA request 0 [ N(REKEY_SA) SA No KE TSi TSr ]
    [ENC] parsed CREATE_CHILD_SA response 0 [ SA No TSi TSr ]
    [IKE] rekeyed CHILD_SA XXX{533} with SPIs ca997de6_i cd27d4fe_o with XXX{534} with SPIs ced1cd01_i c460a7c9_o
     Event: child-rekey
      [OLD SA] state: REKEYING, spi-in: ca997de6
      [NEW SA] state: INSTALLED, spi-in: ced1cd01
    [IKE] closing CHILD_SA XXX{533} with SPIs ca997de6_i (352 bytes) cd27d4fe_o (264 bytes) and TS 0.0.0.0/0 === 10.11.9.40/29
    [IKE] sending DELETE for ESP CHILD_SA with SPI ca997de6
    [ENC] generating INFORMATIONAL request 1 [ D ]
    [IKE] retransmit 1 of request with message ID 1
    [IKE] retransmit 2 of request with message ID 1
    [IKE] retransmit 3 of request with message ID 1
    [IKE] retransmit 4 of request with message ID 1
    [IKE] giving up after 4 retransmits
     Event: child-updown
      [SA] state: DELETING, spi-in: ca997de6
     Event: child-updown
      [SA] state: INSTALLED, spi-in: ced1cd01

To prevent the redundant child-down event for the successfully rekeyed CHILD_SA,
check if a DELETING CHILD_SA has already removed its outbound state due to
having been rekeyed before issuing the child-down event.

Add a new exchange test exercising that a delete timeout after rekeying does
not cause a duplicate child-down event.
2026-02-12 11:45:05 +01:00
Tobias Brunner dba2c9935a Remove accidentally committed libtool script
Fixes: 3e5a528aec ("tpm: Auto-detection of legacy TPM 2.0 devices")
2026-02-09 16:04:23 +01:00
Tobias Brunner 7cca0cb772 Merge branch 'swanctl-plugins'
Uses a separate default plugin list for swanctl (instead of just loading
all of libstrongswan's plugins) to avoid some side-effects of loaded but
unused plugins.  The load statements in the regression tests have been
updated accordingly.

A new configure option for maintainers of distributions that ship
plugins in separate packages changes the message if a plugin is not
found and reduces its log level.  This confused users of tools that don't
use modular plugin loading (e.g. pki or swanctl).

Also changes command line handling in pki and swanctl so that the shared
options can be passed before the actual command and that the debug level
also affects library/plugin initialization.

References strongswan/strongswan#2971
2026-02-06 16:10:50 +01:00
Tobias Brunner e2786cbcb8 swanctl: Add global --debug, --options and --uri arguments
Similarly to the previous commit for pki, this allows setting these
options before the command, and by pre-parsing them we can see log
messages during the initialization.
2026-02-06 11:25:13 +01:00
Tobias Brunner 0d41001e74 debug: Add helper to get the current default log level for a group 2026-02-06 11:21:34 +01:00
Tobias Brunner be68bd50b7 pki: Add global --debug and --options arguments
This allows setting the log level before initializing the library and
loading the plugins, as well as having the top-level command itself in
an options file.
2026-02-06 11:21:34 +01:00
Tobias Brunner dd7b0283ef plugin-loader: Add option to change log message if plugin is not found
Distributions like Debian/Ubuntu ship the plugins in multiple packages
that are not all installed by default.  When running tools like pki or
swanctl, which don't use modular loading with config snippets by default,
there are errors in the output if these packages and plugins are
currently not available.  In order to not alarm users, this change adds
a configure option that package maintainers can use.  It causes the log
level of the message to increase and also adds a note that mentions that
plugins are potentially available in other packages (which should be the
case unless the user tried to load a plugin, e.g. via load statement,
that is not actually built and shipped by the package maintainers).
2026-02-06 11:21:34 +01:00
Tobias Brunner 5b0d506215 testing: Remove unused revocation and constraints plugins for swanctl
swanctl doesn't do any (online) certificate validation, it just parses
and or decrypts them and passes them on to the daemon.
2026-02-06 11:21:34 +01:00
Tobias Brunner 5fe1d71204 swanctl: Use a custom default plugin list
Loading all libstrongswan plugins isn't necessary as the tool only uses
the plugins to parse/decrypt credentials.  So it's similar to pki, but
it doesn't do (online) certificate validation, access tokens, or need
access to databases.

While it's usually not an issue to load unnecessary plugins, one thing
that came up recently are the new capabilities required by the agent
plugin.  Since Debian's AppArmor policy for swanctl doesn't grant them,
this produces an error message that might confuse users.
2026-02-06 11:21:34 +01:00
Tobias Brunner c649774141 configure: Load ldap plugin in pki
It's a fetcher plugin used for online certificate validation.
2026-02-06 11:21:34 +01:00
Tobias Brunner b8d8277ae0 stream-service-unix: Remove unnecessary execute permission from sockets
References strongswan/strongswan#2983
2026-02-06 11:17:36 +01:00
Tobias Brunner 2ed929d9f6 fuzz-ike: Initialize libcharon as logging will cause crashes otherwise
The bus.h header file redirects DBG* macros to the bus but that won't be
available unless libcharon is initialized.
2026-02-06 08:12:52 +01:00
Tobias Brunner 7973080969 testing: Add a reauthentication to ikev2/dhcp-static-client-id
This verifies that we don't release the lease when the old SA is
deleted during the reauthentication.
2026-02-05 17:57:07 +01:00
Tobias Brunner 79a52c488d dhcp: Don't release the address via DHCP if it's still used
This is useful during make-before-break reauthentication, where the
new SA is created before the old one is terminated and the virtual IP
gets released.

This also changes the hash() and equals() functions to avoid potential
collisions.

References strongswan/strongswan#2967
2026-02-05 17:57:01 +01:00
Tobias Brunner 44962c4e71 Merge branch 'cifuzz'
Add CIFuzz on GitHub.

Closes strongswan/strongswan#2993
2026-02-04 12:38:37 +01:00
Tobias Brunner 8a8d4640cf github: Also run UBSan with CIFuzz 2026-02-04 12:38:28 +01:00
Arthur Chan 0f4a78025c github: Add latest CIFuzz
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
2026-02-04 12:38:17 +01:00
Tobias Brunner e73af66f4a pubkey-authenticator: Avoid conflict with config switch based on EAP-Identity
The referenced commit ignored that INVALID_ARG was returned by this
authenticator if an unsupported signature scheme is encountered.  This
caused a crash in find_alternative_eap_cfg() as no EAP identity is
stored in the current auth config.

Since we don't distinguish the situation outside of the authenticator,
we can just return FAILED.

Closes strongswan/strongswan#2979

Fixes: 2f2e4abe3c ("ikev2: Add support to switch peer configs based on EAP-Identities")
2026-01-28 14:16:23 +01:00
Tobias Brunner 353bb42937 github: Use AWS-LC 1.67.0 for tests 2026-01-28 12:03:18 +01:00
Tobias Brunner c10f66d1cc github: Use OpenSSL 3.6.1 for tests 2026-01-28 12:03:18 +01:00
Tobias Brunner 8388904cbe ike-init: Simplify adding extension notifies to IKE_SA_INIT 2026-01-28 12:03:18 +01:00
Arthur Chan b8deb618ef oss-fuzz: Add new fuzzer for libcharon IKE message parser
Closes strongswan/strongswan#2988

Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
2026-01-28 11:59:41 +01:00
Tobias Brunner 7a36a8c220 appveyor: Reduce runtime by using lld instead of ld
In particular with the 2019 image, the time required often exceeded the
maximum of 60 minutes.  Using lld reduces the runtime quite a bit (it's
still close to the limit, though).

This doesn't work with the old OpenSSL version we use with the 2015
image (that libeay32.lib file just doesn't seem to work), so continue
to use ld (the build on that image is the quickest anyway).
2026-01-22 18:15:10 +01:00
Tobias Brunner 7fa4d54b3c array: Handle recursive calls to array_sort() if qsort_r() is not supported
Such a recursive call occurs when sorting the array of Child SAs inside
an IKE SA that causes comparisons of the child configs and their
proposals, which in turn creates a merged array of all transform types
and that uses array_sort() and array_bsearch().

Closes strongswan/strongswan#2926

Fixes: 8e7f379f71 ("ike-sa: Sort CHILD_SAs by CPU ID")
2026-01-22 18:14:58 +01:00
Tobias Brunner d0c36baef9 charon-cmd: Add support for childless IKE SA initiation
References strongswan/strongswan#1594
2026-01-15 14:12:43 +01:00
Tobias Brunner e248fac362 charon-cmd: Only use loose identity matching if no IDr is configured 2026-01-15 14:10:59 +01:00
Tobias Brunner 757dce2ed3 charon-cmd: Add support for PSK authentication with IKEv2
Can be useful for testing purposes (e.g. some public test servers use
PSKs).
2026-01-15 14:10:35 +01:00
Jean-François Hren 5aacf5c7b6 trap-manager: Use latest seq when creating an acquire entry
Closes strongswan/strongswan#2975

Fixes: 79815b4e67 ("trap-manager: Set seq. no. for CHILD_SAs not initiated by an acquire")
2026-01-05 18:14:38 +01:00
Tobias Brunner d68044b216 identification: Add support for organizationIdentifier in DNs
These are e.g. used in eIDAS certificates.
2026-01-05 10:50:24 +01:00
Tobias Brunner f79504994a agent: Fix compiler warning when building with clang
Fixes: 8b467ad39a ("agent: Add option to open socket as specific user")
2025-12-12 15:59:38 +01:00
Tobias Brunner 9d242a4f7d ip-packet: Fix compiler warning seen on FreeBSD 15
We explicitly use untoh16() so this warning isn't relevant:

  ip_packet.c:313:42: error: taking address of packed member 'ip_len' of class or structure 'ip' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
2025-12-12 15:58:31 +01:00
Tobias Brunner db6eca56d7 cirrus: Use FreeBSD 15.0 and 14.3 2025-12-12 15:58:31 +01:00
Tobias Brunner d20a0116b2 Use Botan 3.10.0 for tests
Clean up leak-detective whitelist for newer Botan versions but add
`botan_private_key_load` as `botan_privkey_load*` won't show up anymore
without bfd-backtraces due to inlining if we don't call it directly.

Ref: https://github.com/randombit/botan/discussions/4868
2025-12-12 15:58:31 +01:00
Tobias Brunner 1ff9533348 github: Use AWS-LC 1.65.1 for tests 2025-12-12 15:58:31 +01:00
Tobias Brunner ca37563c55 nm: Version bump to 1.6.4 2025-12-12 15:35:57 +01:00
Andreas Steffen d1c259f44b Version bump to 6.0.4 2025-12-12 15:32:29 +01:00
Tobias Brunner 858934550a NEWS: Add news for 6.0.4 2025-12-10 18:34:20 +01:00
Tobias Brunner d7608ca192 nm: Pass back the username auth-dialog runs as to access ssh-agent socket
This ensures we access the socket as user who NM ran the auth-dialog for,
especially for system-wide connections where the connection does not
mention a user.

We also make sure we don't use the cached socket and user of a previous
connection attempt, because system-wide connections might be used by
different users.
2025-12-10 18:34:19 +01:00
Tobias Brunner 7cc8973db7 charon-nm: Pass configured user when connecting to SSH/GPG agent
This prevents an attack similar to the one fixed previously where a
user passes the path to credentials of another user, in this case the
path to the agent socket of that user.
2025-12-10 18:34:19 +01:00
Tobias Brunner 8b467ad39a agent: Add option to open socket as specific user
This can prevent an attack where user A passes the path to user B's
ssh-agent socket to the daemon that is running as root.
2025-12-10 18:34:19 +01:00
Tobias Brunner a768f57286 nm: Create safe copies of files for user-specific connections
This ensures that only certificates/private keys accessible by the
configured user are accessed and prevents attackers from misusing
other user's credentials.

Also removed setting NM_VERSION_MIN_REQUIRED, which suppresses deprecation
warnings that were added with newer API versions, and
NM_VERSION_MAX_ALLOWED, which warns if using functions added in newer
API versions, so we always build against the latest API available.

But we check explicitly for the required function so this works with
older NM versions and automatically will use it if the function is
backported.

Note that we can't use BUILD_FROM_FILE to read the temporary files as that
uses mmap() which SELinux policies prevent us from using at the location
these files are stored ([/var]/run/NetworkManager/cert/).

Fixes: CVE-2025-9615
2025-12-10 17:12:31 +01:00
Tobias Brunner 84a5208d98 child-rekey: Prevent crash if peer rekeys a Child SA twice before sending a delete
Some (Windows) peers have been seen to initiate a second rekeying for the
same Child SA.  Presumably, this happens if a rekey request from us for
the same old Child SA arrives while it waits for the response to its
first rekey request.  Once we receive the delete for the old SA, we
conclude the rekeying with the second replacement.  However, the first
replacement remained linked to the old SA.  So this change prevents a
crash once the peer sends a delete for that first replacement (which it
seems to do after about 5 minutes).

References strongswan/strongswan#2944
Closes strongswan/strongswan#2945
2025-12-10 17:10:29 +01:00
Andreas Steffen 96468d2891 Merge branch 'master' into testing-per-cpu-sas 2025-12-08 08:46:51 +01:00
Andreas Steffen 909f52875e Version bump to 6.0.4rc1 2025-12-08 08:22:18 +01:00
Tobias Brunner 1454bd7bcf testing: Make per-CPU SAs scenarios more predictable by pinning IRQs to vCPUs
This ensures that packets on sun are processed on a particular CPU and
not randomly on one, which causes expected SAs not to get created or
other weird things.
2025-12-03 11:42:54 +01:00
Jean-François Hren f25b1aca8b credential-manager: Fix leaked signature params if self-signed cert is untrusted
Closes strongswan/strongswan#2954
2025-12-01 19:18:53 +01:00