]> git.ipfire.org Git - thirdparty/strongswan.git/log
thirdparty/strongswan.git
7 months agocharon-tkm: Pass ia and ea ids according to configured proposal mappings tkm-proposal-mapping
Tobias Brunner [Tue, 10 May 2022 08:56:15 +0000 (10:56 +0200)] 
charon-tkm: Pass ia and ea ids according to configured proposal mappings

7 months agoproposal: Add constructor that does no checks or fixups
Tobias Brunner [Tue, 10 May 2022 12:37:40 +0000 (14:37 +0200)] 
proposal: Add constructor that does no checks or fixups

This allows an easier construction of invalid proposals (e.g. IKE
proposals without DH groups) than parsing tokens and using
add_algorithm() manually.

7 months agoproposal: Add lower case names for protocols
Tobias Brunner [Tue, 10 May 2022 12:26:38 +0000 (14:26 +0200)] 
proposal: Add lower case names for protocols

7 months agoMerge branch 'tkm-multi-ke'
Tobias Brunner [Thu, 19 Sep 2024 13:20:31 +0000 (15:20 +0200)] 
Merge branch 'tkm-multi-ke'

Adds support for multiple key exchanges to charon-tkm.

7 months agotesting: Add TKM scenarios with multiple key exchanges
Tobias Brunner [Wed, 17 Nov 2021 13:43:38 +0000 (14:43 +0100)] 
testing: Add TKM scenarios with multiple key exchanges

7 months agocharon-tkm: Add tests with multiple key exchanges
Tobias Brunner [Wed, 24 Nov 2021 14:53:19 +0000 (15:53 +0100)] 
charon-tkm: Add tests with multiple key exchanges

7 months agocharon-tkm: Adapt to interface changes to support multiple key exchanges
Stefan Berghofer [Thu, 29 Jul 2021 14:25:15 +0000 (14:25 +0000)] 
charon-tkm: Adapt to interface changes to support multiple key exchanges

Also includes ESA flags.

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
7 months agoMerge branch 'vici-reload-tasks'
Tobias Brunner [Thu, 19 Sep 2024 08:11:49 +0000 (10:11 +0200)] 
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

7 months agovici-config: Consider queued tasks when terminating IKE/CHILD_SAs
Tobias Brunner [Tue, 3 Sep 2024 14:15:02 +0000 (16:15 +0200)] 
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'")
7 months agoquick-mode: Allow "aborting" task if it's currently active
Tobias Brunner [Tue, 3 Sep 2024 14:09:54 +0000 (16:09 +0200)] 
quick-mode: Allow "aborting" task if it's currently active

Basically the same as the previous commit.

7 months agochild-create: Allow "aborting" task if it's currently active
Tobias Brunner [Tue, 3 Sep 2024 14:05:44 +0000 (16:05 +0200)] 
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.

7 months agoquick-mode: Add getter for child config
Tobias Brunner [Tue, 3 Sep 2024 12:51:28 +0000 (14:51 +0200)] 
quick-mode: Add getter for child config

7 months agochild-create: Add getter for child config
Tobias Brunner [Tue, 3 Sep 2024 12:51:46 +0000 (14:51 +0200)] 
child-create: Add getter for child config

7 months agochecksum: Avoid compiler warning/error when building monolithic
Tobias Brunner [Fri, 6 Sep 2024 08:16:10 +0000 (10:16 +0200)] 
checksum: Avoid compiler warning/error when building monolithic

References strongswan/strongswan#2446

7 months agogithub: Update AWS-LC to 1.35.0 for tests
Tobias Brunner [Wed, 18 Sep 2024 06:49:52 +0000 (08:49 +0200)] 
github: Update AWS-LC to 1.35.0 for tests

7 months agoarray: Don't use realloc() with zero size in array_compress()
Thomas Egerer [Fri, 6 Sep 2024 11:29:40 +0000 (13:29 +0200)] 
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>
8 months agocert-enroll: Fixed typo
Andreas Steffen [Sat, 7 Sep 2024 15:13:00 +0000 (17:13 +0200)] 
cert-enroll: Fixed typo

This typo prevented the cert-enroll script from successfully
signalling a detected change of the sub CA certificate.

8 months agogithub: Use more verbose output for apt-get calls
Tobias Brunner [Thu, 5 Sep 2024 08:46:39 +0000 (10:46 +0200)] 
github: Use more verbose output for apt-get calls

