]> git.ipfire.org Git - thirdparty/strongswan.git/log
thirdparty/strongswan.git
5 months agoVersion bumpt to 5.9.12 5.9.12
Andreas Steffen [Mon, 20 Nov 2023 11:10:34 +0000 (12:10 +0100)] 
Version bumpt to 5.9.12

5 months agoNEWS: Add info about CVE-2023-41913
Tobias Brunner [Wed, 15 Nov 2023 13:23:56 +0000 (14:23 +0100)] 
NEWS: Add info about CVE-2023-41913

5 months agocharon-tkm: Validate DH public key to fix potential buffer overflow
Tobias Brunner [Tue, 11 Jul 2023 10:12:25 +0000 (12:12 +0200)] 
charon-tkm: Validate DH public key to fix potential buffer overflow

Seems this was forgotten in the referenced commit and actually could lead
to a buffer overflow.  Since charon-tkm is untrusted this isn't that
much of an issue but could at least be easily exploited for a DoS attack
as DH public values are set when handling IKE_SA_INIT requests.

Fixes: 0356089d0f94 ("diffie-hellman: Verify public DH values in backends")
Fixes: CVE-2023-41913
5 months agox509: Ensure extensions are encoded even if others are missing
Tobias Brunner [Wed, 15 Nov 2023 16:08:46 +0000 (17:08 +0100)] 
x509: Ensure extensions are encoded even if others are missing

As with the previous commit, this is probably never an issue in practice
as most certificates contain at least one SAN.

5 months agox509: Also encode extendedKeyUsage in cert requests if there are no SANs or certifica...
Tobias Brunner [Wed, 15 Nov 2023 16:01:02 +0000 (17:01 +0100)] 
x509: Also encode extendedKeyUsage in cert requests if there are no SANs or certificate type

Probably never was an issue in practice as most certificates contain at
least one SAN.

5 months agopki: Mention --index in description
Tobias Brunner [Wed, 15 Nov 2023 14:16:07 +0000 (15:16 +0100)] 
pki: Mention --index in description

5 months agoNEWS: Add news for 5.9.12
Tobias Brunner [Wed, 15 Nov 2023 13:05:09 +0000 (14:05 +0100)] 
NEWS: Add news for 5.9.12

5 months agoMove ocsp_responder_t interface as it's not a certificate
Tobias Brunner [Tue, 14 Nov 2023 09:35:47 +0000 (10:35 +0100)] 
Move ocsp_responder_t interface as it's not a certificate

5 months agoFixed some typos, courtesy of codespell
Tobias Brunner [Tue, 14 Nov 2023 09:11:16 +0000 (10:11 +0100)] 
Fixed some typos, courtesy of codespell

5 months agoVersion bump to 5.9.12rc1 5.9.12rc1
Andreas Steffen [Tue, 14 Nov 2023 07:12:00 +0000 (08:12 +0100)] 
Version bump to 5.9.12rc1

5 months agox509: Fix regression introduced by commit a22147a
Andreas Steffen [Tue, 14 Nov 2023 07:00:27 +0000 (08:00 +0100)] 
x509: Fix regression introduced by commit a22147a

Instead of the CA certificate's subjectKeyIdentifier erroneously
the CA's authorityKeyIdentifier was used as the authorityKeyIdentfier
of the certificate to be issued. This might work with a root CA
where the authorityKeyIdentifier equals its subjectKeyIdentfier
but introduces a severe regression when an intermediate CA is used.

5 months agoMerge branch 'ocsp-responder-index'
Tobias Brunner [Mon, 13 Nov 2023 11:51:47 +0000 (12:51 +0100)] 
Merge branch 'ocsp-responder-index'

Adds support for multiple OCSP responders in `pki --ocsp` and one that
is based on OpenSSL-style index.txt files.  The parser for these files
also accepts simplified files that only specify the status, serial number
and optional revocation date/reason.  The OCSP test scenarios are also
updated to use this OCSP responder including one that shows the multi-CA
capabilities of the --ocsp command and the --index option.

5 months agotesting: Use a single OCSP responder for ikev2-multi-ca/ocsp-signers scenario
Tobias Brunner [Tue, 7 Nov 2023 10:21:14 +0000 (11:21 +0100)] 
testing: Use a single OCSP responder for ikev2-multi-ca/ocsp-signers scenario

This demonstrates the multi-CA capabilities of the pki --ocsp command.

5 months agotesting: Use pki --ocsp as OCSP responder
Tobias Brunner [Tue, 31 Oct 2023 08:28:33 +0000 (09:28 +0100)] 
testing: Use pki --ocsp as OCSP responder

