15133 Commits

Author SHA1 Message Date
Tobias Brunner
0e768233f2 leak-detective: Include OpenSSL symbol seen on Debian trixie 2025-09-18 11:13:32 +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
45f5a7a698 curl: Fix types enforced by compiler check in newer libcurl headers 2025-09-15 16:51:42 +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
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
8139256aae botan: Replace calls to deprecated botan_privkey|pubkey_export() 2025-08-22 11:52:51 +02:00
Tobias Brunner
052a939553 openssl: Add support for Ed25519 via AWS-LC 2025-08-21 16:44: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
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
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
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
Tobias Brunner
bab415ec0a child-cfg: Actually force narrowing TS in transport mode only as initiator
Closes strongswan/strongswan#2830

Fixes: ad1ad2159f0b ("child-cfg: Use traffic selector list")
2025-07-11 14:15:06 +02:00
Tobias Brunner
43b805b2da openssl: Don't allocate salt if PRF/hash is unknown
This can happen if e.g. AES-XCBC is selected.

Fixes: 2dbeecfc029b ("openssl: Fix testing KDF_PRF in the constructor with OpenSSL 3.5.1")
2025-07-11 11:47:51 +02:00
Tobias Brunner
2dbeecfc02 openssl: Fix testing KDF_PRF in the constructor with OpenSSL 3.5.1
Setting the salt to NULL now fails, so we set it to hash length's zeroes,
which is the default value for HKDF-Extract if no salt is passed.

Fixes strongswan/strongswan#2828
2025-07-10 19:22:22 +02:00
Tobias Brunner
f88d824114 Fixed some typos, courtesy of codespell 2025-07-08 10:54:49 +02:00
Thomas Egerer
a339468c93 vici: Allow backlog size configuration via compile option
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-07-07 14:20:13 +02:00
orbea
979c57fc30 nm: Don't set DL_LIBS to 'none required' in configure script
This copies the AC_SEARCH_LIBS check from the main strongSwan
configure.ac.

When building networkmanager-strongswan with slibtool if fails.

  ld: cannot find none: No such file or directory
  ld: cannot find required: No such file or directory

This is because configure.ac uses AC_SEARCH_LIBS to find dlopen which
sets the value of $ac_cv_search_dlopen to 'none required' which then
gets set in DL_LIBS and passed to slibtool.

With GNU libtool it silently ignores the unknown arguments.

Gentoo issue: https://bugs.gentoo.org/914100

Closes strongswan/strongswan#2141

Signed-off-by: orbea <orbea@riseup.net>
2025-07-01 07:45:12 +02:00
Tobias Brunner
bd4cee82ac android: New release after adding HTTP proxy configuration 2025-06-27 08:57:45 +02:00
Tobias Brunner
dbcba117ae android: Apply proxy server setting when creating TUN device
This is only available with Android 10+ (SDK 29+).
2025-06-27 08:57:45 +02:00
Tobias Brunner
b944159fcf android: Avoid proxy settings in the internal fetcher 2025-06-27 08:57:45 +02:00
Tobias Brunner
c7307ccc52 android: Allow setting proxy settings in managed profiles 2025-06-27 08:57:45 +02:00
Tobias Brunner
0f2cd032e1 android: Import proxy server settings 2025-06-27 08:57:45 +02:00
Tobias Brunner
c80819c0ad android: Make proxy server configurable 2025-06-27 08:57:45 +02:00
Tobias Brunner
a7cb2fcbf6 android: Add properties to VPN profiles for proxy server configuration 2025-06-27 08:57:45 +02:00
Tobias Brunner
059c70e556 android: Don't mention IKEv1 and L2TP in app description
Also removed on Play so the app does not show up when people search
for these keywords (they tend to not read the actual description and
then are surprised that neither protocol is supported).
2025-06-27 08:57:45 +02:00
Tobias Brunner
4143e47462 android: Update dependencies 2025-06-27 08:57:38 +02:00
Tobias Brunner
a153626af7 identification: Clarify that ID_USER_FQDN is just an alias for ID_RFC822_ADDR
This means userfqdn: is a valid prefix for regular expressions.
2025-06-20 10:37:40 +02:00
Tobias Brunner
e58ef258b5 swanctl: Document that IP-TFS mode is subject to mode negotiation 2025-06-20 10:37:35 +02:00
Tobias Brunner
9dbb15dea9 leak-detective: Remove whitelisted libsoup2.x functions
As mentioned in 0f141fb095a41a9fdfe5c111269eb643dc643494, we can't
really whitelist the "leaks" in GLib, so don't even try to do anything
with libsoup3.x.
2025-06-04 19:08:57 +02:00