]> git.ipfire.org Git - thirdparty/strongswan.git/log
thirdparty/strongswan.git
3 years agonm: Remove old libnm-glib compat stuff
Tobias Brunner [Wed, 20 Apr 2022 07:28:18 +0000 (09:28 +0200)] 
nm: Remove old libnm-glib compat stuff

This shouldn't be necessary anymore.

3 years agoadopt-children-job: Avoid reordering CHILD_SAs
Tobias Brunner [Mon, 9 May 2022 11:33:49 +0000 (13:33 +0200)] 
adopt-children-job: Avoid reordering CHILD_SAs

References strongswan/strongswan#1041

3 years agoquick-mode: Remove outbound SA/policy of rekeyed CHILD_SA
Xiao Liang [Sat, 7 May 2022 12:42:27 +0000 (20:42 +0800)] 
quick-mode: Remove outbound SA/policy of rekeyed CHILD_SA

Remove outbound SA and policy of rekeyed CHILD_SA since only one is valid.
Otherwise, during update-SA job (when NAT mapping changed), CHILD_SA are
updated and installed one by one, leaving a window where old SAs are being
used. There are also circumstances where the new SA is not processed last.

Closes strongswan/strongswan#1041

3 years agoproposal: Demote AES-XCBC/CMAC PRFs in default proposal
Tobias Brunner [Mon, 9 May 2022 09:49:50 +0000 (11:49 +0200)] 
proposal: Demote AES-XCBC/CMAC PRFs in default proposal

These are rarely used, so strictly propose HMAC-based PRFs first.

References strongswan/strongswan#1026
References strongswan/strongswan#1044

3 years agoconfigure: Auto-enable kdf plugin if necessary
Tobias Brunner [Fri, 6 May 2022 12:24:26 +0000 (14:24 +0200)] 
configure: Auto-enable kdf plugin if necessary

This ensures the plugin is available if AES-based PRFs could get used or
none of the third-party crypto plugins is enabled and it's required for
HMAC-based PRFs as well.

References strongswan/strongswan#1026

3 years agogithub: Update automatic labels in issue templates
Tobias Brunner [Fri, 6 May 2022 11:11:53 +0000 (13:11 +0200)] 
github: Update automatic labels in issue templates

3 years agoUse wolfSSL 5.3.0 for tests
Tobias Brunner [Thu, 5 May 2022 07:41:21 +0000 (09:41 +0200)] 
Use wolfSSL 5.3.0 for tests

3 years agoplugin-loader: Print an error message if plugin constructor is not found
Tobias Brunner [Thu, 5 May 2022 08:21:10 +0000 (10:21 +0200)] 
plugin-loader: Print an error message if plugin constructor is not found

3 years agokeymat_v2: Fix error message if KDF can't be created
Tobias Brunner [Fri, 6 May 2022 09:38:08 +0000 (11:38 +0200)] 
keymat_v2: Fix error message if KDF can't be created

Fixes: f619b833accf ("keymat_v2: Use plugin-provided KDF_PRF to derive SKEYSEED")
References strongswan/strongswan#1026

3 years agotesting: Fix 'unsafe repository' error when accessing Git repository
Tobias Brunner [Mon, 2 May 2022 08:51:25 +0000 (10:51 +0200)] 
testing: Fix 'unsafe repository' error when accessing Git repository

A recent security fix for Git added a fatal error if the directory that
contains the .git directory is not owned by the user that runs git in
that directory tree:

  Determine strongSwan version fatal: unsafe repository ('...' is owned by someone else)

To avoid this, we call the git commands as owner of the source
directory (the script has to run as root, so this is no problem).

The user/group ID and name is now also determined via `stat(1)` so it
directly depends on the actual source dir and should work even when not
using sudo.

3 years agoenum: Fix compiler warning
Tobias Brunner [Mon, 2 May 2022 07:31:49 +0000 (09:31 +0200)] 
enum: Fix compiler warning

Closes strongswan/strongswan#1025

3 years agoVersion bump to 5.9.6 5.9.6
Andreas Steffen [Thu, 28 Apr 2022 20:38:10 +0000 (22:38 +0200)] 
Version bump to 5.9.6

3 years agoUse mallinfo2() if available
Tobias Brunner [Mon, 25 Apr 2022 11:30:27 +0000 (13:30 +0200)] 
Use mallinfo2() if available

