19573 Commits

Author SHA1 Message Date
Tobias Brunner
a9e3db6b79 testing: Pass base image codename to application Makefiles
Some might require it to use different revisions or commands.
2025-09-18 11:13:32 +02:00
Tobias Brunner
b51731e197 testing: Mount /proc in the chroot to make systemctl happy 2025-09-18 11:13:27 +02:00
Tobias Brunner
a418666f59 testing: Use new recommended approach to install key for custom apt repository
apt-key add is deprecated (and not available in trixie) as it makes the
available for all sources.  The recommended approach makes the key very
specifically available for just our repository.
2025-09-18 11:12:22 +02:00
Tobias Brunner
2025f630df testing: Remove unnecessary workaround for DHCP 2025-09-18 11:12:22 +02:00
Tobias Brunner
acaf4b2d17 testing: Move sysctl settings to sysctl.d and add some memory settings
Debian trixie doesn't provide a 99-sysctl.conf symlink in that directory
anymore.  The memory settings are also useful there as the default of
one changed and overbooking helps when forking a process with large
memory footprint (e.g. the IKE daemon).
2025-09-18 11:12:22 +02:00
Tobias Brunner
5e85ce17a2 testing: Remove xconsole config for rsyslogd
This produces a warning and we don't have X.
2025-09-18 11:12:22 +02:00
Tobias Brunner
2eef6b242b github: Use AWS-LC 1.61.1 for tests 2025-09-18 08:29:39 +02:00
Tobias Brunner
ac0272cad1 host: Don't try to resolve %any* keywords with mismatched address family
While host_create_from_string_and_family() usually replaces %any*
keywords, this fails if the address family doesn't match (e.g. %any4 with
AF_INET6).  There is no point in trying to resolve these keywords via
DNS as % is no valid character for host names.

Closes strongswan/strongswan#2880
2025-09-16 10:14:26 +02:00
Tobias Brunner
e33dddffea github: Use latest SonarQube action 2025-09-15 17:46:03 +02:00
Tobias Brunner
45f5a7a698 curl: Fix types enforced by compiler check in newer libcurl headers 2025-09-15 16:51:42 +02:00
Tobias Brunner
cfb5e46a98 Merge branch 'plugin-versions'
This adds a symbol with the current version number to all existing
plugins (the PLUGIN_DEFINE() macro makes this easy).  The version is
checked when a plugin is loaded from a file in order to prevent loading
old plugins from any previous build, which could cause all sorts of
issues.

References strongswan/strongswan#2835
2025-08-22 16:49:31 +02:00
Tobias Brunner
c4b32aab04 plugin-loader: Check version of loaded plugins
This prevents loading plugins from older builds that can cause all sorts
of issues as they might access struct members in different locations.

We don't check the version for statically linked plugins.
2025-08-22 15:32:39 +02:00
Tobias Brunner
5cab5672e7 Define plugin version in all existing plugins 2025-08-22 15:32:39 +02:00
Tobias Brunner
d087c349b4 plugin: Add macro to define plugin version and constructor 2025-08-22 15:32:39 +02:00
Tobias Brunner
1b551a9bfd plugin-loader: Don't prevent dynamic linking in addition to static constructors
When built with static plugins and constructors, we might still want to
be able to load external plugins.

Fixes: d860c26e9533 ("plugin-loader: Properly support compilation without dlopen()/dlsym() etc.")
2025-08-22 15:32:39 +02:00
Tobias Brunner
e9fa338e23 pkcs11: Improve detection of already unwrapped CKA_EC_POINTs
If an uncompressed point is already unwrapped (incorrect but some tokens/
modules do this) and therefore still looks like an ASN.1 octet string,
there could be false positives with the previous checks that lead to
mangled points.

By ensuring that we unwrapped the complete ASN.1 chunk, we can already
reduce the false positive rate when the assumed length is smaller than
the chunk, which we previously accepted but isn't the case in correctly
encoded points.

And while we already checked that the first byte indicates a valid point
type/encoding, there could still be false positives.  We can avoid those
with some checks on the length of the unwrapped point.  In particular,
enforcing a multiple of 4/8 should fail for valid unwrapped points where
three bytes were removed in the process (ASN.1 tag and length, point
encoding).

