19343 Commits

Author SHA1 Message Date
Tobias Brunner
3d0f6958a9 openssl: Add support for new API to squeeze data from XOFs
This new API doesn't require a temporary buffer and generating a lot
of already consumed output.
2024-10-25 14:28:40 +02:00
Tobias Brunner
bee06c9ec5 leak-detective: Whitelist OpenSSL 3.2 function 2024-10-25 14:28:35 +02:00
Andreas Steffen
0be6fd7735 certificate_printer: Fix spacing for additional CRL/OCSP URIs
Multiple occurences of CRL and OCSP URIs where not indented correctly.
2024-10-18 15:45:07 +02:00
Tobias Brunner
5019e3ece0 nm: Update build files and switch from intltool to gettext
gnome-common has been deprecated, so has intltool.  This follows GNOME's
recommended migration paths.
2024-10-16 08:16:43 +02:00
Tobias Brunner
faf40b8d74 Revert "conf: Add support for escaping dots in section/option names"
This reverts commit 84a3077e780e7b25bf536da42a583bdc18448362.

Support for dots in names of settings was removed quite a while ago and
now the \. sequence caused `SyntaxWarning: invalid escape sequence`.
2024-10-15 12:59:41 +02:00
Tobias Brunner
60336ceecb wolfssl: Don't undef PARSE_ERROR as headers included later might refer to it 2024-10-15 11:14:35 +02:00
Tobias Brunner
8e020bc9e3 vici-config: Same order for default ESP proposals if unset or set to "default"
The order was different when not setting `esp_proposals` or explicitly
configuring `default`.

Fixes: 33412158f58c ("ike: Send AEAD ESP default proposal first")
2024-10-02 10:33:05 +02:00
Tobias Brunner
089977b69d generator: Make debug log for payload substructure rules more clear
Similar to the previous commit.  Instead of

  generating rule 10 (1258)

followed by (or not if the list is empty)

  generating payload of type PROPOSAL_SUBSTRUCTURE

we now get

  generating rule 10 LIST of PROPOSAL_SUBSTRUCTURE

in the debug log.
2024-10-02 10:08:51 +02:00
Tobias Brunner
2ec6d50a3c parser: Make debug log for payload substructure rules more clear
Instead of this

  parsing rule 10 (1258)

we now see this

  parsing rule 10 LIST of PROPOSAL_SUBSTRUCTURE

in the debug log. Particularly useful if the list is empty as there won't
be a message like this following it:

  x bytes left, parsing recursively PROPOSAL_SUBSTRUCTURE
2024-10-02 10:07:36 +02:00
Tobias Brunner
be0af46d89 Merge branch 'tun-device-ipv6'
Adds support for IPv6 addresses on TUN devices, in particular, to support
virtual IPv6 addresses on FreeBSD/macOS.

Closes strongswan/strongswan#2465
2024-09-25 16:12:49 +02:00
Tobias Brunner
bf165afb78 kernel-pfroute: Route via interface if we don't have a next hop
Compared to RTA_IFP, the format is different when passing an interface
as RTA_GATEWAY, it requires the interface's address and not its name.
2024-09-25 16:12:34 +02:00
Tobias Brunner
fccc76449d tun-device: Fix handling of IPv6 addresses
struct ifreq can't be used for IPv6 as the ifr_addr member is not large
enough.  Actually, configuring an IPv6 address via an AF_INET socket won't
work anyway.  And unfortunately, it's not standardized how IPv6 addresses
are installed, so we have to do this quite differently on Linux and on BSD.
However, we already use SIOCAIFADDR for IPv4 on newer FreeBSD systems,
which wasn't the case when this patch was originally created in 2014.
2024-09-25 15:45:32 +02:00
Tobias Brunner
74208e2cc3 Merge branch 'tkm-multi-ke'
Adds support for multiple key exchanges to charon-tkm.
2024-09-19 15:20:31 +02:00
Tobias Brunner
2b1885b892 testing: Add TKM scenarios with multiple key exchanges 2024-09-19 14:39:13 +02:00
Tobias Brunner
5a8f0767b8 charon-tkm: Add tests with multiple key exchanges 2024-09-19 14:39:13 +02:00
Stefan Berghofer
7975a0cfa4 charon-tkm: Adapt to interface changes to support multiple key exchanges
Also includes ESA flags.

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2024-09-19 14:39:13 +02:00
Tobias Brunner
301abbeaff Merge branch 'vici-reload-tasks'
Consider queued child-creating tasks when reloading configs that have
`start` as start action.  Besides some possible corner cases it fixes
handling IKE_SAs that are current getting established and have no
established CHILD_SAs yet.