mallinfo() is deprecated because it uses `int` for the members of the
returned struct, whereas mallinfo2() uses `size_t`.  It's available
since glibc 2.33.

3 years agoNEWS: Add news for 5.9.6
Tobias Brunner [Fri, 22 Apr 2022 08:55:55 +0000 (10:55 +0200)] 
NEWS: Add news for 5.9.6

3 years agotls-crypto: Initialize cipher suites arrays to avoid warnings
Tobias Brunner [Thu, 21 Apr 2022 13:42:24 +0000 (15:42 +0200)] 
tls-crypto: Initialize cipher suites arrays to avoid warnings

3 years agogcrypt: Initialize variables when en-/decrypting with RSA to avoid warnings
Tobias Brunner [Thu, 21 Apr 2022 13:40:12 +0000 (15:40 +0200)] 
gcrypt: Initialize variables when en-/decrypting with RSA to avoid warnings

3 years agokdf: Fix Doxygen comments
Tobias Brunner [Thu, 21 Apr 2022 12:52:25 +0000 (14:52 +0200)] 
kdf: Fix Doxygen comments

3 years agoopenssl: Fix typo in comment
Tobias Brunner [Thu, 21 Apr 2022 09:06:30 +0000 (11:06 +0200)] 
openssl: Fix typo in comment

3 years agoikev2: Maintain labels during make-before-break reauthentication
Tobias Brunner [Wed, 20 Apr 2022 12:45:41 +0000 (14:45 +0200)] 
ikev2: Maintain labels during make-before-break reauthentication

3 years agogithub: Use run_number instead run_id as external-id for LGTM
Tobias Brunner [Tue, 19 Apr 2022 14:56:06 +0000 (16:56 +0200)] 
github: Use run_number instead run_id as external-id for LGTM

The external-id parameter takes an int32 and the generated run_id was
apparently not valid lately, resulting in undocumented 404 errors when
submitting patches (the API endpoint probably doesn't like negative numbers
because the last accepted id was 2059658094, rejected ids were e.g.
2167472705 or 2168792083).

3 years agoVersion bump to 5.9.6rc1 5.9.6rc1
Andreas Steffen [Sat, 16 Apr 2022 08:23:35 +0000 (10:23 +0200)] 
Version bump to 5.9.6rc1

3 years agoMerge branch 'openssl-3.0'
Tobias Brunner [Thu, 14 Apr 2022 17:06:12 +0000 (19:06 +0200)] 
Merge branch 'openssl-3.0'

This provides compatibility changes for OpenSSL 3.0.

3 years agogithub: Add a build against OpenSSL 3.0
Tobias Brunner [Fri, 4 Mar 2022 13:04:15 +0000 (14:04 +0100)] 
github: Add a build against OpenSSL 3.0

3 years agounit-tests: Add environment variable to skip IPv6 stream tests
Tobias Brunner [Wed, 16 Mar 2022 15:45:16 +0000 (16:45 +0100)] 
unit-tests: Add environment variable to skip IPv6 stream tests

This is an issue e.g. when running tests in default Docker containers.

3 years agounit-tests: Add support for more than one warning per test case
Tobias Brunner [Fri, 4 Mar 2022 14:16:12 +0000 (15:16 +0100)] 
unit-tests: Add support for more than one warning per test case

Warnings are usually short (as compared to failures that contain data
dumps), so the buffer size can be reduced.

3 years agoopenssl: Move ENGINE-specific code into a separate file
Tobias Brunner [Fri, 4 Mar 2022 10:26:52 +0000 (11:26 +0100)] 
openssl: Move ENGINE-specific code into a separate file

This way we can compile it with OPENSSL_SUPPRESS_DEPRECATED for
OpenSSL 3.0, which deprecated the ENGINE API.

3 years agoopenssl: Remove checks and legacy compatibility code for OpenSSL < 1.0.2
Tobias Brunner [Fri, 4 Mar 2022 09:57:20 +0000 (10:57 +0100)] 
openssl: Remove checks and legacy compatibility code for OpenSSL < 1.0.2

More of this code was already removed with previous commits.

While versions < 1.1.1 are not officially supported anymore, 1.0.2 might
still be in use because before 3.x that was the latest version with
official FIPS support (OpenSSL apparently also provides extended commercial
support for it).

3 years agoopenssl: Fixes for HMAC with OpenSSL 3.0
Tobias Brunner [Fri, 4 Mar 2022 09:49:04 +0000 (10:49 +0100)] 
openssl: Fixes for HMAC with OpenSSL 3.0