Closes strongswan/strongswan#2872
2025-08-22 15:31:25 +02:00
Tobias Brunner
abadd47736 charon-cmd: Cache shared secret under identities if available
We won't have identities for private key passwords, but we do for EAP
identities and they might get reused if redirected.
2025-08-22 15:27:00 +02:00
Tobias Brunner
d662a69d9d ike-sa-manager: Avoid deadlock due to race condition during shutdown
If an entry is added while we wait for a checked out SA in flush() (e.g.
due to an action performed by that SA), new entries might get inserted
before the one we wait for.  If that was the first entry in the row, we
didn't correctly update the table and the new entries were basically lost
by overwriting the first entry in the row.  As the SA count was still
increased but the new entries couldn't get enumerated, the daemon wasn't
terminated properly but was stuck in the loop in flush().
2025-08-22 15:26:59 +02:00
Tobias Brunner
3e0123526f trap-manager: Migrate tracked IKE SA in case of redirect during IKE_AUTH 2025-08-22 15:26:59 +02:00
Tobias Brunner
ee668ae91e controller: Migrate tracked IKE SA in case of redirect during IKE_AUTH 2025-08-22 15:26:59 +02:00
Tobias Brunner
3a9120373d ike-sa: Avoid reusing established IKE_SAs that got redirected
These will get terminated by the peer after a while.  So we don't want
to reuse them.
2025-08-22 15:26:59 +02:00
Tobias Brunner
2f0a0fef3d vici: Fix indentation for some add_kv() calls 2025-08-22 15:22:33 +02:00
Mathias Aerts
a24dc2e9ad vici: Include configured local and remote ports in list-conns
Closes strongswan/strongswan#2869
2025-08-22 15:22:13 +02:00
Tobias Brunner
b36da850b5 github: Only run CI for latest commit in a branch, cancel old runs 2025-08-22 12:21:50 +02:00
Tobias Brunner
7b90dc93c0 libipsec: Run unit tests with TESTS_PLUGINS if specified 2025-08-22 12:11:11 +02:00
Tobias Brunner
9da68ec9f5 libtls: Fix double-free when enumerating private keys 2025-08-22 12:07:55 +02:00
Tobias Brunner
dcb53e076b testing: Disable deprecated features in Botan
We keep MD5 enabled for now as we need it for TLS 1.0/1.1.  Once we
remove that we can reconsider (although, it's also needed for EAP-MD5
and since MD4 is disabled as well, which means EAP-MSCHAPv2 won't
be available, we'd be left with only EAP-GTC for simple username/password
authentication, which nobody else supports).
2025-08-22 12:07:55 +02:00
Tobias Brunner
8139256aae botan: Replace calls to deprecated botan_privkey|pubkey_export() 2025-08-22 11:52:51 +02:00
Tobias Brunner
5e4ff88849 github: Use OpenSSL 3.5.2 for tests 2025-08-21 16:44:01 +02:00
Tobias Brunner
d973106eed github: Use AWS-LC 1.58.1 for tests 2025-08-21 16:44:01 +02:00
Tobias Brunner
052a939553 openssl: Add support for Ed25519 via AWS-LC 2025-08-21 16:44:01 +02:00
Tobias Brunner
4096a911a0 github: Check active transforms against reference files
Also collect current results so we can update reference files easily.

Enabled AES-CFB in wolfSSL as we have already support for it in the
plugin.
2025-08-21 16:16:01 +02:00
Tobias Brunner
545eb2416a unit-tests: Add option to collect active crypto transforms
This will allow us to compare new library versions against previous ones,
so we don't suddenly loose some algorithms like it happened with KDFs
recently after updating OpenSSL to 3.5.1.
2025-08-21 16:16:01 +02:00
Tobias Brunner
4c85b9d21b credential-factory: Avoid deadlock during unit tests
If a unit test times out while generating a private key (e.g. because of
a lack of entropy), this avoids a deadlock by still releasing the read
lock that'd prevent acquiring the write lock when plugins are unloaded.

Closes strongswan/strongswan#2850
2025-08-21 16:13:24 +02:00
Tobias Brunner
135ed6aada openssl: Simplify wrapping private key objects 2025-08-21 16:11:13 +02:00
Tobias Brunner
0391450376 openssl: Support EdDSA keys in PKCS#12 containers
References strongswan/strongswan#2848
2025-08-21 16:10:58 +02:00
Tobias Brunner
f02033664e vici: Add support for P-CSCF server attributes
Was apparently forgotten when support was added to the attr plugin
with 98a3ba8a5a16 ("attr: Add p-cscf keyword for P-CSCF server addresses").

