]> git.ipfire.org Git - thirdparty/strongswan.git/log
thirdparty/strongswan.git
2 years agokernel-interface: Add feature to indicate if query_sa() returns last use time
Tobias Brunner [Thu, 23 Jun 2022 13:59:56 +0000 (15:59 +0200)] 
kernel-interface: Add feature to indicate if query_sa() returns last use time

Currently supported by libipsec and PF_KEY on macOS (FreeBSD, like Linux,
reports the time the SA was first used in sadb_lifetime_usetime - it also
triggers rekeyings based on that, which Linux doesn't, it also triggers
them if an SA is never used).

2 years agoikev2: Add option to prefer childless IKE_SAs as initiator
Tobias Brunner [Fri, 3 Feb 2023 08:46:37 +0000 (09:46 +0100)] 
ikev2: Add option to prefer childless IKE_SAs as initiator

2 years agoswanctl: Terminate --monitor-sa command if daemon closes connection
Tobias Brunner [Thu, 26 Jan 2023 10:17:30 +0000 (11:17 +0100)] 
swanctl: Terminate --monitor-sa command if daemon closes connection

2 years agolibvici: Add callback invoked if connection is closed by daemon
Tobias Brunner [Thu, 26 Jan 2023 10:16:11 +0000 (11:16 +0100)] 
libvici: Add callback invoked if connection is closed by daemon

2 years agogithub: Explicitly install pkg-config in macOS build
Tobias Brunner [Mon, 20 Feb 2023 13:24:29 +0000 (14:24 +0100)] 
github: Explicitly install pkg-config in macOS build

Apparently not installed anymore in the latest build image.  If it's
missing, we see errors like these:

  configure.ac:38: error: possibly undefined macro: AC_DEFINE

2 years agoandroid: Update the README for the build via NDK
Tobias Brunner [Mon, 20 Feb 2023 13:11:29 +0000 (14:11 +0100)] 
android: Update the README for the build via NDK

2 years agoandroid: New release after OpenSSL plugin fix android-2.4.1-1
Tobias Brunner [Fri, 17 Feb 2023 15:59:13 +0000 (16:59 +0100)] 
android: New release after OpenSSL plugin fix

2 years agoopenssl: Fix size of plugin feature array
Tobias Brunner [Fri, 17 Feb 2023 15:58:19 +0000 (16:58 +0100)] 
openssl: Fix size of plugin feature array

Fixes: 312847e1a322 ("openssl: Add curve25519 and curve448 after ECDH groups")
2 years agoandroid: New release after fixing interoperability issue with Zyxel firewalls android-2.4.1
Tobias Brunner [Fri, 17 Feb 2023 15:36:28 +0000 (16:36 +0100)] 
android: New release after fixing interoperability issue with Zyxel firewalls

2 years agoopenssl: Add curve25519 and curve448 after ECDH groups
Tobias Brunner [Fri, 17 Feb 2023 15:28:07 +0000 (16:28 +0100)] 
openssl: Add curve25519 and curve448 after ECDH groups