3 years agoopenssl: Fixes for ECDSA with OpenSSL 3.0
Tobias Brunner [Thu, 3 Mar 2022 13:19:03 +0000 (14:19 +0100)] 
openssl: Fixes for ECDSA with OpenSSL 3.0

3 years agoconfigure: Move pkcs8 plugin after plugins that can parse PKCS#8 directly
Tobias Brunner [Thu, 14 Apr 2022 09:57:30 +0000 (11:57 +0200)] 
configure: Move pkcs8 plugin after plugins that can parse PKCS#8 directly

With such plugins we only need the pkcs8 plugin to load encrypted files.

3 years agopkcs8: Parse the decrypted PKCS#8 structure via regular builders
Tobias Brunner [Fri, 4 Mar 2022 07:21:42 +0000 (08:21 +0100)] 
pkcs8: Parse the decrypted PKCS#8 structure via regular builders

This allows other plugins to parse such structures directly.  The pkcs8
plugin is called recursively again if necessary.

3 years agoopenssl: Fixes for RSA with OpenSSL 3.0
Tobias Brunner [Mon, 28 Feb 2022 13:28:18 +0000 (14:28 +0100)] 
openssl: Fixes for RSA with OpenSSL 3.0

3 years agoopenssl: Fixes for DH with OpenSSL 3.0
Tobias Brunner [Fri, 25 Feb 2022 16:05:24 +0000 (17:05 +0100)] 
openssl: Fixes for DH with OpenSSL 3.0

While we could assign the DH object to a EVP_PKEY object, this won't work
with BoringSSL as it doesn't seem to support EVP_PKEY_derive() for DH.

3 years agoopenssl: Fixes for ECDH with OpenSSL 3.0
Tobias Brunner [Thu, 24 Feb 2022 16:29:09 +0000 (17:29 +0100)] 
openssl: Fixes for ECDH with OpenSSL 3.0

Uses new and non-deprecated APIs to create/generate key pairs.

3 years agoopenssl: PRF_KEYED_SHA1 might not be supported
Tobias Brunner [Thu, 24 Feb 2022 13:50:25 +0000 (14:50 +0100)] 
openssl: PRF_KEYED_SHA1 might not be supported

The old API has been deprecated with OpenSSL 3 and direct access to the
state isn't possible via EVP API.  In the future we might just remove this
implementation but we'd probably have to implement EAP-AKA' first, which
uses HMAC-SHA-256 with IKEv2's prf+ construct to derive keys instead
of this weird construct (plus what fips-prf builds around it) that's used
by EAP-AKA.

3 years agoleak-detective: Whitelist OpenSSL 3.0 functions
Tobias Brunner [Wed, 23 Feb 2022 16:39:39 +0000 (17:39 +0100)] 
leak-detective: Whitelist OpenSSL 3.0 functions

3 years agoopenssl: Move shared secret calculation to get_shared_secret()
Tobias Brunner [Fri, 23 Jul 2021 14:44:07 +0000 (16:44 +0200)] 
openssl: Move shared secret calculation to get_shared_secret()

This is a change from the multi-KE branch.

3 years agoMerge branch 'ikev2-kdf-modularization'
Tobias Brunner [Thu, 14 Apr 2022 17:03:03 +0000 (19:03 +0200)] 
Merge branch 'ikev2-kdf-modularization'

This modularizes the IKEv2 key derivation, which makes certification (e.g.
FIPS) easier because it allows the two steps (PRF/prf+) to be implemented
by already certified third-party libraries.

For the existing third-party libraries, the two KDFs are implemented via
the respective library's HKDF implementation.  A generic implementation,
based on existing PRFs, is provided by the new kdf plugin.

3 years agokeymat_v2: Use plugin-provided KDF_PRF to derive SKEYSEED
Tobias Brunner [Tue, 15 Mar 2022 08:49:43 +0000 (09:49 +0100)] 
keymat_v2: Use plugin-provided KDF_PRF to derive SKEYSEED

3 years agounit-tests: Hand out an actual shared secret and pubkey in mock KE implementation
Tobias Brunner [Tue, 15 Mar 2022 10:59:53 +0000 (11:59 +0100)] 
unit-tests: Hand out an actual shared secret and pubkey in mock KE implementation

Makes this a bit more realistic and makes key derivation via OpenSSL's
HKDF work during tests.

