]> git.ipfire.org Git - thirdparty/strongswan.git/log
thirdparty/strongswan.git
2 years agopki: Make --dn optional for certificate renewals via --scep command
Tobias Brunner [Thu, 11 May 2023 10:29:10 +0000 (12:29 +0200)] 
pki: Make --dn optional for certificate renewals via --scep command

When using OpenXPKI, the subject DN in the renewal request has to match
the previous DN exactly.  However, because OpenXPKI may add a bunch of
DC/O RDNs to subjects of issued certificates, running --scep with the
same --dn that was used for the original request won't work (results in
a "Client error / malformed request badRequest" error even after enabling
`renewal_via_pkcs_req`).  This simplifies renewals as --dn can just be
omitted and extracted from the original certificate to avoid this issue.

References strongswan/strongswan#1689

2 years agoMerge branch 'debug-level-build'
Tobias Brunner [Tue, 16 May 2023 10:48:22 +0000 (12:48 +0200)] 
Merge branch 'debug-level-build'

This fixes the build with DEBUG_LEVEL < 4, which was broken when building
from the repository since --enable-warnings was made the default.

Although, most issues only occurred with the level reduced to 0/-1.  And
while removing debug statements at compile time completely is probably
not useful in production, there might be use cases in certain benchmarking
scenarios.  Also, with the recent changes to the controller there should
only rarely be a listener registered at a higher log level so the overhead
for those higher-level DBG statements is minimal.

Anyway, reducing the log level at compile time is a documented feature and
at least DEBUG_LEVEL=3 could be useful to prevent leaking sensitive
information via logs from the outset.  So we should make sure compilation
doesn't fail.

2 years agogithub: Add build with DBG completely disabled
Tobias Brunner [Mon, 1 May 2023 10:35:08 +0000 (12:35 +0200)] 
github: Add build with DBG completely disabled

2 years agosec-updater: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Tue, 2 May 2023 12:16:02 +0000 (14:16 +0200)] 
sec-updater: Fix build with DEBUG_LEVEL < 1

2 years agosw-collector: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Tue, 2 May 2023 12:15:43 +0000 (14:15 +0200)] 
sw-collector: Fix build with DEBUG_LEVEL < 1

2 years agoconftest: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Wed, 3 May 2023 10:31:45 +0000 (12:31 +0200)] 
conftest: Fix build with DEBUG_LEVEL < 1

2 years agopki: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 10:28:03 +0000 (12:28 +0200)] 
pki: Fix build with DEBUG_LEVEL < 1

2 years agoselinux: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 10:18:46 +0000 (12:18 +0200)] 
selinux: Fix build with DEBUG_LEVEL < 1

2 years agoradattr: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Wed, 3 May 2023 10:29:36 +0000 (12:29 +0200)] 
radattr: Fix build with DEBUG_LEVEL < 1

2 years agosystime-fix: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 10:17:25 +0000 (12:17 +0200)] 
systime-fix: Fix build with DEBUG_LEVEL < 1

2 years agokernel-netlink: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Mon, 1 May 2023 10:16:12 +0000 (12:16 +0200)] 
kernel-netlink: Fix build with DEBUG_LEVEL < 2

2 years agoha: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 10:14:57 +0000 (12:14 +0200)] 
ha: Fix build with DEBUG_LEVEL < 1

2 years agodhcp: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 10:12:54 +0000 (12:12 +0200)] 
dhcp: Fix build with DEBUG_LEVEL < 1

2 years agotnc-ifmap: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Wed, 3 May 2023 10:28:51 +0000 (12:28 +0200)] 
tnc-ifmap: Fix build with DEBUG_LEVEL < 2

2 years agoeap-peap: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Wed, 3 May 2023 10:27:48 +0000 (12:27 +0200)] 
eap-peap: Fix build with DEBUG_LEVEL < 1

2 years agoeap-ttls: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Wed, 3 May 2023 10:23:58 +0000 (12:23 +0200)] 
eap-ttls: Fix build with DEBUG_LEVEL < 1

2 years agoeap-radius: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 10:11:32 +0000 (12:11 +0200)] 
eap-radius: Fix build with DEBUG_LEVEL < 1

2 years agoeap-dynamic: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Wed, 3 May 2023 10:22:05 +0000 (12:22 +0200)] 
eap-dynamic: Fix build with DEBUG_LEVEL < 2