The only exception is the ikev2/ocsp-no-signer-cert scenario as the
pki command won't sign an OCSP response with a certificate that isn't
the CA certificate or marked as an OCSP signer.

5 months agopki: Pre-process common arguments
Tobias Brunner [Tue, 31 Oct 2023 08:17:05 +0000 (09:17 +0100)] 
pki: Pre-process common arguments

This way the position of --debug doesn't matter for it to apply to the
parsing of all command-specific arguments.

5 months agopki: Add option to load certificate status information from index.txt
Tobias Brunner [Mon, 30 Oct 2023 17:12:12 +0000 (18:12 +0100)] 
pki: Add option to load certificate status information from index.txt

Each index.txt is associated with the most recently loaded CA
certificate.

5 months agopki: Add index.txt-based OCSP responder
Tobias Brunner [Mon, 30 Oct 2023 17:11:53 +0000 (18:11 +0100)] 
pki: Add index.txt-based OCSP responder

5 months agochunk: Add helper to hash chunks via pointer
Tobias Brunner [Mon, 30 Oct 2023 16:57:23 +0000 (17:57 +0100)] 
chunk: Add helper to hash chunks via pointer

5 months agopki: Drop legacy registration for OCSP responders
Tobias Brunner [Mon, 30 Oct 2023 16:50:18 +0000 (17:50 +0100)] 
pki: Drop legacy registration for OCSP responders

5 months agoopenxpki: Register as OCSP responder
Tobias Brunner [Mon, 30 Oct 2023 16:49:34 +0000 (17:49 +0100)] 
openxpki: Register as OCSP responder

5 months agopki: Use OCSP responder manager for --ocsp --respond
Tobias Brunner [Mon, 30 Oct 2023 16:47:34 +0000 (17:47 +0100)] 
pki: Use OCSP responder manager for --ocsp --respond

5 months agolibrary: Add manager for OCSP responders
Tobias Brunner [Mon, 30 Oct 2023 16:34:51 +0000 (17:34 +0100)] 
library: Add manager for OCSP responders

Registered OCSP responders should return VALIDATION_SKIPPED for issuer
certificates they are not responsible for. However, VALIDATION_FAILED is
currently treated the same way, so that's fine as well.

5 months agoMerge branch 'ocsp-responder'
Tobias Brunner [Mon, 13 Nov 2023 11:42:00 +0000 (12:42 +0100)] 
Merge branch 'ocsp-responder'

Implements a new --ocsp command for the pki tool that can produce OCSP
responses based on information provided by a plugin.  A first plugin
that accesses the OpenXPKI database is also added.

Closes strongswan/strongswan#1958

5 months agoman: Extended pki man page and added pki --ocsp man page
Andreas Steffen [Thu, 19 Oct 2023 17:16:05 +0000 (19:16 +0200)] 
man: Extended pki man page and added pki --ocsp man page

5 months agopki: Added ocsp command
Andreas Steffen [Fri, 13 Oct 2023 19:25:19 +0000 (21:25 +0200)] 
pki: Added ocsp command

The pki --ocsp command implements an OCSP responder.

5 months agopki: Added ocsp-req and ocsp-rsp types to pki --print
Andreas Steffen [Mon, 3 Jul 2023 10:42:09 +0000 (12:42 +0200)] 
pki: Added ocsp-req and ocsp-rsp types to pki --print

5 months agounit-tests: Update test_serial_gen suite
Andreas Steffen [Thu, 15 Jun 2023 14:39:25 +0000 (16:39 +0200)] 
unit-tests: Update test_serial_gen suite

5 months agox509: Support generation of OCSP responses
Andreas Steffen [Thu, 15 Jun 2023 13:47:19 +0000 (15:47 +0200)] 
x509: Support generation of OCSP responses

5 months agocertificates: Added ocsp_single_response object
Andreas Steffen [Thu, 15 Jun 2023 13:42:42 +0000 (15:42 +0200)] 
certificates: Added ocsp_single_response object

5 months agoopenxpki: OCSP responder plugin accessing OpenXPKI
Andreas Steffen [Thu, 15 Jun 2023 14:24:34 +0000 (16:24 +0200)] 
openxpki: OCSP responder plugin accessing OpenXPKI

The openxpki plugin directly access the certificates table in
the OpenXPKI's MariaDB in order to retrieve the status of an
issued X.509 certificate based on its serial number.

5 months agocrl-reason: Fixed typo
Andreas Steffen [Thu, 8 Jun 2023 18:38:24 +0000 (20:38 +0200)] 
crl-reason: Fixed typo