3 years agowolfssl: Implement HMAC-based IKEv2 PRFs via wolfSSL's HKDF implementation
Tobias Brunner [Tue, 15 Mar 2022 08:41:11 +0000 (09:41 +0100)] 
wolfssl: Implement HMAC-based IKEv2 PRFs via wolfSSL's HKDF implementation

3 years agobotan: Implement HMAC-based IKEv2 PRFs via Botan's HKDF implementation
Tobias Brunner [Tue, 15 Mar 2022 08:34:10 +0000 (09:34 +0100)] 
botan: Implement HMAC-based IKEv2 PRFs via Botan's HKDF implementation

3 years agoopenssl: Implement HMAC-based IKEv2 PRFs via OpenSSL's HKDF implementation
Tobias Brunner [Mon, 14 Mar 2022 17:17:11 +0000 (18:17 +0100)] 
openssl: Implement HMAC-based IKEv2 PRFs via OpenSSL's HKDF implementation

3 years agokdf: Implement wrapper for IKEv2 PRFs
Tobias Brunner [Mon, 14 Mar 2022 16:16:17 +0000 (17:16 +0100)] 
kdf: Implement wrapper for IKEv2 PRFs

3 years agotest-vectors: Add vectors for HMAC-based IKEv2 PRFs
Tobias Brunner [Mon, 14 Mar 2022 16:08:39 +0000 (17:08 +0100)] 
test-vectors: Add vectors for HMAC-based IKEv2 PRFs

3 years agocrypto: Add new KDF type for IKEv2 PRFs
Tobias Brunner [Mon, 14 Mar 2022 15:56:32 +0000 (16:56 +0100)] 
crypto: Add new KDF type for IKEv2 PRFs

3 years agocrypto: Adapt kdf_t interface to support KDFs with fixed output length
Tobias Brunner [Mon, 14 Mar 2022 15:54:13 +0000 (16:54 +0100)] 
crypto: Adapt kdf_t interface to support KDFs with fixed output length

3 years agowolfssl: Implement prf+ via wolfSSL's HKDF implementation
Tobias Brunner [Wed, 16 Feb 2022 15:42:55 +0000 (16:42 +0100)] 
wolfssl: Implement prf+ via wolfSSL's HKDF implementation

3 years agobotan: Implement prf+ via Botan's HKDF implementation
Tobias Brunner [Wed, 16 Feb 2022 15:23:38 +0000 (16:23 +0100)] 
botan: Implement prf+ via Botan's HKDF implementation

3 years agocrypto: Remove unused prf_plus_t
Tobias Brunner [Tue, 15 Feb 2022 13:20:07 +0000 (14:20 +0100)] 
crypto: Remove unused prf_plus_t

3 years agokdf: Implement prf+ directly without relying on prf_plus_t
Tobias Brunner [Tue, 15 Feb 2022 13:18:14 +0000 (14:18 +0100)] 
kdf: Implement prf+ directly without relying on prf_plus_t

3 years agokeymat_v1: Derive CHILD_SA keys without using prf_plus_t
Tobias Brunner [Tue, 15 Feb 2022 09:13:53 +0000 (10:13 +0100)] 
keymat_v1: Derive CHILD_SA keys without using prf_plus_t

We already expand skeyid_e in a similar fashion so do this analogous
without relying on prf_plus_t.

3 years agounit-tests: Use plugin-provided prf+ in unit test
Tobias Brunner [Tue, 15 Feb 2022 12:43:58 +0000 (13:43 +0100)] 
unit-tests: Use plugin-provided prf+ in unit test

This tests the params API and the counter overflow.

3 years agotls-hkdf: Use plugin-provided prf+
Tobias Brunner [Mon, 14 Feb 2022 16:09:15 +0000 (17:09 +0100)] 
tls-hkdf: Use plugin-provided prf+

3 years agokeymat_v2: Use plugin-provided prf+ to derive keys
Tobias Brunner [Mon, 14 Feb 2022 15:19:42 +0000 (16:19 +0100)] 
keymat_v2: Use plugin-provided prf+ to derive keys

3 years agoappveyor: Enable kdf plugin on old images with OpenSSL 1.0.2/1.1.0
Tobias Brunner [Thu, 17 Feb 2022 09:15:22 +0000 (10:15 +0100)] 
appveyor: Enable kdf plugin on old images with OpenSSL 1.0.2/1.1.0

HKDF with expand-only mode is only available since OpenSSL 1.1.1.

