Commit Graph
14294 Commits
Author SHA1 Message Date
Martin Willi b18fbde41e test-runner: Properly clean up allocated test suites 2022-09-15 12:16:12 +02:00
Martin Willi 432a846e66 unit-tests: Disable AddressSanitizer for threading cleanup function
As the cleanup function reads from the correct address on the parent frame,
it is currently unclear why AddressSanitizer complains about that pointer
dereference.
2022-09-15 12:16:12 +02:00
Martin Willi 7dce58135e unit-tests: Exclude memory checks after-free from AddressSanitizer
We explicitly test the memory we free()d if that got properly wiped, so suppress
the warning from AddressSanitizer.
2022-09-15 12:16:12 +02:00
Martin Willi d840df185a utils: Define ADDRESS_SANITIZER_EXCLUDE to exclude a function from sanitizer 2022-09-15 12:16:12 +02:00
Martin Willi 1866d33538 utils: Support __has_feature() macro on non-LLVM compilers by returning 0 2022-09-15 12:16:12 +02:00
Tobias Brunner ffada7cb5a pki: Correctly use int as precision specifier when printing PEM certificate 2022-09-14 17:38:59 +02:00
Tobias Brunner 644f74ad8f unit-tests: Add environment variable to only run specific iterations
Helpful when running with increased verbosity and only specific iterations
fail.
2022-09-12 16:13:51 +02:00
Andreas Steffen 747e840912 libstrongswan: Encode RSA-PSS algorithmIdentifier variant
Some third party IKEv2 products expect an RSA-PSS ASN.1
algorithmIdentifier with an explicit trailerField value (CONTEXT3)
instead of the DEFAULT value if the trailerField is missing.