2 years agoeap-mschapv2: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 10:10:11 +0000 (12:10 +0200)] 
eap-mschapv2: Fix build with DEBUG_LEVEL < 1

2 years agovici: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Mon, 1 May 2023 10:06:59 +0000 (12:06 +0200)] 
vici: Fix build with DEBUG_LEVEL < 2

2 years agoforecast: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Wed, 3 May 2023 10:16:15 +0000 (12:16 +0200)] 
forecast: Fix build with DEBUG_LEVEL < 2

2 years agosave-keys: Fix build with DEBUG_LEVEL < 0
Tobias Brunner [Wed, 3 May 2023 08:52:14 +0000 (10:52 +0200)] 
save-keys: Fix build with DEBUG_LEVEL < 0

2 years agomode-config: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 10:05:59 +0000 (12:05 +0200)] 
mode-config: Fix build with DEBUG_LEVEL < 1

2 years agokeymat_v1: Fix build with DEBUG_LEVEL < 3
Tobias Brunner [Mon, 1 May 2023 10:05:02 +0000 (12:05 +0200)] 
keymat_v1: Fix build with DEBUG_LEVEL < 3

2 years agoike-init: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 10:04:22 +0000 (12:04 +0200)] 
ike-init: Fix build with DEBUG_LEVEL < 1

2 years agoike-config: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 10:03:06 +0000 (12:03 +0200)] 
ike-config: Fix build with DEBUG_LEVEL < 1

2 years agochild-create: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 09:59:46 +0000 (11:59 +0200)] 
child-create: Fix build with DEBUG_LEVEL < 1

2 years agopubkey-authenticator: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 09:57:16 +0000 (11:57 +0200)] 
pubkey-authenticator: Fix build with DEBUG_LEVEL < 1

2 years agoeap-authenticator: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 09:55:36 +0000 (11:55 +0200)] 
eap-authenticator: Fix build with DEBUG_LEVEL < 1

2 years agoike-sa: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 09:53:49 +0000 (11:53 +0200)] 
ike-sa: Fix build with DEBUG_LEVEL < 1

2 years agomessage: Fix build with DEBUG__LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 09:51:57 +0000 (11:51 +0200)] 
message: Fix build with DEBUG__LEVEL < 1

2 years agogenerator: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Mon, 1 May 2023 09:48:36 +0000 (11:48 +0200)] 
generator: Fix build with DEBUG_LEVEL < 2

2 years agobackend-manager: Fix build with DEBUG_LEVEL < 3
Tobias Brunner [Mon, 1 May 2023 09:44:17 +0000 (11:44 +0200)] 
backend-manager: Fix build with DEBUG_LEVEL < 3

2 years agolibimcv: Fix build with DEBUG_LEVEL < 3
Tobias Brunner [Tue, 2 May 2023 12:11:44 +0000 (14:11 +0200)] 
libimcv: Fix build with DEBUG_LEVEL < 3

2 years agolibtpmtss: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Tue, 2 May 2023 09:16:22 +0000 (11:16 +0200)] 
libtpmtss: Fix build with DEBUG_LEVEL < 2

2 years agotnccs-20: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Tue, 18 Apr 2023 15:35:36 +0000 (17:35 +0200)] 
tnccs-20: Fix build with DEBUG_LEVEL < 2

2 years agotnccs-11: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Mon, 1 May 2023 14:30:06 +0000 (16:30 +0200)] 
tnccs-11: Fix build with DEBUG_LEVEL < 2

2 years agoradius-client: Fix build with DEBUG_LEVEL < 3
Tobias Brunner [Tue, 18 Apr 2023 15:34:58 +0000 (17:34 +0200)] 
radius-client: Fix build with DEBUG_LEVEL < 3

2 years agolibtls: Fix build with DEBUG_LEVEL < 3
Tobias Brunner [Tue, 18 Apr 2023 14:57:16 +0000 (16:57 +0200)] 
libtls: Fix build with DEBUG_LEVEL < 3

2 years agosimaka-manager: Fix counter in log message when getting quintuplets
Tobias Brunner [Tue, 18 Apr 2023 14:51:21 +0000 (16:51 +0200)] 
simaka-manager: Fix counter in log message when getting quintuplets