3 years agoandroid: Build and load kdf plugin for prf+
Tobias Brunner [Tue, 15 Feb 2022 13:29:36 +0000 (14:29 +0100)] 
android: Build and load kdf plugin for prf+

Not necessary with newer versions of OpenSSL, but our BoringSSL release
does not support HKDF yet.

3 years agotesting: Load kdf plugin in all scenarios that require it
Tobias Brunner [Mon, 14 Feb 2022 15:25:32 +0000 (16:25 +0100)] 
testing: Load kdf plugin in all scenarios that require it

Once we use plugin-provided prf+() these won't work otherwise.

3 years agokeymat_v2: Refactor CHILD_SA key derivation so it only needs one prf+ call
Tobias Brunner [Mon, 14 Feb 2022 14:48:17 +0000 (15:48 +0100)] 
keymat_v2: Refactor CHILD_SA key derivation so it only needs one prf+ call

3 years agokeymat_v2: Refactor IKE key derivation so it only needs one prf+ call
Tobias Brunner [Mon, 14 Feb 2022 14:19:20 +0000 (15:19 +0100)] 
keymat_v2: Refactor IKE key derivation so it only needs one prf+ call

3 years agoopenssl: Add a prf+ implementation based on OpenSSL's HKDF implementation
Tobias Brunner [Fri, 11 Feb 2022 15:38:34 +0000 (16:38 +0100)] 
openssl: Add a prf+ implementation based on OpenSSL's HKDF implementation

The HKDF-Expand() function defined in RFC 5869 is basically the same as
IKEv2's prf+(), so we can use the former to implement the latter.
However, we can only support HMAC-based PRFs this way, which should be
fine as others are rarely used.

3 years agokdf: Add plugin that provides a default prf+ implementation
Tobias Brunner [Fri, 11 Feb 2022 13:49:49 +0000 (14:49 +0100)] 
kdf: Add plugin that provides a default prf+ implementation

3 years agotest-vectors: Add test vectors for prf+
Tobias Brunner [Fri, 11 Feb 2022 12:58:12 +0000 (13:58 +0100)] 
test-vectors: Add test vectors for prf+

3 years agoplugin-feature: Add plugin feature for KDFs
Tobias Brunner [Fri, 11 Feb 2022 10:57:34 +0000 (11:57 +0100)] 
plugin-feature: Add plugin feature for KDFs

3 years agoplugin-feature: Remove 'default' case in plugin_feature_un|load()
Tobias Brunner [Fri, 11 Feb 2022 10:55:36 +0000 (11:55 +0100)] 
plugin-feature: Remove 'default' case in plugin_feature_un|load()

3 years agotest-vectors: Add support for KDF test vectors
Tobias Brunner [Fri, 11 Feb 2022 11:03:38 +0000 (12:03 +0100)] 
test-vectors: Add support for KDF test vectors

3 years agocrypto-factory: Use actual plugin name when testing during construction
Tobias Brunner [Wed, 16 Feb 2022 16:24:17 +0000 (17:24 +0100)] 
crypto-factory: Use actual plugin name when testing during construction

3 years agocrypto-tester: Add facility to test KDFs
Tobias Brunner [Thu, 10 Feb 2022 17:30:50 +0000 (18:30 +0100)] 
crypto-tester: Add facility to test KDFs

3 years agovici: Report registered KDFs
Tobias Brunner [Wed, 9 Feb 2022 15:20:00 +0000 (16:20 +0100)] 
vici: Report registered KDFs

3 years agostroke: List registered KDFs
Tobias Brunner [Wed, 9 Feb 2022 15:18:30 +0000 (16:18 +0100)] 
stroke: List registered KDFs

3 years agocrypto-factory: Add constructor and methods to create KDFs
Tobias Brunner [Wed, 9 Feb 2022 15:16:20 +0000 (16:16 +0100)] 
crypto-factory: Add constructor and methods to create KDFs

Using some arguments directly in the constructor will allow us to fall
back on other implementations.

3 years agopkcs5: Rename kdf_t to avoid conflict
Tobias Brunner [Wed, 9 Feb 2022 15:08:30 +0000 (16:08 +0100)] 
pkcs5: Rename kdf_t to avoid conflict

3 years agotransform: Add private transform for KDFs
Tobias Brunner [Wed, 9 Feb 2022 14:54:47 +0000 (15:54 +0100)] 
transform: Add private transform for KDFs

