]> git.ipfire.org Git - thirdparty/strongswan.git/log
thirdparty/strongswan.git
2 years agokernel-netlink: Explicitly ignore the result of setsockopt()
Tobias Brunner [Thu, 22 Dec 2022 11:55:05 +0000 (12:55 +0100)] 
kernel-netlink: Explicitly ignore the result of setsockopt()

2 years agoFixed some typos, courtesy of codespell
Tobias Brunner [Thu, 22 Dec 2022 10:08:20 +0000 (11:08 +0100)] 
Fixed some typos, courtesy of codespell

2 years agoVersion bump to 5.9.9rc1 5.9.9rc1
Andreas Steffen [Thu, 22 Dec 2022 12:24:34 +0000 (13:24 +0100)] 
Version bump to 5.9.9rc1

2 years agoMake format string a string literal in some debug statements
Thomas Egerer [Thu, 20 Oct 2022 16:10:29 +0000 (16:10 +0000)] 
Make format string a string literal in some debug statements

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2 years agoUse wolfSSL 5.5.4 for tests
Tobias Brunner [Wed, 21 Dec 2022 15:41:36 +0000 (16:41 +0100)] 
Use wolfSSL 5.5.4 for tests

2 years agokernel-netlink: Log extended ACK error/warning messages
Tobias Brunner [Tue, 20 Dec 2022 16:36:51 +0000 (17:36 +0100)] 
kernel-netlink: Log extended ACK error/warning messages

With newer kernels (basic support for extended ACKs is there since 4.12
but some messages for XFRM were only added with 6.1) this gives more
detailed error messages to the user than e.g. a generic EINVAL or ENOSYS
error would.

Also enabled omitting the request payload in NLMSG_ERROR messages.

2 years agoresolve: Don't install individual servers via resolvconf
Tobias Brunner [Tue, 13 Dec 2022 09:50:06 +0000 (10:50 +0100)] 
resolve: Don't install individual servers via resolvconf

The resolvconf implementation provided by systemd via resolvectl strips
everything after the interface name, so each additional server that's
installed replaces the previous one.  And even for other resolvconf
implementations installing them individually doesn't seem necessary as
we track and refcount them anyway.

Closes strongswan/strongswan#1353

2 years agoresolve: Avoid dots in protocol part of interface names when using resolvconf
Tobias Brunner [Wed, 19 Oct 2022 13:55:04 +0000 (15:55 +0200)] 
resolve: Avoid dots in protocol part of interface names when using resolvconf

Newer releases of systemd contain a change that removes not the part
after the first dot but the part after the last when determining the
interface name (apparently some interface names actually contain a dot).

This changes the default prefix to only contain one dot and avoids the
dots added by IPv4 addresses to create a unique interface/protocol for
each DNS server (it also replaces the `:` in IPv6 addresses with
something that might cause less conflicts).

References strongswan/strongswan#1353

2 years agoresolve: Make path to resolvconf(8) configurable
Tobias Brunner [Mon, 15 Nov 2021 14:19:07 +0000 (15:19 +0100)] 
resolve: Make path to resolvconf(8) configurable

Prefer the configured command over finding it at the default location
over installing in the configured file.

References strongswan/strongswan#744

2 years agogithub: Adapt TKM build to changed plugin list
Tobias Brunner [Wed, 14 Dec 2022 15:35:03 +0000 (16:35 +0100)] 
github: Adapt TKM build to changed plugin list

2 years agocharon-tkm: Use built-in plugins instead of OpenSSL
Tobias Brunner [Thu, 1 Dec 2022 16:58:08 +0000 (17:58 +0100)] 
charon-tkm: Use built-in plugins instead of OpenSSL

Since the encryption has been moved into the TKM we don't rely on many
cryptographic operations.  Mainly SHA-1 that's used in IKEv2 (NAT-D) and
for some internal hashes (cookies, message duplicate detection), and
certificate and public key parsing (not the actual signature/chain
verification, which is done by the TKM).

2 years agosha1: Clarify license of the implementation
Tobias Brunner [Thu, 1 Dec 2022 16:52:14 +0000 (17:52 +0100)] 
sha1: Clarify license of the implementation

2 years agogithub: Use tpm2-tss 3.2.1 for tests
Tobias Brunner [Tue, 13 Dec 2022 15:32:02 +0000 (16:32 +0100)] 
github: Use tpm2-tss 3.2.1 for tests

2 years agovici: Add Python 3.10 and 3.11
Tobias Brunner [Mon, 12 Dec 2022 14:55:08 +0000 (15:55 +0100)] 
vici: Add Python 3.10 and 3.11

2 years agogithub: Fix Python build with custom OpenSSL version
Tobias Brunner [Mon, 12 Dec 2022 14:12:11 +0000 (15:12 +0100)] 
github: Fix Python build with custom OpenSSL version