Also fixes the build with DEBUG_LEVEL < 1.

2 years agoesp-packet: Fix build with DEBUG_LEVEL < 3
Tobias Brunner [Tue, 18 Apr 2023 14:49:26 +0000 (16:49 +0200)] 
esp-packet: Fix build with DEBUG_LEVEL < 3

2 years agodrbg: Fix build with DEBUG_LEVEL < 4
Tobias Brunner [Tue, 18 Apr 2023 14:48:08 +0000 (16:48 +0200)] 
drbg: Fix build with DEBUG_LEVEL < 4

2 years agobliss: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Mon, 1 May 2023 12:57:00 +0000 (14:57 +0200)] 
bliss: Fix build with DEBUG_LEVEL < 2

2 years agosqlite: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Tue, 18 Apr 2023 14:46:02 +0000 (16:46 +0200)] 
sqlite: Fix build with DEBUG_LEVEL < 2

2 years agopkcs7: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Tue, 18 Apr 2023 14:44:54 +0000 (16:44 +0200)] 
pkcs7: Fix build with DEBUG_LEVEL < 2

2 years agoconstraints: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 09:10:47 +0000 (11:10 +0200)] 
constraints: Fix build with DEBUG_LEVEL < 1

2 years agorevocation: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 09:07:18 +0000 (11:07 +0200)] 
revocation: Fix build with DEBUG_LEVEL < 1

2 years agox509: Fix build with DEBUG_LEVEL < 2 for structures that ignore unknown critical...
Tobias Brunner [Tue, 18 Apr 2023 14:42:30 +0000 (16:42 +0200)] 
x509: Fix build with DEBUG_LEVEL < 2 for structures that ignore unknown critical extensions

2 years agoplugin-loader: Fix build with DEBUG_LEVEL < 3
Tobias Brunner [Tue, 18 Apr 2023 14:38:18 +0000 (16:38 +0200)] 
plugin-loader: Fix build with DEBUG_LEVEL < 3

2 years agoauth-cfg: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 08:46:28 +0000 (10:46 +0200)] 
auth-cfg: Fix build with DEBUG_LEVEL < 1

2 years agocertificate: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 08:37:01 +0000 (10:37 +0200)] 
certificate: Fix build with DEBUG_LEVEL < 1

2 years agocredential-factory: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 08:38:24 +0000 (10:38 +0200)] 
credential-factory: Fix build with DEBUG_LEVEL < 1

2 years agocrypto-tester: Fix build with DEBUG_LEVEL < 1
Tobias Brunner [Mon, 1 May 2023 08:35:05 +0000 (10:35 +0200)] 
crypto-tester: Fix build with DEBUG_LEVEL < 1

2 years agoasn1: Fix build with DEBUG_LEVEL < 2
Tobias Brunner [Tue, 18 Apr 2023 14:34:38 +0000 (16:34 +0200)] 
asn1: Fix build with DEBUG_LEVEL < 2

2 years agodebug: Add macro to mark variables that are only used in DBG statements
Tobias Brunner [Mon, 1 May 2023 08:44:42 +0000 (10:44 +0200)] 
debug: Add macro to mark variables that are only used in DBG statements

Some variables that are only assigned to be used in DBG statements
will otherwise trigger a "set but not used" warning/error if DEBUG_LEVEL
is too low.

2 years agodoxygen: Enable JS search engine
Tobias Brunner [Thu, 4 May 2023 11:42:06 +0000 (13:42 +0200)] 
doxygen: Enable JS search engine

2 years agodoxygen: Fix syntax for some output parameters
Tobias Brunner [Thu, 4 May 2023 11:39:15 +0000 (13:39 +0200)] 
doxygen: Fix syntax for some output parameters

2 years agoikev1: Migrate CHILD_SAs when IKE_SA is reset during reauthentication
Tobias Brunner [Thu, 20 Apr 2023 08:22:31 +0000 (10:22 +0200)] 
ikev1: Migrate CHILD_SAs when IKE_SA is reset during reauthentication

When we reset the initiator SPI, we have to migrate the adopted children
again so the correct IKE_SA can later be checked out.

Closes strongswan/strongswan#1663