5 months agoutils: Added chunk_to_dec() function
Andreas Steffen [Sat, 3 Jun 2023 20:32:19 +0000 (22:32 +0200)] 
utils: Added chunk_to_dec() function

5 months agox509: Support parsing of OCSP requests
Andreas Steffen [Thu, 15 Jun 2023 14:37:45 +0000 (16:37 +0200)] 
x509: Support parsing of OCSP requests

5 months agopki --pkcs7: Set default to res = 1
Andreas Steffen [Fri, 2 Jun 2023 07:06:13 +0000 (09:06 +0200)] 
pki --pkcs7: Set default to res = 1

5 months agokernel-netlink: Don't add replay state twice when updating SAs
Tobias Brunner [Tue, 7 Nov 2023 16:39:51 +0000 (17:39 +0100)] 
kernel-netlink: Don't add replay state twice when updating SAs

The kernel includes the XFRMA_REPLAY_ESN_VAL attribute when dumping
SAs since it was added with 2.6.39.  So we basically added this attribute
twice to the message sent to the kernel, potentially exceeding the
message buffer if the window size is large.

The XFRMA_REPLAY_VAL attribute is only dumped since 3.19, so that might
still be relevant (Google seems to maintain a 3.18 kernel) and since we
have to query the current lifetime stats anyway, we can just avoid adding
this attribute twice.

Closes strongswan/strongswan#1967

5 months agoMerge branch 'uri-san'
Tobias Brunner [Mon, 13 Nov 2023 11:34:32 +0000 (12:34 +0100)] 
Merge branch 'uri-san'

Adds support to encode SANs of type uniformResourceIdentifier in
certificates.  They currently don't have any use in strongSwan, but
might be required for other applications.

Closes strongswan/strongswan#1983

5 months agoidentification: Support explicit uri: prefix for SANs of type uniformResourceIdentifier
Tobias Brunner [Thu, 9 Nov 2023 11:43:44 +0000 (12:43 +0100)] 
identification: Support explicit uri: prefix for SANs of type uniformResourceIdentifier

5 months agox509: Add support to encode SANs of type uniformResourceIdentifier
Tobias Brunner [Thu, 9 Nov 2023 11:42:54 +0000 (12:42 +0100)] 
x509: Add support to encode SANs of type uniformResourceIdentifier

5 months agox509: Use issuer certificate's subjectKeyIdentifier if available
Tobias Brunner [Mon, 6 Nov 2023 17:39:11 +0000 (18:39 +0100)] 
x509: Use issuer certificate's subjectKeyIdentifier if available

Instead of just generating an authorityKeyIdentifier based on the
issuer's public key, this allows CA certificates to be issued by a
different tool that doesn't use a SHA-1 hash of the subjectPublicKey
for the subjectKeyIdentifier.

Closes strongswan/strongswan#1992
References strongswan/strongswan#1975

5 months agoMerge branch 'pkcs12-no-pw'
Tobias Brunner [Mon, 13 Nov 2023 11:27:31 +0000 (12:27 +0100)] 
Merge branch 'pkcs12-no-pw'

This adds support for password-less PKCS#12 containers and PKCS#8 files.

A new option for charon-cmd also allows loading private keys of any
type (previously only RSA keys were supported).

References strongswan/strongswan#1955

5 months agocharon-cmd: Add support for key types other than RSA
Tobias Brunner [Wed, 18 Oct 2023 15:29:25 +0000 (17:29 +0200)] 
charon-cmd: Add support for key types other than RSA

5 months agopkcs12: Add support for PKCS#12 containers with empty or no password
Tobias Brunner [Wed, 18 Oct 2023 15:22:08 +0000 (17:22 +0200)] 
pkcs12: Add support for PKCS#12 containers with empty or no password

5 months agopkcs7: Add supported for unprotected PKCS#7 encrypted-data
Tobias Brunner [Wed, 18 Oct 2023 15:18:49 +0000 (17:18 +0200)] 
pkcs7: Add supported for unprotected PKCS#7 encrypted-data

5 months agopkcs8: Add support for unprotected PKCS#8 containers
Tobias Brunner [Wed, 18 Oct 2023 15:15:44 +0000 (17:15 +0200)] 
pkcs8: Add support for unprotected PKCS#8 containers

5 months agopkcs12: Treat empty string and no password differently
Tobias Brunner [Wed, 18 Oct 2023 15:11:51 +0000 (17:11 +0200)] 
pkcs12: Treat empty string and no password differently

When deriving the PKCS#12 key, the empty string should result in a
non-zero length Unicode string (two bytes for the 0 terminator).