With -qq we don't see any detailed error messages.

8 months agoike-cfg: Only consider port information if the IP matches
Tobias Brunner [Wed, 4 Sep 2024 13:08:47 +0000 (15:08 +0200)] 
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")
9 months agokey-exchange: Pass prefix array directly, not a pointer to it
Tobias Brunner [Thu, 8 Aug 2024 09:19:16 +0000 (11:19 +0200)] 
key-exchange: Pass prefix array directly, not a pointer to it

9 months agochild-create: Remove redundant variable assignment
Tobias Brunner [Thu, 8 Aug 2024 09:18:24 +0000 (11:18 +0200)] 
child-create: Remove redundant variable assignment

9 months agoMerge branch 'multi-ke'
Tobias Brunner [Wed, 7 Aug 2024 14:20:42 +0000 (16:20 +0200)] 
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.

9 months agotesting: Add ikev2/rw-cert-multi-ke scenario
Tobias Brunner [Thu, 6 Jun 2024 15:48:38 +0000 (17:48 +0200)] 
testing: Add ikev2/rw-cert-multi-ke scenario

9 months agounit-tests: Ensure listeners can track SAs via ike/child_updown/rekey()
Tobias Brunner [Fri, 9 Sep 2022 16:34:29 +0000 (18:34 +0200)] 
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.

9 months agoikev2: Make CHILD_SAs properly trackable during rekey collisions
Tobias Brunner [Mon, 22 Aug 2022 13:43:16 +0000 (15:43 +0200)] 
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).

9 months agoike-init: Indicate support for IKE_INTERMEDIATE
Tobias Brunner [Tue, 5 Nov 2019 15:42:58 +0000 (16:42 +0100)] 
ike-init: Indicate support for IKE_INTERMEDIATE

9 months agoproposal: Prevent selection of duplicate key exchange methods
Tobias Brunner [Fri, 16 Jul 2021 11:52:19 +0000 (13:52 +0200)] 
proposal: Prevent selection of duplicate key exchange methods

All additional (and the initial) key exchanges must use a different method.

9 months agoproposal: Add helper to check if additional key exchanges are contained
Tobias Brunner [Tue, 5 Nov 2019 16:03:42 +0000 (17:03 +0100)] 
proposal: Add helper to check if additional key exchanges are contained

9 months agoproposal: Accept NONE for additional key exchanges also for IKE proposals
Tobias Brunner [Thu, 22 Oct 2020 11:13:00 +0000 (13:13 +0200)] 
proposal: Accept NONE for additional key exchanges also for IKE proposals

9 months agounit-tests: Add tests for CHILD_SA rekeying with multiple key exchanges
Tobias Brunner [Mon, 29 Jun 2020 12:13:53 +0000 (14:13 +0200)] 
unit-tests: Add tests for CHILD_SA rekeying with multiple key exchanges

9 months agounit-tests: Add tests for CHILD_SA creation with multiple key exchanges
Tobias Brunner [Fri, 26 Jun 2020 12:12:47 +0000 (14:12 +0200)] 
unit-tests: Add tests for CHILD_SA creation with multiple key exchanges

9 months agounit-tests: Add tests for IKE_SA rekeying with multiple key exchanges
Tobias Brunner [Mon, 4 Nov 2019 15:17:30 +0000 (16:17 +0100)] 
unit-tests: Add tests for IKE_SA rekeying with multiple key exchanges

9 months agounit-tests: Support multiple proposals in exchange tests
Tobias Brunner [Wed, 17 Jun 2020 16:39:44 +0000 (18:39 +0200)] 
unit-tests: Support multiple proposals in exchange tests

9 months agovici: Increase maximum proposal length
Andreas Steffen [Tue, 6 Jul 2021 10:11:51 +0000 (12:11 +0200)] 
vici: Increase maximum proposal length

9 months agovici: List additional key exchanges
Andreas Steffen [Tue, 19 Nov 2019 19:44:39 +0000 (20:44 +0100)] 
vici: List additional key exchanges

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
9 months agoproposal: Add prefix for additional key exchanges when logging proposals
Tobias Brunner [Thu, 22 Oct 2020 12:15:31 +0000 (14:15 +0200)] 
proposal: Add prefix for additional key exchanges when logging proposals

