18623 Commits

Author SHA1 Message Date
Tobias Brunner
21af89f941 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.
2022-12-02 14:57:47 +01:00
Tobias Brunner
02519ad60e af-alg: Fix compiler warning 2022-12-02 14:56:38 +01:00
Tobias Brunner
3809bdac90 farp: Remove unused variable 2022-12-02 14:56:38 +01:00
Tobias Brunner
4b8eb6e8d9 nm: Ignore lock file left behind by newer versions of intltool 2022-12-02 14:56:38 +01:00
Tobias Brunner
42165f81bc 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)
2022-12-02 14:56:31 +01:00
Tobias Brunner
6ce9aba022 tnccs: Fix Doxygen comments for callback 2022-11-28 17:23:13 +01:00
Tobias Brunner
9fe093c4e2 callback-cred: Document missing callback argument 2022-11-28 17:18:18 +01:00
Tobias Brunner
0fbdc9e925 Doxyfile: Remove obsolete options and replace obsolete paper type value 2022-11-28 17:18:18 +01:00
Tobias Brunner
977ab29fc1 Use Botan 2.19.3 for tests 2022-11-28 16:02:25 +01:00
Tobias Brunner
c1250c56ae testing: Use HTTPS for strongSwan tarballs 2022-11-28 15:57:57 +01:00
Tobias Brunner
4242c81243 testing: Fix URL for kernel patches 2022-11-28 15:55:31 +01:00
Tobias Brunner
4dd3d0e57b 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
2022-11-10 16:53:50 +01:00
Tobias Brunner
c1c85b0fd1 swanctl: Document the type/size of interface IDs 2022-11-10 16:50:02 +01:00
Tobias Brunner
284fc2f796 swanctl: Document the behavior of %unique[-dir] on IKE_SAs 2022-11-10 16:50:02 +01:00
Tobias Brunner
64b10dfb28 conf: Document accepted number and time formats 2022-11-10 16:50:02 +01:00
Tobias Brunner
185b1376a3 conf: Explicitly add time unit to default value for options that accept them 2022-11-10 16:49:35 +01:00
Tim Weller
af71f14ba3 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
2022-11-10 16:23:44 +01:00
Tobias Brunner
7db77fd32b Use wolfSSL 5.5.3 for tests 2022-11-10 16:15:36 +01:00
Tobias Brunner
652ce18120 github: Use OpenSSL 3.0.7 for tests 2022-11-10 16:15:36 +01:00
Tobias Brunner
2bf110d9f8 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.
2022-11-10 13:44:21 +01:00
Tobias Brunner
f16a12eae5 github: Fix URL to BoringSSL repository for Android build 2022-11-05 14:58:02 +01:00
Tobias Brunner
d42f4367dd 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.
2022-10-06 12:26:50 +02:00
Tobias Brunner
68782f35c0 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.
2022-10-06 11:11:35 +02:00
Tobias Brunner
7f46c76125 Make functions static that are only accessed from the same compilation unit
Also removed some declarations for undefined functions.
2022-10-05 19:00:46 +02:00
Tobias Brunner
c58ba0cb9f openssl: Remove unused openssl_hash_chunk() helper
Was used by the ECDSA implementation before 293a912c7de6 ("openssl: Fixes
for ECDSA with OpenSSL 3.0").
2022-10-05 18:15:26 +02:00
Thomas Egerer
4ea61dcbfe 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>
2022-10-05 10:28:05 +02:00
Tobias Brunner
27da024a5d backtrace: Only define print_sourceline() and esc() if actually used 2022-10-03 17:36:17 +02:00
Tobias Brunner
3cc5a670b5 lookip: Explicitly include string.h for strcpy() 2022-10-03 17:36:17 +02:00
Tobias Brunner
ff21f8affe error-notify: Explicitly include string.h for strcpy() 2022-10-03 17:36:17 +02:00
Andreas Steffen
e09bc70d12 Version bump to 5.9.8 5.9.8 2022-10-03 16:16:53 +02:00
Tobias Brunner
b2488db2ce NEWS: Add info about CVE-2022-40617 2022-10-03 10:48:46 +02:00
Tobias Brunner
1f870ae189 cert-validator: Use a separate method for online revocation checking
This avoids having to repeat offline checks after basic trust chain
validation.
2022-10-03 10:48:46 +02:00
Tobias Brunner
1968615590 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).
2022-10-03 10:48:46 +02:00
Tobias Brunner
b1e926148a 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
2022-10-03 10:48:46 +02:00
Andreas Steffen
6bf60221f5 pkcs7: Support rsa-pss signatures 2022-10-03 09:52:07 +02:00
Tobias Brunner
e0fd191f31 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,
  ));
2022-09-29 11:36:00 +02:00
Tobias Brunner
3da4ac8ef6 pki: Remove superfluous ; when initializing EST client 2022-09-29 11:34:50 +02:00
Tobias Brunner
ce82edfbe2 NEWS: Add news for 5.9.8
Also fixed the RFC number for EST.
2022-09-29 09:44:32 +02:00
Tobias Brunner
895597817a 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).
2022-09-28 17:17:56 +02:00
Tobias Brunner
b05a8927d9 lgtm: Don't build with ASan and extra warnings 2022-09-28 15:37:27 +02:00
Tobias Brunner
0cbd1ad892 pki: Fix formatting and use else if to make Coverity happy 2022-09-28 15:07:37 +02:00
Tobias Brunner
00fd78305c Use wolfSSL 5.5.1 for tests 2022-09-28 14:55:39 +02:00
Tobias Brunner
7c9ccceec8 Fixed some typos, courtesy of codespell 2022-09-27 17:46:27 +02:00
Andreas Steffen
ef93c7e2ea Version bump to 5.9.8rc1 5.9.8rc1 2022-09-26 10:34:04 +02:00
Tobias Brunner
5ce1c91b58 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.
2022-09-23 16:28:35 +02:00
Tobias Brunner
14243dcdb5 ikev2: Make sure the child-create task runs after all IKE_SA specific tasks 2022-09-22 17:42:22 +02:00
Tobias Brunner
f3da04c05e 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.
2022-09-22 17:42:22 +02:00
Tobias Brunner
03ea02175e 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")
2022-09-22 17:38:58 +02:00
Tobias Brunner
ebaaacc459 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")
2022-09-22 17:33:52 +02:00
Tobias Brunner
7433f1672a 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
2022-09-21 15:15:18 +02:00