2 years agovici: Improve log messages for terminate/rekey() in case of combined filters
Tobias Brunner [Thu, 27 Apr 2023 14:34:23 +0000 (16:34 +0200)] 
vici: Improve log messages for terminate/rekey() in case of combined filters

As long as any `child*` selector is received, only CHILD_SAs will be
terminated or rekeyed.  Any passed `ike*` selectors will only be used to
filter the IKE_SAs when looking for matching CHILD_SAs.  However, the
previous log messages seemed to indicate that IKE_SAs will also be
terminated/rekeyed.

References strongswan/strongswan#1655

2 years agovici: Create default TCP socket on Windows in Python bindings
Tobias Brunner [Thu, 20 Apr 2023 14:26:52 +0000 (16:26 +0200)] 
vici: Create default TCP socket on Windows in Python bindings

This uses the same value as VICI_DEFAULT_URI.

References strongswan/strongswan#1655

2 years agocharon-systemd: Add a log message when the daemon is starting
Tobias Brunner [Wed, 19 Apr 2023 14:10:26 +0000 (16:10 +0200)] 
charon-systemd: Add a log message when the daemon is starting

While there is a status message sent to systemd (can be seen e.g. in
systemctl status), the version etc. is currently not logged to the
journal, syslog or any log files.

2 years agoleak-detective: Add `on_exit(3)` to whitelist
Tobias Brunner [Tue, 18 Apr 2023 12:17:37 +0000 (14:17 +0200)] 
leak-detective: Add `on_exit(3)` to whitelist

Seems to allocate some TLS value in newer glibc versions.

2 years agocontroller: Add parameter for maximum log level to initiate/terminate_*()
Tobias Brunner [Wed, 19 Apr 2023 14:21:48 +0000 (16:21 +0200)] 
controller: Add parameter for maximum log level to initiate/terminate_*()

Previously, the logger installed by the controller always announced
LEVEL_PRIVATE(4), which produced completely useless logging calls with
the common clients (vici/stroke) whose default log level is LEVEL_CTRL(1).
This can produce quite some overhead if there are e.g. a lot of concurrent
initiate() calls.

2 years agocontroller: Ignore log messages unrelated to IKE_SA affected by a command
Tobias Brunner [Wed, 19 Apr 2023 14:17:18 +0000 (16:17 +0200)] 
controller: Ignore log messages unrelated to IKE_SA affected by a command

Until we know which IKE_SA is affected by an initiate() or terminate_*()
command, unrelated log messages that don't have any IKE context (i.e.
the passed `ike_sa` is NULL) would previously get logged.

2 years agowatcher: Prevent busy wait if callback is active and other FDs have events
Tobias Brunner [Tue, 18 Apr 2023 16:18:48 +0000 (18:18 +0200)] 
watcher: Prevent busy wait if callback is active and other FDs have events

Exiting the loop previously could cause watcher to busy wait (i.e.
rebuild the array and call poll() repeatedly) until the active callback
was done.

Assume watcher observes two FDs 15 and 22, which are in the list in that
order.  FD 15 is signaled and its callback gets triggered.  The array of
FDs is rebuilt and does not include 15 anymore.  Now FD 22 is ready for
reading.  However, when enumerating all registered FDs, the loop previously
was exited when reaching FD 15 and seeing that it's active.  FD 22 was
never checked and the array was immediately rebuilt and poll() called.
If the callback for 15 took longer, this was repeated over and over.

