18673 Commits

Author SHA1 Message Date
Tobias Brunner
36490eefa3 backend-manager: Fix build with DEBUG_LEVEL < 3 2023-05-08 17:32:17 +02:00
Tobias Brunner
0841280cdd libimcv: Fix build with DEBUG_LEVEL < 3 2023-05-08 17:32:17 +02:00
Tobias Brunner
522bd965d1 libtpmtss: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
4a28488a7e tnccs-20: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
a0ee0cbf90 tnccs-11: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
874562fc1c radius-client: Fix build with DEBUG_LEVEL < 3 2023-05-08 17:32:17 +02:00
Tobias Brunner
6086029056 libtls: Fix build with DEBUG_LEVEL < 3 2023-05-08 17:32:17 +02:00
Tobias Brunner
bb06b7a4bb simaka-manager: Fix counter in log message when getting quintuplets
Also fixes the build with DEBUG_LEVEL < 1.
2023-05-08 17:32:17 +02:00
Tobias Brunner
777d0ef7b0 esp-packet: Fix build with DEBUG_LEVEL < 3 2023-05-08 17:32:17 +02:00
Tobias Brunner
1b58e8c386 drbg: Fix build with DEBUG_LEVEL < 4 2023-05-08 17:32:17 +02:00
Tobias Brunner
94cbd6469a bliss: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
b158c210cd sqlite: Fix build with DEBUG_LEVEL < 2 2023-05-08 14:07:18 +02:00
Tobias Brunner
a9a2c040ba pkcs7: Fix build with DEBUG_LEVEL < 2 2023-05-08 14:07:18 +02:00
Tobias Brunner
7ea431cf70 constraints: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:07:18 +02:00
Tobias Brunner
984f8cbcde revocation: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:07:18 +02:00
Tobias Brunner
c0a281472f x509: Fix build with DEBUG_LEVEL < 2 for structures that ignore unknown critical extensions 2023-05-08 14:07:18 +02:00
Tobias Brunner
a551f80e4f plugin-loader: Fix build with DEBUG_LEVEL < 3 2023-05-08 14:06:43 +02:00
Tobias Brunner
1b59031cc3 auth-cfg: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:06:43 +02:00
Tobias Brunner
5a98f8f4ab certificate: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:06:43 +02:00
Tobias Brunner
b39105b5b4 credential-factory: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:06:43 +02:00
Tobias Brunner
f73d8699b3 crypto-tester: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:06:43 +02:00
Tobias Brunner
d7750dff9b asn1: Fix build with DEBUG_LEVEL < 2 2023-05-08 14:06:43 +02:00
Tobias Brunner
2d4a98d0d3 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.
2023-05-08 11:51:10 +02:00
Tobias Brunner
7b453ae409 doxygen: Enable JS search engine 2023-05-04 16:35:51 +02:00
Tobias Brunner
8eaddbb805 doxygen: Fix syntax for some output parameters 2023-05-04 16:35:47 +02:00
Tobias Brunner
69914a2dc5 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
2023-05-01 10:19:59 +02:00
Tobias Brunner
5e46e101a6 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
2023-05-01 10:19:29 +02:00
Tobias Brunner
00a75e332f vici: Create default TCP socket on Windows in Python bindings
This uses the same value as VICI_DEFAULT_URI.

References strongswan/strongswan#1655
2023-05-01 10:19:29 +02:00
Tobias Brunner
d12e6c9e55 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.
2023-04-27 13:52:34 +02:00
Tobias Brunner
0bf061d737 leak-detective: Add on_exit(3) to whitelist
Seems to allocate some TLS value in newer glibc versions.
2023-04-27 13:52:34 +02:00
Tobias Brunner
d96d15b588 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.
2023-04-27 13:52:34 +02:00
Tobias Brunner
77b9f3abb0 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.
2023-04-27 13:52:34 +02:00
Tobias Brunner
30803f90eb 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).
2023-04-27 13:52:34 +02:00
Tobias Brunner
53208b0ba4 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.
2023-04-27 13:52:34 +02:00
Tobias Brunner
705a20619f 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.
2023-04-27 13:52:34 +02:00
Tobias Brunner
34e9cdbcac watcher: Log when watched FDs are added, removed or updated 2023-04-27 13:52:27 +02:00
Tobias Brunner
0a806d9717 watcher: Only log number of managed FDs
Adding the internal notify FD might be confusing.
2023-04-27 13:45:32 +02:00
Tobias Brunner
7c657e78ff 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.
2023-04-27 13:45:32 +02:00
Tobias Brunner
2cb6d144a6 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
2023-04-26 15:52:40 +02:00
Tobias Brunner
0615b86b49 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.
2023-04-25 12:19:49 +02:00
Andreas Steffen
b420857123 Version bump to 5.9.11dr3 5.9.11dr3 2023-04-21 16:36:23 +02:00
Andreas Steffen
47e8b21c76 cert_cache: Replace cached stale OCSP responses in-place 2023-04-21 16:04:26 +02:00
Andreas Steffen
ef94a5b4ab Version bump to 5.9.11dr2 5.9.11dr2 2023-04-19 04:24:18 +02:00
Harald Gutmann
5284cecddc 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
2023-04-03 15:10:37 +02:00
Harald Gutmann
f6dc47f591 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
2023-04-03 13:59:48 +02:00
Tobias Brunner
7a47adb4f0 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
2023-03-31 09:29:12 +02:00
Tobias Brunner
b4e1863fa6 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.
2023-03-31 09:11:20 +02:00
Tobias Brunner
e2a2674476 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.
2023-03-31 09:11:17 +02:00
Tobias Brunner
47d9590556 openssl: Add support for CMS-style signatures in PKCS#7 (RSA-PSS, ECDSA) 2023-03-30 10:46:46 +02:00
Tobias Brunner
5e76bc1634 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.
2023-03-30 10:46:46 +02:00