19343 Commits

Author SHA1 Message Date
Tobias Brunner
24c20803a3 library: Exclude the check_memwipe() function from AddressSanitizer
Newer versions of AddressSanitizer (e.g. in Ubuntu 24.04) will report
this now as stack-use-after-return.
2025-01-10 16:53:37 +01:00
Tobias Brunner
6f912345c1 github: Don't install the NDK as root
On the Ubuntu 24.04 image, this causes the /home/runner/.config/.android
directory to be owned by root, which lets the build fail later.
2025-01-10 16:53:37 +01:00
Tobias Brunner
90dac35927 github: Enable SRP in OpenSSL build for clang AddressSanitizer build
On Ubuntu 24.04, llvm-symbolizer-18, which is used to resolve symbols
in backtraces, links libcurl.so.4 for some reason.  And that in turn
requires SRP.  If our custom build doesn't provide it, we get stuff
like this

  /usr/bin/llvm-symbolizer-18: symbol lookup error: /lib/x86_64-linux-gnu/libcurl.so.4: undefined symbol: SSL_CTX_set_srp_password, version OPENSSL_3.0.0

and the symbols are not resolved and can't be whitelisted.

This also makes sure ASan is actually disabled if our own leak-detective
is used.
2025-01-10 16:52:39 +01:00
Tobias Brunner
9d29d522e5 github: Adapt to switch to Ubuntu 24.04 for ubuntu-latest 2025-01-10 16:14:03 +01:00
Tobias Brunner
95dbd5c858 constraints: Exclude self-signed root CAs without policies from policy validation
Self-signed trust anchors are not part of the certificate path validation
according to RFC 8280, section 6.1:

  When the trust anchor is provided in the form of a self-signed
  certificate, this self-signed certificate is not included as part of
  the prospective certification path.

But policies in them could still be used, as stated in section 6.2:

  Where a CA distributes self-signed certificates to specify trust
  anchor information, certificate extensions can be used to specify
  recommended inputs to path validation.  For example, a policy
  constraints extension could be included in the self-signed
  certificate to indicate that paths beginning with this trust anchor
  should be trusted only for the specified policies.  [...]
  Implementations that use self-signed certificates to specify trust
  anchor information are free to process or ignore such information.

So unconditionally enforcing that self-signed root certificates contain
the policies is probably too strict.  Often they won't contain the
extension at all.  With this change, we allow that but still enforce the
policies in case such a certificate contains them.  The other
policy-related constraints are also enforced still should they be
contained.

Closes strongswan/strongswan#2601
2025-01-09 13:51:11 +01:00
Tobias Brunner
cc8c86c673 github: Use AWS-LC 1.41.1 for tests 2024-12-11 17:21:16 +01:00
Tobias Brunner
ad3106d4f6 vici: Add pyproject.toml file to declare build backend 2024-12-11 17:21:16 +01:00
Tobias Brunner
00b209be8d cirrus: Fix vici Python build on Alpine 2024-12-11 17:21:16 +01:00
Tobias Brunner
b0fcae3ea1 testing: Ignore errors when dumping our routing table
Some scenarios disable route installation and if they are executed before
any scenarios that don't, there won't be a rule for table 220 and we get
"FIB table does not exist" errors.
2024-12-11 15:18:09 +01:00
Tobias Brunner
3babf1f710 vici: Update Python build
Directly calling setup.py is deprecated (apparently has been for a while,
but now we get large warnings).  Direct installation is also discouraged.
So this removes that option.  The built wheel (the old egg format is not
used/built anymore) can be installed manually in a venv or the like.
2024-12-11 15:18:09 +01:00
Tobias Brunner
d6a0de0837 vici: Update supported Python versions 2024-12-11 15:18:09 +01:00
Tobias Brunner
a465c54805 github: Update chunk_from_chars() CodeQL query to new data flow API 2024-12-11 15:17:37 +01:00
Tobias Brunner
ddd1126e96 pubkey: Remove unused set_subject() method
If not properly used (i.e. before sharing the object), this was not
thread-safe.  So better remove it and force users to create immutable
objects.
2024-12-10 09:09:29 +01:00
Tobias Brunner
65e121b498 vici: Delay creation of raw public keys until we know the identity
The previous approach had two drawbacks:

First, it caused duplicate public keys because when the `certificate_t`
object was created and added to the credential set it had no subject
assigned yet.  So it defaulted to the key ID.  However, all previously
loaded keys had their subject already changed to an identity, so there
never was a match and new objects were always added whenever a config
with raw public keys was loaded.