5 months agoopenssl: Add support for unprotected PKCS#12 containers
Tobias Brunner [Wed, 18 Oct 2023 15:01:52 +0000 (17:01 +0200)] 
openssl: Add support for unprotected PKCS#12 containers

5 months agoMerge branch 'x509-ipaddress-constraints'
Tobias Brunner [Mon, 13 Nov 2023 11:23:43 +0000 (12:23 +0100)] 
Merge branch 'x509-ipaddress-constraints'

Adds support for nameConstraints of type iPAddress, which represent a
subnet, to the x509, openssl and constraints plugins.  SANs of type
iPAddress are matched against such constraints.

Closes strongswan/strongswan#1991

5 months agoconstraints: Add support for IP address nameConstraints
Tobias Brunner [Wed, 18 Oct 2023 16:32:48 +0000 (18:32 +0200)] 
constraints: Add support for IP address nameConstraints

5 months agoopenssl: Add support for IP address nameConstraints
Tobias Brunner [Wed, 18 Oct 2023 16:27:07 +0000 (18:27 +0200)] 
openssl: Add support for IP address nameConstraints

5 months agox509: Add support for IP address nameConstraints
Tobias Brunner [Wed, 18 Oct 2023 16:25:14 +0000 (18:25 +0200)] 
x509: Add support for IP address nameConstraints

According to RFC 5280, section 4.2.1.10, these are encoded as address
followed by a network mask of the same length.

5 months agoopenssl: Add support for nameConstraints X.509 extension
Tobias Brunner [Tue, 17 Oct 2023 08:21:28 +0000 (10:21 +0200)] 
openssl: Add support for nameConstraints X.509 extension

Closes strongswan/strongswan#1990

5 months agoMerge branch 'reqid-refcount'
Tobias Brunner [Mon, 13 Nov 2023 11:02:25 +0000 (12:02 +0100)] 
Merge branch 'reqid-refcount'

This fixes issues with CHILD_SAs getting reestablished concurrently.
We intend to reuse the reqid of the previous CHILD_SA, however, previously
the reqids were released and up for reassignment to any other CHILD_SA
or trap policy.  This could cause the reqid to get associated with
completely different traffic selectors, as the reestablished CHILD_SA
would eventually get the requested reqid because the traffic selectors
explicitly don't have to match (to allow narrowing for CHILD_SAs based
on trap policies).

Closes strongswan/strongswan#1855

5 months agoikev2: Correctly maintain allocated reqid during make-before-break reauth
Tobias Brunner [Mon, 2 Oct 2023 14:24:01 +0000 (16:24 +0200)] 
ikev2: Correctly maintain allocated reqid during make-before-break reauth

5 months agotrap-manager: Maintain allocated reqids when handling acquires
Tobias Brunner [Mon, 2 Oct 2023 14:17:33 +0000 (16:17 +0200)] 
trap-manager: Maintain allocated reqids when handling acquires

5 months agoquick-delete: Correctly maintain allocated reqid when recreating CHILD_SA
Tobias Brunner [Mon, 2 Oct 2023 14:10:40 +0000 (16:10 +0200)] 
quick-delete: Correctly maintain allocated reqid when recreating CHILD_SA

5 months agochild-delete: Correctly maintain allocated reqid when recreating CHILD_SA
Tobias Brunner [Mon, 2 Oct 2023 14:08:40 +0000 (16:08 +0200)] 
child-delete: Correctly maintain allocated reqid when recreating CHILD_SA

The old CHILD_SA is destroyed even before the new task is queued, this
makes sure we always maintain a reference to the reqid.

5 months agoike-sa: Correctly maintain allocated reqid when recreating CHILD_SA
Tobias Brunner [Mon, 2 Oct 2023 14:21:28 +0000 (16:21 +0200)] 
ike-sa: Correctly maintain allocated reqid when recreating CHILD_SA

