]> git.ipfire.org Git - thirdparty/strongswan.git/log
thirdparty/strongswan.git
4 years agokernel-netlink: Ignore deprecated candidate source addresses
Tobias Brunner [Mon, 20 Jul 2020 14:20:24 +0000 (16:20 +0200)] 
kernel-netlink: Ignore deprecated candidate source addresses

The currently used address may get deprecated e.g. if an IPv6 prefix changes.
In this case we should switch to another address.

Fixes #3511.

4 years agokernel-netlink: Update cached address flags
Tobias Brunner [Thu, 15 Oct 2020 14:10:07 +0000 (16:10 +0200)] 
kernel-netlink: Update cached address flags

Note that manually adding an IPv6 address without disabling duplicate
address detection (DAD, e.g. via `nodad` when using iproute2) will cause
a roam event due to a flag change after about 1-2 seconds (TENTATIVE is
removed).  If this is a problem, we might have to ignore addresses with
TENTATIVE flag when we receive a RTM_NEWADDR message until that flag is
eventually removed.

Fixes #3511.

4 years agoREADME: Add missing closing quote
Tobias Brunner [Wed, 28 Oct 2020 16:09:53 +0000 (17:09 +0100)] 
README: Add missing closing quote

4 years agochild-create: Update CHILD_SA IP addresses before installation
Tobias Brunner [Thu, 15 Oct 2020 11:45:53 +0000 (13:45 +0200)] 
child-create: Update CHILD_SA IP addresses before installation

We create the child_sa_t object when initiating the CREATE_CHILD_SA
request, however, the IP addresses/ports might have changed once we
eventually receive the response (potentially to a retransmit sent to
a different address).  So update them before installing the SA and
policies.

If the local address changed too and depending on the kernel
implementation, the temporary SA created to allocate the inbound SPI
might remain as it can't be updated.  This could cause issues if e.g.
the address switches back before that SA expired (the updated inbound
SA conflicts with the temporary one), or if that happens close together
and the expire (having to wait for the address update) causes the
updated SA to get deleted.

Fixes #3164.

4 years agochild-sa: Only query/update/delete inbound SA if it was actually installed
Tobias Brunner [Thu, 15 Oct 2020 13:23:02 +0000 (15:23 +0200)] 
child-sa: Only query/update/delete inbound SA if it was actually installed

We usually can't do any of these things with temporary SAs created while
allocating an SPI.

4 years agounit-tests: Free allocated SPIs in mock IPsec backend
Tobias Brunner [Thu, 15 Oct 2020 16:33:26 +0000 (18:33 +0200)] 
unit-tests: Free allocated SPIs in mock IPsec backend

4 years agochild-sa: No need to attempt to update policies if none are configured
Tobias Brunner [Thu, 15 Oct 2020 11:54:15 +0000 (13:54 +0200)] 
child-sa: No need to attempt to update policies if none are configured

4 years agochild-sa: Only reinstall VIPs if any are passed
Tobias Brunner [Thu, 15 Oct 2020 11:42:57 +0000 (13:42 +0200)] 
child-sa: Only reinstall VIPs if any are passed

4 years agotesting: Use silent rules to build strongSwan
Tobias Brunner [Thu, 15 Oct 2020 12:24:46 +0000 (14:24 +0200)] 
testing: Use silent rules to build strongSwan

4 years agoload-tester: Also request a virtual IPv6 address
Tobias Brunner [Wed, 21 Oct 2020 14:24:07 +0000 (16:24 +0200)] 
load-tester: Also request a virtual IPv6 address

Fixes #3595.

4 years agoload-tester: Use appropriate family to request addresses from source IP pools
Tobias Brunner [Wed, 21 Oct 2020 14:04:37 +0000 (16:04 +0200)] 
load-tester: Use appropriate family to request addresses from source IP pools

Looks like this wasn't necessary before 40e90898895c ("Strictly enforce
address family match while acquiring mem_pool IPs").

Fixes #3595.

4 years agoquick-delete: Properly handle failures to restart CHILD_SA
Tobias Brunner [Thu, 8 Oct 2020 12:04:36 +0000 (14:04 +0200)] 
quick-delete: Properly handle failures to restart CHILD_SA

If DESTROY_ME is returned from initiate(), we must not touch the IKE_SA
anymore.

4 years agopkcs7: Order DER encoded attributes
Tobias Brunner [Fri, 9 Oct 2020 15:42:08 +0000 (17:42 +0200)] 
pkcs7: Order DER encoded attributes