9 months agokey-exchange: Add dynamic parser for additional key exchange methods
Tobias Brunner [Mon, 4 Nov 2019 16:27:20 +0000 (17:27 +0100)] 
key-exchange: Add dynamic parser for additional key exchange methods

9 months agochild-rekey: Support CHILD_SA rekeying with multiple key exchanges
Tobias Brunner [Mon, 29 Jun 2020 12:12:05 +0000 (14:12 +0200)] 
child-rekey: Support CHILD_SA rekeying with multiple key exchanges

9 months agounit-tests: Fix CHILD_SA rekey tests after INVALID_KE_PAYLOAD handling changed
Tobias Brunner [Fri, 20 Jul 2018 12:12:48 +0000 (14:12 +0200)] 
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.

9 months agochild-create: Add support for multiple key exchanges
Tobias Brunner [Thu, 25 Jun 2020 08:26:38 +0000 (10:26 +0200)] 
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.

9 months agoike-rekey: Support IKE_SA rekeying with multiple key exchanges
Tobias Brunner [Mon, 6 Apr 2020 15:41:15 +0000 (17:41 +0200)] 
ike-rekey: Support IKE_SA rekeying with multiple key exchanges

9 months agoike-init: Add support for multiple key exchanges
Tobias Brunner [Thu, 31 Oct 2019 16:16:44 +0000 (17:16 +0100)] 
ike-init: Add support for multiple key exchanges

Initially, this is handled with a key derivation for each
IKE_INTERMEDIATE exchange.  When rekeying, the keys are derived only
once all IKE_FOLLOWUP_KE exchanges are done.

9 months agobus: Support multiple key exchanges in ike/child_keys() events
Tobias Brunner [Thu, 9 Apr 2020 09:53:45 +0000 (11:53 +0200)] 
bus: Support multiple key exchanges in ike/child_keys() events

9 months agokeymat_v2: Support key derivation with multiple key exchanges
Tobias Brunner [Thu, 9 Apr 2020 09:37:52 +0000 (11:37 +0200)] 
keymat_v2: Support key derivation with multiple key exchanges

9 months agokey-exchange: Add helper to concatenate shared secrets of several key exchanges
Tobias Brunner [Thu, 9 Apr 2020 09:36:30 +0000 (11:36 +0200)] 
key-exchange: Add helper to concatenate shared secrets of several key exchanges

9 months agokeymat_v2: Proper cleanup if derive_ike_keys() is called multiple times
Tobias Brunner [Thu, 28 Jun 2018 13:33:35 +0000 (15:33 +0200)] 
keymat_v2: Proper cleanup if derive_ike_keys() is called multiple times

9 months agoike-auth: Calculate and collect IntAuth for IKE_INTERMEDIATE exchanges
Tobias Brunner [Tue, 20 Aug 2019 15:07:55 +0000 (17:07 +0200)] 
ike-auth: Calculate and collect IntAuth for IKE_INTERMEDIATE exchanges

The message ID of the first IKE_AUTH exchange is a safe-guard against
potential truncation attacks if IKE_INTERMEDIATE exchanges are not used
for multiple key exchanges but some other future use where the number of
exchanges might not depend on the selected proposal.

9 months agopubkey-authenticator: Handle IntAuth data
Tobias Brunner [Tue, 20 Aug 2019 14:38:01 +0000 (16:38 +0200)] 
pubkey-authenticator: Handle IntAuth data

9 months agopsk-authenticator: Handle IntAuth data
Tobias Brunner [Tue, 20 Aug 2019 14:36:13 +0000 (16:36 +0200)] 
psk-authenticator: Handle IntAuth data

9 months agoeap-authenticator: Handle IntAuth data
Tobias Brunner [Tue, 20 Aug 2019 14:32:17 +0000 (16:32 +0200)] 
eap-authenticator: Handle IntAuth data

9 months agokeymat_v2: Include optional IntAuth in signed octets
Tobias Brunner [Tue, 20 Aug 2019 14:18:05 +0000 (16:18 +0200)] 
keymat_v2: Include optional IntAuth in signed octets

9 months agoauthenticator: Add optional method to set IntAuth data
Tobias Brunner [Tue, 20 Aug 2019 14:13:11 +0000 (16:13 +0200)] 
authenticator: Add optional method to set IntAuth data

9 months agomessage: Store original encrypted payload when generating fragments
Tobias Brunner [Mon, 19 Jul 2021 15:12:09 +0000 (17:12 +0200)] 
message: Store original encrypted payload when generating fragments