Second, the subject was replaced in a way that's not thread-safe on an
object that's already shared in the public credential set.  So other
threads could potentially access the `identification_t` object that's
destroyed during that process.

References strongswan/strongswan#853
Closes strongswan/strongswan#2561
2024-12-10 09:08:05 +01:00
Andreas Steffen
24a9c32a43 testing: Include ML-KEM crypto tests rw-cert scenario 2024-12-06 14:39:20 +01:00
Rob Shearman
caf81bc05c child-create: Fix double free of list of labels after migrate
If a migrate of a child-create occurs then labels_i and labels_r are
freed, but the pointers are left set. If the task is subsequently
destroyed without being reused, then both of these will be double
freed.

Fix this by setting labels_i and labels_r to NULL in the migrate
method after freeing, similar to other fields that are freed.

Closes strongswan/strongswan#2552

Fixes: f9b895b49f49 ("child-create: Add support to handle security labels")
2024-12-05 08:47:52 +01:00
Tobias Brunner
c8f16d18d8 swanctl: Document keX_ prefix and replace DH with KE 2024-12-04 17:59:27 +01:00
Tobias Brunner
c6ca688441 nm: Version bump to 1.6.1 2024-12-03 14:37:26 +01:00
Tobias Brunner
bea1f1100e file-logger: Don't log <> if ike_name is disabled and no IKE_SA is available
Fixes: a2fba6db4a17 ("file-logger: Add option to log messages as JSON objects")
6.0.0
2024-12-03 09:04:34 +01:00
Tobias Brunner
832c811598 testing: Use a single scp command to restore defaults
This is a bit faster than two sequential calls.
2024-12-03 08:43:45 +01:00
Tobias Brunner
3615e907f5 testing: Improve replacing IP addresses in test files
There are a lot of files without patterns and running them all through
sed is quite slow.  Using grep first makes this quicker (about 0.5s per
test).  Ignoring PEM files is also helpful.
2024-12-03 08:43:45 +01:00
Tobias Brunner
1c053bc3f0 testing: Log timestamps relative to the start of the test
Makes it easier to compare multiple runs against each other.
2024-12-03 08:43:45 +01:00
Tobias Brunner
9e88c3f32e testing: Collect test results with an on-guest script in parallel
In particular the swanctl calls all take a while and this allows doing
them in parallel if multiple hosts are involved. This reduces the runtime
of each test by 1-3 seconds.
2024-12-03 08:43:45 +01:00
Tobias Brunner
b3a72c7994 testing: Use an on-guest script to cleanup/initialize and run them in parallel
This is a bit quicker than doing this with separate SSH calls for each
host sequentially (up to half a second per test).
2024-12-03 08:43:45 +01:00
Tobias Brunner
c8cfeeff54 testing: Always use immediate mode for tcpdump
We don't use versions that don't support this anymore and sometimes the
detection didn't work properly and a run without it would get started.
2024-12-03 08:43:45 +01:00
Andreas Steffen
cf9b174dfe Remove two files to be ignored 2024-12-02 23:13:10 +01:00
Andreas Steffen
c86f709b4b Version bump to 6.0.0 2024-12-02 14:21:53 +01:00
Thomas Egerer
fefea48724 child-sa: Update status flags based on success of SA addition
Both variables `inbound_installed` and `outbound_state` are used in
`child_sa_t::destroy()` to determine whether inbound and outbound state
have to be deleted. They are assigned prior to the call to
`kernel_interface_t::add_sa()`. As this call may fail, the destructor may
try to delete a state which it has not been added.
By making the assignment of these variables dependent on the success of
the state addition, we can make sure, a `child_sa_t::destroy()` only
deletes states it has added.