Closes strongswan/strongswan#2418
2024-09-19 10:11:49 +02:00
Tobias Brunner
a4a3dcf6c2 vici-config: Consider queued tasks when terminating IKE/CHILD_SAs
This is particularly important for IKE_SAs that are not yet established,
which would get terminated as they have no established CHILD_SAs yet.

Fixes: 72f9a21b22e9 ("Merge branch 'vici-reload-actions'")
2024-09-18 11:53:17 +02:00
Tobias Brunner
961763b84d quick-mode: Allow "aborting" task if it's currently active
Basically the same as the previous commit.
2024-09-18 11:53:17 +02:00
Tobias Brunner
e81cf3bd36 child-create: Allow "aborting" task if it's currently active
We can't actually abort an active exchange, but we can delete the SA
immediately after its creation.
2024-09-18 11:53:17 +02:00
Tobias Brunner
cf3c90dba6 quick-mode: Add getter for child config 2024-09-18 11:53:17 +02:00
Tobias Brunner
04c9316db5 child-create: Add getter for child config 2024-09-18 11:53:17 +02:00
Tobias Brunner
9d4c7bebfc checksum: Avoid compiler warning/error when building monolithic
References strongswan/strongswan#2446
2024-09-18 11:49:35 +02:00
Tobias Brunner
decccd4f63 github: Update AWS-LC to 1.35.0 for tests 2024-09-18 08:49:52 +02:00
Thomas Egerer
cf7fb47788 array: Don't use realloc() with zero size in array_compress()
The behavior of realloc(3) with zero size was apparently implementation
defined.  While glibc documents the behavior as equivalent to free(3),
that might not apply to other C libraries.  With C17, this behavior has
been deprecated, and with C23, the behavior is now undefined.  It's also
why valgrind warns about this use.

Hence, when array_compress() would call realloc() with a zero size, we
now call free() explicitly and set the pointer to NULL.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2024-09-12 08:53:26 +02:00
Andreas Steffen
957aae8f64 cert-enroll: Fixed typo
This typo prevented the cert-enroll script from successfully
signalling a detected change of the sub CA certificate.
2024-09-07 17:17:07 +02:00
Tobias Brunner
55a660d9f7 github: Use more verbose output for apt-get calls
With -qq we don't see any detailed error messages.
2024-09-05 10:59:20 +02:00
Tobias Brunner
6928709886 ike-cfg: Only consider port information if the IP matches
Otherwise, all configs would be considered to even some degree as the
ports usually match.

Closes strongswan/strongswan#2441

Fixes: 9228a5109b8d ("ike-cfg: Consider port information in IKE config match")
2024-09-05 10:22:25 +02:00
Tobias Brunner
12d2b6e2b4 key-exchange: Pass prefix array directly, not a pointer to it 2024-08-08 11:19:16 +02:00
Tobias Brunner
8e2fde6230 child-create: Remove redundant variable assignment 2024-08-08 11:18:24 +02:00
Tobias Brunner
3a850ae191 Merge branch 'multi-ke'
This adds support for multiple key exchanges (no KEMs yet as none are
standardized so far).  Work on this started over five years ago and went
through multiple iterations (first our own protocol, then standardized
extensions in different variations).

IKE_INTERMEDIATE exchanges, defined RFC 9242, are used to transport
multiple KE payloads between the IKE_SA_INIT and IKE_AUTH exchanges.
To rekey IKE and CHILD_SAs with multiple key exchanges, IKE_FOLLOWUP_KE
exchanges are used, as defined in RFC 9370.

In proposals, additional key exchange methods are configured via `keX_`
prefix, where X is a number between 1 and 7.  For example, `ke1_ecp256`
adds ECP_256 as additional KE method.  As with regular key exchanges,
peers have to agree on a method for each round unless no algorithms are
defined by both or `keX_none` is configured to make that round explicitly
optional.

