19343 Commits

Author SHA1 Message Date
Tobias Brunner
59a4c9c416 ike-auth: Default IDi/IDr to subject DN instead of IP if a certificate is available
This avoids sending a likely unconfirmed identity if no identity is
configured and received (in case of IDr).

Closes strongswan/strongswan#2353
2024-07-30 14:27:15 +02:00
Tobias Brunner
e9a7c9822d ike-sa: Assign function pointers for mediation extension separately
Using preprocessor directives in calls of function-like macros is
not recommended as it might lead to undefined behavior.
2024-07-30 10:29:36 +02:00
Tobias Brunner
72f9a21b22 Merge branch 'vici-reload-actions'
This improves the behavior when reloading or unloading connections that
have `start` included in their `start_actiton`.

Closes strongswan/strongswan#2324
2024-07-30 10:27:50 +02:00
Tobias Brunner
56b6eeb385 testing: Add ikev2/start-action-start scenario
This tests the behavior for configs with start_action=start during
reloads of the config (updates/removal).
2024-07-26 16:56:32 +02:00
Tobias Brunner
7bfaa9acb6 vici: Improve handling of start action when reloading configs
The previous code had some issues because it handled each child config
separately.  Not only was this quite inefficient because all IKE_SAs had
to be enumerated for every config, it also caused problems with the check
for other CHILD_SAs in order to decide whether to delete the IKE_SA or
not.  Because CHILD_SAs are deleted with an INFORMATIONAL exchange, they
are not immediately gone.  This caused a race condition and with more
than one child config and SAs the IKE_SA could be kept because it
could appear as if other, unrelated CHILD_SAs were still there.

Another race condition, which is fixed by the previous commit, occurred
when only changing child configs.  Then it could happen that the code
deemed the IKE_SA empty and a delete for it was queued.  If that happened
while the IKE_SA was deleting one of the CHILD_SAs (or was busy with some
other exchange), the IKE_SA was not switched to IKE_DELETING.  So it
looked usable and create-child tasks for the updated configs might have
gotten queued.  Unfortunately, once the ike-delete task is eventually
executed, these tasks would be gone and the replacement CHILD_SAs never
created.  This commit additionally avoids actually deleting the IKE_SA
even if all child configs change or get removed if any new CHILD_SAs are
to be initiated.
2024-07-26 16:40:57 +02:00
Tobias Brunner
da00a04f60 ike-sa-manager: Avoid initiating CHILD_SAs on IKE_SAs with queued DELETE
The IKE_SA might be busy with a different task while a request to
terminate it is getting queued, we don't want to use such an IKE_SA to
initiate new CHILD_SAs as these tasks will get lost once the IKE_SA is
terminated.
2024-07-26 11:34:44 +02:00
Tobias Brunner
07ce6b44c5 testing: Enable IPv6 guest-to-guest communication
Not sure what changed, but without this setting, ND packets would not
get through to other hosts connected to the same bridge.
2024-07-26 11:34:44 +02:00
Tobias Brunner
0602ed1043 unit-tests: Fix compiler warning with empty message assertion
The empty array of rules for `assert_message_empty()` and the resulting
size 0 triggers warnings like these:

  allocation of insufficient size '0' for type 'listener_message_rule_t' with size '12'

Using calloc() with `nmemb` set to 0 triggers the same warning.
2024-07-15 16:55:29 +02:00
Tobias Brunner
6eec5cc07d daemon: Use correct argument order for calloc() to fix compiler warning
The number of elements is the first argument, their size the second.
The previous code triggered the following warning:

  'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument
2024-07-12 14:00:15 +02:00
Tobias Brunner
574bfad1c0 backtrace: Fix compiler warning on Windows
This change avoids a "variable 'got' might be clobbered by 'longjmp' or
'vfork'" warning with -Wextra.
2024-07-12 11:48:03 +02:00
Tobias Brunner
d759bd9efa Use wolfSSL 5.7.2 for tests 2024-07-11 15:57:12 +02:00
Tobias Brunner
c4bce2b79b testing: Enable mgf1 plugin for scenarios where FreeRADIUS uses PSS signatures
Looks like a cipher suite without DHE was selected previously.