If we don't do this, get_plain() will fail after generating the message
fragmented unless it was generated non-fragmented previously.

9 months agomessage: Add method to generate data to authenticate IKE_INTERMEDIATE exchanges
Tobias Brunner [Tue, 20 Aug 2019 12:57:30 +0000 (14:57 +0200)] 
message: Add method to generate data to authenticate IKE_INTERMEDIATE exchanges

9 months agogenerator: Make pointer to length field optional
Tobias Brunner [Tue, 20 Aug 2019 12:53:16 +0000 (14:53 +0200)] 
generator: Make pointer to length field optional

Only useful if we generate an IKE header.

9 months agokeymat_v2: Add method to calculate IntAuth for IKE_INTERMEDIATE exchanges
Tobias Brunner [Tue, 2 Jul 2019 13:01:26 +0000 (15:01 +0200)] 
keymat_v2: Add method to calculate IntAuth for IKE_INTERMEDIATE exchanges

9 months agomessage: Add rules for IKE_FOLLOWUP_KE exchanges
Tobias Brunner [Fri, 3 Apr 2020 13:10:40 +0000 (15:10 +0200)] 
message: Add rules for IKE_FOLLOWUP_KE exchanges

9 months agoike-header: Add IKE_FOLLOWUP_KE exchange type
Tobias Brunner [Fri, 3 Apr 2020 13:01:17 +0000 (15:01 +0200)] 
ike-header: Add IKE_FOLLOWUP_KE exchange type

9 months agonotify-payload: Add notify types for multiple key exchanges
Tobias Brunner [Fri, 25 Oct 2019 12:27:47 +0000 (14:27 +0200)] 
notify-payload: Add notify types for multiple key exchanges

9 months agoikev2: Reject IKE_INTERMEDIATE requests after IKE_AUTH
Tobias Brunner [Tue, 8 Feb 2022 13:23:37 +0000 (14:23 +0100)] 
ikev2: Reject IKE_INTERMEDIATE requests after IKE_AUTH

We currently only support these exchanges for additional key exchanges,
so once we have the final keys derived and the ike-init task is removed,
we don't expect any more of them.

9 months agomessage: Add rules for IKE_INTERMEDIATE exchanges
Tobias Brunner [Fri, 25 Oct 2019 12:40:35 +0000 (14:40 +0200)] 
message: Add rules for IKE_INTERMEDIATE exchanges

9 months agoike-header: Add IKE_INTERMEDIATE exchange type
Tobias Brunner [Fri, 25 Oct 2019 12:39:54 +0000 (14:39 +0200)] 
ike-header: Add IKE_INTERMEDIATE exchange type

9 months agonotify-payload: Add notify type for IKE_INTERMEDIATE exchange
Tobias Brunner [Wed, 18 Dec 2019 17:42:59 +0000 (18:42 +0100)] 
notify-payload: Add notify type for IKE_INTERMEDIATE exchange

9 months agoproposal-substructure: Encode additional key exchange methods
Tobias Brunner [Fri, 25 Oct 2019 12:55:05 +0000 (14:55 +0200)] 
proposal-substructure: Encode additional key exchange methods

9 months agoproposal: Make all key exchange transforms optional in ESP/AH proposals
Tobias Brunner [Tue, 5 Nov 2019 09:22:36 +0000 (10:22 +0100)] 
proposal: Make all key exchange transforms optional in ESP/AH proposals

9 months agoproposal: Skip all KE transforms if PROPOSAL_SKIP_KE given
Tobias Brunner [Tue, 29 Oct 2019 10:50:00 +0000 (11:50 +0100)] 
proposal: Skip all KE transforms if PROPOSAL_SKIP_KE given

9 months agotransform: Add helper to check if transform type negotiates key exchange
Tobias Brunner [Tue, 29 Oct 2019 10:46:22 +0000 (11:46 +0100)] 
transform: Add helper to check if transform type negotiates key exchange

9 months agotransform: Add additional key exchange transform types
Tobias Brunner [Fri, 25 Oct 2019 12:20:59 +0000 (14:20 +0200)] 
transform: Add additional key exchange transform types

9 months agokernel-pfkey: Fix list of extension type names on FreeBSD
Tobias Brunner [Mon, 29 Jul 2024 12:36:32 +0000 (14:36 +0200)] 
kernel-pfkey: Fix list of extension type names on FreeBSD