2 years agoMerge branch 'vici-python-timeout'
Tobias Brunner [Mon, 12 Dec 2022 13:38:46 +0000 (14:38 +0100)] 
Merge branch 'vici-python-timeout'

Closes strongswan/strongswan#1416

2 years agovici: Gracefully consume/ignore incoming events in Python event deregistration
Martin Willi [Mon, 14 Nov 2022 10:55:30 +0000 (11:55 +0100)] 
vici: Gracefully consume/ignore incoming events in Python event deregistration

When issuing a deregistration message, some last events may still be sent
by the daemon before deregistration completes. Ignore such event messages
silently during deregistration, avoiding exceptions like:

  vici.exception.SessionException:
    Unexpected response type 7, expected '5' (EVENT_CONFIRM)

2 years agovici: Add some initial session level unit-tests
Martin Willi [Fri, 4 Nov 2022 13:46:53 +0000 (14:46 +0100)] 
vici: Add some initial session level unit-tests

2 years agovici: Add simple Python transport layer tests, including timeout
Martin Willi [Fri, 4 Nov 2022 12:40:32 +0000 (13:40 +0100)] 
vici: Add simple Python transport layer tests, including timeout

2 years agovici: Allow the Python event listen() operation to optionally time out
Martin Willi [Fri, 4 Nov 2022 11:00:28 +0000 (12:00 +0100)] 
vici: Allow the Python event listen() operation to optionally time out

The architecture of the Python client is completely blocking, which is fine
for many simple scripts. For more complex applications that do other I/O
and listen for vici events, the most feasible way to integrate the client is
to use a dedicated thread.

Unfortunately, Python has no simple support for thread cancellation. And
having that thread in a blocking recv() does not allow to terminate the
thread gracefully with an Event or the like.

As a way out, add a timeout to the listen() call, so the thread can
periodically do other things, like checking for termination Event and
react on it. Returning from listen() on timeout can be suboptimal, though,
as it involves registration/deregistration for events, including the risk
for missing events while not registered. So return a (None, None) tuple
instead on timeout, allowing the caller to periodically do other things
while staying registered for the events and continue in listen().

The timeout applies to the socket recv() for the start of the header, only,
so a message is either read in full or times out, avoiding the risk
of breaking message framing on the stream with partial reads.

2 years agovici: Remove support for Python 2
Martin Willi [Fri, 4 Nov 2022 12:26:35 +0000 (13:26 +0100)] 
vici: Remove support for Python 2

Python 2 is dead and unmaintained for a while now. Time to stop carrying
on its support.

2 years agovici: Base default soft lifetime on hard lifetime if configured
Tobias Brunner [Tue, 6 Dec 2022 16:33:20 +0000 (17:33 +0100)] 
vici: Base default soft lifetime on hard lifetime if configured

Depending on the configured hard lifetime the default soft lifetime
might not make sense and could even cause rekeying to get disabled.
To avoid that, derive the soft lifetime from the hard lifetime so it's
10% higher than the soft lifetime.

References strongswan/strongswan#1414

2 years agochild-cfg: Fix apply_jitter() in case jitter is bigger than rekey value
Dmitriy Alexandrov [Mon, 14 Nov 2022 10:09:52 +0000 (14:09 +0400)] 
child-cfg: Fix apply_jitter() in case jitter is bigger than rekey value