This basically reverts d16d5a245f0b ("watcher: Avoid queueing multiple
watcher callbacks at the same time"), whose goal is quite unclear to me.
If it really wanted to allow only a single callback for all FDs, it didn't
achieve that as any FD before an active one would get notified and if
multiple FDs are ready concurrently, they'd all get triggered too.
Skipping entries with active callback makes sense as it avoids a lookup
in the FD array and subsequent revents checks.  But why would we need to
rebuild the array if we see such an entry?  Once the callback is done,
the watcher is notified and the array rebuilt anyway (also if any other
FD was ready and jobs get queued).

2 years agowatcher: Move debug log messages out of mutex
Tobias Brunner [Tue, 18 Apr 2023 13:59:34 +0000 (15:59 +0200)] 
watcher: Move debug log messages out of mutex

The list of FDs is recreated quite often (e.g. due to the kernel-netlink
event sockets) and if a logger depends on watcher_t in some way this
might cause conflicts if the mutex is held.

2 years agowatcher: Make sure to re-activate the correct entry after a callback
Tobias Brunner [Tue, 18 Apr 2023 13:55:10 +0000 (15:55 +0200)] 
watcher: Make sure to re-activate the correct entry after a callback

Since the same FD may be added multiple times (e.g. with separate
callbacks for WATCHER_READ and WATCHER_WRITE), the previous check
might not have found the correct entry.  As the entry can't be removed
while in a callback, the pointer comparison is fine.

2 years agowatcher: Log when watched FDs are added, removed or updated
Tobias Brunner [Tue, 18 Apr 2023 13:52:23 +0000 (15:52 +0200)] 
watcher: Log when watched FDs are added, removed or updated

2 years agowatcher: Only log number of managed FDs
Tobias Brunner [Tue, 18 Apr 2023 13:50:42 +0000 (15:50 +0200)] 
watcher: Only log number of managed FDs

Adding the internal notify FD might be confusing.

2 years agowatcher: Avoid logging on level 1 while holding the mutex
Tobias Brunner [Tue, 18 Apr 2023 13:46:29 +0000 (15:46 +0200)] 
watcher: Avoid logging on level 1 while holding the mutex

This could be problematic in case loggers in some way rely on watcher_t
themselves.  This particular log message should rarely occur if at all,
but still avoid holding the mutex.

2 years agovici: Don't lock connection in write mode when enabling on_write() callback
Tobias Brunner [Thu, 13 Apr 2023 11:55:00 +0000 (13:55 +0200)] 
vici: Don't lock connection in write mode when enabling on_write() callback

This should prevent a deadlock that could previously be caused when a
control-log event was raised.  The deadlock looked something like this:

 * Thread A holds the read lock on bus_t and raises the control-log event.
   This requires acquiring the connection entry in write mode to queue the
   outgoing message.  If it is already held by another thread, this blocks
   on a condvar.

 * Thread B is registering the on_write() callback on the same connection's
   stream due to a previous log message.  Before this change, the code
   acquired the entry in write mode as well, thus, blocking thread A.  To
   remove/add the stream, the mutex in watcher_t needs to be acquired.

 * Thread C is in watcher_t's watch() and holds the mutex while logging on
   level 2 or 3.  The latter requires the read lock on bus_t, which should
   usually be acquirable even if thread A holds it.  Unless writers are
   concurrently waiting on the lock and the implementation is blocking
   new readers to prevent writer starvation.

 * Thread D is removing a logger from the bus (e.g. after an initiate()
   call) and is waiting to acquire the write lock on bus_t and is thereby
   blocking thread C.

With this change, thread B should not block thread A anymore.  So thread D
and thread C should eventually be able to proceed as well.

Thread A could be held up a bit if there is a thread already sending
messages for the same connection, but that should only cause a delay, no
deadlock, as on_write() and do_write() don't log (or lock) anything while
keeping the entry locked in write mode.

Closes strongswan/strongswan#566

2 years agosonarcloud: Ignore "User-defined types should not be passed as variadic arguments"
Tobias Brunner [Tue, 25 Apr 2023 10:19:49 +0000 (12:19 +0200)] 
sonarcloud: Ignore "User-defined types should not be passed as variadic arguments"

This triggers an error for functions that take chunk_t as variadic
arguments (cat, debug, builders, ASN.1 wrap).

Since we are not using C++, this should be fine as we are only passing
POD types anyway.

2 years agoVersion bump to 5.9.11dr3 5.9.11dr3
Andreas Steffen [Fri, 21 Apr 2023 14:36:23 +0000 (16:36 +0200)] 
Version bump to 5.9.11dr3

2 years agocert_cache: Replace cached stale OCSP responses in-place
Andreas Steffen [Fri, 21 Apr 2023 14:04:26 +0000 (16:04 +0200)] 
cert_cache: Replace cached stale OCSP responses in-place

2 years agoVersion bump to 5.9.11dr2 5.9.11dr2
Andreas Steffen [Wed, 19 Apr 2023 02:24:18 +0000 (04:24 +0200)] 
Version bump to 5.9.11dr2

2 years agopki: Filter whitespace in base64 encoded EST responses
Harald Gutmann [Fri, 31 Mar 2023 11:38:48 +0000 (13:38 +0200)] 
pki: Filter whitespace in base64 encoded EST responses

As clarified in RFC 8951, section 3.1 [1].

[1] https://www.rfc-editor.org/rfc/rfc8951#name-white-space-processing

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
Closes strongswan/strongswan#1616

2 years agopki: Add support for EST server label
Harald Gutmann [Sat, 18 Mar 2023 22:31:39 +0000 (23:31 +0100)] 
pki: Add support for EST server label

As specified in EST RFC 7030, Section 3.1 [1].

[1] https://www.rfc-editor.org/rfc/rfc7030.html#section-3.1

2 years agoMerge branch 'pkcs7-signatures'
Tobias Brunner [Fri, 31 Mar 2023 07:29:12 +0000 (09:29 +0200)] 
Merge branch 'pkcs7-signatures'

Adds support for CMS-style signatures in PKCS#7 containers, which allows
verifying RSA-PSS and ECDSA signatures.

Ed25519 signatures should be supported when verifying, however, they
currently can't be created.  Ed448 signatures are currently not supported.
That's because RFC 8419 has very strict requirements in regards to the
hash algorithms used for signed attributes.  With Ed25519 only SHA-512 is
allowed (pki currently has an issue with Ed25519 in combination with
SHA-512 due to its associated HASH_IDENTITY) and with Ed448 only SHAKE256
with 512-bit output, which has to be encoded in the algorithmIdentifier
parameters (something we currently don't support at all).

Closes strongswan/strongswan#1615

2 years agopki: Allow specifying signature scheme for PKCS#7 signatures
Tobias Brunner [Thu, 30 Mar 2023 09:19:28 +0000 (11:19 +0200)] 
pki: Allow specifying signature scheme for PKCS#7 signatures

Also changed the error handling a bit so it is more like in the other
pki commands.

2 years agopki: Unify parsing of RSA padding scheme and fix disabling PSS
Tobias Brunner [Thu, 30 Mar 2023 12:23:38 +0000 (14:23 +0200)] 
pki: Unify parsing of RSA padding scheme and fix disabling PSS

If PSS padding is enabled by default, not all commands allowed disabling
it explicitly.

2 years agoopenssl: Add support for CMS-style signatures in PKCS#7 (RSA-PSS, ECDSA)
Tobias Brunner [Fri, 24 Mar 2023 16:17:37 +0000 (17:17 +0100)] 
openssl: Add support for CMS-style signatures in PKCS#7 (RSA-PSS, ECDSA)

2 years agopkcs7: Add support for CMS-style signatures (RSA-PSS, ECDSA)
Tobias Brunner [Fri, 24 Mar 2023 16:04:42 +0000 (17:04 +0100)] 
pkcs7: Add support for CMS-style signatures (RSA-PSS, ECDSA)

For the legacy schemes with rsaEncryption nothing changes, but if an
actual signature scheme is encoded we use that to find the key and
verify the signature.

The descriptions for the PKCS#7 structure are adapted for CMS.

2 years agoasn1: Allow suppressing log messages when parsing algorithm identifiers
Tobias Brunner [Fri, 24 Mar 2023 16:00:10 +0000 (17:00 +0100)] 
asn1: Allow suppressing log messages when parsing algorithm identifiers

2 years agobotan: Pass n and e separately for RSA public keys
Tobias Brunner [Mon, 27 Mar 2023 14:40:31 +0000 (16:40 +0200)] 
botan: Pass n and e separately for RSA public keys

Some encoders, like those provided by the dnskey and sshkey plugins,
require these separately when encoding keys.

Also fixes the type for the ASN.1 encoding (which is a subjectPublicKeyInfo
structure) depending on the key type.  This worked fine for PEM encoding
as the pem plugin doesn't care what the actual type of the key is (which
is encoded in the SPKI structure), but other plugins do (e.g. the sshkey
plugin).

2 years agoipseckey: Add support for ECDSA and EdDSA public keys
Tobias Brunner [Thu, 23 Mar 2023 12:51:33 +0000 (13:51 +0100)] 
ipseckey: Add support for ECDSA and EdDSA public keys

2 years agoUse wolfSSL 5.6.0 for tests
Tobias Brunner [Mon, 27 Mar 2023 09:51:48 +0000 (11:51 +0200)] 
Use wolfSSL 5.6.0 for tests

The `--enable-heapmath` configure option has been deprecated.  As
already described in eae30af029b1 ("Use wolfSSL 5.4.0 for tests"), the
alternative is to configure `--with-max-rsa-bits=8192` instead in order
to test the modp6144 and modp8192 DH groups.

2 years agoVersion bump to 5.9.11dr1 5.9.11dr1
Andreas Steffen [Tue, 28 Mar 2023 14:27:04 +0000 (16:27 +0200)] 
Version bump to 5.9.11dr1

2 years agorevocation: Suppress some log messages for cached OCSP responses
Tobias Brunner [Mon, 27 Mar 2023 15:32:57 +0000 (17:32 +0200)] 
revocation: Suppress some log messages for cached OCSP responses

We don't have any information on the issuer of cached OCSP responses, in
particular if the OCSP response is issued by a dedicated OCSP signer,
whose certificate might not be contained in the response or even signed
by the same CA but could just be locally installed.  So the only way to
determine if a response applies to the current certificate and its CA
is searching for the response's issuer certificate and verifying that.

However, when using multiple CAs that provide revocation checking via
OCSP, in particular with multi-level CAs (e.g. like the
ikev2-multi-ca/ocsp-signers test scenario), we might have unrelated OCSP
responses in the cache when verifying a particular certificate.  In this
case we don't need any confusing

  ocsp response verification failed, no signer certificate '...' found

error messages because the response was for a different CA.

Similarly, if lots of clients of the same CA connect there could be lots
of OCSP responses in the cache that, while being applicable to the current
CA, don't have any information on the certificate we are currently
checking.  In this case all the

  ocsp response correctly signed by "..."
  ocsp response contains no status on our certificate

messages don't provide any value.

In the mentioned test scenario, we suppress the

  ocsp response verification failed, no signer certificate 'C=CH, O=strongSwan Project, OU=Research OCSP Signing Authority, CN=ocsp.research.strongswan.org' found

message from the cached OCSP response for carol's end-entity certificate
when verifying the "Research" intermediate CA certificate that issued
carol's certificate.

Then the

  ocsp response verification failed, no signer certificate 'C=CH, O=strongSwan Project, OU=Research OCSP Signing Authority, CN=ocsp.research.strongswan.org' found
  ocsp response verification failed, no signer certificate 'C=CH, O=strongSwan Project, OU=OCSP Signing Authority, CN=ocsp.strongswan.org' found

messages from the cached OCSP responses for carol's end-entity and
intermediate CA certificates when verifying dave's end-entity certificate.

And finally the

  ocsp response verification failed, no signer certificate 'C=CH, O=strongSwan Project, OU=Research OCSP Signing Authority, CN=ocsp.research.strongswan.org' found
    ocsp response correctly signed by "C=CH, O=strongSwan Project, OU=OCSP Signing Authority, CN=ocsp.strongswan.org"
    ocsp response contains no status on our certificate
  ocsp response verification failed, no signer certificate 'C=CH, O=strongSwan Project, OU=Sales OCSP Signing Authority, CN=ocsp.sales.strongswan.org' found

messages from the cached OCSP responses for carol's end-entity
certificate, the applicable but unrelated response for carol's "Research"
intermediate CA certificate and the response for dave's end-entity
certificate when verifying dave's "Sales" intermediate CA.

2 years agotesting: Fix installation of swid-generator with newer versions of setuptools
Tobias Brunner [Tue, 28 Mar 2023 09:55:17 +0000 (11:55 +0200)] 
testing: Fix installation of swid-generator with newer versions of setuptools

With version 60.0.0 setuptools changed to a local installation of
distutils.  This seems to break the installation of swid-generator (causing
an `importlib.metadata.PackageNotFoundError: swid-generator` error).

Note that while Debian ships setuptools 52.0.0, `python-daemon` recently
added a dependency on `setuptools>=62.4.0`, which installs that version
that's then later used to install swid-generator.

The main difference seems to be that the local version installs the
package in `/usr/lib/python3.9/site-packages`, while the stdlib version
does so in `/usr/local/lib/python3.9/dist-packages` (similarly for the
`swid_generator` script and the `distro` dependency).

Not sure if there is a better/proper way to fix this.  Might just be an
issue with Debian bullseye and mixing system packages with those installed
via pip3.

2 years agoMerge branch 'crl-sign'
Tobias Brunner [Fri, 24 Mar 2023 16:34:05 +0000 (17:34 +0100)] 
Merge branch 'crl-sign'

Enforces that the certificate that signed a CRL either encodes the
cRLSign keyUsage (even if it is a CA certificate) or is a CA certificate
without a keyUsage extension (which should rarely be the case nowadays).

This is in compliance with RFC 5280, section 6.3.3. (f):

  If a key usage extension is present in the CRL issuer's certificate,
  verify that the cRLSign bit is set.

strongSwan encodes a keyUsage extension with cRLSign bit set in all CA
certificates it generates since 1ec8f22de222 ("set Certificate Sign and
CRL Sign flags in keyUsage extension if CA is true"), which was 13 years
ago.  Before that the extension was not encoded so those CA certificates
would also still be accepted as CRL issuer (if they are still valid, but
considering the SHA-1 deprecation that happened since then, they were
most likely replaced anyway).

References strongswan/strongswan#1548

2 years agoopenssl: Only allow certificates with cRLSign keyUsage to sign CRLs
Tobias Brunner [Wed, 22 Feb 2023 16:21:15 +0000 (17:21 +0100)] 
openssl: Only allow certificates with cRLSign keyUsage to sign CRLs

2 years agox509: Only allow certificates with cRLSign keyUsage to sign CRLs
Tobias Brunner [Wed, 22 Feb 2023 16:20:07 +0000 (17:20 +0100)] 
x509: Only allow certificates with cRLSign keyUsage to sign CRLs

2 years agoopenssl: Set X509_CRL_SIGN for CA certificates without keyUsage extension
Tobias Brunner [Wed, 22 Feb 2023 16:18:36 +0000 (17:18 +0100)] 
openssl: Set X509_CRL_SIGN for CA certificates without keyUsage extension

2 years agox509: Set X509_CRL_SIGN for CA certificates without keyUsage extension
Tobias Brunner [Wed, 22 Feb 2023 16:18:14 +0000 (17:18 +0100)] 
x509: Set X509_CRL_SIGN for CA certificates without keyUsage extension

2 years agoappveyor: Build eap-radius plugin on Windows
Tobias Brunner [Wed, 8 Mar 2023 14:33:43 +0000 (15:33 +0100)] 
appveyor: Build eap-radius plugin on Windows

2 years agolibradius: Link to winsock32 on Windows
Tobias Brunner [Wed, 8 Mar 2023 14:55:38 +0000 (15:55 +0100)] 
libradius: Link to winsock32 on Windows

2 years agoeap-radius: Don't include socket.h explicitly
Tobias Brunner [Wed, 8 Mar 2023 14:31:42 +0000 (15:31 +0100)] 
eap-radius: Don't include socket.h explicitly

We rely on the includes via utils.h so this compiles on Windows.

2 years agowindows: Fix compat define for sendto(2)
Tobias Brunner [Wed, 8 Mar 2023 14:05:42 +0000 (15:05 +0100)] 
windows: Fix compat define for sendto(2)

2 years agokernel-wfp: Install bypass policies also on FWPM_SUBLAYER_IPSEC_TUNNEL sublayer
Tobias Brunner [Wed, 1 Mar 2023 16:08:37 +0000 (17:08 +0100)] 
kernel-wfp: Install bypass policies also on FWPM_SUBLAYER_IPSEC_TUNNEL sublayer

This is apparently necessary to bypass tunnel mode SAs/policies.

References strongswan/strongswan#1552

2 years agowindows: Fix invalid pointer dereference when terminating service thread
Tobias Brunner [Tue, 7 Mar 2023 15:57:27 +0000 (16:57 +0100)] 
windows: Fix invalid pointer dereference when terminating service thread

When running as a service, the libraries are initialized/deinitialized
not by the main thread but by a separate thread that runs the registered
main service procedure.  When the service is stopped, the libraries are
deinitialized by that thread and the thread lock and hashtable are
destroyed.  But afterwards the DllMain callback is also triggered for
that thread so we have to prevent it from accessing these objects again.

References strongswan/strongswan#1567