Maintaining the reqid when recreating a CHILD_SA from scratch night not
strictly be necessary as we usually don't have to replace any temporary
states in the kernel.  However, there could be concurrent acquires that
might actually make it necessary (we use the reqid to keep track of
acquires and it's also part of the duplicate check).

5 months agoikev1: Only set reqid on rekeyed CHILD_SA if it was allocated dynamically
Tobias Brunner [Mon, 2 Oct 2023 14:06:48 +0000 (16:06 +0200)] 
ikev1: Only set reqid on rekeyed CHILD_SA if it was allocated dynamically

5 months agochild-rekey: Only set reqid on new CHILD_SA if it was allocated dynamically
Tobias Brunner [Mon, 2 Oct 2023 14:02:08 +0000 (16:02 +0200)] 
child-rekey: Only set reqid on new CHILD_SA if it was allocated dynamically

Keeping a reference ensures that if the old SA expires before the new
one is installed, the previous reqid isn't reallocated to a concurrently
established CHILD_SA with different selectors.

5 months agoquick-mode: Maintain reference to reqid while CHILD_SA is established
Tobias Brunner [Mon, 2 Oct 2023 14:20:01 +0000 (16:20 +0200)] 
quick-mode: Maintain reference to reqid while CHILD_SA is established

5 months agochild-create: Maintain reference to reqid while CHILD_SA is established
Tobias Brunner [Mon, 2 Oct 2023 14:00:07 +0000 (16:00 +0200)] 
child-create: Maintain reference to reqid while CHILD_SA is established

5 months agochild-sa: Add method that returns a reference to an allocated reqid
Tobias Brunner [Mon, 2 Oct 2023 13:08:49 +0000 (15:08 +0200)] 
child-sa: Add method that returns a reference to an allocated reqid

5 months agochild-sa: Keep a reference to the previous reqid
Tobias Brunner [Mon, 2 Oct 2023 13:47:02 +0000 (15:47 +0200)] 
child-sa: Keep a reference to the previous reqid

The reference is kept until the reqid is either confirmed (i.e.
re-allocated) or replaced by a different reqid, which happens only once
we know the final traffic selectors, or the SA is destroyed without
installing it.

5 months agokernel-interface: Add method to increase refcount for allocated reqid
Tobias Brunner [Mon, 2 Oct 2023 12:58:50 +0000 (14:58 +0200)] 
kernel-interface: Add method to increase refcount for allocated reqid

5 months agokernel-interface: Remove unnecessary parameters for release_reqid()
Tobias Brunner [Mon, 2 Oct 2023 12:08:56 +0000 (14:08 +0200)] 
kernel-interface: Remove unnecessary parameters for release_reqid()

These are not included in the initial lookup anymore. Also simplified
the implementation as we always add the same entry to the two hash
tables.

5 months agokernel-interface: Use reqid as sole key in hash table
Tobias Brunner [Mon, 2 Oct 2023 11:59:23 +0000 (13:59 +0200)] 
kernel-interface: Use reqid as sole key in hash table

Every reqid is allocated once, we don't store the same reqid with e.g.
different marks or interface IDs that would make it necessary to make
them part of the key in that table (that's different in the other table).

To preserve the current behavior, that is, allocating a new reqid if e.g.
the marks are different, the additional selector values (which will
result in an additional policy in the Linux kernel) are compared after
the initial lookup.

5 months agocredential-manager: Add option to reject trusted end-entity certificates
Tobias Brunner [Wed, 31 May 2023 12:39:05 +0000 (14:39 +0200)] 
credential-manager: Add option to reject trusted end-entity certificates

This allows preventing peers from authenticating with certificates
that are locally trusted, in particular, our own local certificate (which
safeguards against accidental reuse of certificates on multiple peers).

On the other hand, if this option is enabled, end-entity certificates
for peers can't be configured anymore explicitly (e.g. via remote.certs
in swanctl.conf).

5 months agocert-enroll: Preventing some errors that might occur
Andreas Steffen [Sun, 12 Nov 2023 09:22:38 +0000 (10:22 +0100)] 
cert-enroll: Preventing some errors that might occur

5 months agocert-enroll: Install TLS client/server credentials
Andreas Steffen [Mon, 6 Nov 2023 18:33:25 +0000 (19:33 +0100)] 
cert-enroll: Install TLS client/server credentials

Install the generated key, host certificate and associated CA certificates
as credentials for a TLS-protected client-server connection.

5 months agotls-server: Also change DH group when selecting a different EC curve
Tobias Brunner [Thu, 5 Oct 2023 08:27:18 +0000 (10:27 +0200)] 
tls-server: Also change DH group when selecting a different EC curve

If we initially selected a group the peer doesn't support (e.g. because
curve25519 is the first ECDH group provided by plugins), then found
a supported curve, we previously still instantiated a DH object for the
original group and might have formatted the parameters incorrectly.

5 months agoike-sa: Fix handling of redirects during IKE_AUTH
Tobias Brunner [Thu, 31 Aug 2023 11:45:10 +0000 (13:45 +0200)] 
ike-sa: Fix handling of redirects during IKE_AUTH