Also removed the redundant checks for `my_spi` and `other_spi` being set
along with the check for the above flags. It seems that when the flags
are set, the SPIs *must* be set.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2024-11-29 13:46:12 +01:00
Tobias Brunner
8b69327ad2 NEWS: Add news for 6.0.0 2024-11-27 11:38:54 +01:00
Tobias Brunner
6cf84547d7 swanctl: Update note about reauth approaches for reauth_time 2024-11-27 11:08:05 +01:00
Tobias Brunner
ac7500cccd github: Use AWS-LC 1.40.0 for tests 2024-11-27 10:13:36 +01:00
Tobias Brunner
b1858a9b9b scripts: Use correct type for length when printing count for KEM KATs 2024-11-27 10:12:56 +01:00
Andreas Steffen
4de6bb3feb Version bump to 6.0.0rc2 6.0.0rc2 2024-11-26 08:21:20 +01:00
Andreas Steffen
f59ca9698a cert-enroll: Support three generations of CA certificates
If the lifetime of an issuing or sub CA is twice the lifetime of
the end entity certificates issued by it and the renewal cycle of
the issuing CAs is a little shorter than the validity of the end
entity certificates then three generations of CA certificates have
to be handled by the cert-enroll scripts.
2024-11-26 08:15:09 +01:00
Tobias Brunner
559298b53e x509: Use SHA-256 as default hash/signature algorithm for attribute certificates
References strongswan/strongswan#2523
2024-11-25 16:52:35 +01:00
Tobias Brunner
5b677e612d unit-tests: Remove RSA/ECDSA schemes with weak hash algorithms (MD5/SHA-1)
These have been discouraged for a long time and there are now more and
more crypto libraries that have them disabled by default.  However, for
some we only can detect this at runtime, in particular in FIPS mode, so
tests would fail as the plugins would still announce them.  So instead
we just remove the schemes from these tests for now (at least for RSA,
removing signatures with SHA-1 completely isn't an option yet as that's
still the default with some clients).

Closes strongswan/strongswan#2523
2024-11-25 16:52:21 +01:00
Tobias Brunner
5217920967 github: Run apidoc test on Ubuntu 24.04 image
The Doxygen version on 22.04 doesn't understand some of the new directives.
2024-11-25 16:09:29 +01:00
Tobias Brunner
799b3076ab apidoc: Update Doxyfile.in
The only actual change is disabling timestamps (makes it easier to
compare).
2024-11-25 12:22:25 +01:00
Tobias Brunner
17bc5166d4 Fixed some typos, courtesy of codespell 2024-11-25 12:06:54 +01:00
Tobias Brunner
7e310e3425 testing: Make timing for TKM rekey scenarios a bit more stable
In particular for the first one randomization could trigger an additional
rekeying, which let the "Adding ESA ..." check fail.  But even without
randomization (could be seen in the second scenario that already uses
`rand_time=0`) 4 seconds can apparently be too low some time.
2024-11-25 11:44:04 +01:00
Andreas Steffen
af28aac85f Version bump to 6.0.0rc1 6.0.0rc1 2024-11-25 11:11:17 +01:00
Andreas Steffen
2c18e87b25 testing: Added ML-KEM test cases 2024-11-23 16:53:02 +01:00
Andreas Steffen
def312d200 testing: Fixed typos 2024-11-23 15:06:37 +01:00
Tobias Brunner
36d9b88837 github: Install pkgconf instead of pkg-config on macOS
The package was apparently renamed/transitioned, but that doesn't really
work properly (causes a symlink issue when installing via pkg-config).
2024-11-22 15:19:04 +01:00
Tobias Brunner
5f31d6a9fc ml: Fix compilation with some compilers
Some (older) compilers complain that "variable-sized object may not be
initialized".
2024-11-22 14:43:57 +01:00
Tobias Brunner
a42e24b762 fuzz: Fix build after changing default plugins 2024-11-22 14:41:19 +01:00
Tobias Brunner
f462e4b9ee traffic-selector: Add workaround for possibly bogus warning with GCC 14
When compiling with -O3 with GCC 14, we get the following warning/error:

/usr/include/x86_64-linux-gnu/bits/string_fortified.h:29:10: error: '__builtin_memcpy' offset [0, 3] is out of the bounds [0, 0] [-Werror=array-bounds=]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~

Which seems completely bogus as that array has a fixed size of 16 and
some weird workarounds remove the warning (e.g. adding an assignment
to `subset->netbits` before the `memcpy()`).  This is also the only
place GCC complains about and we use `memcpy()` all over the place
in this file to set those addresses.

Closes strongswan/strongswan#2509
2024-11-22 14:31:13 +01:00
Tobias Brunner
b2210f446e NEWS: Add some news for 6.0.0 2024-11-22 14:19:54 +01:00
Andreas Steffen
a5e80cf5e4 libcharon: Enable make_before_break option by default 2024-11-22 14:18:39 +01:00
Tobias Brunner
e69e7c86e7 Merge commit 'default-plugins'
Changes the default crypto plugins from the built-in ones to openssl.
2024-11-22 14:17:17 +01:00