The list was extended earlier this year.

9 months agoMerge branch 'sa-dir'
Tobias Brunner [Wed, 7 Aug 2024 12:59:55 +0000 (14:59 +0200)] 
Merge branch 'sa-dir'

Configures the direction of IPsec SAs in the Linux kernel if
possible (6.10+).

9 months agokernel-netlink: Set replay window 0 if kernel supports SA direction attribute
Tobias Brunner [Tue, 30 Apr 2024 13:12:22 +0000 (15:12 +0200)] 
kernel-netlink: Set replay window 0 if kernel supports SA direction attribute

The kernel now allows a 0 replay window with ESN for SAs that are
explicitly tagged as outbound SAs.  But not just that, it actually
rejects outbound SAs with replay windows > 0.  So we add a version check
to control the replay window size.  Note that adding the attribute
unconditionally would be fine even for older kernels, but if somebody
backports the direction patches, the installation of outbound SAs might
fail if the replay window is not adjusted accordingly.

9 months agokernel-netlink: Add SA direction attribute
Tobias Brunner [Tue, 30 Apr 2024 09:39:00 +0000 (11:39 +0200)] 
kernel-netlink: Add SA direction attribute

9 months agokernel-netlink: Only disable DF-flag copying on outbound SAs
Tobias Brunner [Tue, 30 Apr 2024 13:11:12 +0000 (15:11 +0200)] 
kernel-netlink: Only disable DF-flag copying on outbound SAs

This will cause errors on inbound SAs if the SA direction attribute is
used.

9 months agokernel-netlink: Add missing names for XFRM message types and attributes
Tobias Brunner [Tue, 7 May 2024 08:07:17 +0000 (10:07 +0200)] 
kernel-netlink: Add missing names for XFRM message types and attributes

9 months agoinclude: Update XFRM header for SA direction attribute
Tobias Brunner [Tue, 30 Apr 2024 09:09:41 +0000 (11:09 +0200)] 
include: Update XFRM header for SA direction attribute

9 months agoike-sa: Add address family specific configuration of fragment size
Thomas Egerer [Fri, 2 Aug 2024 11:47:13 +0000 (11:47 +0000)] 
ike-sa: Add address family specific configuration of fragment size

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
9 months agoandroid: Fix import of an already existing VPN profile
Tobias Brunner [Wed, 7 Aug 2024 06:58:12 +0000 (08:58 +0200)] 
android: Fix import of an already existing VPN profile

9 months agoMerge branch 'android-14' android-2.5.2
Tobias Brunner [Tue, 6 Aug 2024 16:02:18 +0000 (18:02 +0200)] 
Merge branch 'android-14'

Updates target SDK to Android 14 (34) and fixes compatibility issues.

9 months agoandroid: New release after updating target SDK and fixing some compatibility issues
Tobias Brunner [Mon, 5 Aug 2024 12:52:30 +0000 (14:52 +0200)] 
android: New release after updating target SDK and fixing some compatibility issues

9 months agoandroid: Increase targetSdkVersion to 34 (Android 14)
Tobias Brunner [Mon, 5 Aug 2024 12:31:32 +0000 (14:31 +0200)] 
android: Increase targetSdkVersion to 34 (Android 14)

9 months agoandroid: Avoid using deprecated ViewCompat methods
Tobias Brunner [Mon, 5 Aug 2024 12:16:51 +0000 (14:16 +0200)] 
android: Avoid using deprecated ViewCompat methods

9 months agoandroid: Replace deprecated Observer/Observable with PropertyChangeListener etc.
Tobias Brunner [Mon, 5 Aug 2024 09:51:40 +0000 (11:51 +0200)] 
android: Replace deprecated Observer/Observable with PropertyChangeListener etc.

Kinda misusing the interface as there is no specific property, but
otherwise seems like a 1:1 replacement.

9 months agoandroid: Add workaround for a bug preventing background service starts from TileService
Tobias Brunner [Mon, 5 Aug 2024 09:02:49 +0000 (11:02 +0200)] 
android: Add workaround for a bug preventing background service starts from TileService

When targeting Android 14, we get a "Background activity launch blocked!"
exception when trying to start the connection in the background (closing
the drawer works).  Which is apparently a bug:

  https://issuetracker.google.com/issues/305035828