Since the referenced commit, the state switch to IKE_ESTABLISHED doesn't
happen immediately after completing the authentication but only after
the remaining tasks have finished.  Due to that redirects during IKE_AUTH
were treated like those during IKE_SA_INIT causing the IKE_SA and task
manager to get reset.  However, unlike the ike-init task, the ike-auth
task returned SUCCESS and, therefore, got destroyed, while a different
task was removed from the array that was modified during the reset.
This later caused a dereference of the freed ike-auth task and a crash.

Fixes: 5ce1c91b58a2 ("ikev2: Trigger ike_updown() event after all IKE-specific tasks ran")
5 months agogithub: Use latest Sonar scanner
Tobias Brunner [Tue, 31 Oct 2023 11:22:35 +0000 (12:22 +0100)] 
github: Use latest Sonar scanner

5 months agoUse wolfSSL 5.6.4 for tests
Tobias Brunner [Tue, 31 Oct 2023 08:41:49 +0000 (09:41 +0100)] 
Use wolfSSL 5.6.4 for tests

6 months agoVersion bump to 5.9.12dr2 5.9.12dr2
Andreas Steffen [Mon, 30 Oct 2023 21:42:55 +0000 (22:42 +0100)] 
Version bump to 5.9.12dr2

6 months agocert-enroll: Pack all source files into EXTRA_DIST
Andreas Steffen [Thu, 26 Oct 2023 13:15:37 +0000 (15:15 +0200)] 
cert-enroll: Pack all source files into EXTRA_DIST

6 months agoMerge branch 'reject-explicit-ecdsa'
Tobias Brunner [Fri, 13 Oct 2023 07:10:56 +0000 (09:10 +0200)] 
Merge branch 'reject-explicit-ecdsa'

There is a relatively recent NIAP requirement to reject certificates with
ECDSA keys that explicitly encode the curve parameters (TD0527, Test 8b).

Since explicit encoding is pretty rare (if used at all and e.g. wolfSSL
already rejects it, by default), we should follow that requirement and
just reject such keys/certificates completely.

This currently can be enforced in all crypto plugins except when using
older versions of OpenSSL (< 1.1.1h) and Botan (< 3.2.0).

Closes strongswan/strongswan#1949
References strongswan/strongswan#1796

6 months agounit-tests: Add a test case for explicit ECDSA parameters
Tobias Brunner [Mon, 17 Jul 2023 10:32:59 +0000 (12:32 +0200)] 
unit-tests: Add a test case for explicit ECDSA parameters

Currently only warns about it as older OpenSSL versions (AppVeyor)
don't reject them.

6 months agoUse Botan 3.2.0 for tests
Tobias Brunner [Thu, 31 Aug 2023 12:46:51 +0000 (14:46 +0200)] 
Use Botan 3.2.0 for tests

This includes a change that allows checking EC keys for explicit
param encoding.

6 months agobotan: Reject EC keys with explicitly encoded parameters
Tobias Brunner [Thu, 31 Aug 2023 12:27:09 +0000 (14:27 +0200)] 
botan: Reject EC keys with explicitly encoded parameters

This requires a function that will be added in the upcoming Botan 3.2
release.

6 months agoopenssl: Reject EC keys with explicitly encoded parameters
Tobias Brunner [Mon, 17 Jul 2023 10:01:06 +0000 (12:01 +0200)] 
openssl: Reject EC keys with explicitly encoded parameters

EC_KEY_decoded_from_explicit_params() was added with 1.1.1h but has been
deprecated with 3.0.

6 months agowolfssl: Reject EC keys with explicitly encoded parameters
Tobias Brunner [Mon, 17 Jul 2023 09:43:47 +0000 (11:43 +0200)] 
wolfssl: Reject EC keys with explicitly encoded parameters

These are not allowed in X.509 certificates according to RFC 5480 and
some newer validations apparently explicitly check for this.

Note that WolfSSL rejects such keys, by default.  Only when compiled with
WOLFSSL_NO_ASN_STRICT are they accepted.

6 months agocert-enroll: Fixed path in cert-install-openxpki
Andreas Steffen [Thu, 12 Oct 2023 06:14:38 +0000 (08:14 +0200)] 
cert-enroll: Fixed path in cert-install-openxpki

6 months agocirrus: Use FreeBSD 12.4
Tobias Brunner [Mon, 9 Oct 2023 12:57:17 +0000 (14:57 +0200)] 
cirrus: Use FreeBSD 12.4

FreeBSD 12.3 is officially EOL.

6 months agocirrus: Use FreeBSD 13.2
Tobias Brunner [Mon, 9 Oct 2023 12:52:25 +0000 (14:52 +0200)] 
cirrus: Use FreeBSD 13.2