3 years agocrypto: Add interface for key derivation functions
Tobias Brunner [Wed, 9 Feb 2022 10:54:28 +0000 (11:54 +0100)] 
crypto: Add interface for key derivation functions

3 years agoMerge branch 'labeled-ipsec'
Tobias Brunner [Thu, 14 Apr 2022 16:43:16 +0000 (18:43 +0200)] 
Merge branch 'labeled-ipsec'

This adds support for labeled IPsec with SELinux (and a proprietary mode
that can be used to match child configs).  For SELinux support, compile
with --enable-selinux.

Other changes include a combined start action (trap|start), avoiding
initiating duplicate CHILD_SAs, updating reqids if dynamic traffic
selectors change, removing reqid errors on policy updates, or querying
specific CHILD_SAs with vici's list-sas command.

Closes #3075

3 years agotesting: Add DSCP scenario that uses simple labels
Tobias Brunner [Thu, 14 Apr 2022 12:13:07 +0000 (14:13 +0200)] 
testing: Add DSCP scenario that uses simple labels

Instead of creating two IKE_SAs with different identities, this scenario
uses simple labels to select the correct child config.

3 years agoswanctl: Add options to filter CHILD_SAs in --list-sas
Tobias Brunner [Wed, 2 Jun 2021 12:46:03 +0000 (14:46 +0200)] 
swanctl: Add options to filter CHILD_SAs in --list-sas

3 years agovici: Add options to only return specific CHILD_SAs in list-sas()
Tobias Brunner [Wed, 2 Jun 2021 12:37:39 +0000 (14:37 +0200)] 
vici: Add options to only return specific CHILD_SAs in list-sas()

3 years agotesting: Copy comments to test log
Tobias Brunner [Wed, 2 Jun 2021 12:29:55 +0000 (14:29 +0200)] 
testing: Copy comments to test log

3 years agoswanctl: Report labels in --list-* commands
Tobias Brunner [Tue, 21 Dec 2021 11:18:21 +0000 (12:18 +0100)] 
swanctl: Report labels in --list-* commands

3 years agovici: Report security label on CHILD_SA, policies and configs
Tobias Brunner [Tue, 21 Dec 2021 11:10:34 +0000 (12:10 +0100)] 
vici: Report security label on CHILD_SA, policies and configs

3 years agovici: Make security labels and mode configurable
Tobias Brunner [Tue, 21 Dec 2021 10:56:32 +0000 (11:56 +0100)] 
vici: Make security labels and mode configurable

3 years agokernel-netlink: Forward labels from acquires
Tobias Brunner [Tue, 21 Dec 2021 10:33:06 +0000 (11:33 +0100)] 
kernel-netlink: Forward labels from acquires

3 years agotrap-manager: Add support to handle acquires with security labels
Tobias Brunner [Tue, 21 Dec 2021 10:26:50 +0000 (11:26 +0100)] 
trap-manager: Add support to handle acquires with security labels

3 years agokernel-handler: Log security label received with acquire
Tobias Brunner [Tue, 21 Dec 2021 10:26:12 +0000 (11:26 +0100)] 
kernel-handler: Log security label received with acquire

3 years agokernel-interface: Optionally pass security label with an acquire
Tobias Brunner [Tue, 21 Dec 2021 10:22:36 +0000 (11:22 +0100)] 
kernel-interface: Optionally pass security label with an acquire

3 years agoike-sa: Accept optional security label when initiating CHILD_SAs
Tobias Brunner [Mon, 20 Dec 2021 15:16:00 +0000 (16:16 +0100)] 
ike-sa: Accept optional security label when initiating CHILD_SAs

3 years agochild-rekey: Maintain security label during rekeying
Tobias Brunner [Mon, 20 Dec 2021 15:10:19 +0000 (16:10 +0100)] 
child-rekey: Maintain security label during rekeying

3 years agoselinux: Add plugin to install trap policies with generic labels
Tobias Brunner [Wed, 2 Feb 2022 14:51:06 +0000 (15:51 +0100)] 
selinux: Add plugin to install trap policies with generic labels

After establishing an IKE_SA, we check if any of its child configs
define generic SELinux labels and install trap policies for them if
necessary narrowed to the current (virtual) IPs.

3 years agoike-sa: Add helper to determine an IKE_SA's dynamic hosts
Tobias Brunner [Wed, 2 Feb 2022 14:45:57 +0000 (15:45 +0100)] 
ike-sa: Add helper to determine an IKE_SA's dynamic hosts