The workaround here is kinda ugly.  In particular, because it's not
possible anymore since a few versions to open a dialog that allows users
to directly grant the required permission to the app.  We can only open
the generic settings dialog where users have to search for the app and
grant the permission themselves (we could add a dialog with an explanation
similar to the one for the power whitelist if necessary).  Hopefully this
gets fixed at some point (the current beta of Android 15 still has the
same bug, though).

9 months agoandroid: Use PendingIntent-version of startActivityAndCollapse()
Tobias Brunner [Mon, 5 Aug 2024 08:47:10 +0000 (10:47 +0200)] 
android: Use PendingIntent-version of startActivityAndCollapse()

The other version has been deprecated and throws an exception when
targeting Android 14+.

9 months agoandroid: Explicitly mark receiver as not exported during registration
Tobias Brunner [Mon, 5 Aug 2024 08:35:05 +0000 (10:35 +0200)] 
android: Explicitly mark receiver as not exported during registration

9 months agoandroid: Declare foreground service type for VpnService instance
Tobias Brunner [Tue, 30 Jul 2024 13:18:22 +0000 (15:18 +0200)] 
android: Declare foreground service type for VpnService instance

Required for Android 14 (34).  Since no other type fits we use specialUse,
which also requires a new permission and a description for why we use it.

9 months agoandroid: Fix label for name field in managed profiles
Tobias Brunner [Mon, 5 Aug 2024 12:39:17 +0000 (14:39 +0200)] 
android: Fix label for name field in managed profiles

The field is not actually optional.

9 months agoandroid: Fix crash when opening list of apps for new profiles
Tobias Brunner [Mon, 5 Aug 2024 09:16:39 +0000 (11:16 +0200)] 
android: Fix crash when opening list of apps for new profiles

Fixes: 150dc5ab6401 ("android: Make selected apps read-only")
9 months agoandroid: Update dependencies
Tobias Brunner [Tue, 16 Jul 2024 14:36:36 +0000 (16:36 +0200)] 
android: Update dependencies

9 months agoandroid: Update Gradle plugin
Tobias Brunner [Tue, 16 Jul 2024 08:59:06 +0000 (10:59 +0200)] 
android: Update Gradle plugin

9 months agoinit: Add `Wants=` dependencies to systemd units
Matteo Carnelos [Thu, 6 Jun 2024 13:54:11 +0000 (15:54 +0200)] 
init: Add `Wants=` dependencies to systemd units

If no other units have dependencies on network-online.target or
syslog.target they might not get initialized resulting in a possibly
non-ideal startup order.

Closes strongswan/strongswan#2279

9 months agoike-auth: Default IDi/IDr to subject DN instead of IP if a certificate is available
Tobias Brunner [Wed, 17 Jul 2024 13:31:51 +0000 (15:31 +0200)] 
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

9 months agoike-sa: Assign function pointers for mediation extension separately
Tobias Brunner [Fri, 26 Jul 2024 16:07:23 +0000 (18:07 +0200)] 
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.

9 months agoMerge branch 'vici-reload-actions'
Tobias Brunner [Tue, 30 Jul 2024 08:26:21 +0000 (10:26 +0200)] 
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

9 months agotesting: Add ikev2/start-action-start scenario
Tobias Brunner [Fri, 26 Jul 2024 14:56:32 +0000 (16:56 +0200)] 
testing: Add ikev2/start-action-start scenario

This tests the behavior for configs with start_action=start during
reloads of the config (updates/removal).

9 months agovici: Improve handling of start action when reloading configs
Tobias Brunner [Thu, 4 Jul 2024 14:17:43 +0000 (16:17 +0200)] 
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.

9 months agoike-sa-manager: Avoid initiating CHILD_SAs on IKE_SAs with queued DELETE
Tobias Brunner [Thu, 4 Jul 2024 12:43:37 +0000 (14:43 +0200)] 
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.

9 months agotesting: Enable IPv6 guest-to-guest communication
Tobias Brunner [Thu, 4 Jul 2024 16:23:03 +0000 (18:23 +0200)] 
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.

9 months agounit-tests: Fix compiler warning with empty message assertion
Tobias Brunner [Mon, 15 Jul 2024 14:55:29 +0000 (16:55 +0200)] 
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.

9 months agodaemon: Use correct argument order for calloc() to fix compiler warning
Tobias Brunner [Fri, 12 Jul 2024 12:00:15 +0000 (14:00 +0200)] 
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