This should fix an error thrown by bison:

 ld-elf.so.1: /lib/libc.so.7: version FBSD_1.7 required by /usr/local/bin/bison not found

6 months agoVersion bump to 5.9.12dr2 5.9.12dr1
Andreas Steffen [Wed, 4 Oct 2023 05:59:15 +0000 (07:59 +0200)] 
Version bump to 5.9.12dr2

6 months agocert-enroll: certificate checking and enrollment
Andreas Steffen [Fri, 1 Sep 2023 10:33:09 +0000 (12:33 +0200)] 
cert-enroll: certificate checking and enrollment

The cert-enroll script handles the initial enrollment of an X.509
host certificate with a PKI server via the EST or SCEP protocols.

Run as a systemd timer or via a crontab entry the script daily
checks the expiration date of the host certificate. When a given
deadline is reached, the host certificate is automatically renewed
via EST or SCEP re-enrollment based on the possession of the old
private key and the matching certificate.

7 months agoike-sa: Destroy CHILD_SAs in order
Tobias Brunner [Thu, 7 Sep 2023 15:33:00 +0000 (17:33 +0200)] 
ike-sa: Destroy CHILD_SAs in order

This works around an issue that occurs when recreating an IKE_SA with
multiple CHILD_SAs that use dynamically allocated reqids.

We currently try to preserve the reqid when reestablishing, so the
create-child task gets the reqid of the previous CHILD_SA and will try
to reallocate that once the CHILD_SA is installed.  Before that, the old
CHILD_SA is destroyed and the reqid is released and added to the array
of reqids to get reused.  However, because of the reverse order used here,
the first reqid in the array is the one of the last CHILD_SA.

So it can happen that a newly created CHILD_SA gets a reqid reassigned
that a later CHILD_SA will then also claim for itself and get assigned
because an entry with that reqid exists.  So multiple CHILD_SAs with
different traffic selectors could then share the same reqid.

References strongswan/strongswan#1855

7 months agolibipsec: Also install routes without preferred source to forward traffic
Boi Sletterink [Thu, 29 Jun 2023 15:39:37 +0000 (17:39 +0200)] 
libipsec: Also install routes without preferred source to forward traffic

Fixes a problem installing policies with source traffic selectors that do
not contain/match any of the local addresses.

When installing a route for a source TS that does contain one or more
local addresses, a preferred source address should be set in the route
(analogous to the `src` option in `ip route add`). This address is used
when the host itself sends traffic via that route (in contrast to
forwarding it).

When the source TS does not encompass any of the local addresses, the
host is not allowed to send traffic via this route and does not need to
set the preferred source address. However, the code would just return a
failure because it could not find a matching local address. This commit
changes this so routes without preferred source IP are installed to
allow non-local traffic to get forwarded via TUN device.

Closes strongswan/strongswan#1766

7 months agoconfigure: Fix in6_pktinfo auto detection
Antony Antony [Mon, 4 Sep 2023 09:18:23 +0000 (11:18 +0200)] 
configure: Fix in6_pktinfo auto detection

This commit fixes auto detection of in6_pktinfo.
When negotiating an IPv6 IKE session charon reported an error

"Jun 30 16:42:49 03[NET] error reading IP header"

The cause of error was missing in6_pktinfo declaration, which is
auto detected. This auto detection may fail with an error depending
on compiler flags:

configure:19850: checking for in6_pktinfo
configure:19870: gcc -c -g -O0 -Wall -Wno-format -Wno-format-security
-Wno-pointer-sign -Werror -Wfatal-errors -Wno-error=stringop-truncation
conftest.c >&5
conftest.c: In function 'main':
conftest.c:73:11: error: 'pi.ipi6_ifindex' is used uninitialized in this
function [-Werror=uninitialized]
   73 |     if (pi.ipi6_ifindex)
      |         ~~^~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: all warnings being treated as errors

Signed-off-by: Antony Antony <antony.antony@secunet.com>
8 months agovici: Fix connecting to socket in Python bindings on Windows
Tobias Brunner [Thu, 31 Aug 2023 09:39:52 +0000 (11:39 +0200)] 
vici: Fix connecting to socket in Python bindings on Windows

socket.connect() takes a single argument with the address that depends
on the address family, for TCP it's a tuple with IP and port.

Fixes: 00a75e332f29 ("vici: Create default TCP socket on Windows in Python bindings")
Closes strongswan/strongswan#1874

8 months agoandroid: New release after updating target SDK to 33 android-2.4.2
Tobias Brunner [Tue, 29 Aug 2023 16:09:33 +0000 (18:09 +0200)] 
android: New release after updating target SDK to 33