The attributes are encoded as a SET OF, which means that in DER encoding
the encoded attributes have to be ordered lexicographically.

Fixes #3589.

4 years agoswanctl: Support any key type for decrypted keys
Tobias Brunner [Thu, 8 Oct 2020 07:40:12 +0000 (09:40 +0200)] 
swanctl: Support any key type for decrypted keys

The previous code required explicit support for a particular key type,
of which Ed25519 and Ed448 were missing.  While a fallback to `any` would
have been possible (this is already the case for unencrypted keys in the
`private` and `pkcs8` directories, which are not parsed by swanctl), it's
not necessary (as long as swanctl and the daemon are from the same release)
and does not require the daemon to detect the key type again.

Fixes #3586.

4 years agovici: Support all defined key types
Tobias Brunner [Thu, 8 Oct 2020 07:32:57 +0000 (09:32 +0200)] 
vici: Support all defined key types

References #3586.

4 years agorevocation: Validate OCSP nonce only if response actually contains a nonce
Martin Willi [Mon, 10 Aug 2020 16:29:52 +0000 (18:29 +0200)] 
revocation: Validate OCSP nonce only if response actually contains a nonce

Commit 27756b081c1b8 (revocation: Check that nonce in OCSP response matches)
introduced strict nonce validation to prevent replay attacks with OCSP
responses having a longer lifetime. However, many commercial CAs (such as
Digicert) do not support nonces in responses, as they reuse once-issued OCSP
responses for the OCSP lifetime. This can be problematic for replay attack
scenarios, but is nothing we can fix at our end.

With the mentioned commit, such OCSP responses get completely unusable,
requiring the fallback to CRL based revocation. CRLs don't provide any
replay protection either, so there is nothing gained security-wise, but may
require a download of several megabytes CRL data.

To make use of replay protection where available, but fix OCSP verification
where it is not, do nonce verification only if the response actually contains
a nonce. To be safe against replay attacks, one has to fix the OCSP responder
or use a different CA, but this is not something we can enforce.

Fixes #3557.

4 years agocharon-nm: Terminate if signaled by NetworkManager
Tobias Brunner [Tue, 6 Sep 2016 07:25:27 +0000 (09:25 +0200)] 
charon-nm: Terminate if signaled by NetworkManager

This only happens during shutdown, not after terminating a connection.

Fixes #3579.

4 years agosys-logger: Optionally log the level of each message
Tobias Brunner [Tue, 21 Jul 2020 13:57:12 +0000 (15:57 +0200)] 
sys-logger: Optionally log the level of each message

Fixes #3509.

4 years agofile-logger: Optionally log the level of each message
Tobias Brunner [Tue, 21 Jul 2020 13:56:50 +0000 (15:56 +0200)] 
file-logger: Optionally log the level of each message

Fixes #3509.

4 years agodrbg: Add missing format specifiers to debug output
Thomas Egerer [Mon, 12 Oct 2020 16:41:53 +0000 (16:41 +0000)] 
drbg: Add missing format specifiers to debug output

Fixes: 737375a2d27e ("drbg: Implemented NIST SP-800-90A DRBG")
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
4 years agolibimcv: Fix Doxygen comments for some pts_meas_algo_* functions
Tobias Brunner [Mon, 12 Oct 2020 11:48:57 +0000 (13:48 +0200)] 
libimcv: Fix Doxygen comments for some pts_meas_algo_* functions

4 years agoVersion bump to 5.9.1dr1 5.9.1dr1
Andreas Steffen [Mon, 5 Oct 2020 19:43:44 +0000 (21:43 +0200)] 
Version bump to 5.9.1dr1

4 years agotpm: Auto-detection of legacy TPM 2.0 devices
Andreas Steffen [Wed, 30 Sep 2020 14:36:29 +0000 (16:36 +0200)] 
tpm: Auto-detection of legacy TPM 2.0 devices

4 years agopts: Variable size PCR banks
Andreas Steffen [Sat, 19 Sep 2020 07:22:14 +0000 (09:22 +0200)] 
pts: Variable size PCR banks

4 years agolibtpmtss: Remove aik_blob debug output
Andreas Steffen [Wed, 16 Sep 2020 19:35:00 +0000 (21:35 +0200)] 
libtpmtss: Remove aik_blob debug output