3 years agotrap-manager: Add facility to install externally managed trap policies
Tobias Brunner [Tue, 1 Feb 2022 19:17:50 +0000 (20:17 +0100)] 
trap-manager: Add facility to install externally managed trap policies

This allows managing trap policies outside of the trap manager.

We'll use this to create trap policies with generic labels if trap policies
can't (or won't) be used (e.g. as responder for roadwarriors).

3 years agochild-sa: Allocate a new reqid if dynamic traffic selectors are updated
Tobias Brunner [Thu, 3 Feb 2022 16:10:46 +0000 (17:10 +0100)] 
child-sa: Allocate a new reqid if dynamic traffic selectors are updated

If update_sa() is called and dynamic traffic selectors are changed using
new addresses, this might cause issues if we continue to use a reqid that
doesn't match the updated traffic selectors.  For instance, if the initiator
then uses make-before-break reauth from the new IP.  It's also a particular
problem in the SELinux case where multiple CHILD_SAs with specific labels
all share the same (trap) policy with generic label.  However, SAs created
after the update would not match due to the new reqid.

3 years agokernel-netlink: Allow reqid updates for policies again
Tobias Brunner [Fri, 4 Feb 2022 08:37:37 +0000 (09:37 +0100)] 
kernel-netlink: Allow reqid updates for policies again

This was originally added with 1551d8b13d14 ("kernel-netlink: reject
policy refcount if the reqid differs").  Since then we added code to
allocate constant reqids for the same TS, which pretty much avoids the
previous issues.

However, the reqid might have to be changed due to MOBIKE updates. And
because reqids are allocated for a complete set of traffic selectors and
not individual pairs, this can create a problem with drop policies as
those will use the old reqid (they are installed with the same priority,
reqid etc. to replace the actual IPsec policies), while unmodified
replacement policies will use the new one.  A similar issue exists for
CHILD_SAs with SELinux contexts as those all use duplicate policies (same
generic label) but can't all be updated concurrently.

3 years agokernel-interface: Add support to change the reqid in update_sa()
Tobias Brunner [Thu, 3 Feb 2022 16:10:12 +0000 (17:10 +0100)] 
kernel-interface: Add support to change the reqid in update_sa()

3 years agokernel-wfp: Use new UDP ports in update_sa()
Tobias Brunner [Thu, 3 Feb 2022 16:08:58 +0000 (17:08 +0100)] 
kernel-wfp: Use new UDP ports in update_sa()

3 years agochild-sa: Support dynamically updating trap policies
Tobias Brunner [Thu, 3 Feb 2022 13:46:59 +0000 (14:46 +0100)] 
child-sa: Support dynamically updating trap policies

3 years agochild-create: Add support to handle security labels
Tobias Brunner [Wed, 2 Feb 2022 09:40:16 +0000 (10:40 +0100)] 
child-create: Add support to handle security labels

With SELinux and without a specific label from an acquire, we abort
establishing the CHILD_SA (for the first one we prefer a childless IKE_SA,
but since that's a separate extension, we fall back to letting the initial
CHILD_SA fail as we won't propose a label).

If trap policies are not installed already (e.g. because it's impossible to
do so like as responder for roadwarriors), this will require installing
them dynamically once the IKE_SA is established.

3 years agochild-create: Consider security label when comparing CHILD_SAs
Tobias Brunner [Mon, 20 Dec 2021 14:58:46 +0000 (15:58 +0100)] 
child-create: Consider security label when comparing CHILD_SAs

3 years agochild-sa: Add support for security labels
Tobias Brunner [Mon, 20 Dec 2021 14:28:07 +0000 (15:28 +0100)] 
child-sa: Add support for security labels

In SELinux mode we install the configured label on the policies and the
negotiated one on the SAs.  This is how it usually is configured where the
policy/configuration has a generic context and the SAs will get the actual
context of the flows assigned (the latter matches the former, so flows
match the policies but will trigger an acquire if no matching SA exists).

In the simple mode we don't pass the label to the kernel and to avoid
duplicate policy errors we also don't use it to acquire unique reqids.

3 years agokernel-interface: Optionally consider security label when allocating reqids
Tobias Brunner [Mon, 20 Dec 2021 14:11:37 +0000 (15:11 +0100)] 
kernel-interface: Optionally consider security label when allocating reqids