The setting charon.rsa_pss_trailerfield = yes enables the explicit
encoding.
2022-09-06 21:15:43 +02:00
Tobias Brunner 55f7268eb1 unit-tests: Let the TLS server thread close its own socket
Closing the socket from the main thread, while the server thread is
still in accept() (or is just about to enter it), seems to
occasionally cause a deadlock on macOS.
2022-09-06 15:40:32 +02:00
Tobias Brunner 0f6b0380a8 ipsec: Remove scepclient from usage output 2022-09-06 09:33:00 +02:00
Tobias Brunner befdefa5d3 starter: Fix comment for debug function 2022-09-06 09:33:00 +02:00
Tobias Brunner 879ffd7ece unit-tests: Make TLS echo server cancelable
Seems to be required on macOS (libtls tests didn't run before the recent
implicit enabling via pki).  Other platforms apparently let accept() fail
if the socket is shutdown/closed in teardown_creds(), macOS apparently
doesn't do that.
2022-09-06 09:33:00 +02:00
Tobias Brunner 88859b506c libtls: Fix encoding of TLS 1.3 certificate extension as server
Same as 9664ef4ba6 ("libtls: Fixed encoding of TLS 1.3 certificate
extension") but for the server.
2022-09-06 09:33:00 +02:00
Andreas Steffen 3fa3d2666a pki: pki --req can use old certreq as template
When an X.509 certificate has to be renewed it is helpful to use
the old PKCS#10 certificate request as a template, so that the
distinguishedName (DN), the subjectAlternativeName (SAN) and
a certificate profile name don't have to be typed-in again.

The old public key in the existing certreq is replaced with the
new key and the signature is re-generated using the new private key.
2022-08-31 15:10:34 +02:00
Andreas Steffen 359b5739f4 pki: Fixed memory leak in pki --scep 2022-08-28 11:42:13 +02:00
Andreas Steffen 3b2b7a3bee pki: Fixed filenames in pki --estca/--scepca man pages 2022-08-27 09:51:05 +02:00
Noel Kuntze dbe3de7bb9 connmark: Fix wrong plugin name in log message
Closes strongswan/strongswan#1244
2022-08-26 17:00:18 +02:00
Andreas Steffen 6e860fb07c leak_detective: Whitelist botan_privkey_load_rsa_pkcs1() 2022-08-26 12:17:22 +02:00
Andreas Steffen 52a3c3662d libtls: the signature unit tests use scheme-specific credentials 2022-08-26 12:17:22 +02:00
Andreas Steffen 63fd718915 libtls: call create_public_enumerator() with key_type 2022-08-26 12:17:22 +02:00
Andreas Steffen a417703301 libtls: enforce correct signature scheme for ECDSA keys 2022-08-26 12:17:22 +02:00
Andreas Steffen 9664ef4ba6 libtls: Fixed encoding of TLS 1.3 certificate extension 2022-08-25 10:51:05 +02:00
Andreas Steffen 784606a827 pki: use libtls for pki --est|--estca 2022-08-25 10:50:40 +02:00
Andreas Steffen 976c74b772 pki: --est adds --keyid and --certid options
With the --keyid option private keys stored on a smartcard or in
a TPM 2.0 can be used for public key based client authentication.

With the --certid option the corresponding client certificate
can reside on a smartcard or a TPM 2.0.
2022-08-25 07:02:29 +02:00
Andreas Steffen 2b53b1055d pki: Optimize certificate download for --scep and --est 2022-08-25 07:02:29 +02:00
Andreas Steffen b392fbd68c libtls: unit tests run with default plugins
The gcm plugin has been added to the default plugins and all
certificate types are loaded to allow the libtls socket unit
tests to run with the strongSwan default plugins.
2022-08-25 07:02:29 +02:00
Andreas Steffen a3914d7db5 libtls: Send empty cert payload upon cert request
Currently when a TLS client doesn't have a certificate, it doesn't
send a certficiate payload upon receiving a certificate request
from the TLS server. According to the TLS 1.2 and 1.3 RFCs an
empty certificate payload must be sent.
2022-08-25 07:02:29 +02:00
Andreas Steffen 60a764bad9 pki: use libtls for pki --est 2022-08-25 07:02:29 +02:00
Andreas Steffen c2dc5f69ca pki: Created pki --est man page 2022-08-25 07:02:29 +02:00
Andreas Steffen ba1d8aba32 pki: Enroll an X.509 certificate with an EST server 2022-08-25 07:02:29 +02:00
Andreas Steffen 7e5daec56e pki: Created pki --estca man page 2022-08-25 07:02:29 +02:00
Andreas Steffen b16c0e928e pki: Clean up SCEP functions 2022-08-24 20:46:44 +02:00
Andreas Steffen ba76a9f5ff pki: Get CA certs via EST (RFC 7030) 2022-08-24 20:46:44 +02:00
Andreas Steffen 1ef8b92211 pkcs10: Support of Microsoft CertTypeExtension
The msCertificateTypeExtension OID (1.3.6.1.4.1.311.20.2) can
be used in a PKCS#10 certificate request to define a certificate
profile. It consists of an UTF8 string.

pki: profile option
2022-08-24 20:46:44 +02:00
Andreas Steffen 8716f7c03c scepclient: Removal and replacement by pki subcommands
The "ipsec scepclient" tool has been removed and replaced by the
pki subcommands "pki --scep" and "pki --scepca" which implement the
new SCEP RFC 8894 standard that was released in September 2020 and
which supports trusted "certificate renewal" based on the existing
client certificate.
2022-08-24 20:46:44 +02:00
Andreas Steffen 122796df27 pki: Additional pki.scep options for strongswan.conf 2022-08-24 20:46:44 +02:00
Andreas Steffen 93f2901d1a pki: Created pki --scep man page 2022-08-24 20:46:44 +02:00
Andreas Steffen 7c7a5a0260 pki: Enroll an X.509 certificate with a SCEP server 2022-08-24 20:46:44 +02:00
Andreas Steffen a9d70bd485 pki: Created pki --scepca man page 2022-08-24 20:46:44 +02:00
Andreas Steffen 6851273944 pki: Get CA certs via SCEP 2022-08-19 23:00:11 +02:00
Fabrice Fontaine 5900426a71 wolfssl: Rename encrypt methods to avoid conflicts with system headers
Rename `encrypt` methods to avoid the following build failure when wolfSSL
is built with --enable-opensslextra:

In file included from ../../../../src/libstrongswan/utils/utils.h:59,
                 from ../../../../src/libstrongswan/library.h:101,
                 from wolfssl_common.h:29,
                 from wolfssl_aead.c:23:
wolfssl_aead.c:90:16: error: conflicting types for 'encrypt'; have '_Bool(union <anonymous>,  chunk_t,  chunk_t,  chunk_t,  chunk_t *)'
   90 | METHOD(aead_t, encrypt, bool,
      |                ^~~~~~~
../../../../src/libstrongswan/utils/utils/object.h:99:20: note: in definition of macro 'METHOD'
   99 |         static ret name(union {iface *_public; this;} \
      |                    ^~~~
In file included from /home/autobuild/autobuild/instance-5/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/include/wolfssl/wolfcrypt/wc_port.h:573,
                 from /home/autobuild/autobuild/instance-5/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/include/wolfssl/wolfcrypt/types.h:35,
                 from /home/autobuild/autobuild/instance-5/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/include/wolfssl/wolfcrypt/logging.h:33,
                 from /home/autobuild/autobuild/instance-5/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/include/wolfssl/ssl.h:35,
                 from wolfssl_common.h:64,
                 from wolfssl_aead.c:23:
/home/autobuild/autobuild/instance-5/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/include/unistd.h:149:6: note: previous declaration of 'encrypt' with type 'void(char *, int)'
  149 | void encrypt(char *, int);
      |      ^~~~~~~

Closes strongswan/strongswan#1201
2022-08-18 10:41:15 +02:00
Tobias Brunner 47fd5ab6b5 eap-mschapv2: Fix compile warning/error when compiled with -Warray-bounds
Since the allocated data was smaller than sizeof(eap_mschapv2_header_t),
the following compile error was triggered (with newer GCC versions):

eap_mschapv2.c: In function 'process_peer_success':
eap_mschapv2.c:945:12: error: array subscript 'eap_mschapv2_header_t[0]' is partly outside array bounds of 'unsigned char[6]' [-Werror=array-bounds]
  945 |         eap->code = EAP_RESPONSE;
      |            ^~
In file included from /usr/include/stdlib.h:587,
                 from ../../../../src/libstrongswan/utils/printf_hook/printf_hook.h:26,
                 from ../../../../src/libstrongswan/library.h:101,
                 from ../../../../src/libcharon/sa/eap/eap_method.h:28,
                 from eap_mschapv2.h:27,
                 from eap_mschapv2.c:18:
eap_mschapv2.c:944:15: note: object of size 6 allocated by '__builtin_alloca'
  944 |         eap = alloca(len);
      |               ^~~~~~

Closes strongswan/strongswan#1188
Closes strongswan/strongswan#1215
2022-08-18 09:39:05 +02:00
Andreas Steffen bcedd65a31 pkcs7: Allow for missing optional content field
The content field of type OCTET STRING of a ContentInfo object
with ContentType Data

  ContentInfo ::= SEQUENCE {
     contentType ContentType,
     content
        [0] EXPLICIT OCTET STRING OPTIONAL

is optional and can be missing if no data is available
2022-07-29 07:59:00 +02:00
Tobias Brunner 19baf5a08c ike-cfg: Fix typo in method description 2022-07-26 14:35:56 +02:00
Tobias Brunner 45e6311640 mock-dh: Fix typo in comment 2022-07-26 10:03:23 +02:00
Tobias Brunner 77553bfee6 dhcp: Fix retransmission timeouts
The previous code did not ensure that there was a delay of at least
`try` seconds after each sent request.  Instead, whenever the condvar was
signaled, which could be due to retransmitted responses or messages for
unrelated transactions (there could even be spurious wakeups), the counter
was increased and a retransmit sent.  So instead of actually waiting for
15 seconds for a response (and sending 4 retransmits over that timespan),
it could happen that all five messages were sent within a second without
enough time to actually receive a response.

Using an absolute timeout that we reuse as long as there was no timeout
and the condvar was signaled for something unrelated, should ensure we
wait at least the intended delay after each sent message.

Closes strongswan/strongswan#1154
2022-07-22 07:20:30 +02:00
Tobias Brunner 44ab5533b0 connmark: Consider configured mask in installed firewall rules
This allows using the upper parts of the marks for other purposes.  For
instance, with `mark_in=mark_out=%unique/0x0000ffff` mark values in the
upper two bytes would not get reset by the rules installed by this plugin.
However, note that in this example the daemon would have to get restarted
after 65'535 CHILD_SAs to reset the counter for unique marks, which is a
global 32-bit counter that's unaware of any masks.

Closes strongswan/strongswan#1087
2022-07-18 15:05:51 +02:00
Tobias Brunner 42ed6b44b2 af-alg: Fix "'strncpy' specified bound equals destination size" warnings 2022-07-18 14:49:12 +02:00
Tobias Brunner 112bb465fb openssl: Add support for AES and Camellia in CTR mode 2022-07-18 13:01:22 +02:00
Tobias Brunner 3d966d6d0a aggressive-mode: Determine local identity before deriving keys
This might require a PSK, for which the local identity might be necessary.
2022-07-18 12:56:20 +02:00