]> git.ipfire.org Git - thirdparty/strongswan.git/log
thirdparty/strongswan.git
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

3 years agopeer-cfg: Consider security labels when selecting child configs
Tobias Brunner [Mon, 10 Jan 2022 17:31:34 +0000 (18:31 +0100)] 
peer-cfg: Consider security labels when selecting child configs

3 years agochild-cfg: Add method to select a security label
Tobias Brunner [Tue, 11 Jan 2022 09:15:53 +0000 (10:15 +0100)] 
child-cfg: Add method to select a security label

3 years agochild-cfg: Add optional security label and mode
Tobias Brunner [Mon, 20 Dec 2021 12:49:56 +0000 (13:49 +0100)] 
child-cfg: Add optional security label and mode

3 years agokernel-netlink: Add support for optional security label on SAs and policies
Tobias Brunner [Mon, 20 Dec 2021 14:02:42 +0000 (15:02 +0100)] 
kernel-netlink: Add support for optional security label on SAs and policies

3 years agoencoding: Remove unused TS_TYPE and ADDRESS encodings
Tobias Brunner [Thu, 13 Jan 2022 13:26:06 +0000 (14:26 +0100)] 
encoding: Remove unused TS_TYPE and ADDRESS encodings

3 years agots-payload: Add support for TS of type TS_SECLABEL
Tobias Brunner [Mon, 10 Jan 2022 16:39:56 +0000 (17:39 +0100)] 
ts-payload: Add support for TS of type TS_SECLABEL

The security labels can be retrieved in a separate list from the
regular traffic selectors.  We currently only plan to support a single
security label ourselves, so when generating we don't expect a list.

3 years agotraffic-selector-substructure: Add support for TS_SECLABEL
Tobias Brunner [Mon, 10 Jan 2022 16:34:22 +0000 (17:34 +0100)] 
traffic-selector-substructure: Add support for TS_SECLABEL

Changes how regular address range traffic selectors are parsed as the
IKE parser currently doesn't provide sub-type parsing.

Also removed a lot of unused method definitions.

3 years agotraffic-selector: Add TS_SECLABEL type
Tobias Brunner [Mon, 10 Jan 2022 15:35:38 +0000 (16:35 +0100)] 
traffic-selector: Add TS_SECLABEL type

3 years agoleak-detective: Whitelist selinux_check_access()
Tobias Brunner [Fri, 4 Feb 2022 07:17:54 +0000 (08:17 +0100)] 
leak-detective: Whitelist selinux_check_access()

3 years agosec-label: Add enum for security label mode
Tobias Brunner [Thu, 27 Jan 2022 13:49:39 +0000 (14:49 +0100)] 
sec-label: Add enum for security label mode

3 years agosec-label: Add class to represent security labels
Tobias Brunner [Mon, 20 Dec 2021 10:23:37 +0000 (11:23 +0100)] 
sec-label: Add class to represent security labels

In accordance with SELinux, we include the null-terminator in the encoding
for now.

3 years agoconfigure: Add option to link against libselinux
Tobias Brunner [Fri, 17 Dec 2021 16:13:27 +0000 (17:13 +0100)] 
configure: Add option to link against libselinux

3 years agovici: Make combination of 'trap' and 'start' configurable
Tobias Brunner [Thu, 16 Dec 2021 15:51:04 +0000 (16:51 +0100)] 
vici: Make combination of 'trap' and 'start' configurable

3 years agoenum: Add helper to parse enum flags from strings
Tobias Brunner [Fri, 17 Dec 2021 14:19:02 +0000 (15:19 +0100)] 
enum: Add helper to parse enum flags from strings

Individual flag names are separated by |.

3 years agoike: Treat action_t as flags so 'start' and 'trap' can be combined
Tobias Brunner [Thu, 16 Dec 2021 15:34:37 +0000 (16:34 +0100)] 
ike: Treat action_t as flags so 'start' and 'trap' can be combined

While combining the actions could cause duplicates (while the SA is
initiated, traffic might trigger the trap and the initiation of another
CHILD_SA), the previous commit should avoid most duplicates.  If reuse_ikesa
is disabled, duplicates can't be prevented, though.