8 months agoandroid: Increase compile-/targetSdkVersion to 33 (Android 13)
Tobias Brunner [Tue, 29 Aug 2023 15:57:29 +0000 (17:57 +0200)] 
android: Increase compile-/targetSdkVersion to 33 (Android 13)

8 months agoandroid: Request permission to display notifications on Android 13
Tobias Brunner [Tue, 29 Aug 2023 15:45:32 +0000 (17:45 +0200)] 
android: Request permission to display notifications on Android 13

Note that displaying the notification for the background service is
apparently not strictly necessary.  So it's fine if the user wants to
hide it.  That the service is running can still be seen in the task
manager (pull down the status drawer twice, there is a bullet with a number
at the bottom if the service is running).

Simply use the system dialog.  If the user denies it twice, it won't show
up again.  The explanation dialog would not show up the first time (i.e.
shouldShowRequestPermissionRationale() returns false), only once the user
denied the permission once.  Currently seems like a bit much work
as we don't need the user to allow notifications.

8 months agoandroid: Compile OpenSSL with hardware acceleration
Tobias Brunner [Tue, 29 Aug 2023 15:41:46 +0000 (17:41 +0200)] 
android: Compile OpenSSL with hardware acceleration

8 months agoandroid: Use new sockets to determine source IP
Tobias Brunner [Wed, 17 May 2023 08:17:14 +0000 (10:17 +0200)] 
android: Use new sockets to determine source IP

Particularly on Samsung devices, the connect() call to dissolve the
previous connection on an existing socket via AF_UNSPEC does fail in
some situations with ECONNREFUSED:

  [KNL] failed to disconnect socket: Connection refused

While creating a new socket is potentially a bit more overhead, this
should avoid the issue.

Closes strongswan/strongswan#1691

8 months agotesting: Use pip from venv to download dependencies
Tobias Brunner [Mon, 28 Aug 2023 15:49:26 +0000 (17:49 +0200)] 
testing: Use pip from venv to download dependencies

pip3 isn't installed in the base image anymore since 21bf3e41f94a
("testing: Use venv for strongTNC").

9 months agokernel-pfroute: Maintain virtual flag when repopulating interface addrs
Tobias Brunner [Tue, 25 Jul 2023 08:21:40 +0000 (10:21 +0200)] 
kernel-pfroute: Maintain virtual flag when repopulating interface addrs

When adding a virtual IP on a TUN interface, the interface might get
activated (in terms of receiving the event) after we've already set the
virtual flag for the added address.  As the activation repopulates the
addresses on the interface, this cleared the flag and the address would
no longer be treated as virtual IP when installing routes for CHILD_SAs
that reference it in their local traffic selectors.

Closes strongswan/strongswan#1807

9 months agoMerge branch 'netlink-buf'
Tobias Brunner [Wed, 26 Jul 2023 13:15:24 +0000 (15:15 +0200)] 
Merge branch 'netlink-buf'

Fixes an infinite loop if e.g. Netlink event sockets get too many
packets queued and poll() just returns POLLERR for the socket.  Also
increases the default receive buffer size for Netlink sockets to better
support systems with lots of route updates.

Closes strongswan/strongswan#1757

9 months agowatcher: Change handling of POLLERR and remove WATCHER_EXCEPT
Tobias Brunner [Fri, 21 Jul 2023 08:01:41 +0000 (10:01 +0200)] 
watcher: Change handling of POLLERR and remove WATCHER_EXCEPT

We can't actually explicitly listen for errors by passing POLLERR in
`events` (the man page for poll() clearly states it's ignored).  On the
other hand, POLLERR can be returned for any FD and, even worse, it might
be the only event indicated.

The latter caused an infinite loop as we didn't notify the callback nor
clear the error by calling `getsockopt(..., SOL_SOCKET, SO_ERROR, ...)`.
And while the latter would be able to reset the state to break the loop,
it seems to leave the FD in a defunct state where no further events will
be returned by poll().  Notifying the callback works better (the error
is then reported by e.g. recvfrom()) and automatically happened already
if POLLERR was returned together with e.g. POLLIN.

So we now treat POLLERR like the other error indicators we handle (POLLHUP
and POLLINVAL) and just notify the callbacks.

9 months agokernel-netlink: Also set the receive buffer size on event sockets
Tobias Brunner [Fri, 21 Jul 2023 07:39:09 +0000 (09:39 +0200)] 
kernel-netlink: Also set the receive buffer size on event sockets

This was weirdly overlooked and could cause issues e.g. on hosts with
lots of route changes.