Could be a side-effect of dc1085734f34 ("testing: Remove unnecessary
FreeRADIUS dh_file option as recommended in the log").
2024-06-26 14:56:22 +02:00
Tobias Brunner
a9ced3ccb4 testing: Fix IP pool scenarios after changing base address
Fixes: 2b11764b705d ("mem-pool: Adjust the base address if it's the network ID")
2024-06-26 14:56:22 +02:00
Maxim Uvarov
dd256e730d testing: Enable error code checks for load-testconfig
Errors in load-testconfig are hidden due to not checking scp
return code and mute all errors. Add -e to trap script on
any errors in this script.

References strongswan/strongswan#2310

Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
2024-06-26 14:55:52 +02:00
Maxim Uvarov
d8c6fa3b9a testing: Enable sftp subsystem in default sshd_config
OpenSSH defaults have changed and scp stopped to work with newer versions.
There are 2 options to fix it, either use -O (legacy scp protocol)
with scp, or enable the sftp subsystem in the SSH server config.
This fix uses the second variant.

Closes strongswan/strongswan#2310

Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
2024-06-26 14:54:38 +02:00
Tobias Brunner
710973f0b0 cirrus: Use FreeBSD 13.3 and 14.1 2024-06-18 16:25:08 +02:00
Tobias Brunner
d02aea9c2c quick-mode: Get a reference when adopting the reqid of a rekeyed CHILD_SA 2024-06-17 14:58:47 +02:00
Tobias Brunner
2b11764b70 mem-pool: Adjust the base address if it's the network ID
Instead of just adding the offset internally, this way the reported
base address is always the first assignable address (e.g. for
192.168.0.0/24 vs. 192.168.0.1/24).

Closes strongswan/strongswan#2264
2024-06-17 14:55:43 +02:00
Tobias Brunner
1cbcf198ab testing: Make RADIUS server enforce client identity in certificate's CN 2024-06-17 14:47:11 +02:00
Tobias Brunner
dc1085734f testing: Remove unnecessary FreeRADIUS dh_file option as recommended in the log 2024-06-17 14:47:11 +02:00
Tobias Brunner
49cb7b016f charon-nm: Use a different routing table than the regular IKE daemon
If the regular daemon is running, it creates an unconditional routing
rule for the routing table.  The rule that charon-nm tries to create,
which excludes marked IKE/ESP traffic to avoid a routing loop, then
can't be installed and we'd end up with said loop.

Closes strongswan/strongswan#2230
2024-06-17 14:45:52 +02:00
Tobias Brunner
59587783ff cirrus: Explicitly install tpm2-tss-sys package on Alpine
The libraries were previously shipped with the -dev package.
2024-05-27 14:08:08 +02:00
Tobias Brunner
fc6556fd18 github: Use AWS-LC 1.28.0 for tests 2024-05-27 10:42:37 +02:00
Tobias Brunner
8e88d56206 x509: Encode challenge passwords as PrintableString if possible
As recommended by RFC 2985, section 5.4.1:

  ChallengePassword attribute values generated in accordance with this
  version of this document SHOULD use the PrintableString encoding
  whenever possible.  If internationalization issues make this
  impossible, the UTF8String alternative SHOULD be used.

Even though the RFC continues with

  PKCS #9-attribute processing systems MUST be able to recognize and
  process all string types in DirectoryString values.

there might be older SCEP server implementations that don't accept
UTF8String-encoded passwords.  In particular because previous versions of
PKCS#9 defined this attribute's type as a CHOICE between PrintableString
and T61String.

References strongswan/strongswan#1831
2024-05-17 14:04:20 +02:00
Tobias Brunner
f8c6ff1fc1 streams: Add ability to listen on any VSOCK CID
Can be useful if the CID inside the VM is not known.

The \htmlonly\endhtmlonly hack is used to avoid compiler warnings due
to /* inside a block comment.
2024-05-17 14:00:12 +02:00
Thomas Egerer
3d7d527ad9 streams: Add support for AF_VSOCK sockets on Linux
These allow, for instance, a vici client on a host to communicate with
an IKE daemon running in a VM.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2024-05-17 14:00:12 +02:00
Thomas Egerer
9228a5109b ike-cfg: Consider port information in IKE config match
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2024-05-17 13:53:00 +02:00
Tobias Brunner
287ef047a9 github: Use tpm2-tss 3.2.3 for tests 2024-04-29 16:10:39 +02:00
Tobias Brunner
059249bae7 configure: Enable counters plugin also if vici is enabled but stroke is disabled 2024-04-18 08:59:18 +02:00
Tobias Brunner
f8e6fd30de gitignore: Don't ignore proposal_keywords.c
If somebody copies our .gitignore and tries to import the source code,
the proposal_keywords.c file will not be added as it's ignored by the
`*keywords.c` pattern we use to ignore gperf-generated source files.

Closes strongswan/strongswan#2014
2024-04-15 18:29:42 +02:00
Tobias Brunner
5f99a28381 mem-pool: Reject the creation of unintentionally empty pools
If a base address is configured, we don't expect the pool to be empty,
so reject the creation (e.g. with the broadcast address as base).

References strongswan/strongswan#2205
2024-04-15 09:50:41 +02:00
Tobias Brunner
afeac365fd swanctl: Document possibility of non-zero base addresses for in-memory pools
References strongswan/strongswan#2205
2024-04-15 09:50:34 +02:00
Tobias Brunner
907079bd13 Use AWS-LC 1.24.0 for tests 2024-04-12 14:59:32 +02:00
Tobias Brunner
3a20170324 github: Don't search for coverage results
We explicitly pass the final .info file prepared with lcov, so there is
no need to search for other files (that then won't work anyway).  The
search also finds the uncleaned .info file, which includes the test code.

The latter should have gotten ignored anyway, but the patterns are
apparently not correct anymore. So fixing that as well just to be sure.
2024-04-04 15:00:13 +02:00
Tobias Brunner
75c5c5667d github: Update coverage data upload to Codecov
Since the script and action have issues with the directory structure, we
upload the lcov results instead.
2024-04-04 09:25:12 +02:00
Tobias Brunner
9c208c4e46 Merge branch 'openwrt-fixes'
Closes strongswan/strongswan#2185
2024-04-03 11:28:24 +02:00
Philip Prindeville
e5bc3a50f6 wolfssl: Avoid conflict with RNG when built without EdDSA or FIPS enabled
There are definitions of RNG in <wolfssl/wolfcrypt/settings.h> and
<wolfssl/wolfcrypt/random.h> that play havoc with the literal RNG being
used in the expansions of PLUGIN_*(RNG, ...) when ##-concatenated to
build the enum value FEATURE_RNG.

The #undef in wolfssl_cmmon.h only had an effect if wolfSSL was built
with EdDSA or FIPS enabled, otherwise, the headers that define RNG were
not pulled in before it.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2024-04-03 08:48:46 +02:00
Noel Kuntze
1b19053919 uci: Upstream patch to adapt to option datatype abstraction
This is a patch from the OpenWrt package sources necessary to adapt to
changes from 2008 that abstracted the option datatype (added a list
type).

Signed-off-by: Noel Kuntze <noel.kuntze@thermi.consulting>
Reviewed-by: Philip Prindeville <philipp@redfish-solutions.com>
2024-04-03 08:41:42 +02:00
Tobias Brunner
b73a476c1f cirrus: Add build on Alpine Linux with musl C library 2024-04-02 14:21:56 +02:00
Tobias Brunner
56f4b2096a sha3: Fix Keccak when compiled with GCC 13.x
With GCC 13, the compiler apparently applies new aliasing optimizations
when compiled with -O2 and without -fno-strict-aliasing.  This caused
the application of the second padding bit, where the state was accessed
via uint8_t[], to be moved before the loop that absorbs the buffer into
the state, where the state is accessed via uint64_t[], resulting in
incorrect output.  By only accessing the state via uint64_t[] here the
compiler won't reorder the instructions.
2024-04-02 14:19:40 +02:00
Tobias Brunner
ac713746c9 unit-tests: Adhere to TESTS_NO_IPV6 in HTTP fetcher test suite 2024-04-02 14:18:49 +02:00
Tobias Brunner
9ac6c469a5 bliss: Fix build with built-in printf-specifiers
This won't work for monolithic builds because the plugin and the
executable are built before libstrongswan.
2024-04-02 14:18:43 +02:00
Tobias Brunner
84166508f8 Use wolfSSL 5.7.0 for tests 2024-03-22 11:43:39 +01:00
Tobias Brunner
540881627f farp: Fix build with musl C library
Same issue as described in the previous commit.

Fixes: 187c72d1afdc ("dhcp: Port the plugin to FreeBSD/macOS")
2024-03-22 11:41:13 +01:00
Tobias Brunner
f5b1ca4ef6 pf-handler: Fix build with musl C library
musl's headers define a lot of networking structs.  For some, the
definition in the Linux UAPI headers is then suppressed by e.g.
__UAPI_DEF_ETHHDR.

Since we included musl's net/ethernet.h, which includes netinet/if_ether.h
that defines `struct ethhdr` (and the above constant), **after** we
include linux/if_ether.h, there was a compilation error because the
struct was defined multiple times.

However, simply moving that include doesn't fix the problem because for
ARP-specific structs the Linux headers don't provide __UAPI_DEF* checks.
So instead of directly including the linux/ headers, we include those
provided by the C library.  For glibc these usually just include the
Linux headers, but for musl this allows them to define the struct
directly.  We also need to move if.h and add packet.h, which define
other structs (or include headers that do so) that we use.

Fixes: 187c72d1afdc ("dhcp: Port the plugin to FreeBSD/macOS")
2024-03-22 11:40:15 +01:00
Thomas Egerer
f3c8e02c69 ike-sa-manager: Unlock mutex if allocating SPI fails to avoid lock contention
Fixes: 5d91d8c46937 ("Check rng return value when generating SPIs in ike_sa_manager_t")
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2024-03-20 13:18:57 +01:00
Andreas Steffen
dea8493f3a Version bump to 5.9.14 5.9.14 2024-03-19 11:56:44 +01:00
Tobias Brunner
470ead96ea github: Use AWS-LC 1.23.0 for tests 2024-03-18 09:00:38 +01:00
Wataru Ashihara
c3f8642e72 save-keys: Fix Wireshark algorithm identifier for 3DES
Wireshark has shown the following error dialogue because the identifier
was incorrect [1]:

Error loading table 'ESP SAs': esp_sa:18: invalid value: TripleDes-CBC [RFC2451]

[1] 3757f42e5f/epan/dissectors/packet-ipsec.c (L203)

Closes strongswan/strongswan#2013
2024-03-18 08:54:41 +01:00
Tobias Brunner
9acd90575a ike-cfg: Change how OCSP certificate requests are enabled
The previous option caused such requests to be enabled if not explicitly
disabled, which only the vici plugin did, for all other backends requests
would have been sent.

References strongswan/strongswan#2016
2024-03-15 15:38:19 +01:00