3 years agoenum: Allow specifying the name used when none of the flags are set
Tobias Brunner [Fri, 17 Dec 2021 13:25:44 +0000 (14:25 +0100)] 
enum: Allow specifying the name used when none of the flags are set

3 years agochild-create: Abort initiating a duplicate CHILD_SA
Tobias Brunner [Thu, 20 May 2021 16:11:58 +0000 (18:11 +0200)] 
child-create: Abort initiating a duplicate CHILD_SA

This could happen if an acquire is triggered while we respond to a
CREATE_CHILD_SA request from the peer, or if an acquire is triggered
while an IKE_SA (with its existing CHILD_SAs) is reestablished (also
with break-before-make reauthentication).  Also catches multiple
manual initiations.

Note that this ignores the traffic selectors from acquires (narrowing to
them seems rare in practice anyway).

Duplicates can still get created if e.g. both peers initiate them
concurrently.

3 years agochild-create: Just abort CREATE_CHILD_SA request if nonce creation fails
Tobias Brunner [Thu, 20 May 2021 15:55:54 +0000 (17:55 +0200)] 
child-create: Just abort CREATE_CHILD_SA request if nonce creation fails

No need to send an illegal request with just an error notify.

3 years agokernel-listener: Use a struct to pass data from acquires
Tobias Brunner [Thu, 16 Dec 2021 12:50:38 +0000 (13:50 +0100)] 
kernel-listener: Use a struct to pass data from acquires

3 years agokernel-netlink: Read protocol of acquire not from template
Tobias Brunner [Fri, 28 May 2021 11:36:04 +0000 (13:36 +0200)] 
kernel-netlink: Read protocol of acquire not from template

If a policy with IPComp template triggers an acquire, we get two, one for
an IPComp, one for ESP/AH SA.  However, the triggering template of the trap
policy (where we get the reqid from), will be the same in both acquires,
IPComp, which we ignore, so no acquire was actually forwarded.

3 years agoike-sa: Use a struct to pass optional arguments when initiating CHILD_SAs
Tobias Brunner [Wed, 19 May 2021 12:16:20 +0000 (14:16 +0200)] 
ike-sa: Use a struct to pass optional arguments when initiating CHILD_SAs

3 years agoike: Don't reset optional CHILD_SA properties when migrating child-creating tasks
Tobias Brunner [Thu, 20 May 2021 09:43:39 +0000 (11:43 +0200)] 
ike: Don't reset optional CHILD_SA properties when migrating child-creating tasks

These are set via methods, which are not called again after migration
(e.g. when retrying due to INVALID_KE or when moving queued tasks), so we
don't want to clear these values.

3 years agocirrus: Use FreeBSD 12.3
Tobias Brunner [Thu, 14 Apr 2022 16:38:43 +0000 (18:38 +0200)] 
cirrus: Use FreeBSD 12.3

This should fix this error thrown by autoreconf:

ld-elf.so.1: /usr/local/lib/perl5/5.32/mach/CORE/libperl.so.5.32: Undefined symbol "strerror_l@FBSD_1.6"

3 years agoike: Track unprocessed initial IKE messages like half-open IKE_SAs
Tobias Brunner [Fri, 4 Jun 2021 16:11:46 +0000 (18:11 +0200)] 
ike: Track unprocessed initial IKE messages like half-open IKE_SAs

This should make the DoS limits (cookie_threshold[_ip] and block_threshold)
more accurate so that it won't be possible to create lots of jobs from
spoofed IP addresses before half-open IKE_SAs are actually created from
these jobs to enforce those limits.

Note that retransmits are tracked as half-open SAs until they are
processed/dismissed as the check only happens in checkout_by_message().

Increasing the count in process_message_job_create() avoids issues with
missing calls to track_init() before calling checkout_by_message() (e.g.
when processing fragmented IKEv1 messages, which are reinjected via a
process message job).

3 years agoreceiver: Add per-IP cookie threshold
Tobias Brunner [Fri, 18 Mar 2022 14:13:06 +0000 (15:13 +0100)] 
receiver: Add per-IP cookie threshold