4 years agopts: Parse TPM 2.0 BIOS/EFI event log
Andreas Steffen [Wed, 16 Sep 2020 15:15:05 +0000 (17:15 +0200)] 
pts: Parse TPM 2.0 BIOS/EFI event log

4 years agotpm: TPM 2.0 supports SHA3 and CMAC
Andreas Steffen [Tue, 15 Sep 2020 10:32:05 +0000 (12:32 +0200)] 
tpm: TPM 2.0 supports SHA3 and CMAC

4 years agoUse Botan 2.16.0 for tests
Tobias Brunner [Wed, 7 Oct 2020 08:01:37 +0000 (10:01 +0200)] 
Use Botan 2.16.0 for tests

4 years agoopenssl: Accept CRLs issued by non-CA certificates with cRLSign keyUsage flag
Tobias Brunner [Wed, 29 Jul 2020 16:40:20 +0000 (18:40 +0200)] 
openssl: Accept CRLs issued by non-CA certificates with cRLSign keyUsage flag

The x509 plugin accepted CRL signers since forever, to be precise, since
dffb176f2bc0 ("CRLSign keyUsage or CA basicConstraint are sufficient
for CRL validation")).

References #3529.

4 years agotesting: Build certificates when make-testing is called
Tobias Brunner [Tue, 22 Sep 2020 15:31:45 +0000 (17:31 +0200)] 
testing: Build certificates when make-testing is called

4 years agoinit: Remove obsolete StandardOutput setting from legacy systemd unit
Mingli Yu [Wed, 23 Sep 2020 08:20:22 +0000 (16:20 +0800)] 
init: Remove obsolete StandardOutput setting from legacy systemd unit

The standard output value "syslog" was deprecated for a while and did fall
back to "journal". It causes a warning since systemd version 246 [1].

By removing the setting it will default to DefaultStandardOutput, which
defaults to "journal".

[1] https://github.com/systemd/systemd/blob/master/NEWS#L202

Closes strongswan/strongswan#181.

4 years agoSimplify handling of terminating signals in all libcharon wrappers
Tobias Brunner [Tue, 29 Sep 2020 13:38:24 +0000 (15:38 +0200)] 
Simplify handling of terminating signals in all libcharon wrappers

Closes strongswan/strongswan#182.

4 years agotravis: Bump tpm2-tss to 2.4.3
Tobias Brunner [Thu, 24 Sep 2020 06:52:22 +0000 (08:52 +0200)] 
travis: Bump tpm2-tss to 2.4.3

4 years agolgtm: Fix building dependencies (in particular tpm2-tss)
Tobias Brunner [Tue, 22 Sep 2020 08:51:12 +0000 (10:51 +0200)] 
lgtm: Fix building dependencies (in particular tpm2-tss)

This was moved to a separate step with 0ff939585ec7 ("travis: Bump tpm2-tss
to 2.4.1") so packages are installed before these dependencies are built.
However, on LGTM, packages can't be installed explicitly, so `deps` is
a no-op and we still have to list some dependencies in the config.

4 years agoike-vendor: Add option to send Cisco FLexVPN vendor ID
Noel Kuntze [Fri, 24 Jul 2020 20:25:40 +0000 (22:25 +0200)] 
ike-vendor: Add option to send Cisco FLexVPN vendor ID

A new global option enables sending this vendor ID to prevent Cisco
devices from narrowing the initiator's local traffic selector to the
requested virtual IP, so e.g. 0.0.0.0/0 can be used instead.

This has been tested with a "tunnel mode ipsec ipv4" Cisco template but
should also work for GRE encapsulation.

Closes strongswan/strongswan#180.

4 years agolibipsec: Enable code coverage
Tobias Brunner [Wed, 9 Sep 2020 09:38:02 +0000 (11:38 +0200)] 
libipsec: Enable code coverage

Same as with libtls.

4 years agolibtls: Enable code coverage
Tobias Brunner [Wed, 9 Sep 2020 09:36:53 +0000 (11:36 +0200)] 
libtls: Enable code coverage

While the test runner was already correctly set up, the library itself
was not and no coverage was reported for any of its files.

4 years agoleak-detective: Whitelist OPENSSL_init_ssl()
Tobias Brunner [Fri, 4 Sep 2020 14:40:48 +0000 (16:40 +0200)] 
leak-detective: Whitelist OPENSSL_init_ssl()

These leaks are reported with OpenSSL 1.1.0+ if the mysql plugin is loaded.

4 years agotravis: Read project/organization for SonarCloud from environment variable
Tobias Brunner [Fri, 4 Sep 2020 14:20:40 +0000 (16:20 +0200)] 
travis: Read project/organization for SonarCloud from environment variable

4 years agoAdd project config for SonarCloud to ignore some files/rules
Tobias Brunner [Tue, 17 Mar 2020 13:37:33 +0000 (14:37 +0100)] 
Add project config for SonarCloud to ignore some files/rules

These settings have already been configured in the UI, but it might be
helpful to have them here so it's easier to set up the analysis of forks.

4 years agotesting: Increase memory of alice by 20 MiB
Tobias Brunner [Fri, 4 Sep 2020 12:57:56 +0000 (14:57 +0200)] 
testing: Increase memory of alice by 20 MiB

It's ever so close with strongTNC, sometimes the OOM killer got triggered
and the tests failed, or even worse, the whole guest system got stuck.
This might just be enough for now.

4 years agotesting: Fix dependency issue with strongTNC
Tobias Brunner [Mon, 24 Aug 2020 14:22:18 +0000 (16:22 +0200)] 
testing: Fix dependency issue with strongTNC

Apparently, djangorestframework-camel-case, in the referenced version,
uses `six` but does not itself require/install it (later versions removed
Python 2 support altogether).

4 years agoMerge branch 'testing-buster'
Tobias Brunner [Thu, 3 Sep 2020 13:53:14 +0000 (15:53 +0200)] 
Merge branch 'testing-buster'

Use Debian buster as base image for the testing environment.

4 years agotesting: Fix route-based/net2net-xfrmi-ike scenario
Tobias Brunner [Tue, 25 Aug 2020 08:28:58 +0000 (10:28 +0200)] 
testing: Fix route-based/net2net-xfrmi-ike scenario

On newer systems, the upper hard limit for open file descriptors (see
`ulimit -H -n`) was increased from 4096 to 524288.  Due to how python-daemon
closes potentially open file descriptors (basically stores them in a set,
removes those excluded by config, and loops through all of them), the updown
script was either killed immediately (by the OOM killer) or not ready yet
when updown events occurred.

4 years agoleak-detective: Whitelist leaks that occur on Debian buster
Tobias Brunner [Mon, 24 Aug 2020 14:20:43 +0000 (16:20 +0200)] 
leak-detective: Whitelist leaks that occur on Debian buster

4 years agotesting: Use Debian buster as base image
Tobias Brunner [Mon, 24 Aug 2020 14:20:15 +0000 (16:20 +0200)] 
testing: Use Debian buster as base image

4 years agotesting: Use latest x509-ada release
Tobias Brunner [Thu, 3 Sep 2020 11:30:30 +0000 (13:30 +0200)] 
testing: Use latest x509-ada release

This fixes an issue with newer compiler versions where crashes would be
caused if functions of the generated C X.509 parser are not aligned.

4 years agotesting: Add man, valgrind and strace to base image
Tobias Brunner [Mon, 24 Aug 2020 14:19:34 +0000 (16:19 +0200)] 
testing: Add man, valgrind and strace to base image

4 years agotesting: Install vici Python module manually
Tobias Brunner [Mon, 24 Aug 2020 14:17:04 +0000 (16:17 +0200)] 
testing: Install vici Python module manually

easy_install is not included in Debian's python-setuptools package
anymore, so we install it manually using setup.py.

4 years agotesting: Replace deprecated/removed `pip install --download` command
Tobias Brunner [Mon, 24 Aug 2020 14:15:50 +0000 (16:15 +0200)] 
testing: Replace deprecated/removed `pip install --download` command

It was deprecated for a while and has been replaced by `pip download`.

4 years agotesting: Use legacy iptables on Debian buster
Tobias Brunner [Mon, 24 Aug 2020 14:14:07 +0000 (16:14 +0200)] 
testing: Use legacy iptables on Debian buster

The iptables-nft wrapper that uses the nftables framework can't handle
the CLUSTERIP target (plus we'd require nftables in the kernel).

4 years agotesting: Increase maximum guest image size
Tobias Brunner [Mon, 24 Aug 2020 14:06:06 +0000 (16:06 +0200)] 
testing: Increase maximum guest image size

Seems that each Debian release increases the image size by about 200 MiB.
But increase it a bit more so we have room for logs/tools/debug symbols.

4 years agotesting: Use pkill to reload rsyslogd config/recreate log files
Tobias Brunner [Mon, 24 Aug 2020 14:01:27 +0000 (16:01 +0200)] 
testing: Use pkill to reload rsyslogd config/recreate log files

The PID location changes with newer Debian releases so it's more
portable this way.

4 years agotesting: Remove deprecated UsePrivilegeSeparation option from sshd_config
Tobias Brunner [Mon, 24 Aug 2020 13:57:03 +0000 (15:57 +0200)] 
testing: Remove deprecated UsePrivilegeSeparation option from sshd_config

4 years agotesting: Add Linux 5.8 kernel config
Tobias Brunner [Mon, 24 Aug 2020 13:54:13 +0000 (15:54 +0200)] 
testing: Add Linux 5.8 kernel config

Enables TCP encap for ESP.

4 years agotesting: Use host's /dev/urandom as /dev/random on guests via VirtIO RNG
Tobias Brunner [Mon, 24 Aug 2020 13:33:44 +0000 (15:33 +0200)] 
testing: Use host's /dev/urandom as /dev/random on guests via VirtIO RNG

Newer versions of systemd etc. seem to require quite a lot of entropy
from /dev/random while booting, which can block and therefore delay the
start of other services (in particular sshd) by more than a minute.
Using the host's /dev/urandom via VirtIO RNG, we can avoid blocking the
guests.

The required kernel options are added for kernel versions 5.4+.

4 years agolibimcv: Add Debian 10.5 to IMV database
Tobias Brunner [Mon, 24 Aug 2020 13:32:16 +0000 (15:32 +0200)] 
libimcv: Add Debian 10.5 to IMV database

4 years agotesting: Support build with Debian buster base image
Tobias Brunner [Tue, 28 Jul 2020 15:20:31 +0000 (17:20 +0200)] 
testing: Support build with Debian buster base image

4 years agotravis: Bump wolfSSL to 4.5.0
Tobias Brunner [Fri, 21 Aug 2020 06:49:59 +0000 (08:49 +0200)] 
travis: Bump wolfSSL to 4.5.0

4 years agoimv-scanner: Fix potential buffer overflow
Tobias Brunner [Tue, 18 Aug 2020 11:18:52 +0000 (13:18 +0200)] 
imv-scanner: Fix potential buffer overflow

While `pos` was moved to the end, `len` was not adjusted (i.e. set to 0)
so later calls could write beyond the buffer.  However, the last port
written might have been incomplete, so instead we just reset the string.

4 years agoaesni: Remove useless algorithm assignments
Tobias Brunner [Tue, 18 Aug 2020 11:17:24 +0000 (13:17 +0200)] 
aesni: Remove useless algorithm assignments

4 years agovici: Don't use pytest-pycodestyle with Python 3.5
Tobias Brunner [Mon, 17 Aug 2020 13:22:34 +0000 (15:22 +0200)] 
vici: Don't use pytest-pycodestyle with Python 3.5

This causes problems due to a deprecation error during the Ubuntu Xenial
build on Travis.

4 years agotravis: Bump tpm2-tss to 2.4.2
Tobias Brunner [Mon, 17 Aug 2020 11:45:15 +0000 (13:45 +0200)] 
travis: Bump tpm2-tss to 2.4.2

5 years agoVersion bump to 5.9.0 5.9.0
Andreas Steffen [Wed, 29 Jul 2020 11:08:09 +0000 (13:08 +0200)] 
Version bump to 5.9.0

5 years agoNEWS: Add news for 5.9.0
Tobias Brunner [Fri, 24 Jul 2020 14:43:00 +0000 (16:43 +0200)] 
NEWS: Add news for 5.9.0

5 years agovici: Fix typos in comments
Tobias Brunner [Thu, 23 Jul 2020 12:50:17 +0000 (14:50 +0200)] 
vici: Fix typos in comments

5 years agoVersion bump to 5.9.0rc1 5.9.0rc1
Andreas Steffen [Tue, 21 Jul 2020 20:43:36 +0000 (22:43 +0200)] 
Version bump to 5.9.0rc1

5 years agoconfigure: Ignore unknown Git version number
Tobias Brunner [Mon, 20 Jul 2020 15:38:03 +0000 (17:38 +0200)] 
configure: Ignore unknown Git version number

Don't abort the script if the version is reported as UNKNOWN, which happens
on CI hosts where the repository is only cloned with a certain depth (which
may not include the latest tag).

Also, never map VERSION to UNKNOWN.

Fixes: 2e522952c77d ("configure: Optionally use version information obtained from Git in executables")
5 years agoUse Botan 2.15.0 for tests
Tobias Brunner [Mon, 20 Jul 2020 14:58:03 +0000 (16:58 +0200)] 
Use Botan 2.15.0 for tests

5 years agounit-tests: Fix cancel_onoff test
Tobias Brunner [Mon, 20 Jul 2020 09:45:54 +0000 (11:45 +0200)] 
unit-tests: Fix cancel_onoff test

If it takes a while to start one of the threads, another thread might already
have passed the usleep() call previously used and re-enabled cancelability
so that the loop that checked for it would never terminate.

5 years agounit-tests: Print a header for each test function/iteration if verbosity is >= 0
Tobias Brunner [Wed, 1 Jul 2020 11:29:22 +0000 (13:29 +0200)] 
unit-tests: Print a header for each test function/iteration if verbosity is >= 0

5 years agounit-tests: Add ability to filter test cases and functions
Tobias Brunner [Wed, 17 Jun 2020 08:55:12 +0000 (10:55 +0200)] 
unit-tests: Add ability to filter test cases and functions

5 years agoconfigure: Optionally use version information obtained from Git in executables
Tobias Brunner [Tue, 5 May 2020 14:19:09 +0000 (16:19 +0200)] 
configure: Optionally use version information obtained from Git in executables

The variable GIT_VERSION is always defined, either obtained from Git or
a file that is embedded in tarballs when they are built.  Optionally,
that version is declared as VERSION in config.h so it will be used e.g. in
the daemons when they print the version number.

There is a check that should catch missing tags (i.e. if the version number
in AC_INIT() isn't a prefix of the version obtained via Git).

5 years agoopenssl: Use consistent ifdefs to disable x25519/448
Tobias Brunner [Thu, 2 Jul 2020 12:09:32 +0000 (14:09 +0200)] 
openssl: Use consistent ifdefs to disable x25519/448

When compiling with OPENSSL_NO_ECDH but without OPENSSL_NO_EC the build
failed.

5 years agoMerge branch 'vici-ca-certs'
Tobias Brunner [Mon, 20 Jul 2020 12:07:47 +0000 (14:07 +0200)] 
Merge branch 'vici-ca-certs'

These changes store all CA certificates in vici_authority_t, which avoids
issues with unloading authority sections or clearing credentials.

Closes strongswan/strongswan#172.

5 years agovici: Keep track of all CA certificates in vici_authority_t
Tobias Brunner [Wed, 20 May 2020 14:50:11 +0000 (16:50 +0200)] 
vici: Keep track of all CA certificates in vici_authority_t

This way we only have one reference for each CA certificate, whether it
is loaded in an authority section, a connection or via load-certs() command.
It also avoids enumerating CA certificates multiple times if they are
loaded in different ways.

5 years agoobject: Add helper for callbacks with two void pointers
Tobias Brunner [Wed, 20 May 2020 15:34:39 +0000 (17:34 +0200)] 
object: Add helper for callbacks with two void pointers

5 years agovici: Make attribute certificates untrusted again
Tobias Brunner [Wed, 20 May 2020 13:25:51 +0000 (15:25 +0200)] 
vici: Make attribute certificates untrusted again

Fixes: 334119b843d7 ("Share vici_cert_info.c with vici_cred.c")
5 years agovici: Clear credential cache when unloading an authority section
Tobias Brunner [Wed, 20 May 2020 13:05:44 +0000 (15:05 +0200)] 
vici: Clear credential cache when unloading an authority section

5 years agovici: Directly provide CA certificates in authority sections
Tobias Brunner [Wed, 20 May 2020 12:40:51 +0000 (14:40 +0200)] 
vici: Directly provide CA certificates in authority sections

With the previous approach, CA certificates that were not re-loaded via
load-cert() (e.g. from tokens or via absolute paths) would not be available
anymore after the clear-creds() command was used.  This avoids this
issue, but can cause duplicate CA certificates to get stored and enumerated,
so there might be a scaling factor.

5 years agocertificate: Extract helper function to filter certificates
Tobias Brunner [Wed, 20 May 2020 12:25:33 +0000 (14:25 +0200)] 
certificate: Extract helper function to filter certificates

5 years agoMerge branch 'ordered-hashtable'
Tobias Brunner [Mon, 20 Jul 2020 12:01:22 +0000 (14:01 +0200)] 
Merge branch 'ordered-hashtable'

This changes the hashtable implementation to that it maintains insertion
order.  This is then used in the vici plugin to store connections in a
hash table instead of a linked list, which makes managing them quite a
bit faster if there are lots of connections.

The old implementation is extracted into a new class (hashlist_t), which
optionally supports sorting keys and provides the previous get_match()
function.

5 years agohashtable: Use quadratic probing
Tobias Brunner [Fri, 24 Apr 2020 17:11:25 +0000 (19:11 +0200)] 
hashtable: Use quadratic probing

This reduces the clustering problem (primary clustering) but is not
completely free of it (secondary clustering) it still reduces the maximum
and average probing lengths.

5 years agovici: Store configs in a hashtable
Tobias Brunner [Fri, 24 Apr 2020 13:16:26 +0000 (15:16 +0200)] 
vici: Store configs in a hashtable

This makes updates more efficient if many configs are loaded. Configs
still have to be enumerated to select them.

5 years agohashtable: Maintain insertion order when enumerating
Tobias Brunner [Fri, 24 Apr 2020 13:51:17 +0000 (15:51 +0200)] 
hashtable: Maintain insertion order when enumerating

With the previous approach we'd require at least an additional pointer
per item to store them in a list (15-18% increase in the overhead per
item).  Instead we switch from handling collisions with overflow lists to
an open addressing scheme and store the actual table as variable-sized
indices pointing into an array of all inserted items in their original
order.

This can reduce the memory overhead even compared to the previous
implementation (especially for smaller tables), but because the array for
items is preallocated whenever the table is resized, it can be worse for
certain numbers of items.  However, avoiding all the allocations required
by the previous design is actually a big advantage.

Depending on the usage pattern, the performance can improve quite a bit (in
particular when inserting many items).  The raw lookup performance is a bit
slower as probing lengths increase with open addressing, but there are some
caching benefits due to the compact storage.  So for general usage the
performance should be better.  For instance, one test I did was counting the
occurrences of words in a list of 1'000'000 randomly selected words from a
dictionary of ~58'000 words (i.e. using a counter stored under each word as
key).  The new implementation was ~8% faster on average while requiring
10% less memory.

Since we can't remove items from the array (would change the indices of all
items that follow it) we just mark them as removed and remove them once the
hash table is resized/rehashed (the cells in the hash table for these may
be reused).  Due to this the latter may also happen if the number of stored
items does not increase e.g. after a series of remove/put operations (each
insertion requires storage in the array, no matter if items were removed).
So if the capacity is exhausted, the table is resized/rehashed (after lots
of removals the size may even be reduced) and all items marked as removed
are simply skipped.

Compared to the previous implementation the load factor/capacity is
lowered to reduce chances of collisions and to avoid primary clustering to
some degree.  However, the latter in particular, but the open addressing
scheme in general, make this implementation completely unsuited for the
get_match() functionality (purposefully hashing to the same value and,
therefore, increasing the probing length and clustering).  And keeping the
keys optionally sorted would complicate the code significantly.  So we just
keep the existing hashlist_t implementation without adding code to maintain
the overall insertion order (we could add that feature optionally later, but
with the mentioned overhead for one or two pointers).

The maximum size is currently not changed.  With the new implementation
this translates to a hard limit for the maximum number of items that can be
held in the table (=CAPACITY(MAX_SIZE)).  Since this equals 715'827'882
items with the current settings, this shouldn't be a problem in practice,
the table alone would require 20 GiB in memory for that many items.  The
hashlist_t implementation doesn't have that limitation due to the overflow
lists (it can store beyond it's capacity) but it itself would require over
29 GiB of memory to hold that many items.

5 years agohashlist: Move get_match() and sorting into a separate class
Tobias Brunner [Fri, 24 Apr 2020 11:41:53 +0000 (13:41 +0200)] 
hashlist: Move get_match() and sorting into a separate class

The main intention here is that we can change the hashtable_t
implementation without being impeded by the special requirements imposed
by get_match() and sorting the keys/items in buckets.

5 years agounit-tests: Pass test iteration to fixtures
Tobias Brunner [Fri, 24 Apr 2020 12:45:21 +0000 (14:45 +0200)] 
unit-tests: Pass test iteration to fixtures

5 years agohashtable: Optionally collect and report profiling data
Tobias Brunner [Fri, 24 Apr 2020 08:56:50 +0000 (10:56 +0200)] 
hashtable: Optionally collect and report profiling data

5 years agohashtable: Optionally sort keys/items in buckets in a specific way
Tobias Brunner [Fri, 24 Apr 2020 06:50:24 +0000 (08:50 +0200)] 
hashtable: Optionally sort keys/items in buckets in a specific way

This can improve negative lookups, but is mostly intended to be used
with get_match() so keys/items can be matched/enumerated in a specific
order.  It's like storing sorted linked lists under a shared key but
with less memory overhead.

5 years agohashtable: Store items in buckets in insertion order
Tobias Brunner [Fri, 24 Apr 2020 06:30:03 +0000 (08:30 +0200)] 
hashtable: Store items in buckets in insertion order

This is more predictable when using get_match() in particular because
the order does not change anymore when the table is rehashed.

5 years agounit-tests: Add tests for larger number of items in hashtables
Tobias Brunner [Fri, 24 Apr 2020 06:02:59 +0000 (08:02 +0200)] 
unit-tests: Add tests for larger number of items in hashtables

5 years agounit-tests: Optionally report the times test cases ran
Tobias Brunner [Thu, 16 Apr 2020 16:05:37 +0000 (18:05 +0200)] 
unit-tests: Optionally report the times test cases ran

5 years agokernel-netlink: Ignore preference for temporary addresses for IPv6 VIPs
Tobias Brunner [Tue, 7 Jul 2020 08:01:46 +0000 (10:01 +0200)] 
kernel-netlink: Ignore preference for temporary addresses for IPv6 VIPs

They are not marked as temporary addresses so make sure we always return
them whether temporary addresses are preferred as source addresses or not
as we need to enumerate them when searching for addresses in traffic selectors
to install routes.

Fixes: 9f12b8a61c47 ("kernel-netlink: Enumerate temporary IPv6 addresses according to config")
5 years agocharon-nm: Set DPD/close action to restart and enable indefinite keying tries
Tobias Brunner [Mon, 18 May 2020 12:17:24 +0000 (14:17 +0200)] 
charon-nm: Set DPD/close action to restart and enable indefinite keying tries

We don't track CHILD_SA down events anymore and rely on NM's initial timeout
to let the user know if the connection failed initially.  So we also don't
have to explicitly differentiate between initial connection failures and
later ones like we do an Android.  Also, with the default retransmission
settings, there will only be one keying try as NM's timeout is lower than
the combined retransmission timeout of 165s.

There is no visual indicator while the connection is reestablished later.

Fixes #3300.

5 years agovici: With start_action=start, terminate IKE_SA without children on unload
Tobias Brunner [Wed, 1 Jul 2020 11:49:58 +0000 (13:49 +0200)] 
vici: With start_action=start, terminate IKE_SA without children on unload

This includes IKE_SAs in CONNECTING state, which not yet have any
CHILD_SAs.

Closes strongswan/strongswan#175.

5 years agoeap-radius: Small spelling fix
Boris Vanhoof [Sat, 27 Jun 2020 08:32:19 +0000 (10:32 +0200)] 
eap-radius: Small spelling fix

Closes strongswan/strongswan#174.

5 years agotesting: Skip tests with missing files, don't abort the test run
Tobias Brunner [Tue, 23 Jun 2020 14:24:18 +0000 (16:24 +0200)] 
testing: Skip tests with missing files, don't abort the test run

This allows simple test configs in testing/tests/local that are no
actual test cases.

5 years agoVersion bump to 5.9.0dr2 5.9.0dr2
Andreas Steffen [Sun, 14 Jun 2020 10:15:44 +0000 (12:15 +0200)] 
Version bump to 5.9.0dr2

5 years agotesting: Fix SQL scenarios after preferring AEAD for ESP
Tobias Brunner [Fri, 5 Jun 2020 13:54:15 +0000 (15:54 +0200)] 
testing: Fix SQL scenarios after preferring AEAD for ESP

sql/net2net-route|start-pem seem to be the only ones that configure a
proposal via database.

5 years agotesting: Fix ikev2/net2net-fragmentation scenario
Tobias Brunner [Fri, 5 Jun 2020 13:46:49 +0000 (15:46 +0200)] 
testing: Fix ikev2/net2net-fragmentation scenario

The IKE_AUTH message from moon is now larger because of the AEAD proposal.