Also avoid returning 0 and disabling rekeying in the rare case of
`jitter = rekey` and the `1/jitter` chance of that happening (returning
1 at least doesn't disable rekeying).

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

2 years agogithub: CodeQL currently doesn't support ccache
Tobias Brunner [Tue, 6 Dec 2022 08:39:50 +0000 (09:39 +0100)] 
github: CodeQL currently doesn't support ccache

Just disable it but keep everything in place for now.

2 years agotesting: Check canonical OCSP/CRL serial numbers
Andreas Steffen [Wed, 23 Nov 2022 09:48:38 +0000 (10:48 +0100)] 
testing: Check canonical OCSP/CRL serial numbers

2 years agounit-tests: Check encoding/retrieval of serial numbers
Andreas Steffen [Sat, 19 Nov 2022 11:27:49 +0000 (12:27 +0100)] 
unit-tests: Check encoding/retrieval of serial numbers

2 years agocertificates: Retrieve serial numbers in canonical form
Andreas Steffen [Sun, 20 Nov 2022 10:27:34 +0000 (11:27 +0100)] 
certificates: Retrieve serial numbers in canonical form

The x509 plugin retrieves serial numbers with two's complement
encoding whereas the openssl plugin partially returns them without
leading zeroes.

Serial numbers in X.509 certificates, X.509 CRL, X.509 attribute
certificates, OCSP Requests and OCSP responses are now returned in
canonical form without prepended zero octets.

2 years agogithub: Remove obsolete LGTM workflow
Tobias Brunner [Fri, 2 Dec 2022 08:50:43 +0000 (09:50 +0100)] 
github: Remove obsolete LGTM workflow

lgtm.com will be shutdown soon.

2 years agogithub: Add CodeQL workflow
Tobias Brunner [Thu, 1 Dec 2022 17:17:28 +0000 (18:17 +0100)] 
github: Add CodeQL workflow

2 years agogithub: Fix path to Android lint report
Tobias Brunner [Thu, 1 Dec 2022 15:40:54 +0000 (16:40 +0100)] 
github: Fix path to Android lint report

Has a -debug suffix now.

2 years agogithub: Update GitHub-provided actions so they don't use deprecated Node.js 12
Tobias Brunner [Thu, 1 Dec 2022 13:21:21 +0000 (14:21 +0100)] 
github: Update GitHub-provided actions so they don't use deprecated Node.js 12

2 years agogithub: Adapt to switch to Ubuntu 22.04 for ubuntu-latest
Tobias Brunner [Mon, 28 Nov 2022 16:01:45 +0000 (17:01 +0100)] 
github: Adapt to switch to Ubuntu 22.04 for ubuntu-latest

Ubuntu 22.04 ships OpenSSL 3, which requires debug symbols so we can
whitelist leaks because we don't deinitialize the library.  And because
the shipped library is not built with `-fno-omit-frame-pointer`, the
build with AddressSanitizer can't use its fast stack unwind method.
However, the previous workaround for DTLS handling with glibc apparently
isn't necessary anymore.

In the custom OpenSSL build we drop no-stdio as that lets the configure
check for libldns fail because ERR_print_errors_fp@OPENSSL_3.0.0 is not
found.

For ccache, the default path to the cache directory has changed.

Also simplified the NM tests as there is only one build since
085daf474330 ("nm: Remove old libnm-glib compat stuff").

2 years agogithub: Set timeout for tests on macOS
Tobias Brunner [Thu, 1 Dec 2022 12:33:01 +0000 (13:33 +0100)] 
github: Set timeout for tests on macOS

They sometimes hang (without our internal timeout catching them).
So instead of waiting for hours, let them get aborted earlier.

2 years agofuzz: Force `make check` to fail if fuzz target fails
Tobias Brunner [Thu, 1 Dec 2022 15:31:23 +0000 (16:31 +0100)] 
fuzz: Force `make check` to fail if fuzz target fails

2 years agoleak-detective: Whitelist additional OpenSSL 3 functions
Tobias Brunner [Thu, 1 Dec 2022 08:40:21 +0000 (09:40 +0100)] 
leak-detective: Whitelist additional OpenSSL 3 functions

These are necessary when building against the OpenSSL 3 version shipped
with Ubuntu (the first is only seen when built with --enable-bfd-backtraces).

2 years agobacktrace: Suppress internal errors by libbfd
Tobias Brunner [Thu, 1 Dec 2022 08:31:44 +0000 (09:31 +0100)] 
backtrace: Suppress internal errors by libbfd

At least since Ubuntu 22.04 there are lots of (apparently non-fatal)
"DWARF error: could not find variable specification" errors generated
by bfd_find_nearest_line().  This also happens with addr2line, which
internally uses libbfd.  No idea what the actual issue is (it still
happens with binutils 2.39 in Ubuntu 22.10), but since it doesn't seem
to affect the functionality we need this avoids filling the test logs
with useless messages.

2 years agobacktrace: Add ability to lookup function names via libbfd
Tobias Brunner [Thu, 1 Dec 2022 08:29:17 +0000 (09:29 +0100)] 
backtrace: Add ability to lookup function names via libbfd

dladdr() is not always able to determine the function names while
libbfd often can in such cases.

2 years agoaf-alg: Fix compiler warning
Tobias Brunner [Thu, 1 Dec 2022 08:27:44 +0000 (09:27 +0100)] 
af-alg: Fix compiler warning

2 years agofarp: Remove unused variable
Tobias Brunner [Tue, 29 Nov 2022 16:56:40 +0000 (17:56 +0100)] 
farp: Remove unused variable

2 years agonm: Ignore lock file left behind by newer versions of intltool
Tobias Brunner [Tue, 29 Nov 2022 16:55:37 +0000 (17:55 +0100)] 
nm: Ignore lock file left behind by newer versions of intltool

2 years agothread: Exclude thread_main() from AddressSanitizer
Tobias Brunner [Tue, 29 Nov 2022 15:51:06 +0000 (16:51 +0100)] 
thread: Exclude thread_main() from AddressSanitizer

With GCC 11.3 AddressSanitizer causes the following crash when a thread
is cancelled (e.g. in the test_condvar_cancel test):

==84365==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/asan/asan_thread.cpp:367 "((ptr[0] == kCurrentStackFrameMagic)) != (0)" (0x0, 0x0)
    #0 0x7ff0801b2988 in AsanCheckFailed ../../../../src/libsanitizer/asan/asan_rtl.cpp:74
    #1 0x7ff0801d330e in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cpp:78
    #2 0x7ff0801b810c in __asan::AsanThread::GetStackFrameAccessByAddr(unsigned long, __asan::AsanThread::StackFrameAccess*) ../../../../src/libsanitizer/asan/asan_thread.cpp:367
    #3 0x7ff080122e9b in __asan::GetStackAddressInformation(unsigned long, unsigned long, __asan::StackAddressDescription*) ../../../../src/libsanitizer/asan/asan_descriptions.cpp:203
    #4 0x7ff0801242d8 in __asan::AddressDescription::AddressDescription(unsigned long, unsigned long, bool) ../../../../src/libsanitizer/asan/asan_descriptions.cpp:455
    #5 0x7ff0801242d8 in __asan::AddressDescription::AddressDescription(unsigned long, unsigned long, bool) ../../../../src/libsanitizer/asan/asan_descriptions.cpp:439
    #6 0x7ff080126a84 in __asan::ErrorGeneric::ErrorGeneric(unsigned int, unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long) ../../../../src/libsanitizer/asan/asan_errors.cpp:389
    #7 0x7ff0801b1fa5 in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) ../../../../src/libsanitizer/asan/asan_report.cpp:476
    #8 0x7ff080148fe8 in __interceptor_sigaltstack ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:9986
    #9 0x7ff0801af473 in __asan::PlatformUnpoisonStacks() ../../../../src/libsanitizer/asan/asan_posix.cpp:44
    #10 0x7ff0801b500c in __asan_handle_no_return ../../../../src/libsanitizer/asan/asan_rtl.cpp:612
    #11 0x7ff07fe04d50 in thread_main /media/sf_scratch/src/libstrongswan/threading/thread.c:321
    #12 0x7ff07d7d4b42 in start_thread nptl/pthread_create.c:442
    #13 0x7ff07d8669ff  (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff)

2 years agotnccs: Fix Doxygen comments for callback
Tobias Brunner [Mon, 28 Nov 2022 16:15:13 +0000 (17:15 +0100)] 
tnccs: Fix Doxygen comments for callback

2 years agocallback-cred: Document missing callback argument
Tobias Brunner [Mon, 28 Nov 2022 16:13:11 +0000 (17:13 +0100)] 
callback-cred: Document missing callback argument

2 years agoDoxyfile: Remove obsolete options and replace obsolete paper type value
Tobias Brunner [Mon, 28 Nov 2022 16:11:25 +0000 (17:11 +0100)] 
Doxyfile: Remove obsolete options and replace obsolete paper type value

2 years agoUse Botan 2.19.3 for tests
Tobias Brunner [Mon, 28 Nov 2022 15:02:25 +0000 (16:02 +0100)] 
Use Botan 2.19.3 for tests

2 years agotesting: Use HTTPS for strongSwan tarballs
Tobias Brunner [Mon, 28 Nov 2022 14:57:57 +0000 (15:57 +0100)] 
testing: Use HTTPS for strongSwan tarballs

2 years agotesting: Fix URL for kernel patches
Tobias Brunner [Mon, 28 Nov 2022 14:55:31 +0000 (15:55 +0100)] 
testing: Fix URL for kernel patches

2 years agoMerge branch 'number-formats'
Tobias Brunner [Thu, 10 Nov 2022 15:53:50 +0000 (16:53 +0100)] 
Merge branch 'number-formats'

Document the accepted number formats in swanctl.conf/strongswan.conf and
clarify some details for specific options.

Closes strongswan/strongswan#1329

2 years agoswanctl: Document the type/size of interface IDs
Tobias Brunner [Fri, 14 Oct 2022 09:04:38 +0000 (11:04 +0200)] 
swanctl: Document the type/size of interface IDs

2 years agoswanctl: Document the behavior of %unique[-dir] on IKE_SAs
Tobias Brunner [Fri, 14 Oct 2022 08:57:53 +0000 (10:57 +0200)] 
swanctl: Document the behavior of %unique[-dir] on IKE_SAs

2 years agoconf: Document accepted number and time formats
Tobias Brunner [Fri, 14 Oct 2022 08:54:04 +0000 (10:54 +0200)] 
conf: Document accepted number and time formats

2 years agoconf: Explicitly add time unit to default value for options that accept them
Tobias Brunner [Fri, 14 Oct 2022 08:53:26 +0000 (10:53 +0200)] 
conf: Explicitly add time unit to default value for options that accept them

2 years agowolfssl: Updates to resolve build conflicts
Tim Weller [Tue, 4 Oct 2022 16:44:09 +0000 (11:44 -0500)] 
wolfssl: Updates to resolve build conflicts

The wolfSSL's OpenSSL compatibility layer is not used by the plugin at
all and preventing its inclusion avoids conflicts with ASN1_ constants.

The inclusion of wolfssl/ssl.h is moved to the only file that requires
it as older wolfSSL versions defined a conflicting ASN1_GENERALIZEDTIME.

Other changes address issues with the FIPS use case.

Closes strongswan/strongswan#1332

2 years agoUse wolfSSL 5.5.3 for tests
Tobias Brunner [Wed, 9 Nov 2022 16:36:42 +0000 (17:36 +0100)] 
Use wolfSSL 5.5.3 for tests

2 years agogithub: Use OpenSSL 3.0.7 for tests
Tobias Brunner [Wed, 9 Nov 2022 16:39:50 +0000 (17:39 +0100)] 
github: Use OpenSSL 3.0.7 for tests

2 years agobacktrace: Fix build with newer MinGW versions
Tobias Brunner [Thu, 10 Nov 2022 12:44:21 +0000 (13:44 +0100)] 
backtrace: Fix build with newer MinGW versions

A recent change added CALLBACK to PENUM_PAGE_FILE_CALLBACKW/A in psapi.h,
which conflicts with our own macro of the same name.  Our compat/windows.h
header undefs the Windows definition, but that only works if Windows
headers are included before ours, which wasn't the case for psapi.h.

2 years agogithub: Fix URL to BoringSSL repository for Android build
Tobias Brunner [Sat, 5 Nov 2022 13:58:02 +0000 (14:58 +0100)] 
github: Fix URL to BoringSSL repository for Android build

2 years agocirrus: Don't explicitly install openldap*-client on FreeBSD
Tobias Brunner [Thu, 6 Oct 2022 10:06:36 +0000 (12:06 +0200)] 
cirrus: Don't explicitly install openldap*-client on FreeBSD

This avoids a conflicts as mysql80-client has a dependency on either
openldap24-client (FreeBSD 12) or openldap26-client (FreeBSD 13) so e.g.
installing openldap24-client on FreeBSD 13 causes

  openldap26-client-2.6.3 conflicts with openldap24-client-2.4.59_4 on /usr/local/bin/ldapadd

Similarly, when installing openldap26-client on FreeBSD 12.  So just let
the mysql80-client package decide which version is installed.

2 years agogithub: Try to avoid crashes by LeakSanitizer
Tobias Brunner [Thu, 6 Oct 2022 08:22:49 +0000 (10:22 +0200)] 
github: Try to avoid crashes by LeakSanitizer

There are spurious crashes after test runs (during the reporting phase
of LeakSanitizer) that are triggered by seemingly unrelated code changes.
It seems to be related to how glibc handles dynamic TLS allocations.

2 years agoMake functions static that are only accessed from the same compilation unit
Tobias Brunner [Wed, 5 Oct 2022 14:37:22 +0000 (16:37 +0200)] 
Make functions static that are only accessed from the same compilation unit

Also removed some declarations for undefined functions.

2 years agoopenssl: Remove unused openssl_hash_chunk() helper
Tobias Brunner [Wed, 5 Oct 2022 16:14:12 +0000 (18:14 +0200)] 
openssl: Remove unused openssl_hash_chunk() helper

Was used by the ECDSA implementation before 293a912c7de6 ("openssl: Fixes
for ECDSA with OpenSSL 3.0").

2 years agokernel-interface: Make first reqid configurable
Thomas Egerer [Tue, 26 Jul 2022 13:38:34 +0000 (15:38 +0200)] 
kernel-interface: Make first reqid configurable

This can be helpful to reserve low reqids for manual configuration.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2 years agobacktrace: Only define print_sourceline() and esc() if actually used
Tobias Brunner [Mon, 3 Oct 2022 12:06:35 +0000 (14:06 +0200)] 
backtrace: Only define print_sourceline() and esc() if actually used

2 years agolookip: Explicitly include string.h for strcpy()
Tobias Brunner [Mon, 3 Oct 2022 11:54:03 +0000 (13:54 +0200)] 
lookip: Explicitly include string.h for strcpy()

2 years agoerror-notify: Explicitly include string.h for strcpy()
Tobias Brunner [Mon, 3 Oct 2022 11:53:27 +0000 (13:53 +0200)] 
error-notify: Explicitly include string.h for strcpy()

2 years agoVersion bump to 5.9.8 5.9.8
Andreas Steffen [Mon, 3 Oct 2022 14:16:53 +0000 (16:16 +0200)] 
Version bump to 5.9.8

2 years agoNEWS: Add info about CVE-2022-40617
Tobias Brunner [Wed, 21 Sep 2022 08:32:59 +0000 (10:32 +0200)] 
NEWS: Add info about CVE-2022-40617

2 years agocert-validator: Use a separate method for online revocation checking
Tobias Brunner [Wed, 21 Sep 2022 08:22:16 +0000 (10:22 +0200)] 
cert-validator: Use a separate method for online revocation checking

This avoids having to repeat offline checks after basic trust chain
validation.

2 years agorevocation: Enforce a (configurable) timeout when fetching OCSP/CRL
Tobias Brunner [Fri, 22 Jul 2022 12:50:41 +0000 (14:50 +0200)] 
revocation: Enforce a (configurable) timeout when fetching OCSP/CRL

Malicious servers could otherwise block the fetching thread indefinitely
after the initial TCP handshake (which has a default timeout of 10s
in the curl and winhttp plugins, the soup plugin actually has a default
overall timeout of 10s).

2 years agocredential-manager: Do online revocation checks only after basic trust chain validation
Tobias Brunner [Fri, 22 Jul 2022 13:37:43 +0000 (15:37 +0200)] 
credential-manager: Do online revocation checks only after basic trust chain validation

This avoids querying URLs of potentially untrusted certificates, e.g. if
an attacker sends a specially crafted end-entity and intermediate CA
certificate with a CDP that points to a server that completes the
TCP handshake but then does not send any further data, which will block
the fetcher thread (depending on the plugin) for as long as the default
timeout for TCP.  Doing that multiple times will block all worker threads,
leading to a DoS attack.

The logging during the certificate verification obviously changes.  The
following example shows the output of `pki --verify` for the current
strongswan.org certificate:

new:

  using certificate "CN=www.strongswan.org"
  using trusted intermediate ca certificate "C=US, O=Let's Encrypt, CN=R3"
  using trusted ca certificate "C=US, O=Internet Security Research Group, CN=ISRG Root X1"
  reached self-signed root ca with a path length of 1
checking certificate status of "CN=www.strongswan.org"
  requesting ocsp status from 'http://r3.o.lencr.org' ...
  ocsp response correctly signed by "C=US, O=Let's Encrypt, CN=R3"
  ocsp response is valid: until Jul 27 12:59:58 2022
certificate status is good
checking certificate status of "C=US, O=Let's Encrypt, CN=R3"
ocsp response verification failed, no signer certificate 'C=US, O=Let's Encrypt, CN=R3' found
  fetching crl from 'http://x1.c.lencr.org/' ...
  using trusted certificate "C=US, O=Internet Security Research Group, CN=ISRG Root X1"
  crl correctly signed by "C=US, O=Internet Security Research Group, CN=ISRG Root X1"
  crl is valid: until Apr 18 01:59:59 2023
certificate status is good
certificate trusted, lifetimes valid, certificate not revoked

old:

  using certificate "CN=www.strongswan.org"
  using trusted intermediate ca certificate "C=US, O=Let's Encrypt, CN=R3"
checking certificate status of "CN=www.strongswan.org"
  requesting ocsp status from 'http://r3.o.lencr.org' ...
  ocsp response correctly signed by "C=US, O=Let's Encrypt, CN=R3"
  ocsp response is valid: until Jul 27 12:59:58 2022
certificate status is good
  using trusted ca certificate "C=US, O=Internet Security Research Group, CN=ISRG Root X1"
checking certificate status of "C=US, O=Let's Encrypt, CN=R3"
ocsp response verification failed, no signer certificate 'C=US, O=Let's Encrypt, CN=R3' found
  fetching crl from 'http://x1.c.lencr.org/' ...
  using trusted certificate "C=US, O=Internet Security Research Group, CN=ISRG Root X1"
  crl correctly signed by "C=US, O=Internet Security Research Group, CN=ISRG Root X1"
  crl is valid: until Apr 18 01:59:59 2023
certificate status is good
  reached self-signed root ca with a path length of 1
certificate trusted, lifetimes valid, certificate not revoked

Note that this also fixes an issue with the previous dual-use of the
`trusted` flag.  It not only indicated whether the chain is trusted but
also whether the current issuer is the root anchor (the corresponding
flag in the `cert_validator_t` interface is called `anchor`).  This was
a problem when building multi-level trust chains for pre-trusted
end-entity certificates (i.e. where `trusted` is TRUE from the start).
This caused the main loop to get aborted after the first intermediate CA
certificate and the mentioned `anchor` flag wasn't correct in any calls
to `cert_validator_t` implementations.

Fixes: CVE-2022-40617
2 years agopkcs7: Support rsa-pss signatures
Andreas Steffen [Sun, 2 Oct 2022 11:01:34 +0000 (13:01 +0200)] 
pkcs7: Support rsa-pss signatures

2 years agoobject: Make INIT() a compound statement
Tobias Brunner [Thu, 29 Sep 2022 09:36:00 +0000 (11:36 +0200)] 
object: Make INIT() a compound statement

This forces the use of a semicolon after INIT() and makes existing ones,
which was the case for basically all instances, necessary so e.g.
sonarcloud won't complain about an empty statement after every one of
them.

By evaluating to the allocated object, it would theoretically also allow
constructs like this:

  struct_t *this;

  return INIT(this,
   .a = x,
   .b = y,
  );

or this:

  array_insert(a, ARRAY_TAIL, INIT(this,
    .a = x,
    .b = y,
  ));

2 years agopki: Remove superfluous ; when initializing EST client
Tobias Brunner [Thu, 29 Sep 2022 09:34:50 +0000 (11:34 +0200)] 
pki: Remove superfluous ; when initializing EST client

2 years agoNEWS: Add news for 5.9.8
Tobias Brunner [Thu, 29 Sep 2022 07:44:32 +0000 (09:44 +0200)] 
NEWS: Add news for 5.9.8

Also fixed the RFC number for EST.

2 years agogithub: Prefer third-party crypto lib's implementations over ours
Tobias Brunner [Wed, 28 Sep 2022 15:17:56 +0000 (17:17 +0200)] 
github: Prefer third-party crypto lib's implementations over ours

If e.g. the hmac plugin is loaded before the third-party crypto lib
plugin, we might not use the latter's HMAC implementation in some
cases (e.g. in the libtls tests).

2 years agolgtm: Don't build with ASan and extra warnings
Tobias Brunner [Wed, 28 Sep 2022 13:35:50 +0000 (15:35 +0200)] 
lgtm: Don't build with ASan and extra warnings

2 years agopki: Fix formatting and use `else if` to make Coverity happy
Tobias Brunner [Wed, 28 Sep 2022 13:07:37 +0000 (15:07 +0200)] 
pki: Fix formatting and use `else if` to make Coverity happy

2 years agoUse wolfSSL 5.5.1 for tests
Tobias Brunner [Wed, 28 Sep 2022 12:55:39 +0000 (14:55 +0200)] 
Use wolfSSL 5.5.1 for tests

2 years agoFixed some typos, courtesy of codespell
Tobias Brunner [Tue, 27 Sep 2022 15:14:58 +0000 (17:14 +0200)] 
Fixed some typos, courtesy of codespell

2 years agoVersion bump to 5.9.8rc1 5.9.8rc1
Andreas Steffen [Mon, 26 Sep 2022 08:34:04 +0000 (10:34 +0200)] 
Version bump to 5.9.8rc1

2 years agoikev2: Trigger ike_updown() event after all IKE-specific tasks ran
Tobias Brunner [Thu, 22 Sep 2022 14:14:44 +0000 (16:14 +0200)] 
ikev2: Trigger ike_updown() event after all IKE-specific tasks ran

This makes sure the event is only triggered after the IKE_SA is fully
established and e.g. virtual IPs, additional peer addresses or
a modified reauth time (on the initiator) are assigned to it.  This was
e.g. a problem for the selinux plugin if virtual IPs are used.

We use a separate task to trigger the event that's queued before the
child-create task so the event is triggered before the child_updown()
event.  Same goes for the state change to IKE_ESTABLISHED.

A new condition is used to indicate the successful completion of all
authentication rounds, so we don't have to set the IKE_ESTABLISHED state
in the ike-auth task (it was used as condition in other tasks).

Since set_state() also sets the rekey and reauth times, this required
some minor changes in regards to how AUTH_LIFETIME notifies are handled.

2 years agoikev2: Make sure the child-create task runs after all IKE_SA specific tasks
Tobias Brunner [Thu, 22 Sep 2022 14:04:52 +0000 (16:04 +0200)] 
ikev2: Make sure the child-create task runs after all IKE_SA specific tasks

2 years agoikev2: The ike-me task does not have to run before the ike-auth task
Tobias Brunner [Thu, 22 Sep 2022 13:47:34 +0000 (15:47 +0200)] 
ikev2: The ike-me task does not have to run before the ike-auth task

Since e334bd46b184 ("ike-auth: Move packet collection to post_build()
method") tasks and plugins can modify the IKE_SA_INIT message independent
of the ike-auth task.

2 years agosocket-dynamic: Use IPv6-only mode for IPv6 sockets
Tobias Brunner [Thu, 22 Sep 2022 15:36:38 +0000 (17:36 +0200)] 
socket-dynamic: Use IPv6-only mode for IPv6 sockets

Same as the previous commit.

Fixes: 5f9ad62a8156 ("socket-dynamic: Don't set SO_REUSEADDR on IKE sockets anymore")
2 years agosocket-default: Use IPv6-only mode for IPv6 sockets
Tobias Brunner [Thu, 22 Sep 2022 15:33:52 +0000 (17:33 +0200)] 
socket-default: Use IPv6-only mode for IPv6 sockets

Otherwise, we can't open a dedicated IPv4 socket on the same port as the
IPv6 socket already is set up do receive IPv4 packets (unless we'd again
enable SO_REUSEADDR).

Fixes: 83da13371292 ("socket-default: Don't set SO_REUSEADDR on IKE sockets anymore")
2 years agoandroid: Prevent FD leak from HttpURLConnection
Tobias Brunner [Fri, 22 Jul 2022 09:43:56 +0000 (11:43 +0200)] 
android: Prevent FD leak from HttpURLConnection

The default is apparently "Connection: keep-alive", which somehow keeps
the socket around, which leaks file descriptors with every connection
that fetches OCSP and/or CRLs.  Over time that could result in the number
of FDs reaching a limit e.g. imposed by FD_SET().

Closes strongswan/strongswan#1160

2 years agoandroid: Update dependencies
Tobias Brunner [Fri, 22 Jul 2022 08:26:07 +0000 (10:26 +0200)] 
android: Update dependencies

2 years agoandroid: Set compile-/targetSdkVersion to 32
Tobias Brunner [Fri, 22 Jul 2022 09:13:36 +0000 (11:13 +0200)] 
android: Set compile-/targetSdkVersion to 32

2 years agoandroid: Fix "Format string ... is not valid format string..." error
Tobias Brunner [Fri, 22 Jul 2022 12:10:45 +0000 (14:10 +0200)] 
android: Fix "Format string ... is not valid format string..." error

The linter complained that two of the strings don't actually contain any
printf-specifiers (i.e. don't expect any arguments) and therefore
shouldn't be used with String.format().

2 years agoandroid: Mark PendingIntents as immutable via FLAG_IMMUTABLE
Tobias Brunner [Fri, 22 Jul 2022 09:12:52 +0000 (11:12 +0200)] 
android: Mark PendingIntents as immutable via FLAG_IMMUTABLE

Setting this or explicitly FLAG_MUTABLE is required when targeting
Android 12.

References strongswan/strongswan#1151

2 years agoandroid: Explicitly mark Activities/Services with intent-filter as exported
Tobias Brunner [Fri, 22 Jul 2022 09:11:14 +0000 (11:11 +0200)] 
android: Explicitly mark Activities/Services with intent-filter as exported

Required when targeting Android 12.

2 years agoandroid: Move package namespace declaration from Manifest to build file
Tobias Brunner [Fri, 22 Jul 2022 08:22:05 +0000 (10:22 +0200)] 
android: Move package namespace declaration from Manifest to build file

2 years agoandroid: Remove unused jni directory spec from sourceSets
Tobias Brunner [Fri, 22 Jul 2022 08:20:16 +0000 (10:20 +0200)] 
android: Remove unused jni directory spec from sourceSets

2 years agoandroid: Update Gradle plugin
Tobias Brunner [Fri, 22 Jul 2022 08:20:04 +0000 (10:20 +0200)] 
android: Update Gradle plugin

2 years agosocket-win: Don't set SO_REUSEADDR on IKE sockets anymore
Tobias Brunner [Tue, 6 Sep 2022 14:21:46 +0000 (16:21 +0200)] 
socket-win: Don't set SO_REUSEADDR on IKE sockets anymore

Same as the change for socket-default in a previous commit.

2 years agosocket-dynamic: Don't set SO_REUSEADDR on IKE sockets anymore
Tobias Brunner [Tue, 6 Sep 2022 14:21:03 +0000 (16:21 +0200)] 
socket-dynamic: Don't set SO_REUSEADDR on IKE sockets anymore

Same as the previous commit.

2 years agosocket-default: Don't set SO_REUSEADDR on IKE sockets anymore
Tobias Brunner [Tue, 6 Sep 2022 14:11:49 +0000 (16:11 +0200)] 
socket-default: Don't set SO_REUSEADDR on IKE sockets anymore

This was originally required when pluto and charon both bound sockets to
the same port to send messages.  Pluto also received messages on them but
charon didn't and used a raw socket instead.  Since the removal of pluto
we don't need to set this option anymore, which might actually mask
mistakes like running charon and charon-systemd concurrently (that could
result in messages getting sent fine by both daemons but only received
by one).

Note that a failure to create/bind the sockets will not immediately
result in a shutdown of the daemon.  Instead, there will be an error
once the receiver tries to read any messages and also whenever the sender
attempts to send a request.

2 years agoMerge branch 'eap-vendor-id'
Tobias Brunner [Wed, 21 Sep 2022 11:37:18 +0000 (13:37 +0200)] 
Merge branch 'eap-vendor-id'

Changes the type for EAP vendor IDs from uint32_t to pen_t, which has
explicitly been added to represent three-byte IANA-allocated Private
Enterprise Numbers (PEN), which the EAP RFC called "SMI Network
Management Private Enterprise Codes".

References strongswan/strongswan#581

2 years agoeap: Make sure eap_type_t is large enough to hold vendor-specific types
Tobias Brunner [Thu, 21 Jul 2022 11:37:01 +0000 (13:37 +0200)] 
eap: Make sure eap_type_t is large enough to hold vendor-specific types

Unless compiled with `-fshort-enumes` that's usually the case already.

2 years agoeap: Print vendor (PEN) names for vendor-specific EAP methods
Tobias Brunner [Thu, 21 Jul 2022 11:19:56 +0000 (13:19 +0200)] 
eap: Print vendor (PEN) names for vendor-specific EAP methods