For consistency, using an underscore like the `split*` options and not a
dash like in the attr plugin.

References strongswan/strongswan#2396
2025-08-21 16:04:39 +02:00
Tobias Brunner
ea05033319 eap-authenticator: Assume IKE identity as EAP-Identity if client doesn't send one
Apparently, some clients (e.g. native Android) just send an empty
EAP-Identity response.  We silently ignored that previously and then
used the IKE identity for the actual EAP method.  This change tries to
do something similar (i.e. don't fail if the response is empty), but by
assuming the IKE identity as EAP-Identity, we match that and possibly
can switch configs.

Closes strongswan/strongswan#2833
Fixes: 2f2e4abe3c52 ("ikev2: Add support to switch peer configs based on EAP-Identities")
2025-08-21 16:02:36 +02:00
Tobias Brunner
2560146204 github: Use provided actions for SonarQube installation and scan
Also switch to the cloud cache (which doesn't seem to work either way
anyway).
2025-08-05 10:27:32 +02:00
Tobias Brunner
ff06159099 certexpire: Double size of internal buffer for identities
The error-notify, lookip, and whitelist (previous commit) plugins already
use the same buffer size for identities.
2025-07-23 18:50:53 +02:00
seantywork
ae2e0b6cf2 whitelist: Double the length of the id field in the messages
Closes strongswan/strongswan#2842
2025-07-23 18:50:33 +02:00
Tobias Brunner
6c813ddc13 Use wolfSSL 5.8.2 for tests 2025-07-19 12:11:29 +02:00
Tobias Brunner
011c346b00 wolfssl: Store RNG on object for curve25519
5.8.2 enables blinding for curve25519 by default, so the RNG set when
making the key is also used later on.
2025-07-19 12:10:25 +02:00
Rob Shearman
1b62e88980 ml: Disable versioning for shared object
Avoid generating versioned shared objects which would need to be
installed along with the version-independent symlink by specifying
"-avoid-version" in the libtool LDFLAGS for the plugin. Avoid any
unwanted surprises by also specifying the "-module" option, making the
LDFLAGS consistent with all other libstrongswan plugins.

Closes strongswan/strongswan#2844
2025-07-18 16:30:50 +02:00
Tobias Brunner
58c567da74 Merge branch 'whitelist-watcher'
Use watcher and non-blocking I/O for client connections to avoid issues
with clients that stay connected for a long time.

Closes strongswan/strongswan#2827
2025-07-18 16:16:17 +02:00
Tobias Brunner
85ebf6abd4 whitelist: Add error handling to socket reads and fix a memory leak
This now adds some state (basically a message buffer), but simplifies
error handling as we don't have to handle two potential failure paths
and could avoid some potential issues by still calling the blocking
read_all().

It also fixes a memory leak when clients disconnect.
2025-07-18 12:07:45 +02:00
Rob Shearman
412231eecd whitelist: Use a watcher for control socket reading rather than blocking
Performing a stream read_all call (which is a blocking read) from
within the accept callback has the issue that if a whitelist client is
still connected whilst a shutdown of the charon deamon is triggered
then that shutdown won't complete gracefully due to the accept task
never exiting.

So fix shutting down gracefully by using the socket watcher rather than
a blocking read upon connection accept. Fall back to a blocking read
for partial messages to avoid the complexity associated (i.e. storing
state) for incomplete reads, which shouldn't block and cause the
original problem if the client only sends whole messages.
2025-07-15 14:50:56 +02:00
Tobias Brunner
e98ea89d99 nm: Version bump to 1.6.3 2025-07-14 11:01:14 +02:00
Andreas Steffen
23eb1e0945 Version bump to 6.0.2 6.0.2 2025-07-13 09:56:49 +02:00
Tobias Brunner
4c54550352 testing: Use alternative approach for retransmits in ikev1/dpd-restart scenario
With a long delay, the retransmit might not get sent before further tests
are evaluated on faster machines, while more retransmits should still allow
the scenario to succeed on slower ones.
2025-07-11 14:15:40 +02:00