This was the order before 46a6b062822c ("openssl: Only announce ECDH
groups actually supported by OpenSSL") but that's not really the reason
for this change.  It's related to the Android app, where we previously
didn't support these DH groups in BoringSSL and added the curve25519
plugin after the openssl plugin instead.  This resulted in the same
order, i.e. ECDH groups before curve25519.  With the switch to OpenSSL
and the mentioned commit, this changed and curve25519 was now the first
group that was proposed and used for the KE payload.  Not really an
issue you'd think, however, there are apparently Zyxel Firewalls with
older firmware versions (some forum posts mentioned a fix in V5.31) that
can't handle KE payloads with DH groups > 21 (ecp521). So with
curve25519 (31) proposed in the KE payload, they silently dropped the
IKE_SA_INIT request and no connection could be established.

2 years agolibtls: Fix double-free for untrusted peer certificates
Tobias Brunner [Fri, 17 Feb 2023 14:07:20 +0000 (15:07 +0100)] 
libtls: Fix double-free for untrusted peer certificates

`public` is returned, but previously only if a trusted key was found.
We obviously don't want to return untrusted keys and since the reference
was correctly destroyed after determining the key type, this later caused
a double-free.

Fixes: 63fd718915b5 ("libtls: call create_public_enumerator() with key_type")
2 years agoenum: Add functions to add and remove mappings from enum names
Tobias Brunner [Thu, 16 Feb 2023 16:04:40 +0000 (17:04 +0100)] 
enum: Add functions to add and remove mappings from enum names

Co-authored-by: Thomas Egerer <thomas.egerer@secunet.com>
2 years agoMerge branch 'hw-packet-offload'
Tobias Brunner [Fri, 17 Feb 2023 12:27:37 +0000 (13:27 +0100)] 
Merge branch 'hw-packet-offload'

This adds support for the new "packet" hardware offload feature that's
added to the Linux kernel with 6.2.  In this mode, the device handles
the complete framing of the ESP packet as well as the policy checks,
in addition to the crypto.

For the IKE sockets, port-based bypass policies are automatically
offloaded to devices that support it.

Closes strongswan/strongswan#1462

2 years agokernel-netlink: Offload bypass policies for IKE ports on interfaces
Tobias Brunner [Fri, 27 Jan 2023 13:08:41 +0000 (14:08 +0100)] 
kernel-netlink: Offload bypass policies for IKE ports on interfaces

While this uses the same mechanism, it's not necessary to explicitly
enable port_bypass, the regular socket policies work fine to bypass any
software policies.

2 years agokernel-netlink: Use event socket wrapper for XFRM and networking events
Tobias Brunner [Thu, 26 Jan 2023 16:50:51 +0000 (17:50 +0100)] 
kernel-netlink: Use event socket wrapper for XFRM and networking events

2 years agokernel-netlink: Add simple wrapper for Netlink event sockets
Tobias Brunner [Thu, 26 Jan 2023 16:43:18 +0000 (17:43 +0100)] 
kernel-netlink: Add simple wrapper for Netlink event sockets

2 years agokernel-pfkey: Always register for events
Tobias Brunner [Thu, 26 Jan 2023 15:21:07 +0000 (16:21 +0100)] 
kernel-pfkey: Always register for events

The starter-specific code path isn't necessary anymore since
d8fdd1018e16 ("starter: Don't flush SAs in the kernel").

2 years agokernel-pfroute: Always listen for events
Tobias Brunner [Thu, 26 Jan 2023 15:19:22 +0000 (16:19 +0100)] 
kernel-pfroute: Always listen for events

The starter-specific code path isn't necessary anymore since
d8fdd1018e16 ("starter: Don't flush SAs in the kernel").

2 years agokernel-netlink: Always register for events
Tobias Brunner [Thu, 26 Jan 2023 15:17:15 +0000 (16:17 +0100)] 
kernel-netlink: Always register for events

The starter-specific code path isn't necessary anymore since
d8fdd1018e16 ("starter: Don't flush SAs in the kernel").

2 years agostarter: Remove starter-specific plugin lists
Tobias Brunner [Thu, 26 Jan 2023 15:09:32 +0000 (16:09 +0100)] 
starter: Remove starter-specific plugin lists

It hasn't loaded any plugins since d8fdd1018e16 ("starter: Don't flush
SAs in the kernel"), which was released with 5.3.3.

2 years agokernel-netlink: Fallback to configured interface when HW offloading policies
Tobias Brunner [Thu, 26 Jan 2023 12:25:11 +0000 (13:25 +0100)] 
kernel-netlink: Fallback to configured interface when HW offloading policies

This allows offloading bypass and drop policies to a specific interface
by configuring `interface` and `hw_offload=packet` (`auto` works too).

2 years agoshunt-manager: Pass HW offload mode when installing policies
Tobias Brunner [Wed, 25 Jan 2023 13:40:39 +0000 (14:40 +0100)] 
shunt-manager: Pass HW offload mode when installing policies

2 years agovici: Update offloading configuration for full packet HW offloading
Tobias Brunner [Thu, 15 Dec 2022 15:41:59 +0000 (16:41 +0100)] 
vici: Update offloading configuration for full packet HW offloading

2 years agokernel-netlink: Add support for full packet and policy HW offloading
Tobias Brunner [Thu, 15 Dec 2022 15:41:43 +0000 (16:41 +0100)] 
kernel-netlink: Add support for full packet and policy HW offloading

2 years agochild-sa: Pass HW offload mode for policies
Tobias Brunner [Mon, 19 Dec 2022 11:50:54 +0000 (12:50 +0100)] 
child-sa: Pass HW offload mode for policies

2 years agokernel-ipsec: Add HW offload mode to policies
Tobias Brunner [Mon, 19 Dec 2022 10:44:48 +0000 (11:44 +0100)] 
kernel-ipsec: Add HW offload mode to policies

2 years agoMerge branch 'android-updates' android-2.4.0
Tobias Brunner [Wed, 15 Feb 2023 13:50:12 +0000 (14:50 +0100)] 
Merge branch 'android-updates'

Switched from BoringSSL to OpenSSL. A script is provided to build the
library as needed.

2 years agoandroid: New release after switching to OpenSSL
Tobias Brunner [Mon, 13 Feb 2023 10:31:09 +0000 (11:31 +0100)] 
android: New release after switching to OpenSSL

2 years agoandroid: Use correct language code for Ukrainian
Tobias Brunner [Mon, 13 Feb 2023 13:25:17 +0000 (14:25 +0100)] 
android: Use correct language code for Ukrainian

While UA is the country code, the language code is apparently uk.

2 years agoandroid: Clean up plugin list after switching to OpenSSL
Tobias Brunner [Fri, 10 Feb 2023 09:36:50 +0000 (10:36 +0100)] 
android: Clean up plugin list after switching to OpenSSL

Keep the kdf plugin because of AES-XCBC (and CAMELLIA-XCBC, which is now
supported due to OpenSSL).  Other plugins like fips-prf, pubkey or pkcs8
were never actually used by the app.  The random plugin might have been
necessary with early versions.

2 years agoandroid: Use custom-built OpenSSL for GH action
Tobias Brunner [Thu, 9 Feb 2023 16:06:47 +0000 (17:06 +0100)] 
android: Use custom-built OpenSSL for GH action

2 years agoandroid: Increase minSdkVersion to 21 (Android 5.0)
Tobias Brunner [Thu, 9 Feb 2023 14:40:58 +0000 (15:40 +0100)] 
android: Increase minSdkVersion to 21 (Android 5.0)

Newer NDKs haven't supported the version(s) we used for a while. Also,
versions < 21 will be removed with the next version of the NDK.

2 years agoandroid: Add a script to build OpenSSL's libcrypto as needed by the app
Tobias Brunner [Thu, 9 Feb 2023 15:39:08 +0000 (16:39 +0100)] 
android: Add a script to build OpenSSL's libcrypto as needed by the app

The build script requires the paths to the NDK and OpenSSL sources.

It runs the build in a Docker container, by default. But if the required
tools are installed on the system (currently jq, make and perl) it can
also be run directly on the system by defining NO_DOCKER.

A relatively recent version of the NDK is required (the pre-built
toolchains are required).

2 years agoandroid: Add the application ID to the log
Tobias Brunner [Fri, 10 Feb 2023 10:24:02 +0000 (11:24 +0100)] 
android: Add the application ID to the log

2 years agoandroid: Update screenshots and add more with advanced settings
Tobias Brunner [Tue, 13 Dec 2022 14:28:12 +0000 (15:28 +0100)] 
android: Update screenshots and add more with advanced settings

2 years agoandroid: Update Gradle plugin
Tobias Brunner [Mon, 3 Oct 2022 08:48:18 +0000 (10:48 +0200)] 
android: Update Gradle plugin

2 years agogithub: Use OpenSSL 3.0.8 for tests
Tobias Brunner [Tue, 7 Feb 2023 17:06:16 +0000 (18:06 +0100)] 
github: Use OpenSSL 3.0.8 for tests

2 years agogithub: Use tpm2-tss 3.2.2 for tests
Tobias Brunner [Tue, 31 Jan 2023 16:22:44 +0000 (17:22 +0100)] 
github: Use tpm2-tss 3.2.2 for tests

2 years agoRevert "libipsec: Added Windows tun device support"
Andreas Steffen [Tue, 31 Jan 2023 14:19:58 +0000 (15:19 +0100)] 
Revert "libipsec: Added Windows tun device support"

This reverts commit 77b91e6d0eaffb3c69b47221c3de3bb8ff80e01a.

2 years agolibipsec: Added Windows tun device support libipsec-wintun
Andreas Steffen [Tue, 31 Jan 2023 13:59:57 +0000 (14:59 +0100)] 
libipsec: Added Windows tun device support

2 years agochild-sa: Fix typo in comment
xujielong [Mon, 30 Jan 2023 08:34:19 +0000 (16:34 +0800)] 
child-sa: Fix typo in comment

Closes strongswan/strongswan#1527

2 years agocurl: Add an option to select the SSL/TLS backend (if available)
Tobias Brunner [Fri, 13 Jan 2023 16:17:06 +0000 (17:17 +0100)] 
curl: Add an option to select the SSL/TLS backend (if available)

If libcurl is built with MultiSSL support (not the case for e.g.
Debian/Ubuntu, which ship separate, conflicting libraries), this allows
selecting the SSL/TLS backend libcurl uses.

2 years agocurl: Don't ignore unknown SSL/TLS backends
Tobias Brunner [Fri, 13 Jan 2023 16:11:50 +0000 (17:11 +0100)] 
curl: Don't ignore unknown SSL/TLS backends

Only older versions of OpenSSL and GnuTLS need special treatment, so we
now accept all other backends (e.g. "(SecureTransport) OpenSSL/1.1.1s"
on macOS).

Whenever we remove support for the affected versions of the mentioned
libraries, we can remove the corresponding *-threading plugin feature
and the code here.

2 years agoMerge branch 'man-sysconfdir'
Tobias Brunner [Mon, 16 Jan 2023 10:41:17 +0000 (11:41 +0100)] 
Merge branch 'man-sysconfdir'

Closes strongswan/strongswan#1511

2 years agoswanctl: Don't use hard-coded path to sysconfdir
Tobias Brunner [Mon, 16 Jan 2023 10:39:29 +0000 (11:39 +0100)] 
swanctl: Don't use hard-coded path to sysconfdir

2 years agoconf: Add swanctl.conf and swanctl man pages to SEE ALSO
Tobias Brunner [Mon, 16 Jan 2023 10:37:27 +0000 (11:37 +0100)] 
conf: Add swanctl.conf and swanctl man pages to SEE ALSO

2 years agoconf: Replace hard-coded /etc where appropriate
Tobias Brunner [Mon, 16 Jan 2023 10:35:42 +0000 (11:35 +0100)] 
conf: Replace hard-coded /etc where appropriate

Also document the actual value of ${sysconfdir}.

2 years agoman: Use configured path for config files in man pages
Petr Menšík [Sun, 15 Jan 2023 15:55:45 +0000 (16:55 +0100)] 
man: Use configured path for config files in man pages

2 years agoipsec: Include IPSEC_CONFDIR variable replacement in man page
Petr Menšík [Sun, 15 Jan 2023 15:17:07 +0000 (16:17 +0100)] 
ipsec: Include IPSEC_CONFDIR variable replacement in man page

Fedora has chosena different default directory to avoid conflicts with
libreswan. Use ${sysconfdir} variable to provide the correct location.

2 years agopki: Use X.509v3 EKU extension in CSR
Andreas Steffen [Wed, 11 Jan 2023 16:44:15 +0000 (17:44 +0100)] 
pki: Use X.509v3 EKU extension in CSR

2 years agokernel-netlink: Define SOL_NETLINK for old versions of socket.h
Tobias Brunner [Mon, 9 Jan 2023 15:57:53 +0000 (16:57 +0100)] 
kernel-netlink: Define SOL_NETLINK for old versions of socket.h

While the kernel defines it since 2005 (2.6.14), some older versions of
socket.h shipped with C libraries might not.  In particular, glibc only
added it with 2.24 in 2016.

Closes strongswan/strongswan#1503

2 years agogithub: Workaround for Python conflict in macOS image
Tobias Brunner [Fri, 6 Jan 2023 13:17:29 +0000 (14:17 +0100)] 
github: Workaround for Python conflict in macOS image

The Python versions installed in the system image in
`/Library/Frameworks/Python.framework/` have symlinks in `/usr/local/bin/`
that conflict with symlinks that `brew` tries to create, which causes
errors like these:

    ==> Pouring python@3.11--3.11.1.monterey.bottle.tar.gz
    Error: The `brew link` step did not complete successfully
    The formula built, but is not symlinked into /usr/local
    Could not symlink bin/2to3-3.11
    Target /usr/local/bin/2to3-3.11
    already exists. You may want to remove it:
      rm '/usr/local/bin/2to3-3.11'

    To force the link and overwrite all conflicting files:
      brew link --overwrite python@3.11

    To list all files that would be deleted:
      brew link --overwrite --dry-run python@3.11

    Possible conflicting files are:
    /usr/local/bin/2to3-3.11 -> /Library/Frameworks/Python.framework/Versions/3.11/bin/2to3-3.11
    /usr/local/bin/idle3.11 -> /Library/Frameworks/Python.framework/Versions/3.11/bin/idle3.11
    /usr/local/bin/pydoc3.11 -> /Library/Frameworks/Python.framework/Versions/3.11/bin/pydoc3.11
    /usr/local/bin/python3.11 -> /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11
    /usr/local/bin/python3.11-config -> /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11-config

2 years agodh-speed: Add wolfssl and BP ECDH to test script
Tobias Brunner [Fri, 6 Jan 2023 11:01:56 +0000 (12:01 +0100)] 
dh-speed: Add wolfssl and BP ECDH to test script

2 years agodh-speed: Dynamically look up KE method
Tobias Brunner [Fri, 6 Jan 2023 11:00:55 +0000 (12:00 +0100)] 
dh-speed: Dynamically look up KE method

2 years agodh-speed: Don't reuse DH object
Tobias Brunner [Fri, 6 Jan 2023 10:28:37 +0000 (11:28 +0100)] 
dh-speed: Don't reuse DH object

Since the changes to the DH implementations that were merged with
30faf04e92dc ("Merge branch 'multi-ke-backport'"), most implementations
don't support deriving different shared secrets for the same private key
by calling set_public_key() with another public key anymore (some prevent
it explicitly, but reusing DH private keys is not something we want to
support anyway).  So we can't reuse the DH object on one side for every
round.

2 years agoVersion bump to 5.9.9 5.9.9
Andreas Steffen [Sun, 1 Jan 2023 10:55:50 +0000 (11:55 +0100)] 
Version bump to 5.9.9

2 years agoVersion bump to 5.9.9rc2 5.9.9rc2
Andreas Steffen [Fri, 23 Dec 2022 10:19:06 +0000 (11:19 +0100)] 
Version bump to 5.9.9rc2

2 years agotesting: Abort kernel build if patch can't be applied
Tobias Brunner [Fri, 23 Dec 2022 09:31:14 +0000 (10:31 +0100)] 
testing: Abort kernel build if patch can't be applied

2 years agoNEWS: Add news for 5.9.9
Tobias Brunner [Thu, 22 Dec 2022 18:58:49 +0000 (19:58 +0100)] 
NEWS: Add news for 5.9.9

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)