Also changed is how rekey collisions are handled, which makes CHILD_SAs
properly trackable via child_rekey() hook.
2024-08-07 16:20:42 +02:00
Tobias Brunner
f3c7e5227c testing: Add ikev2/rw-cert-multi-ke scenario 2024-08-07 16:20:19 +02:00
Tobias Brunner
ddb9b274c2 unit-tests: Ensure listeners can track SAs via ike/child_updown/rekey()
Previously, it could happen that child_rekey() was triggered twice for
the same "old" SA.  For listeners that would mean they'd loose track as
they'd be tracking a new SA that wasn't relevant anymore and for which
no updown event would ever get triggered (it was the redundant SA in a
collision).  This new assert ensures that events are triggered in a
predictable way and listeners can track SAs properly.
2024-08-07 16:20:19 +02:00
Tobias Brunner
d2b2e1b3fa ikev2: Make CHILD_SAs properly trackable during rekey collisions
As the winner of a rekey collision, we previously always triggered the
child_rekey() event once when creating the redundant SA on behalf of the
peer in the passive child-rekey task and then a second time when
creating the winning SA in the active task.  However, both calls passed
the replaced CHILD_SA as "old". This made tracking CHILD_SAs impossible
because there was no transition from the redundant, "new" SA of the
first event to the "new", winning SA of the second.  Of course, when the
second event was triggered, the redundant SA might not have existed
anymore because the peer is expected to delete it, which could happen
before the CREATE_CHILD_SA response arrives at the initiator.

This refactoring ensures that the child_rekey() event is triggered in
a way that makes the CHILD_SAs trackable in all reasonable (and even
some unreasonable) scenarios.  The event is generally only triggered
once after installing the outbound SA for the new/winning CHILD_SA.
This can be when processing the CREATE_CHILD_SA in the active child-rekey
task, or when processing the DELETE for the old SA in a passive
child-delete task.  There are some cases where the event is still
triggered twice, but it is now ensured that listeners can properly
transition to the winning SA.

Some corner cases are now also handled correctly, e.g. if a responder's
DELETE for the new CHILD_SA arrives before its CREATE_CHILD_SA response
that actually creates it on the initiator.  Also handled properly are
responders of rekeyings that incorrectly send a DELETE for the old
CHILD_SA (previously this caused both, the new and the old SA, to get
deleted).
2024-08-07 16:20:19 +02:00
Tobias Brunner
7ad610a140 ike-init: Indicate support for IKE_INTERMEDIATE 2024-08-07 16:20:19 +02:00
Tobias Brunner
012d99ecf4 proposal: Prevent selection of duplicate key exchange methods
All additional (and the initial) key exchanges must use a different method.
2024-08-07 16:20:19 +02:00
Tobias Brunner
1d5e921911 proposal: Add helper to check if additional key exchanges are contained 2024-08-07 16:20:19 +02:00
Tobias Brunner
882ff93bfd proposal: Accept NONE for additional key exchanges also for IKE proposals 2024-08-07 16:20:19 +02:00
Tobias Brunner
33e421320a unit-tests: Add tests for CHILD_SA rekeying with multiple key exchanges 2024-08-07 16:20:19 +02:00
Tobias Brunner
37eeafa37f unit-tests: Add tests for CHILD_SA creation with multiple key exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
329a7b331d unit-tests: Add tests for IKE_SA rekeying with multiple key exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
37c56affa1 unit-tests: Support multiple proposals in exchange tests 2024-08-07 16:20:18 +02:00
Andreas Steffen
d4fb07911f vici: Increase maximum proposal length 2024-08-07 16:20:18 +02:00
Andreas Steffen
355f917532 vici: List additional key exchanges
Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2024-08-07 16:20:18 +02:00
Tobias Brunner
c5a6938b9e proposal: Add prefix for additional key exchanges when logging proposals 2024-08-07 16:20:18 +02:00
Tobias Brunner
e05d86b27a key-exchange: Add dynamic parser for additional key exchange methods 2024-08-07 16:20:18 +02:00
Tobias Brunner
95275d2fe5 child-rekey: Support CHILD_SA rekeying with multiple key exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
c200bd1668 unit-tests: Fix CHILD_SA rekey tests after INVALID_KE_PAYLOAD handling changed
The responder doesn't create a CHILD_SA and allocate an SPI anymore
when responding with an INVALID_KE_PAYLOAD notify.
2024-08-07 16:20:18 +02:00
Tobias Brunner
d7760416d6 child-create: Add support for multiple key exchanges
It also changes that payloads are built before installing the CHILD_SA
on the responder, that is, the KE payload is generated before keys are
derived, so that key_exchange_t::get_public_key() is called before
get_shared_secret(), or its internal equivalent, which could be relevant
for KE implementations that want to ensure that the key can't be
accessed again after the key derivation.
2024-08-07 16:20:18 +02:00
Tobias Brunner
ca3e6d2d14 ike-rekey: Support IKE_SA rekeying with multiple key exchanges 2024-08-07 16:20:18 +02:00