Because the global cookie threshold is higher than the per-IP block
threshold, it was previously possible for an attacker to block a legitimate
user by sending spoofed IKE_SA_INIT packets from that user's IP.

The timespan for requiring cookies is now also not extended anymore with
every IKE_SA_INIT received during the calm down period.  Because this
allowed an attacker, after initially triggering the global cookie threshold,
to force cookies for all clients by sending just a single spoofed
IKE_SA_INIT every 10 seconds.

We keep track of reaching the per-IP threshold in segments of the hashed
IP addresses, so only a (random, due to chunk_hash()'s random key) subset
of clients will receive cookies, if single IPs are targeted.

The default global threshold is increased a bit.

3 years agoreceiver: Use a time based limit to switch COOKIE secrets
Tobias Brunner [Fri, 4 Jun 2021 11:41:31 +0000 (13:41 +0200)] 
receiver: Use a time based limit to switch COOKIE secrets

If we are under attack and there are lots of requests, we might hit
the previous use count limit pretty quickly and may switch secrets multiple
times a second, which renders the 10 second default lifetime of COOKIEs
pointless and prevents legitimate clients from sending requests with valid
COOKIEs.

3 years agolgtm: Fix query for chunk_from_chars()
Tobias Brunner [Thu, 14 Apr 2022 13:16:38 +0000 (15:16 +0200)] 
lgtm: Fix query for chunk_from_chars()

`Block` has apparently been deprecated and renamed to `BlockStmt` a while
ago.  Support for `Block` was recently removed completely.

3 years agotraffic-selector: Avoid out-of-bound array access when calculating range
Tobias Brunner [Wed, 16 Mar 2022 10:45:49 +0000 (11:45 +0100)] 
traffic-selector: Avoid out-of-bound array access when calculating range

This happens for `/0` subnet masks.  In practice, it's not an issue because
if `bytes` is 0, then so are `netbits`, `bits` and `mask`.  So the two
incorrectly addressed array elements are not actually modified.  The first
operation is a `&= 0xff` and the second a `|= 0`, so nothing changes.
But some tools might not consider the values and report this as undefined
behavior, which it technically is.

3 years agoMerge branch 'pfkey-exclude-routes'
Tobias Brunner [Tue, 15 Mar 2022 13:04:19 +0000 (14:04 +0100)] 
Merge branch 'pfkey-exclude-routes'

Avoid unnecessary exclude routes on FreeBSD where these can cause problems.

Closes strongswan/strongswan#890

3 years agokernel-pfkey: Don't install exclude routes for locally connected peers
Tobias Brunner [Wed, 16 Feb 2022 13:47:40 +0000 (14:47 +0100)] 
kernel-pfkey: Don't install exclude routes for locally connected peers

Such routes with a gateway that equals the peer's address are problematic
on FreeBSD.  And since there is most likely a narrow route for the local
subnet anyway, the exclude routes would be redundant.

3 years agokernel-pfkey: Only install exclude route if not routing via outbound interface
Tobias Brunner [Fri, 11 Feb 2022 16:23:15 +0000 (17:23 +0100)] 
kernel-pfkey: Only install exclude route if not routing via outbound interface

When installing routes based on remote traffic selectors, it can be
necessary to install an exclude route for the remote peer to avoid a
routing loop and continue to be able to reach it via IKE/ESP.

However, such routes are only necessary, if the routes we install don't
go via outbound interface.  That's the case when using VIPs and routing
via TUN devices, or when using internal source IPs and routing via
their interfaces.

Installing such exclude routes if not necessary can cause issues on
FreeBSD (EINVAL when sending packets to the peer).

3 years agokernel-netlink: Remove unimplemented XFRM_OFFLOAD_IPV6 flag
Leon Romanovsky [Mon, 21 Feb 2022 13:35:30 +0000 (15:35 +0200)] 
kernel-netlink: Remove unimplemented XFRM_OFFLOAD_IPV6 flag

The XFRM_OFFLOAD_IPV6 flag was never implemented in the kernel and there
are no plans to do so.

Kernel patch: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7c76ecd9c99b6e9a771d813ab1aa7fa428b3ade1

Closes strongswan/strongswan#916

3 years agoREADME: Added link to docs.strongswan.org
Andreas Steffen [Wed, 2 Mar 2022 20:55:43 +0000 (21:55 +0100)] 
README: Added link to docs.strongswan.org

3 years agotesting: Increase memory on winnetou even more
Tobias Brunner [Tue, 1 Mar 2022 09:10:37 +0000 (10:10 +0100)] 
testing: Increase memory on winnetou even more

3 years agotls-server: Use correct error alerts if client doesn't send a certificate
Tobias Brunner [Tue, 1 Mar 2022 09:05:26 +0000 (10:05 +0100)] 
tls-server: Use correct error alerts if client doesn't send a certificate

TLS 1.3 defines a specific alert for this and for TLS 1.2, RFC 5246,
section 7.4.6 defines handshake_failure as correct response.

3 years agoopenssl: Don't unload providers
Tobias Brunner [Wed, 23 Feb 2022 16:29:02 +0000 (17:29 +0100)] 
openssl: Don't unload providers

There is a conflict between atexit() handlers registered by OpenSSL and
some executables (e.g. swanctl or pki) to deinitialize libstrongswan.
Because plugins are usually loaded after atexit() has been called, the
handler registered by OpenSSL will run before our handler.  So when the
latter destroys the plugins it's a bad idea to try to access any OpenSSL
objects as they might already be invalid.

Fixes: f556fce16b60 ("openssl: Load "legacy" provider in OpenSSL 3 for algorithms like MD4, DES etc.")
Closes strongswan/strongswan#921

3 years agoUse wolfSSL 5.2.0 for tests
Tobias Brunner [Tue, 22 Feb 2022 08:35:01 +0000 (09:35 +0100)] 
Use wolfSSL 5.2.0 for tests

3 years agomgf1: Fix Doxygen group for XOF implementation
Tobias Brunner [Fri, 11 Feb 2022 13:19:35 +0000 (14:19 +0100)] 
mgf1: Fix Doxygen group for XOF implementation

3 years agoxof: Fix typo in documentation for set_seed()
Tobias Brunner [Wed, 9 Feb 2022 10:36:43 +0000 (11:36 +0100)] 
xof: Fix typo in documentation for set_seed()

3 years agotls-peer: Simplify identity check for server certificate
Tobias Brunner [Fri, 4 Feb 2022 10:16:14 +0000 (11:16 +0100)] 
tls-peer: Simplify identity check for server certificate

has_subject() already matches the identity against the subject DN and
all the SANs (it actually already did when this check was added with
c81147998619 ("Strictly check if the server certificate matches the TLS
server identity")).

3 years agotls-test: Add option to specify a specific remote identity
Tobias Brunner [Wed, 2 Feb 2022 17:54:41 +0000 (18:54 +0100)] 
tls-test: Add option to specify a specific remote identity

3 years agolibtls: Enforce client/server identity when looking for public key
Tobias Brunner [Wed, 2 Feb 2022 17:39:20 +0000 (18:39 +0100)] 
libtls: Enforce client/server identity when looking for public key

The client already enforces that the server identity is contained in the
received certificate.  But on the server, the referenced commit changed
the lookup from the configured (or adopted if %any was configured) client
identity to the subject DN of the received client certificate.  So any
client with a trusted certificate was accepted.

Fixes: d2fc9b0961c6 ("tls-server: Mutual authentication support for TLS 1.3")
Closes strongswan/strongswan#873

3 years agoMerge branch 'natd-fixes'
Tobias Brunner [Tue, 15 Feb 2022 15:38:31 +0000 (16:38 +0100)] 
Merge branch 'natd-fixes'

This adds some modifications to NAT-D in case the source IP can't be
determined before generating NAT-D notifies.  If this happens when using
IPv4, a local NAT is faked (UDP-encap can be disabled later via MOBIKE
if no NAT is actually detected).  If it happens when using IPv6, NAT-T
is disabled completely.

It also removes the old fallbacks for source NAT-D notifies, which were
generally unused but could lead to incorrect results in the above
scenario.

Closes strongswan/strongswan#861

3 years agoike-natd: Queue DPD after faking local NAT to check if UDP-encap can be disabled
Tobias Brunner [Mon, 31 Jan 2022 13:17:40 +0000 (14:17 +0100)] 
ike-natd: Queue DPD after faking local NAT to check if UDP-encap can be disabled

3 years agoike-mobike: Make task a no-op if MOBIKE is not supported
Tobias Brunner [Mon, 31 Jan 2022 13:13:02 +0000 (14:13 +0100)] 
ike-mobike: Make task a no-op if MOBIKE is not supported

This allows queuing such a task before IKE_AUTH has been processed.

3 years agoike-natd: Fake NAT situation or disable NAT-D if source IP is undetermined
Tobias Brunner [Tue, 29 Jun 2021 14:11:51 +0000 (16:11 +0200)] 
ike-natd: Fake NAT situation or disable NAT-D if source IP is undetermined

This can happen if an IKE_SA is initiated to a static IP before DHCP is
done.  Instead of failing the initiation, we either fake a NAT situation
(for IPv4) or disable NAT-D (for IPv6 where NATs and UDP-encap are not
widely used or supported).

This also removes the old fallbacks to determine the source address(es).
A source address lookup is done in ike_sa_t::resolve_hosts() (wasn't the
case initially) and enumerating local IPs (which was added even earlier)
could still lead to issues if e.g. LAN addresses are available but the
WAN address that's later used is not yet (in which case only the responder
would detect a NAT and UDP-encap would be configured asymmetrically).

To force UDP-encap locally in case there is no actual NAT, we store this
as COND_NAT_HERE instead of COND_NAT_FAKE.  This ensures DPDs will contain
NAT-D notifies and we can later remove the state via MOBIKE.  We trigger
a MOBIKE update after such a DPD by registering a changed NAT mapping after
checking for a disappearing local NAT, which is very unlikely to happen
outside of a MOBIKE update (where that flag is not checked).

3 years agoha: Streamline handling of conditions and extensions
Thomas Egerer [Tue, 8 Feb 2022 16:52:02 +0000 (17:52 +0100)] 
ha: Streamline handling of conditions and extensions

Automatically takes care of sending/receiving newly added extensions and
conditions.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
3 years agoerror-notify: Handle missing alerts
Tobias Brunner [Fri, 11 Feb 2022 17:11:57 +0000 (18:11 +0100)] 
error-notify: Handle missing alerts

References strongswan/strongswan#876.

3 years agotesting: Print the actual start time of a command for `do-tests -t`
Tobias Brunner [Wed, 9 Feb 2022 17:54:23 +0000 (18:54 +0100)] 
testing: Print the actual start time of a command for `do-tests -t`

Because the command line, together with the results, is printed after
executing it, there could have been weird delays between commands.

3 years agoappveyor: Install autotools package on 2019 image
Tobias Brunner [Fri, 4 Feb 2022 11:05:53 +0000 (12:05 +0100)] 
appveyor: Install autotools package on 2019 image

On the recently updated 2019 image, autoreconf is not found anymore, as
recent versions of msys2 don't ship autools with base-devel aymore, so
install the autotools package explicitly.

3 years agoopenssl: Return correct number of plugin features if ECDH groups are omitted
Tobias Brunner [Fri, 4 Feb 2022 15:30:51 +0000 (16:30 +0100)] 
openssl: Return correct number of plugin features if ECDH groups are omitted

Fixes: 46a6b062822c ("openssl: Only announce ECDH groups actually supported by OpenSSL")
3 years agoproposal: Add ESN transform to default ESP AEAD proposal
Martin Willi [Mon, 31 Jan 2022 13:01:42 +0000 (14:01 +0100)] 
proposal: Add ESN transform to default ESP AEAD proposal

The commit mentioned below adds an AES-GCM default proposal for ESP. That
proposal does not include any ESN or non-ESN transform to indicate if
extended sequence numbers are supported.

A standards-compliant peer will include one or more ESN support transforms,
and will be unable to select this proposal due to a proposal mismatch.

Fix the default AES-GCM proposal by adding a NO_ESN algorithm. While ESN has
been supported in the Linux kernel for a while, having it in the default
proposal can be problematic with kernel-libipsec or on other platforms.

Fixes: c7bef954eec6 ("proposal: Add AES-GCM to the ESP default AEAD proposal")
Closes strongswan/strongswan#868

3 years agoSECURITY: Fix link to PGP key
Tobias Brunner [Tue, 25 Jan 2022 09:54:10 +0000 (10:54 +0100)] 
SECURITY: Fix link to PGP key

3 years agosys-logger: Optionally support mapping strongSwan loglevels to syslog levels
Martin Willi [Thu, 20 Jan 2022 13:48:48 +0000 (14:48 +0100)] 
sys-logger: Optionally support mapping strongSwan loglevels to syslog levels

strongSwan logs all syslog messages using LOG_INFO for historical reasons,
regardless of the strongSwan loglevel used producing the log message.

In some setups with advanced logging infrastructure, it may be feasible
to be more verbose when logging in strongSwan, but then filter messages
on the syslog server. While this may be possible by custom syslog filtering
rules matching the log level included with the log_level setting, this is
not super convenient.

So add a new map_level setting, which can map strongSwan loglevels to
syslog loglevels. By default this is disabled, keeping the existing
behavior. If enabled, it maps strongSwan loglevels to syslog loglevels
at a given syslog loglevel offset.

Closes strongswan/strongswan#859

3 years agoaddrblock: Allow limiting validation depth of issuer addrblock extensions
Martin Willi [Wed, 12 Jan 2022 10:00:20 +0000 (11:00 +0100)] 
addrblock: Allow limiting validation depth of issuer addrblock extensions

RFC3779 requires to validate the addrblocks of issuer certificates strictly,
that is, they must contain the extension and the claimed addrblock, up to
the root CA.

When working with third party root CAs that do not have the extension,
this makes using the plugin impossible. So add a depth setting that limits
the number of issuer certificates to check bottom-up towards the root CA.
A depth value of 0 disables any issuer check, the default value of -1
checks all issuers in the chain, keeping the existing behavior.

Closes strongswan/strongswan#860

3 years agoUse Botan 2.19.1 for tests
Tobias Brunner [Thu, 20 Jan 2022 09:04:30 +0000 (10:04 +0100)] 
Use Botan 2.19.1 for tests

3 years agoVersion bump to 5.9.5 5.9.5
Andreas Steffen [Mon, 24 Jan 2022 11:01:10 +0000 (12:01 +0100)] 
Version bump to 5.9.5

3 years agoNEWS: Add info about CVE-2021-45079
Tobias Brunner [Thu, 20 Jan 2022 16:24:02 +0000 (17:24 +0100)] 
NEWS: Add info about CVE-2021-45079

3 years agoeap-authenticator: Enforce failure if MSK generation fails
Tobias Brunner [Tue, 14 Dec 2021 09:51:35 +0000 (10:51 +0100)] 
eap-authenticator: Enforce failure if MSK generation fails

Without this, the authentication succeeded if the server sent an early
EAP-Success message for mutual, key-generating EAP methods like EAP-TLS,
which may be used in EAP-only scenarios but would complete without server
or client authentication.  For clients configured for such EAP-only
scenarios, a rogue server could capture traffic after the tunnel is
established or even access hosts behind the client.  For non-mutual EAP
methods, public key server authentication has been enforced for a while.

A server previously could also crash a client by sending an EAP-Success
immediately without initiating an actual EAP method.

Fixes: 0706c39cda52 ("added support for EAP methods not establishing an MSK")
Fixes: CVE-2021-45079
3 years agoNEWS: Add news for 5.9.5
Tobias Brunner [Thu, 20 Jan 2022 16:22:37 +0000 (17:22 +0100)] 
NEWS: Add news for 5.9.5

3 years agoFixed some typos, courtesy of codespell
Tobias Brunner [Thu, 20 Jan 2022 09:44:42 +0000 (10:44 +0100)] 
Fixed some typos, courtesy of codespell

3 years agoagent: Log socket path if connecting to it failed
Tobias Brunner [Tue, 14 Dec 2021 09:58:28 +0000 (10:58 +0100)] 
agent: Log socket path if connecting to it failed

3 years agoVersion bump to 5.9.5rc1 5.9.5rc1
Andreas Steffen [Sun, 16 Jan 2022 06:48:06 +0000 (07:48 +0100)] 
Version bump to 5.9.5rc1

3 years agomessage: Add getter/setter for metadata handling
Tobias Brunner [Thu, 2 Dec 2021 15:12:31 +0000 (16:12 +0100)] 
message: Add getter/setter for metadata handling

3 years agopacket: Add helper function to create a clone without data
Tobias Brunner [Thu, 2 Dec 2021 15:10:46 +0000 (16:10 +0100)] 
packet: Add helper function to create a clone without data

3 years agopacket: Add getter/setter for metadata handling
Tobias Brunner [Thu, 2 Dec 2021 14:34:18 +0000 (15:34 +0100)] 
packet: Add getter/setter for metadata handling

3 years agometadata-set: Add implementation for a collection of metadata objects
Tobias Brunner [Thu, 2 Dec 2021 10:25:34 +0000 (11:25 +0100)] 
metadata-set: Add implementation for a collection of metadata objects

3 years agometadata: Add metadata factory and implementation for integer types
Tobias Brunner [Wed, 1 Dec 2021 16:13:35 +0000 (17:13 +0100)] 
metadata: Add metadata factory and implementation for integer types

Co-authored-by: Thomas Egerer <thomas.egerer@secunet.com>
3 years agotesting: Modified ikev2/net2net-rfc3779 scenario
Andreas Steffen [Mon, 10 Jan 2022 20:14:05 +0000 (21:14 +0100)] 
testing: Modified ikev2/net2net-rfc3779 scenario

3 years agoUse wolfSSL 5.1.1 for tests
Tobias Brunner [Tue, 4 Jan 2022 14:44:29 +0000 (15:44 +0100)] 
Use wolfSSL 5.1.1 for tests

Add --tags when fetching commits so we get tags that are not in any
branches, which is currently the case with this tag.

3 years agoconf: Fix typo for ha plugin's buffer size option
Noel Kuntze [Thu, 30 Dec 2021 09:30:55 +0000 (10:30 +0100)] 
conf: Fix typo for ha plugin's buffer size option

Fixes: ce048c30ff87 ("ha: Double receive buffer size for HA messages and make it configurable")
Closes strongswan/strongswan#832

3 years agoVersion bump to 5.9.5dr4 5.9.5dr4
Andreas Steffen [Fri, 31 Dec 2021 13:46:31 +0000 (14:46 +0100)] 
Version bump to 5.9.5dr4

3 years agosw-collector: Iterate through history logs
Andreas Steffen [Sun, 17 Oct 2021 13:53:42 +0000 (15:53 +0200)] 
sw-collector: Iterate through history logs

The logrotate function causes the apt history to be split into
several parts at arbitrary points in time. If history.log only
is parsed then some package installation changes stored in
zipped backup history files might get lost.

Thus sw-collector now searches all backup history files until
a date older than the current event stored in the collector.db
database is found, so that no entries get overlooked.

3 years agolibtpmtss: Some minor improvements
Andreas Steffen [Fri, 17 Dec 2021 12:20:56 +0000 (13:20 +0100)] 
libtpmtss: Some minor improvements

3 years agoVersion bump to 5.9.5dr3 5.9.5dr3
Andreas Steffen [Sat, 11 Dec 2021 15:39:34 +0000 (16:39 +0100)] 
Version bump to 5.9.5dr3

3 years agolibtpmtss: Establish session with TPM 2.0
Andreas Steffen [Mon, 8 Nov 2021 08:02:40 +0000 (09:02 +0100)] 
libtpmtss: Establish session with TPM 2.0

Using the trusted RSA or ECC Endorsement Key of the TPM 2.0 a
secure session is established via RSA public key encryption or
an ephemeral ECDH key exchange, respectively.

The session allows HMAC-based authenticated communication with
the TPM 2.0 and the exchanged parameters can be encrypted where
necessary to guarantee confidentiality.

3 years agoMerge branch 'openssl-providers'
Tobias Brunner [Wed, 8 Dec 2021 10:34:46 +0000 (11:34 +0100)] 
Merge branch 'openssl-providers'

Optionally load the legacy provider in OpenSSL 3 (enabled, by default) to
make algorithms like MD4 and DES available, which we require for
EAP-MSCHAPv2.  Allow explicitly loading the fips provider via existing
fips_mode option.  The loaded providers, whether influenced by the above
options or not, are logged.

Closes strongswan/strongswan#759

3 years agoopenssl: Log loaded providers
Tobias Brunner [Mon, 22 Nov 2021 09:38:29 +0000 (10:38 +0100)] 
openssl: Log loaded providers

3 years agoopenssl: Make fips_mode option work with OpenSSL 3
Tobias Brunner [Mon, 22 Nov 2021 09:34:08 +0000 (10:34 +0100)] 
openssl: Make fips_mode option work with OpenSSL 3

3 years agoopenssl: Load "legacy" provider in OpenSSL 3 for algorithms like MD4, DES etc.
Tobias Brunner [Thu, 30 Sep 2021 07:41:57 +0000 (09:41 +0200)] 
openssl: Load "legacy" provider in OpenSSL 3 for algorithms like MD4, DES etc.

We still require these algorithms for e.g. EAP-MSCHAPv2, so the option is
enabled, by default.  To use other providers (e.g. fips or even custom
ones), the option can be disabled and the providers to load/activate can
be configured in openssl.cnf.  For instance, the following has the same
effect as enabling the option:

    openssl_conf = openssl_init

    [openssl_init]
    providers = providers

    [providers]
    default = activate
    legacy = activate

    [activate]
    activate = yes

3 years agoMerge branch 'libtls-tests'
Tobias Brunner [Wed, 8 Dec 2021 10:33:32 +0000 (11:33 +0100)] 
Merge branch 'libtls-tests'

Improves handling failures during unit tests of libtls and includes a
change for the openssl plugin so it only announces ECDH groups for which
the library provides the required ECC curve.

Closes strongswan/strongswan#752

3 years agoopenssl: Only announce ECDH groups actually supported by OpenSSL
Tobias Brunner [Tue, 16 Nov 2021 13:34:03 +0000 (14:34 +0100)] 
openssl: Only announce ECDH groups actually supported by OpenSSL

Determined by whether the library provides curves for it or not.
For instance, in the OpenSSL 3 FIPS provider the Brainpool curves are
not included.  And in the Fedora package several weak curves are
explicitly patched out and the Brainpool curves are omitted even in
non-FIPS mode.

3 years agoopenssl: Add helper to map ECDH groups to curve NIDs
Tobias Brunner [Tue, 16 Nov 2021 13:33:09 +0000 (14:33 +0100)] 
openssl: Add helper to map ECDH groups to curve NIDs

3 years agolibtls: Shutdown server socket in test teardown function
Tobias Brunner [Mon, 15 Nov 2021 13:01:44 +0000 (14:01 +0100)] 
libtls: Shutdown server socket in test teardown function

If a test fails and the server thread is blocked reading on the socket,
it would stay stuck.

3 years agotls-socket: Handle sending fatal errors better
Tobias Brunner [Mon, 15 Nov 2021 13:39:22 +0000 (14:39 +0100)] 
tls-socket: Handle sending fatal errors better

In particular as server, the previous code might cause it to hang in
recv() if this case wasn't triggered by a close notify (followed by a
shutdown of the socket) but it e.g. failed processing a ServerHello and
responded with a fatal alert.

Fixes: 09fbaad6bd71 ("tls-socket: Don't fail reading if sending data failed")
3 years agogcrypt: Support of AES-CFB encryption
Andreas Steffen [Mon, 6 Dec 2021 12:43:45 +0000 (13:43 +0100)] 
gcrypt:  Support of AES-CFB encryption

3 years agobotan: Support of AES-CFB encryption
Andreas Steffen [Mon, 6 Dec 2021 12:28:31 +0000 (13:28 +0100)] 
botan: Support of AES-CFB encryption