Compare commits

...

1319 Commits

Author SHA1 Message Date
Tobias Brunner
404111b46f Merge branch 'vici-alerts'
Exposes alerts via vici protocol.

Closes strongswan/strongswan#2894
2025-10-02 10:22:51 +02:00
Martin Willi
f5f04b7d20 bus: Clarify that ALERT_TS_NARROWED is issued for local narrowing as well 2025-10-02 10:22:36 +02:00
Martin Willi
86a50d1618 child-create: Raise an ALERT_TS_MISMATCH when receiving TS_UNACCEPTABLE
When sending a TS_UNACCEPTABLE notify, a ALERT_TS_MISMATCH is sent, but
not when receiving one. This seems inconsistent compared to proposal
mismatch handling, so extend the child_create task to raise such an alert.
2025-10-02 10:22:36 +02:00
Martin Willi
d46529fe2d vici: Raise alert events from the bus alert listener hook
The bus alert infrastructure is currently exposed through the error-notify
plugin using a dedicated socket using a rather archaic message format.
Vici clients would need a dedicated socket connection just to receive such
alert messages, making their implementation more complex.

With vici, it is rather trivial to expose bus alerts through a dedicated
event message that vici clients may subscribe to. Add such an "alert"
event type to vici. Alert names are mapped to strings for simple consumption by
clients.

For now, the error-notify string message is omitted from events, as it mostly
contains static information without much value; instead add the IKE_SA details
for alerts associated to an IKE_SA. Other alert specific data may be added in
the future if needed; preferably using a structured format instead of the
arbitrary string messages used by error-notify. To allow future extensions,
wrap IKE_SA details under a dedicated "ike-sa" property.
2025-10-02 10:22:32 +02:00
Tobias Brunner
b83aed1362 libtls: Use correct constant in error message
Closes strongswan/strongswan#2896

Fixes: e7313962808c ("tls-server: Check if peer sent hash and signature algorithms")
2025-10-02 10:02:49 +02:00
Tobias Brunner
eb2d8768d8 github: Use OpenSSL 3 for macOS builds and enable additional plugins
The Homebrew formula has been using OpenSSL 3 for a while.  The eap-peap
and pkcs11 plugins also have been enabled in the formula.  The dhcp plugin
is enabled to test the port (the farp plugin was already enabled since
its port to FreeBSD/macOS).  The drbg plugin is enabled to run the ML-KEM
test vectors.
2025-10-02 09:03:37 +02:00
Tobias Brunner
6a55de1fa2 github: Build on macOS 14 instead of the deprecated macOS 13
While macos-13 was running on Intel, both macos-latest (macOS 15) and
macos-14 run on ARM64.  While there are Intel-based images for 14 and 15,
they will only be available until August 2027 (and there aren't any Intel
devices anymore anyway).
2025-10-01 19:08:51 +02:00
Tobias Brunner
d0770e5362 github: Use OpenSSL 3.6.0 for tests 2025-10-01 19:08:49 +02:00
Tobias Brunner
61daa338c7 vici: Remove deprecated license classifier in Python metadata 2025-10-01 19:08:34 +02:00
Tobias Brunner
bfed29705e Merge branch 'android-updates'
This fixes GUI-related compatibility issues with Android 16 and allows
(pre-)selecting on-device certificates/keys with managed profiles.  Also
fixes a typo in the managed config description that prevented
split-tunneling settings from working.
2025-10-01 15:19:18 +02:00
Tobias Brunner
74a4700b6d android: New release after updating target SDK and allowing cert selection in managed profiles 2025-10-01 15:18:27 +02:00
Tobias Brunner
ce8b5ff394 android: Fix typo for split-tunneling settings in managed config description
We use the American spelling "tunneling" throughout the app.
2025-10-01 14:47:02 +02:00
Tobias Brunner
cde39f4c1a android: Make a certificate alias pre-selectable in managed profiles
This allows associating a pre-installed certificate/key with a VPN
profile.  For instance, one locally generated on the device via
SCEP/ETS by the MDM.  It only works if the app is granted access to the
certificate/key (alias) by the MDM.

For now, users may still select a different certificate if one is
available (since this requires the certificate to be installed as
user-selectable there might not be).
2025-09-30 16:51:08 +02:00
Tobias Brunner
11f043c3de android: Prompt the user to edit the profile if no certificate is selected 2025-09-30 16:51:08 +02:00
Tobias Brunner
1a16b2c0cb android: Don't print "null" if no user certificate is selected 2025-09-30 11:26:41 +02:00
Tobias Brunner
4918e681ee android: Allow selecting a user certificate for managed profiles
This is only enabled for profiles that are not distributed with a
certificate.
2025-09-30 11:26:41 +02:00
Tobias Brunner
eac76a1a5a android: Explicitly pull in androidx.localbroadcastmanager
Seems to not get pulled in automatically anymore.  This has actually been
deprecated for years apparently.  Unfortunately, it's not that easy to
replace, so keep it for now.
2025-09-30 11:26:41 +02:00
Tobias Brunner
e26d974fe3 android: Remove redundant namespace and fix indentation in state fragment layout 2025-09-30 11:26:40 +02:00
Tobias Brunner
357b93e99d android: Use correct title for proxy server port field in managed configs 2025-09-30 11:26:40 +02:00
Tobias Brunner
3bf34f1cd5 android: Simplify theme definition due to minSdkVersion 2025-09-30 11:26:40 +02:00
Tobias Brunner
13426bd2ea android: Remove obsolete TargetApi attribute 2025-09-30 11:26:40 +02:00
Tobias Brunner
59b74c767a android: Update syntax for three values Gradle warns about
Others seem to be fine or even get an explicit error if changed, like
targetSdkVersion.
2025-09-30 11:26:40 +02:00
Tobias Brunner
19ef347628 android: Increase targetSdkVersion to 36 (Android 16) 2025-09-30 11:26:40 +02:00
Tobias Brunner
86508cdf2b android: Update NDK version 2025-09-30 11:26:40 +02:00
Tobias Brunner
2404b2bee6 android: Apply UI changes for edge-to-edge views in Android 15+
When targeting Android 15, edge-to-edge is the default and when targeting
Android 16, apps can't opt-out from this anymore.  So we update our views
and enable edge-to-edge also for older versions (avoids the black bar
behind the system UI at the bottom).  For most views we just use automatic
margins via android:fitsSystemWindows (or programmatically via
setDecorFitsSystemWindows).  However, for the profile lists and log views,
we take some extra measures that allow the lists to go behind the bottom
system UI.  Appropriate padding is applied at the bottom of the lists so
the last item(s) can be scrolled into full view.
2025-09-30 11:26:40 +02:00
Tobias Brunner
216a9dbb8d android: Avoid crash if read-only profile selection dialog is hidden 2025-09-30 11:26:40 +02:00
Tobias Brunner
3eb2f58a51 android: Update dependencies 2025-09-30 11:26:40 +02:00
Tobias Brunner
ff5fc29285 android: Update Gradle plugin 2025-09-30 11:26:40 +02:00
Tobias Brunner
b1275f26a6 github: Use latest SonarQube action
Updating this although the fixed security issue only affects Windows
builds.
2025-09-26 15:34:28 +02:00
Tobias Brunner
b3011e8e87 Remove support for MD2
No part of IKE/IPsec or X.509 uses MD2 anymore, so there really is no
reason to still support it (unlike MD4 that is used in EAP-MSCHAPv2,
MD5 that's used in EAP-MD5, or SHA-1 that's used for e.g. NAT-D hashes).

It caused test vectors to fail on systems where OpenSSL is built with
MD2 support but has it disabled at runtime.
2025-09-23 15:59:35 +02:00
Andreas Steffen
2b13873c0f Version bump to 6.0.3dr1 2025-09-22 18:57:54 +02:00
Tobias Brunner
7af0caeee1 Merge branch 'testing-trixie'
Use Debian trixie as base image for testing.
2025-09-18 11:27:38 +02:00
Tobias Brunner
1043fa32de testing: Add delay after qemu-nbd -c
Seems that there is a delay before the disk can be used when using newer
QEMU versions (e.g. on Debian trixie). We get errors like these:

  sfdisk: cannot open /dev/nbd0: Inappropriate ioctl for device

or

  mount: /srv/strongswan-testing/build/loop: special device /dev/nbd0p1 does not exist.

A sleep before the next command seems to help.

Also see [1].

[1] https://gitlab.com/qemu-project/qemu/-/issues/1413
2025-09-18 11:13:32 +02:00
Tobias Brunner
e9ebe49d44 testing: Add option to run tests without leak detective
This new option allows to disable leak detective to reduce the runtime
during development.  Either only for the command line (swanctl, pki etc.)
or optionally also for the daemon(s).

Disabling leak detective only for the CLI tools already brings a
considerable reduction in runtime (from 48m to 38m on my dev host) as
there are many such calls in the post-test stage.  Any leaks in those
tools are also a lot less of an issue than leaks in the daemon.  So using
this during development should be fine as long as a full test run is done
regularly (in particular before releases).  Disabling leak detective
completely further reduces the runtime (to 30m on my dev host). But that
should probably only be used for functional regression tests after
verifying new code didn't introduce new leaks.

This also fixes the service script which is used for charon-tkm since
16fcdb460afd ("charon-tkm: Don't use starter/stroke with charon-tkm anymore").
2025-09-18 11:13:32 +02:00
Tobias Brunner
906205b7ee testing: Use Debian trixie to test TKM 2025-09-18 11:13:32 +02:00
Tobias Brunner
a0a5bd7669 testing: Use Debian trixie 2025-09-18 11:13:32 +02:00
Tobias Brunner
f3cc9bec18 testing: Use proper directory for slapd PID files 2025-09-18 11:13:32 +02:00
Tobias Brunner
d8a1747fa1 libimcv: Add Debian 13 (trixie) to database 2025-09-18 11:13:32 +02:00
Tobias Brunner
3aa7e1d418 testing: Increase memory for guest hosts to run Debian trixie
While some increase was necessary anyway because the idle system requires
about 5-10 MiB more memory, the main issue is resolving the code line and
function name in case of a memory leak.  Calling addr2line requires a lot
more memory than before.  Using backtraces via libbfd doesn't help either
because the trigger is the bfd_find_nearest_line() call we use as well.
And because we'd try to resolve all symbols that way (for whitelisting),
the memory overhead would be even higher and affect every shutdown, even
if no leak occurred.  It also causes a significant time overhead (running
all tests took 75m instead of 48m).

I also tested switching to ASAN/LSAN.  The peak memory usage is slightly
higher than when using libbfd, but enabling it also increased the runtime
overhead a lot (the daemon and swanctl both required about 10-20 MiB more
memory, not just during the shutdown).
2025-09-18 11:13:32 +02:00
Tobias Brunner
1767ba2a13 testing: Add support for Debian trixie base images 2025-09-18 11:13:32 +02:00
Tobias Brunner
518b8e4286 testing: Use pipx to install swidGenerator on Debian trixie
We could use the same approach on bookworm (if the base image is updated),
but just use the old approach there for now.
2025-09-18 11:13:32 +02:00
Tobias Brunner
fa1cd74712 testing: Install required packages in venv of updated strongTNC
Update revision for some dependency updates.  While python3-setuptools is
installed on the system, the venv apparently can't use it.  legacy-cgi is
required to use that old Django version with newer Python releases.
2025-09-18 11:13:32 +02:00
Tobias Brunner
ecc2e35713 testing: Update TKM RPC to be compatible with newer compilers 2025-09-18 11:13:32 +02:00
Tobias Brunner
b4a51f1719 testing: Use newer version of TKM on trixie
The API for libgmpada has change with 1.6 in a way that's not
backwards-compatible.  So we use a different revision that includes
the required changes depending on the Debian version.

This also adds support for esa_select(), to support seamless rekeyings,
which requires updating xfrm-ada as well.
2025-09-18 11:13:32 +02:00
Tobias Brunner
ddeb3c463e testing: Run commands in chroot in a login shell
Similar to the previous commit, this ensures we have the same environment
we do later on the system.
2025-09-18 11:13:32 +02:00
Tobias Brunner
870aa75eed testing: Start a login shell in chroot script
This ensures we have the same environment (e.g. stuff from /etc/profile.d)
as when logging in via SSH later.
2025-09-18 11:13:32 +02:00
Tobias Brunner
b998695344 testing: Ignore unknown memory in leak detective
This is set in two locations for systemd services and login shells. The
memory is freed by OPENSSL_cleanup().
2025-09-18 11:13:32 +02:00
Tobias Brunner
0e768233f2 leak-detective: Include OpenSSL symbol seen on Debian trixie 2025-09-18 11:13:32 +02:00
Tobias Brunner
a9e3db6b79 testing: Pass base image codename to application Makefiles
Some might require it to use different revisions or commands.
2025-09-18 11:13:32 +02:00
Tobias Brunner
b51731e197 testing: Mount /proc in the chroot to make systemctl happy 2025-09-18 11:13:27 +02:00
Tobias Brunner
a418666f59 testing: Use new recommended approach to install key for custom apt repository
apt-key add is deprecated (and not available in trixie) as it makes the
available for all sources.  The recommended approach makes the key very
specifically available for just our repository.
2025-09-18 11:12:22 +02:00
Tobias Brunner
2025f630df testing: Remove unnecessary workaround for DHCP 2025-09-18 11:12:22 +02:00
Tobias Brunner
acaf4b2d17 testing: Move sysctl settings to sysctl.d and add some memory settings
Debian trixie doesn't provide a 99-sysctl.conf symlink in that directory
anymore.  The memory settings are also useful there as the default of
one changed and overbooking helps when forking a process with large
memory footprint (e.g. the IKE daemon).
2025-09-18 11:12:22 +02:00
Tobias Brunner
5e85ce17a2 testing: Remove xconsole config for rsyslogd
This produces a warning and we don't have X.
2025-09-18 11:12:22 +02:00
Tobias Brunner
2eef6b242b github: Use AWS-LC 1.61.1 for tests 2025-09-18 08:29:39 +02:00
Tobias Brunner
ac0272cad1 host: Don't try to resolve %any* keywords with mismatched address family
While host_create_from_string_and_family() usually replaces %any*
keywords, this fails if the address family doesn't match (e.g. %any4 with
AF_INET6).  There is no point in trying to resolve these keywords via
DNS as % is no valid character for host names.

Closes strongswan/strongswan#2880
2025-09-16 10:14:26 +02:00
Tobias Brunner
e33dddffea github: Use latest SonarQube action 2025-09-15 17:46:03 +02:00
Tobias Brunner
45f5a7a698 curl: Fix types enforced by compiler check in newer libcurl headers 2025-09-15 16:51:42 +02:00
Tobias Brunner
cfb5e46a98 Merge branch 'plugin-versions'
This adds a symbol with the current version number to all existing
plugins (the PLUGIN_DEFINE() macro makes this easy).  The version is
checked when a plugin is loaded from a file in order to prevent loading
old plugins from any previous build, which could cause all sorts of
issues.

References strongswan/strongswan#2835
2025-08-22 16:49:31 +02:00
Tobias Brunner
c4b32aab04 plugin-loader: Check version of loaded plugins
This prevents loading plugins from older builds that can cause all sorts
of issues as they might access struct members in different locations.

We don't check the version for statically linked plugins.
2025-08-22 15:32:39 +02:00
Tobias Brunner
5cab5672e7 Define plugin version in all existing plugins 2025-08-22 15:32:39 +02:00
Tobias Brunner
d087c349b4 plugin: Add macro to define plugin version and constructor 2025-08-22 15:32:39 +02:00
Tobias Brunner
1b551a9bfd plugin-loader: Don't prevent dynamic linking in addition to static constructors
When built with static plugins and constructors, we might still want to
be able to load external plugins.

Fixes: d860c26e9533 ("plugin-loader: Properly support compilation without dlopen()/dlsym() etc.")
2025-08-22 15:32:39 +02:00
Tobias Brunner
e9fa338e23 pkcs11: Improve detection of already unwrapped CKA_EC_POINTs
If an uncompressed point is already unwrapped (incorrect but some tokens/
modules do this) and therefore still looks like an ASN.1 octet string,
there could be false positives with the previous checks that lead to
mangled points.

By ensuring that we unwrapped the complete ASN.1 chunk, we can already
reduce the false positive rate when the assumed length is smaller than
the chunk, which we previously accepted but isn't the case in correctly
encoded points.

And while we already checked that the first byte indicates a valid point
type/encoding, there could still be false positives.  We can avoid those
with some checks on the length of the unwrapped point.  In particular,
enforcing a multiple of 4/8 should fail for valid unwrapped points where
three bytes were removed in the process (ASN.1 tag and length, point
encoding).

Closes strongswan/strongswan#2872
2025-08-22 15:31:25 +02:00
Tobias Brunner
abadd47736 charon-cmd: Cache shared secret under identities if available
We won't have identities for private key passwords, but we do for EAP
identities and they might get reused if redirected.
2025-08-22 15:27:00 +02:00
Tobias Brunner
d662a69d9d ike-sa-manager: Avoid deadlock due to race condition during shutdown
If an entry is added while we wait for a checked out SA in flush() (e.g.
due to an action performed by that SA), new entries might get inserted
before the one we wait for.  If that was the first entry in the row, we
didn't correctly update the table and the new entries were basically lost
by overwriting the first entry in the row.  As the SA count was still
increased but the new entries couldn't get enumerated, the daemon wasn't
terminated properly but was stuck in the loop in flush().
2025-08-22 15:26:59 +02:00
Tobias Brunner
3e0123526f trap-manager: Migrate tracked IKE SA in case of redirect during IKE_AUTH 2025-08-22 15:26:59 +02:00
Tobias Brunner
ee668ae91e controller: Migrate tracked IKE SA in case of redirect during IKE_AUTH 2025-08-22 15:26:59 +02:00
Tobias Brunner
3a9120373d ike-sa: Avoid reusing established IKE_SAs that got redirected
These will get terminated by the peer after a while.  So we don't want
to reuse them.
2025-08-22 15:26:59 +02:00
Tobias Brunner
2f0a0fef3d vici: Fix indentation for some add_kv() calls 2025-08-22 15:22:33 +02:00
Mathias Aerts
a24dc2e9ad vici: Include configured local and remote ports in list-conns
Closes strongswan/strongswan#2869
2025-08-22 15:22:13 +02:00
Tobias Brunner
b36da850b5 github: Only run CI for latest commit in a branch, cancel old runs 2025-08-22 12:21:50 +02:00
Tobias Brunner
7b90dc93c0 libipsec: Run unit tests with TESTS_PLUGINS if specified 2025-08-22 12:11:11 +02:00
Tobias Brunner
9da68ec9f5 libtls: Fix double-free when enumerating private keys 2025-08-22 12:07:55 +02:00
Tobias Brunner
dcb53e076b testing: Disable deprecated features in Botan
We keep MD5 enabled for now as we need it for TLS 1.0/1.1.  Once we
remove that we can reconsider (although, it's also needed for EAP-MD5
and since MD4 is disabled as well, which means EAP-MSCHAPv2 won't
be available, we'd be left with only EAP-GTC for simple username/password
authentication, which nobody else supports).
2025-08-22 12:07:55 +02:00
Tobias Brunner
8139256aae botan: Replace calls to deprecated botan_privkey|pubkey_export() 2025-08-22 11:52:51 +02:00
Tobias Brunner
5e4ff88849 github: Use OpenSSL 3.5.2 for tests 2025-08-21 16:44:01 +02:00
Tobias Brunner
d973106eed github: Use AWS-LC 1.58.1 for tests 2025-08-21 16:44:01 +02:00
Tobias Brunner
052a939553 openssl: Add support for Ed25519 via AWS-LC 2025-08-21 16:44:01 +02:00
Tobias Brunner
4096a911a0 github: Check active transforms against reference files
Also collect current results so we can update reference files easily.

Enabled AES-CFB in wolfSSL as we have already support for it in the
plugin.
2025-08-21 16:16:01 +02:00
Tobias Brunner
545eb2416a unit-tests: Add option to collect active crypto transforms
This will allow us to compare new library versions against previous ones,
so we don't suddenly loose some algorithms like it happened with KDFs
recently after updating OpenSSL to 3.5.1.
2025-08-21 16:16:01 +02:00
Tobias Brunner
4c85b9d21b credential-factory: Avoid deadlock during unit tests
If a unit test times out while generating a private key (e.g. because of
a lack of entropy), this avoids a deadlock by still releasing the read
lock that'd prevent acquiring the write lock when plugins are unloaded.

Closes strongswan/strongswan#2850
2025-08-21 16:13:24 +02:00
Tobias Brunner
135ed6aada openssl: Simplify wrapping private key objects 2025-08-21 16:11:13 +02:00
Tobias Brunner
0391450376 openssl: Support EdDSA keys in PKCS#12 containers
References strongswan/strongswan#2848
2025-08-21 16:10:58 +02:00
Tobias Brunner
f02033664e vici: Add support for P-CSCF server attributes
Was apparently forgotten when support was added to the attr plugin
with 98a3ba8a5a16 ("attr: Add p-cscf keyword for P-CSCF server addresses").

For consistency, using an underscore like the `split*` options and not a
dash like in the attr plugin.

References strongswan/strongswan#2396
2025-08-21 16:04:39 +02:00
Tobias Brunner
ea05033319 eap-authenticator: Assume IKE identity as EAP-Identity if client doesn't send one
Apparently, some clients (e.g. native Android) just send an empty
EAP-Identity response.  We silently ignored that previously and then
used the IKE identity for the actual EAP method.  This change tries to
do something similar (i.e. don't fail if the response is empty), but by
assuming the IKE identity as EAP-Identity, we match that and possibly
can switch configs.

Closes strongswan/strongswan#2833
Fixes: 2f2e4abe3c52 ("ikev2: Add support to switch peer configs based on EAP-Identities")
2025-08-21 16:02:36 +02:00
Tobias Brunner
2560146204 github: Use provided actions for SonarQube installation and scan
Also switch to the cloud cache (which doesn't seem to work either way
anyway).
2025-08-05 10:27:32 +02:00
Tobias Brunner
ff06159099 certexpire: Double size of internal buffer for identities
The error-notify, lookip, and whitelist (previous commit) plugins already
use the same buffer size for identities.
2025-07-23 18:50:53 +02:00
seantywork
ae2e0b6cf2 whitelist: Double the length of the id field in the messages
Closes strongswan/strongswan#2842
2025-07-23 18:50:33 +02:00
Tobias Brunner
6c813ddc13 Use wolfSSL 5.8.2 for tests 2025-07-19 12:11:29 +02:00
Tobias Brunner
011c346b00 wolfssl: Store RNG on object for curve25519
5.8.2 enables blinding for curve25519 by default, so the RNG set when
making the key is also used later on.
2025-07-19 12:10:25 +02:00
Rob Shearman
1b62e88980 ml: Disable versioning for shared object
Avoid generating versioned shared objects which would need to be
installed along with the version-independent symlink by specifying
"-avoid-version" in the libtool LDFLAGS for the plugin. Avoid any
unwanted surprises by also specifying the "-module" option, making the
LDFLAGS consistent with all other libstrongswan plugins.

Closes strongswan/strongswan#2844
2025-07-18 16:30:50 +02:00
Tobias Brunner
58c567da74 Merge branch 'whitelist-watcher'
Use watcher and non-blocking I/O for client connections to avoid issues
with clients that stay connected for a long time.

Closes strongswan/strongswan#2827
2025-07-18 16:16:17 +02:00
Tobias Brunner
85ebf6abd4 whitelist: Add error handling to socket reads and fix a memory leak
This now adds some state (basically a message buffer), but simplifies
error handling as we don't have to handle two potential failure paths
and could avoid some potential issues by still calling the blocking
read_all().

It also fixes a memory leak when clients disconnect.
2025-07-18 12:07:45 +02:00
Rob Shearman
412231eecd whitelist: Use a watcher for control socket reading rather than blocking
Performing a stream read_all call (which is a blocking read) from
within the accept callback has the issue that if a whitelist client is
still connected whilst a shutdown of the charon deamon is triggered
then that shutdown won't complete gracefully due to the accept task
never exiting.

So fix shutting down gracefully by using the socket watcher rather than
a blocking read upon connection accept. Fall back to a blocking read
for partial messages to avoid the complexity associated (i.e. storing
state) for incomplete reads, which shouldn't block and cause the
original problem if the client only sends whole messages.
2025-07-15 14:50:56 +02:00
Tobias Brunner
e98ea89d99 nm: Version bump to 1.6.3 2025-07-14 11:01:14 +02:00
Andreas Steffen
23eb1e0945 Version bump to 6.0.2 2025-07-13 09:56:49 +02:00
Tobias Brunner
4c54550352 testing: Use alternative approach for retransmits in ikev1/dpd-restart scenario
With a long delay, the retransmit might not get sent before further tests
are evaluated on faster machines, while more retransmits should still allow
the scenario to succeed on slower ones.
2025-07-11 14:15:40 +02:00
Tobias Brunner
bab415ec0a child-cfg: Actually force narrowing TS in transport mode only as initiator
Closes strongswan/strongswan#2830

Fixes: ad1ad2159f0b ("child-cfg: Use traffic selector list")
2025-07-11 14:15:06 +02:00
Tobias Brunner
43b805b2da openssl: Don't allocate salt if PRF/hash is unknown
This can happen if e.g. AES-XCBC is selected.

Fixes: 2dbeecfc029b ("openssl: Fix testing KDF_PRF in the constructor with OpenSSL 3.5.1")
2025-07-11 11:47:51 +02:00
Tobias Brunner
2c32412594 github: Shorten name for crypto-plugin job and reverse matrix arguments
This gives us more readable names in the UI.  Instead of

  crypto-plugins (ubuntu-latest, b...
  crypto-plugins (ubuntu-latest, b...
  crypto-plugins (ubuntu-latest, ...
  crypto-plugins (ubuntu-latest, ...
  crypto-plugins (ubuntu-latest, o...
  crypto-plugins (ubuntu-latest, o...

we now get

  crypto (botan, ubuntu-latest, no)
  crypto (botan, ubuntu-latest, yes)
  crypto (wolfssl, ubuntu-latest, no)
  crypto (wolfssl, ubuntu-latest, yes)
  crypto (openssl, ubuntu-latest, no)
  crypto (openssl, ubuntu-latest, yes)
2025-07-10 19:23:02 +02:00
Tobias Brunner
2dbeecfc02 openssl: Fix testing KDF_PRF in the constructor with OpenSSL 3.5.1
Setting the salt to NULL now fails, so we set it to hash length's zeroes,
which is the default value for HKDF-Extract if no salt is passed.

Fixes strongswan/strongswan#2828
2025-07-10 19:22:22 +02:00
Tobias Brunner
a8c2d125f1 Doxyfile: Don't hide set_seed() method 2025-07-08 13:13:06 +02:00
Tobias Brunner
f88d824114 Fixed some typos, courtesy of codespell 2025-07-08 10:54:49 +02:00
Andreas Steffen
bd65a21ce0 Version bump to 6.0.2rc1 2025-07-07 18:25:37 +02:00
Tobias Brunner
85c6473a5e NEWS: Add news for 6.0.2 2025-07-07 18:04:34 +02:00
Tobias Brunner
36f7c98f4e github: Use AWS-LC 1.55.0 for tests 2025-07-07 18:04:19 +02:00
Tobias Brunner
b46960d80c github: Use OpenSSL 3.5.1 for tests 2025-07-07 18:04:19 +02:00
Thomas Egerer
a339468c93 vici: Allow backlog size configuration via compile option
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-07-07 14:20:13 +02:00
Tobias Brunner
9eb5fcd6b6 github: Make sure at least one run with the same content is not skipped 2025-07-07 11:55:01 +02:00
Andreas Steffen
1f42640c43 Version bump to 6.0.2dr3 2025-07-03 11:43:53 +02:00
orbea
979c57fc30 nm: Don't set DL_LIBS to 'none required' in configure script
This copies the AC_SEARCH_LIBS check from the main strongSwan
configure.ac.

When building networkmanager-strongswan with slibtool if fails.

  ld: cannot find none: No such file or directory
  ld: cannot find required: No such file or directory

This is because configure.ac uses AC_SEARCH_LIBS to find dlopen which
sets the value of $ac_cv_search_dlopen to 'none required' which then
gets set in DL_LIBS and passed to slibtool.

With GNU libtool it silently ignores the unknown arguments.

Gentoo issue: https://bugs.gentoo.org/914100

Closes strongswan/strongswan#2141

Signed-off-by: orbea <orbea@riseup.net>
2025-07-01 07:45:12 +02:00
Tobias Brunner
a666944e65 Merge branch 'android-http-proxy'
Adds support for HTTP proxy server.

Closes strongswan/strongswan#2789
2025-06-27 09:13:38 +02:00
Tobias Brunner
bd4cee82ac android: New release after adding HTTP proxy configuration 2025-06-27 08:57:45 +02:00
Tobias Brunner
dbcba117ae android: Apply proxy server setting when creating TUN device
This is only available with Android 10+ (SDK 29+).
2025-06-27 08:57:45 +02:00
Tobias Brunner
b944159fcf android: Avoid proxy settings in the internal fetcher 2025-06-27 08:57:45 +02:00
Tobias Brunner
c7307ccc52 android: Allow setting proxy settings in managed profiles 2025-06-27 08:57:45 +02:00
Tobias Brunner
0f2cd032e1 android: Import proxy server settings 2025-06-27 08:57:45 +02:00
Tobias Brunner
c80819c0ad android: Make proxy server configurable 2025-06-27 08:57:45 +02:00
Tobias Brunner
a7cb2fcbf6 android: Add properties to VPN profiles for proxy server configuration 2025-06-27 08:57:45 +02:00
Tobias Brunner
059c70e556 android: Don't mention IKEv1 and L2TP in app description
Also removed on Play so the app does not show up when people search
for these keywords (they tend to not read the actual description and
then are surprised that neither protocol is supported).
2025-06-27 08:57:45 +02:00
Tobias Brunner
4143e47462 android: Update dependencies 2025-06-27 08:57:38 +02:00
Tobias Brunner
a153626af7 identification: Clarify that ID_USER_FQDN is just an alias for ID_RFC822_ADDR
This means userfqdn: is a valid prefix for regular expressions.
2025-06-20 10:37:40 +02:00
Tobias Brunner
e58ef258b5 swanctl: Document that IP-TFS mode is subject to mode negotiation 2025-06-20 10:37:35 +02:00
Tobias Brunner
9a6aa2530e testing: Make sure ML-KEM scenarios use our ml plugin
We now support OpenSSL's implementation in the openssl plugin.  This
makes sure our plugin is used on at least one of the hosts if we ever
switch to an OpenSSL version that supports ML-KEM.

In the ikev2/rw-mlkem scenario the logic is reversed.  There the ml plugin
is preferred on moon to test the responder side (and carol for the
initiator) and dave will switch to OpenSSL if it ever provides ML-KEM.
2025-06-20 10:37:24 +02:00
Andreas Steffen
faf7ad2331 Version bump to 6.0.2dr2 2025-06-05 13:43:21 +02:00
Andreas Steffen
f9985d72e4 testing: soup plugin removed from test environment 2025-06-05 13:42:41 +02:00
Andreas Steffen
2fa8f4a90f Version bump to 6.0.2dr1 2025-06-04 19:58:23 +02:00
Tobias Brunner
b39311e19e Merge branch 'libsoup3'
Ports the soup plugin to libsoup 3.

Closes strongswan/strongswan#2788
2025-06-04 19:09:33 +02:00
Tobias Brunner
b8108a4c3c github: Use libsoup 3 for tests
Requires installing libxml2-dev explicitly for the alpine build as
libsoup-dev had a dependency on it.
2025-06-04 19:08:57 +02:00
Tobias Brunner
9dbb15dea9 leak-detective: Remove whitelisted libsoup2.x functions
As mentioned in 0f141fb095a41a9fdfe5c111269eb643dc643494, we can't
really whitelist the "leaks" in GLib, so don't even try to do anything
with libsoup3.x.
2025-06-04 19:08:57 +02:00
Mike Gorse
6ddabf52d5 soup: Port to libsoup 3 2025-06-04 19:08:07 +02:00
Tobias Brunner
e864b8a8b1 fetcher: Remove unused FETCH_HTTP_VERSION_1_0 option
Was only used by the removed scepclient and does not serve any purpose
nowadays anyway.
2025-06-04 19:07:22 +02:00
Tobias Brunner
82adb5ce0f unit-tests: Serial number tests depend on X.509 certificate parsing
Requires additional plugin features, but if this is available, the
others are usually as well.
2025-06-04 19:07:22 +02:00
Tobias Brunner
71f1091129 wolfssl: Fix build if wolfSSL was built in OpenSSL-compat mode 2025-06-04 19:07:13 +02:00
Tobias Brunner
3d426cbfee Merge branch 'wolfssl-fips'
Fixes various issues when building the wolfssl plugin against wolfSSL's
FIPS module.

References strongswan/strongswan#2603
Closes strongswan/strongswan#2771
2025-06-02 11:31:03 +02:00
Juliusz Sosinowicz
f38bb91654 wolfssl: Unlock keys if necessary when using FIPS module
Wrap the functions that require it in PRIVATE_KEY_UNLOCK/PRIVATE_KEY_LOCK.
This can't be done at plugin initialization because it needs to be done
for every thread. strongSwan currently doesn't provide on-thread-create
callbacks for plugins so we need to wrap each direct call. Another reason
to do so is that some functions we call (e.g. wc_EccKeyToDer) internally
call PRIVATE_KEY_UNLOCK/PRIVATE_KEY_LOCK and would leave the keys locked
for that particular thread.
2025-06-02 09:15:05 +02:00
Juliusz Sosinowicz
85eb5c7812 wolfssl: Properly initialize ECC private key object 2025-06-02 09:15:05 +02:00
Tobias Brunner
879e3ce05a wolfssl: Set a dummy key when testing KDF implementations
In FIPS mode, wolfSSL enforces a minimum key size for these algorithms.
2025-06-02 09:15:05 +02:00
Tobias Brunner
757e00c0ae test-vectors: Remove HMAC PRF test vectors with key size 4
Some implementations enforce a minimum key size (e.g. wolfSSL in FIPS
mode) and in practice, the keys will be longer anyway (e.g. our nonces
are 32 bytes).
2025-06-02 09:15:05 +02:00
Tobias Brunner
d0292a6f50 wolfssl: Include settings.h in case WOLFSSL_USER_SETTINGS is defined 2025-06-02 09:15:05 +02:00
Tobias Brunner
217049606b wolfssl: Use consistent defines for ECC public/private key loading
HAVE_ECC_KEY_IMPORT can be defined while HAVE_ECC_SIGN is not.
So just use the same defines we use when defining the load functions.
2025-06-02 09:15:04 +02:00
Tobias Brunner
7bfd81d78a wolfssl: Call wc_SetSeed_Cb() as required for FIPS-mode 2025-06-02 09:15:04 +02:00
Tobias Brunner
3a5f203958 Merge branch 'iptfs'
This adds basic support for IP-TFS/AGGFRAG (RFC 9347).  The Linux kernel,
since 6.14, only supports aggregation/fragmentation so far.  The actual
TFS features will get added later.
2025-05-28 16:48:42 +02:00
Tobias Brunner
dc4fef146a testing: Add ikev2/net2net-iptfs scenario 2025-05-28 16:37:47 +02:00
Tobias Brunner
b4a0eb3603 testing: Add config for Linux 6.14
This has IP-TFS enabled.
2025-05-28 16:37:46 +02:00
Tobias Brunner
a7a3c4a22a conf: Document global IP-TFS settings 2025-05-28 16:37:46 +02:00
Tobias Brunner
46525cdc4f child-create: Negotiate IP-TFS mode if configured 2025-05-28 16:37:46 +02:00
Tobias Brunner
f5f7424e1d notify-payload: Add notify type for IP-TFS/AGGFRAG 2025-05-28 16:37:46 +02:00
Tobias Brunner
6372b2890f kernel-netlink: Support IPTFS mode and attributes 2025-05-28 16:37:46 +02:00
Tobias Brunner
f32773b3a8 child-sa: Allow disabling fragmenting packets across AGGFRAG payloads
This is necessary if the peer isn't able to handle such fragments.
2025-05-28 16:37:46 +02:00
Tobias Brunner
33db7a200f kernel-ipsec: Add flag to disable sending fragments across AGGFRAG payloads
We have to set this if the peer indicates that it doesn't support
handling such fragments in the notify.
2025-05-28 16:37:46 +02:00
Tobias Brunner
1afc76dd56 vici: Make IP-TFS mode configurable 2025-05-28 16:37:46 +02:00
Tobias Brunner
e175abaf89 include: Add XFRM mode and attributes for IP-TFS 2025-05-28 16:37:46 +02:00
Tobias Brunner
419528f2ac ipsec-types: Add new mode for IP-TFS
Added at the end as the numeric mode is e.g. used in SQL databases.
2025-05-28 16:37:27 +02:00
Tobias Brunner
72e3b7dcc8 Merge branch 'per-cpu-sas'
This adds support for per-CPU SAs (RFC 9611).
2025-05-28 16:36:10 +02:00
Tobias Brunner
b7d3349000 testing: Add ikev2/per-cpu-sas-encap-transport scenario
Tests transport mode and UDP encapsulation with random source ports.
Interestingly, the responder always uses the same SA to respond (maybe
due to the cache on the policy).
2025-05-28 16:35:27 +02:00
Tobias Brunner
3b2f8cf282 testing: Add ikev2/per-cpu-sas-encap scenario
Basically the same as the one without UDP encapsulation, but here the
outbound SAs use random source ports.
2025-05-28 16:35:27 +02:00
Tobias Brunner
d83fbe82e4 kernel-netlink: Suppress NAT mapping updates for per-CPU SAs
As we set the remote port to 0, we'd get a mapping change message with
every packet. Setting the threshold avoids all kernel messages after the
first, which we suppress explicitly as well.
2025-05-28 16:35:27 +02:00
Tobias Brunner
14e1ec2b77 child-sa: Configure UDP encapsulation for per-CPU SAs
As the kernel does not support processing UDP-encapsulated and plain ESP
for the same SA, we require forcing UDP encapsulation if there is no NAT.
2025-05-28 16:35:27 +02:00
Tobias Brunner
73083503f2 vici: Make UDP encapsulation for per-CPU SAs configurable 2025-05-28 16:35:27 +02:00
Tobias Brunner
d594171d9e child-cfg: Add flag to enable UDP encapsulation for per-CPU SAs 2025-05-28 16:35:27 +02:00
Tobias Brunner
bf34484d24 testing: Add per-CPU SA test scenario 2025-05-28 16:35:27 +02:00
Tobias Brunner
e24edb2991 testing: Configure multiple virtual CPUs for moon and sun
This allows testing per-CPU SAs by e.g. pinging over a specific CPU
via taskset.
2025-05-28 16:35:27 +02:00
Tobias Brunner
0edaadfc94 testing: Enable SMP support for latest kernels 2025-05-28 16:35:27 +02:00
Tobias Brunner
f95bdb6fb0 swanctl: Report per-CPU information in --list-sas 2025-05-28 16:35:27 +02:00
Tobias Brunner
c176d32a73 vici: Report per-CPU SA information 2025-05-28 16:35:27 +02:00
Tobias Brunner
fbfae44dd1 vici: Make per-CPU CHILD_SAs configurable 2025-05-28 16:35:27 +02:00
Tobias Brunner
a950ca3ec2 kernel-netlink: Forward CPU ID from acquires 2025-05-28 16:35:27 +02:00
Tobias Brunner
4a595508b7 trap-manager: Add support to handle acquires for per-CPU SAs 2025-05-28 16:35:27 +02:00
Tobias Brunner
65b7f9d563 kernel-handler: Log CPU ID that's passed with an acquire 2025-05-28 16:35:27 +02:00
Tobias Brunner
d6eed3979b kernel-interface: Optionally pass CPU ID for which an acquire was triggered 2025-05-28 16:35:27 +02:00
Tobias Brunner
2082fa5dd2 ike-sa: Accept optional CPU ID when initiating CHILD_SAs 2025-05-28 16:35:26 +02:00
Tobias Brunner
8e7f379f71 ike-sa: Sort CHILD_SAs by CPU ID
This might make debugging easier and also ensures that a possible
fallback SA without CPU ID is established first when reestablishing
an IKE_SA.  Because even if such an SA is established first initially,
that might change later depending on when per-CPU SAs are rekeyed.
2025-05-28 16:35:26 +02:00
Tobias Brunner
af34b5b1dc child-rekey: Maintain per-CPU values during rekeying 2025-05-28 16:35:26 +02:00
Tobias Brunner
bdf882d3af child-create: Add support to negotiate per-CPU SAs 2025-05-28 16:35:26 +02:00
Tobias Brunner
3a8bb93761 updown: Don't call the script for per-CPU SAs
Rules are installed for the fallback SA that has no CPU ID assigned.
2025-05-28 16:35:26 +02:00
Tobias Brunner
297be45275 ha: Ignore per-CPU CHILD_SAs
These only work on initiators (with trap policies), which is something
the plugin doesn't support.
2025-05-28 16:35:26 +02:00
Tobias Brunner
17f2188756 forecast: Ignore per-CPU CHILD_SAs
Not sure if this combination does make sense as the plugin itself would
be a major bottleneck.

Similar to the connmark plugin, PREROUTING rules list SPIs or UDP ports,
which would be necessary for all SAs while the OUTPUT rules would only be
required once.
2025-05-28 16:35:26 +02:00
Tobias Brunner
5faf884285 connmark: Ignore per-CPU CHILD_SAs
The combination probably doesn't make much sense.

The OUTPUT rules would definitely only be required once, while the INPUT
and PREROUTING rules list individual SPIs and/or UDP ports, which would
be necessary for all SAs.

By the way, the rules in PREROUTING might actually not be necessary
anymore if the set_mark_in option was used for such SAs.
2025-05-28 16:35:26 +02:00
Tobias Brunner
a505f4b9b0 child-sa: Add support for per-CPU SAs
The CPU ID is also set on inbound SAs as it can be used to configure RSS
or some eBPF program.
2025-05-28 16:35:26 +02:00
Tobias Brunner
bdfcfea1f2 kernel-netlink: Add support to enable per-CPU acquires on policies 2025-05-28 16:35:26 +02:00
Tobias Brunner
53be94d06c kernel-netlink: Add support to set CPU ID on SA 2025-05-28 16:35:26 +02:00
Tobias Brunner
12395cedf3 ipsec-types: Add identifier for the maximum (=no) CPU ID 2025-05-28 16:35:26 +02:00
Tobias Brunner
aa1322aed5 include: Add XFRM identifiers for per-CPU SAs/acquires 2025-05-28 16:35:26 +02:00
Tobias Brunner
d4575da53c child-cfg: Add flag to enable per-CPU SAs 2025-05-28 16:35:26 +02:00
Tobias Brunner
749814a75f notify-payload: Add notify types for per-resource CHILD_SAs 2025-05-28 16:35:26 +02:00
Tobias Brunner
8f6e3c164a testing: Include the kernel build number 2025-05-28 16:35:26 +02:00
Tobias Brunner
b6a4cfc705 Merge branch 'acquires-seq'
This uses the sequence number from acquires when installing the SA. This
allows handling narrowing properly by changing the reqid and still
removing the temporary state in the kernel.  It also changes that
traffic selectors are reused during rekeying/recreation/reauthentication,
so narrowed selectors won't return to the wider configured TS because
there won't be any TS from triggering packets to narrow again.
2025-05-28 16:30:56 +02:00
Tobias Brunner
8cb5918b0c testing: Add ikev2/net2net-route-narrow scenario 2025-05-28 16:01:00 +02:00
Tobias Brunner
6c7c539eaf child-create: Consider previous TS when checking for duplicates 2025-05-28 16:01:00 +02:00
Tobias Brunner
58d6778adb child-sa: Add helper to check if a list of TS match negotiated TS 2025-05-28 16:01:00 +02:00
Tobias Brunner
e7fc7a4ecc child-create: Maintain traffic selectors during rekeying/reauthentication
If we don't do this, narrowed SAs would default to the wide configured
traffic selectors and the peer won't know if/how to narrow.
2025-05-28 16:01:00 +02:00
Tobias Brunner
9205458355 child-create: Use more generic method to pass information from previous SA
Besides the previous key exchange method, this will allow us to also
reuse the previous traffic selectors.  Some data is still passed in
separate methods as some are set even when there is no previous SA and
others are not set in all cases.

The interface for queue_child() now optionally takes the previous
Child SA to handle both recreations and initiations from scratch.
2025-05-28 11:06:19 +02:00
Tobias Brunner
ad1ad2159f child-cfg: Use traffic selector list 2025-05-28 11:06:19 +02:00
Tobias Brunner
4b468126ca traffic-selector-list: Add helper class to manage a collection of TS
Provides functions to optionally resolve dynamic TS and to narrow
them based on a list of supplied TS.
2025-05-28 11:06:19 +02:00
Tobias Brunner
79815b4e67 trap-manager: Set seq. no. for CHILD_SAs not initiated by an acquire
This fixes cases where `start_action = trap|start` is used and an acquire
is triggered while the SA is initiated (granted if narrowing is expected,
that's not a recommended configuration as the responder can only use
the first config when there is no packet TS).  The resulting second
create-child task will potentially get dropped by the duplicate check,
so the temporary state won't get removed and traffic is blocked until
that expires, neither can acquires get triggered for traffic that doesn't
match the initial SA's policies.
2025-05-28 10:11:53 +02:00
Tobias Brunner
ac0c73a412 child-create: Trigger CHILD_INSTALLING event after setting traffic selectors
This was the case before bce0c5fd74a0 ("child-create: Update CHILD_SA IP
addresses before installation") and allows listeners to consider the
traffic selectors of the SA that's about to get installed.
2025-05-28 10:11:53 +02:00
Tobias Brunner
5bb6f636ad child-create: Use helper to compare packet TS against CHILD_SAs 2025-05-28 10:11:53 +02:00
Tobias Brunner
769d9a12aa child-sa: Add helper to check if two TS match negotiated TS 2025-05-28 10:11:53 +02:00
Tobias Brunner
65b810e9b0 acquire-job: Use helpers to manage acquire data 2025-05-28 10:11:53 +02:00
Tobias Brunner
c563b0d930 kernel-listener: Add helpers to clone/destroy acquire data 2025-05-28 10:11:53 +02:00
Tobias Brunner
6ae29af18b child-create: Consider triggering TS when checking for duplicate 2025-05-28 10:11:53 +02:00
Tobias Brunner
6e274271af vici: Include reqid when listing trap policies 2025-05-28 10:11:53 +02:00
Tobias Brunner
5624f7ffaa kernel-pfkey: Don't use TS from acquire in tunnel mode
The addresses are actually the endpoints of the SA, not information on
the matched packet (except that the RFC says to set the ports and
protocol of the packet in the source address, which the Linux kernel
doesn't do).  So these are useless, unless transport mode is used, where
the addresses are needed for the wildcard trap policy use case.

The RFC mentions a PROXY address (a single one, not two), that could
apparently be something like the source address in tunnel mode.
However, the description of how this is used in the RFC is quite weird
and neither Linux nor FreeBSD send such an attribute in SADB_ACQUIRE.
2025-05-28 10:11:53 +02:00
Tobias Brunner
b024b7e9a6 kernel-netlink: Add support for acquire sequence numbers
Note that while PF_KEYv2 also uses sequence numbers to identify acquires,
which we currently don't use correctly by the way, it does not include
information about the packet that triggered an acquire.  What we receive
in src and dst, and currently forward as traffic selectors, are actually
the designated endpoints of the SA. So especially in tunnel mode this is
useless to do narrowing on the responder (these addresses might not even
match the configured TS).
2025-05-28 10:01:19 +02:00
Tobias Brunner
46c338a78f kernel-interface: Change reqid if seq. nos. are supported and narrowing occurred
With the sequence numbers we don't have to maintain the reqid to delete
the temporary state.

One exception is with labels.  There we currently only install trap
policies with the generic label.  SAs created from those don't have
policies installed, so we have to reuse the reqid of the trap even if
narrowing occurs.

And as before, we reuse the reqid without checking traffic selectors if
sequence numbers are not supported.

Note that if a CHILD_SA is manually initiated (i.e. has no sequence
number assigned) right before an acquire is triggered, there are several
possible outcomes depending on whether narrowing occurs.  If there is no
narrowing, the same reqid is assigned and the kernel will remove the
temporary SA when the SA is installed (no seq => reqid match).
Afterwards, the queued duplicate CHILD_SA is destroyed and the acquire
state in the trap manager gets removed.  If there is narrowing, a new
reqid is allocated, so the installation of the SA will not remove the
temporary state.  However, due to the narrowing, the duplicate check
fails and when the duplicate is installed (with sequence number), the
temporary state is deleted (as is the state in the trap manager).
2025-05-28 10:01:19 +02:00
Tobias Brunner
c5b2a8eaa3 child-cfg: Use separate method to get configured traffic selectors
Optionally with "dynamic" traffic selectors resolved.  A new method
is added for those cases where we actually want to select potentially
narrowed traffic selectors using a supplied list.  The latter now also
always logs details, while the former does not.
2025-05-28 10:01:19 +02:00
Tobias Brunner
84da416082 trap-manager: Use sequence numbers to identify acquires
Either use the sequence number from the kernel (and potentially update
it if the acquire was retriggered), or generate our own sequence
numbers, which simplifies matching acquires to established/destroyed
CHILD_SAs.
2025-05-28 10:01:19 +02:00
Tobias Brunner
82c82cbbd6 ike: Support optional acquire sequence numbers when creating CHILD_SAs 2025-05-28 10:01:19 +02:00
Tobias Brunner
0c9bac73d9 child-sa: Store and propagate optional acquire sequence number 2025-05-28 10:01:19 +02:00
Tobias Brunner
3e6d7db5e3 kernel-interface: Add members for optional acquire sequence number 2025-05-28 10:01:19 +02:00
Tobias Brunner
301887b865 Merge branch 'regex-ids'
Adds support for POSIX regular expressions in configured identities,
which makes matching remote identities more flexible.
2025-05-28 09:58:46 +02:00
Tobias Brunner
981c82ab50 vici: Add support for POSIX regular expressions in identity fields 2025-05-28 09:58:17 +02:00
Tobias Brunner
10c2985cdd conf: Escape " and \ in man page output 2025-05-28 09:58:17 +02:00
Tobias Brunner
7de05b918c identification: Add support for POSIX regular expressions
When cross-compiling for Windows on Ubuntu, we don't have POSIX regular
expressions available (there does not seem to be any alternative libraries
either), but since the tests are not executed that's OK.  On AppVeyor,
MSYS2 has libgnurx installed, which works fine but requires explicit
linking with `-lregex`.

This is loosely based on a patch by Thomas Egerer.
2025-05-28 09:58:17 +02:00
Tobias Brunner
2b1f0e8c6e debug: Use separate log group for watcher_t
This component produces a lot of messages that make debugging job
handling difficult.
2025-05-27 17:41:02 +02:00
Tobias Brunner
4703ef00ce github: Use AWS-LC 1.52.0 for tests 2025-05-27 17:38:32 +02:00
Tobias Brunner
29986dd1e5 wolfssl: Remove unused drbg_t instance when building without testable KE 2025-05-27 17:38:32 +02:00
Tobias Brunner
e3fa72b81a ml: Remove unused drbg_t instance when building without testable KE 2025-05-27 17:38:32 +02:00
Tobias Brunner
07a9926464 botan: Remove unused drbg_t instance when building without testable KE 2025-05-27 17:38:32 +02:00
Tobias Brunner
37ec770758 pki: Reduce indentation in usage output and print command description
Also print error message at the end of the output.
2025-05-27 17:38:32 +02:00
Tobias Brunner
5f4988eb7c swanctl: Reduce indentation in usage output and print command descriptions
Also print error message at the end of the output.
2025-05-27 17:38:24 +02:00
Tobias Brunner
9a9d0a0bf7 swanctl: Document maximum log level of messages received by --log 2025-05-22 14:24:43 +02:00
Tobias Brunner
362fa94ef5 vici: Document that the log event only receives messages on level 0 and 1 2025-05-22 14:05:51 +02:00
Tobias Brunner
688b9e27d5 Merge branch 'initiate-cancel'
Allow proper shutdown if a deadlock is caused by too many concurrent
blocking initiation requests.

References strongswan/strongswan#2776
2025-05-19 17:21:57 +02:00
Tobias Brunner
f8e5e38b12 vici: Make threads handling requests get canceled explicitly
Threads initiating SAs can get stuck on the semaphore in
wait_for_listener() during shutdown if the corresponding job is never
executed.  A particular case when this can happen is if more initiations
are triggered than worker threads are available.  This causes a (known)
deadlock as no workers are free anymore to process jobs (for inbound
messages or timeouts etc.), including the one to initiate an SA.
This change at least allows a proper shutdown.
2025-05-19 17:20:59 +02:00
Tobias Brunner
8d3855ba31 vici: Don't pass stack variable to thread cleanup handler
The variable seems to get overwritten during cleanup, causing a
segmentation fault because either the pointer and/or the length is
invalid.
2025-05-19 17:19:20 +02:00
Tobias Brunner
367e782054 controller: Avoid memory leak if initiate job is never executed
This can happen if the daemon is terminated while an initiation is
pending.
2025-05-19 17:19:20 +02:00
Tobias Brunner
94cc07cab4 uci: Remove obsolete and broken plugin
The plugin was apparently broken for years because it uses functions that
don't exist anymore.  It was quite limited anyway, so it was never really
used in OpenWrt to begin with (instead they generate configs in a custom
init script).
2025-05-19 17:17:45 +02:00
Tobias Brunner
2b3a5172d8 configure: Add missing dependency of lib-prefix.m4
Fixes: 7ec0101250bf ("Include lib-prefix.m4 directly and remove gettext dependency")
2025-05-13 18:45:45 +02:00
Tobias Brunner
e8e5e2d441 configure: Simplify inclusion of M4 macros 2025-05-13 18:45:45 +02:00
Gerardo Ravago
99fda969b4 openssl: Fix AWS-LC build
The `crypt` functions defined here conflict with the `crypt` function
defined in `unistd.h` and trigger compilation errors when building
against the latest version of AWS-LC, which introduced a new transitive
include of `unistd.h` via `bio.h`.

This simply renames the function to avoid the error.

Closes strongswan/strongswan#2786
2025-05-13 17:16:07 +02:00
Tobias Brunner
7ec0101250 Include lib-prefix.m4 directly and remove gettext dependency
A recent gettext release (0.25 via Homebrew) installs the M4 macros in a
different location (<prefix>/share/gettext/m4 instead of
<prefix>/share/aclocal). According to the commit messages to avoid "bad
interactions between autoreconf and autopoint".  Since we only depend
on gettext for that macro and this move makes it complicated, we can also
just integrate the macro from gnulib directly (which gettext 0.18+ relies
on anyway).
2025-05-13 17:15:23 +02:00
Tobias Brunner
198d112745 github: Use AWS-LC 1.51.2 for tests 2025-05-13 17:15:15 +02:00
Tobias Brunner
2ee768ec4e ha: Fix arguments in debug statement when destroying incomplete IKE_SAs
Closes strongswan/strongswan#2781

Fixes: 97bd0e2297ed ("ha: Destroy incomplete IKE_SAs after de-/activating a segment")
2025-05-13 17:15:05 +02:00
Tobias Brunner
a1a477528f Use wolfSSL 5.8.0 for tests 2025-05-13 17:14:54 +02:00
Tobias Brunner
5863b8d89b wolfssl: Update ML-KEM API for wolfSSL 5.8.0 release 2025-05-13 17:14:54 +02:00
Tobias Brunner
4249d721ec testing: Add rw-eap-id-switch scenario 2025-04-14 12:18:24 +02:00
Tobias Brunner
2f2e4abe3c ikev2: Add support to switch peer configs based on EAP-Identities
This changes how EAP identities are used from the config. Instead of
setting a statically configured identity != %any, an EAP-Identity
exchange is now always initiated (and required).  If the received identity
doesn't match, the peer config is switched to one with a matching
identity (wildcards are supported for that match).  This allows switching
to a config with a different EAP method or child settings based on the
EAP identity.

There is currently no "best" match.  The configs are evaluated based on
the order returned from the initial peer config lookup.

References strongswan/strongswan#2702
2025-04-14 12:05:24 +02:00
Tobias Brunner
651a5b0ded android: Only select default ABIs when building OpenSSL
This skips the experimental RISC-V ABI in newer NDKs.
2025-04-14 11:54:42 +02:00
Tobias Brunner
09edb565ba android: Skip unknown ABIs when building OpenSSL
Newer NDKs have RISC-V as experimental ABI (not enabled by default, see
next commit).  If we don't have a mapping for a specific target, OpenSSL
falls back to 'android-arm', so that won't really work (interestingly,
it does build).
2025-04-14 11:54:42 +02:00
Tobias Brunner
0f1f375a21 android: Protect but don't keep track of sockets used for source address lookups
These sockets are closed immediately again, so no need to re-protect them
during roaming events.

References strongswan/strongswan#1691

Fixes: 6d87a8651068 ("android: Use new sockets to determine source IP")
2025-04-14 11:54:42 +02:00
Tobias Brunner
77f99df656 android: Remove special handling of legacy Android versions in native code
Since minSdkVersion has been 21 for a while, we can remove some code
that was necessary for older versions.
2025-04-14 11:54:42 +02:00
Tobias Brunner
523067e6db init: Only install legacy service unit if starter/stroke is enabled
Closes strongswan/strongswan#2722
2025-04-14 11:54:42 +02:00
Tobias Brunner
8ae00c334a charon-nm: Mark VPN connection as persistent
If this is not set, it looks like NM shuts down the VPN connection and
calls disconnect() if there is any connectivity change.

References strongswan/strongswan#2707
2025-04-14 11:40:59 +02:00
Tobias Brunner
57e74f64b3 kernel-netlink: Enable UDP GRO
This enables GRO offload for inbound ESP-in-UDP packets if the
esp4|6_offload modules are loaded.  Note that inbound ESP or ESP-in-UDP
packets won't be visible on layer 3 in Netfilter or tcpdump.
2025-04-14 11:39:44 +02:00
Tobias Brunner
d54a29cc5c github: Use OpenSSL 3.5.0 to test ML-KEM 2025-04-14 11:38:48 +02:00
Tobias Brunner
b914333ab4 openssl: Add support for ML-KEM with OpenSSL 3.5 2025-04-14 11:38:48 +02:00
Tobias Brunner
f2e88b169f leak-detective: Whitelist OpenSSL 3.5 functions 2025-04-14 11:38:48 +02:00
Tobias Brunner
fd17d154e5 github: Build OpenSSL from the Git repository instead of a tarball
This is more flexible and allows test builds against branches.
2025-04-14 11:38:48 +02:00
Tobias Brunner
defbabd724 tty: Produce colored output in CI environments 2025-04-10 09:33:19 +02:00
Tobias Brunner
245ea0597d vici: Increase buffer to hold uint64_t when parsing packet limits 2025-04-10 08:31:10 +02:00
Thomas Egerer
ed8c08fbe7 vici: Improve byte lifetime parsing
Increase buffer to 32 bytes to hold uint64_t completely and check for
overflows after multiplication with size modifiers.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-04-10 08:31:10 +02:00
Tobias Brunner
9fe58c83fb proposal: Add supported KE methods to default ESP/AH proposals, but optional
This allows accepting clients that send proposals with non-optional KE
methods during rekeying, while still accepting clients that use the
previous non-KE default proposals.
2025-04-10 08:31:10 +02:00
Tobias Brunner
8cb36be188 swanctl: Document "none" keyword for ESP proposals 2025-04-10 08:31:10 +02:00
Tobias Brunner
46674e64c1 ha: Support sync of private IKE_SA extensions and conditions
This requires a new protocol version as private extensions would enable
unrelated regular extensions, even when sending the private extension
as second attribute (which would work for conditions as they are
explicitly enabled/disabled).
2025-04-10 08:31:09 +02:00
Tobias Brunner
8679d91c81 ike-sa: Remove redundant setting of IKE_SA conditions after a rekeying
This was originally added with b0e40caafbd7 ("NAT-T conditions were not
inherited during IKE_SA rekeying") in 2008 when there was only a single
inherit() method.  Later the inherit_pre() method was added and then
with 094963d1b160 ("ikev2: Apply extensions and conditions before
starting rekeying") in 2014 the extensions and conditions were set
already there.
2025-04-10 08:31:09 +02:00
Tobias Brunner
07978c16b3 ike-sa: Add possibility to store private extensions/conditions
This avoids conflicts with upstream changes if patched versions of
strongSwan require a number of private extensions and conditions.  For
example, the following extensions can be used as usual via the
`enable|supports_extension()` methods:

	#define PRIVATE_EXT_1 (EXT_PRIVATE_MARKER | (1<<0))
	#define PRIVATE_EXT_2 (EXT_PRIVATE_MARKER | (1<<1))

Defining an enum would also be possible but because the type won't match
the values would have to be cast to `ike_extension_t` when using the
methods.

Similarly, `COND_PRIVATE_MARKER` may be used to define private conditions
that can be used with the `set|has_condition()` methods.

Because the MSB is explicitly not set in `private_extensions|conditions`,
these members may directly be checked against private values, e.g.:

	if (this->private_extensions & PRIVATE_EXT_1)
	{
	}
2025-04-10 08:31:09 +02:00
Tobias Brunner
6ed63be612 peer-cfg: Use flags for boolean options
Makes it potentially easier to add new flags.

The mediation flag is not converted as the #ifdefs make it awkward.
2025-04-10 08:31:09 +02:00
Tobias Brunner
b0a4b7f2dd daemon: Add facility to register custom init/deinit functions
Same as the previous commit but with access to the daemon.
2025-04-10 08:31:09 +02:00
Tobias Brunner
a6f4146f45 library: Add facility to register custom init/deinit functions
These can be linked into the application to do initialization/cleanup
without having to modify the source code.
2025-04-10 08:31:09 +02:00
Tobias Brunner
1a20502573 github: Add compile test with --without-testable-ke option 2025-04-10 08:31:09 +02:00
Tobias Brunner
6cbd93838b Add configure option to disable testing key exchange methods
If this is used, the functionality to set a private key/value/seed for
key exchange methods is removed (including from the interface to avoid
accidentally forgetting to wrap implementations and uses of set_seed()).

The set_seed() method is assigned outside the INIT() macro to avoid
potentially undefined behavior (preprocessing directives in macro
arguments).

The test done by the crypto tester is a simple functionality test.
2025-04-10 08:31:09 +02:00
Thomas Egerer
a7c285bc50 auth-cfg: Add lower case enum names for auth_rule_t
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-04-10 08:31:09 +02:00
Thomas Egerer
af9095fdd9 ldap: Use timeout value for synchronous calls
So far, the timeout value was only used as connect timeout while a
malicious server could accept the connection and then starve us. So use
the timeout for LDAP_OPT_TIMEOUT, too, which affects all synchronous
calls.  In particular, ldap_simple_bind_s(), which has no timeout
argument like ldap_search_st().

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-04-10 08:31:09 +02:00
Thomas Egerer
ee4e93419b gitignore: Add *.i and *.s files
Ignore a couple of compiler generated temp files.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-04-10 08:31:09 +02:00
Tobias Brunner
0bccc287d6 Doxyfile: Exclude OpenSSL sources of Android app
They can produce warnings and we don't want to include documentation for
these anyway.
2025-04-10 08:31:09 +02:00
Tobias Brunner
cdefe52494 github: Set type in issue templates 2025-04-10 08:31:09 +02:00
Tobias Brunner
d7305a556f testing: Use blockdev instead of partprobe to load partitions
This avoids a dependency on parted as blockdev is in util-linux on
Debian/Ubuntu, which is installed by default.  And it might work more
reliably.
2025-04-10 08:31:09 +02:00
Tobias Brunner
353d5c130b testing: Use tar instead of recursive scp
It seems that scp is sometimes very slow (unclear what causes it as it's
not always the same).  Packing up the files with tar performs a lot
better in these situations.  And copying the files to multiple hosts
in parallel additionally helps to reduce the time required for these
steps.

Using --overwrite and -h preserves existing symlinks (e.g. for the users
file in /etc/freeradius/3.0) and overwrites the target file instead.
The -m option ignores timestamps when extracting the files as some target
files will be newer than the source.  Using -h when packing up files in
load-testconfig allows using symlinks in the test config dirs to files
on the host running the tests.
2025-04-07 14:54:48 +02:00
Tobias Brunner
d7eb3ed92e testing: Make ocsp.cgi in ikev2-multi-ca/ocsp-signers scenario executable 2025-04-07 14:54:48 +02:00
Tobias Brunner
a1ab256756 testing: Add some network utilities to the base image 2025-04-04 12:06:59 +02:00
Tobias Brunner
022f2d5f30 testing: Add option for a quick rebuild of strongSwan
This shaves off about 1 minute of build time on my machine.  We also
don't need the separate build step and can just run `make install`.
2025-04-04 12:06:59 +02:00
Tobias Brunner
02c43fa6e4 testing: Move removal of charon.pid into posttest section
Fixes: a103f3a2849f ("testing: Add options to only run pre- or posttest scripts of a scenario")
2025-04-04 12:06:59 +02:00
Tobias Brunner
08428f6b5d testing: Fix loading test config for tests that were never run
The file won't exist in the previous location until load-testconfig was
executed once.  Since it's not modified by the script it's fine to
load it directly from the original location.

Fixes: a103f3a2849f ("testing: Add options to only run pre- or posttest scripts of a scenario")
2025-04-04 12:06:59 +02:00
Tobias Brunner
5e4dedfc20 Merge branch 'android-always-on-managed'
Fixes an issue with initiating managed profiles as Always-on VPN.

Closes strongswan/strongswan#2756
2025-04-04 08:57:12 +02:00
Tobias Brunner
8036b3f932 android: New release after fixing Always-on VPN with managed profiles 2025-04-03 16:35:47 +02:00
Tobias Brunner
d87be9b981 android: Fix starting a managed profile as Always-on VPN
The callbacks provided via ProcessLifecycleOwner are only triggered when
Activities are started.  However, when Android triggers the Always-on
VPN it directly starts our VpnService subclass, no Activity.  So the
configs were not loaded and the VPN couldn't be initiated with a managed
profile.  This ensures the config is loaded right from the start of
the app.  And by registering for modifications in onCreate() we can also
use the correct config if the app is never started in-between changes to
the managed profiles and triggering the Always-on VPN.
2025-04-03 16:19:53 +02:00
Tobias Brunner
11978ddd39 Cast uses of return_*(), nop() and enumerator_create_empty()
As described in the previous commit, GCC 15 uses C23 by default and that
changes the meaning of such argument-less function declarations.  So
whenever we assign such a function to a pointer that expects a function
with arguments it causes an incompatible pointer type warning.  We
could define dedicated functions/callbacks whenever necessary, but this
seems like the simpler approach for now (especially since most uses of
these functions have already been cast).
2025-03-19 10:22:37 +01:00
Tobias Brunner
d5d2568ff0 callback-job: Replace return_false() in constructors with dedicated function
Besides being clearer, this fixes issues with GCC 15.  The latter uses
C23 by default, which changes the meaning of function declarations
without parameters such as

	bool return false();

Instead of "this function takes an unknown number of arguments", this
now equals (void), that is, "this function takes no arguments".  So we
run into incompatible pointer type warnings all over when using such
functions.  They could be cast to (void*) but this seems the cleaner
solution for this use case.
2025-03-19 10:22:37 +01:00
Tobias Brunner
38d89f57f0 charon-nm: Use CALLBACK macro for callback job's cancel implementation
Casting to this specific function type doesn't work anymore if C23 is
used as the types mismatch.
2025-03-19 10:22:37 +01:00
Tobias Brunner
a7b5de5690 pki: Fix signature of help() to match that of a callback in command_t 2025-03-19 10:22:37 +01:00
Tobias Brunner
2553357f85 github: Use AWS-LC 1.48.5 for tests 2025-03-18 08:32:52 +01:00
Tobias Brunner
1f222f5dfb testing: Install iperf3 instead of iperf 2025-03-14 11:49:48 +01:00
Tobias Brunner
a103f3a284 testing: Add options to only run pre- or posttest scripts of a scenario
This allows to manually do some testing without having to type commands
to set up a scenario.

Also changes how arguments are parsed (allowing to pass options mixed
with test dirs) and adds some usage output.
2025-03-14 11:49:42 +01:00
Tobias Brunner
25ec2bc43d Don't reference 5.9 in URLs to docs.strongswan.org 2025-03-11 10:26:31 +01:00
Tobias Brunner
378c75cb2e nm: Version bump to 1.6.2 2025-03-11 09:57:54 +01:00
Andreas Steffen
1e8cca4004 Version bump to 6.0.1 2025-03-10 19:19:37 +01:00
Andreas Steffen
5a74d796a8 testing: Adapted ha/active-passive tests 2025-03-10 19:18:40 +01:00
Tobias Brunner
fcaee9e123 vici: Document ICMP type/code traffic selector restrictions 2025-03-05 10:55:51 +01:00
Tobias Brunner
3c3a545bfe NEWS: Add news for 6.0.1 2025-03-05 08:50:44 +01:00
Tobias Brunner
4e2cf58961 receiver: Properly clean up if hasher or RNG can't be created 2025-03-04 15:30:25 +01:00
Tobias Brunner
380ec66c92 winhttp: Properly destroy linked list if connection can't be opened 2025-03-04 15:27:53 +01:00
Tobias Brunner
a70ba4d600 pkcs11: Free copied name of PKCS#11 module in error cases 2025-03-04 14:48:42 +01:00
Tobias Brunner
8fc09ae158 stream-service: Avoid FD leak during deinitialization 2025-03-04 14:41:03 +01:00
Tobias Brunner
3b0f260b40 gcm: Properly clean up IV generator if crypter can't be created 2025-03-04 14:37:44 +01:00
Tobias Brunner
2cf94745de daemon: Properly clean up logger entries in error cases
The copied target string was not freed.
2025-03-04 14:33:36 +01:00
Tobias Brunner
e6b9f82a87 swanctl: Fix memory leak in --load-creds if --clear fails 2025-03-04 14:30:35 +01:00
Tobias Brunner
938f6d3777 testing: Update build recipe after changing Python build
Fixes: 3babf1f7108d ("vici: Update Python build")
2025-03-04 13:52:30 +01:00
Tobias Brunner
251582d0b6 vici: Update docs after changing Python build
Fixes: 3babf1f7108d ("vici: Update Python build")
2025-03-04 13:52:24 +01:00
Tobias Brunner
511add2111 Fixed some typos, courtesy of codespell 2025-03-04 13:43:31 +01:00
Andreas Steffen
61c0006002 Version bump to 6.0.1rc1 2025-03-03 10:10:03 +01:00
Tobias Brunner
8c1714ba12 Revert "kernel-netlink: Don't fallback to peer address as gateway"
This reverts commit f717bb5249caea550bc6e2baeb09ca309ad83b39.

Causes issues in our testing environment. Default route via host is
preferred if no gateway is set in the installed routes.  Needs some
investigation.

References strongswan/strongswan#2548
2025-03-03 09:46:14 +01:00
Tobias Brunner
de30b6b385 charon-nm: Lower default retransmission settings to restore SAs more quickly
These are the same values we use for the Android app.

References strongswan/strongswan#2696
2025-02-28 16:47:05 +01:00
Tobias Brunner
8e97e20642 charon-nm: Use a DPD to check the current path
If the client's network goes down for a while but the same IP address
is assigned later, it won't be aware if the server killed the IKE_SA
while it wasn't reachable.  This way, a DPD is triggered and the client
can reestablish the SA if necessary.  When roaming to a different IP,
a MOBIKE update is triggered with the same effect.

References strongswan/strongswan#2696
2025-02-28 16:46:50 +01:00
Tobias Brunner
af0535894c conf: Document some global options for charon-nm
These have specific values for charon-nm's use case but might have to be
changed for special setups or because of conflicts.

References strongswan/strongswan#2683
2025-02-28 16:46:43 +01:00
Tobias Brunner
7205d02360 conf: Add missing modules to install config snippets
In particular the one for charon-nm was missing.

References strongswan/strongswan#2683
2025-02-28 16:45:33 +01:00
Tobias Brunner
069a81e69a ikev2: Trigger ike_reestablish_pre|post events for make-before-break reauth
Listeners can't track those IKE_SAs otherwise.  For break-before-make
reauthentications, these events are already triggered because that is
implemented by calling reestablish() on the old IKE_SA.
2025-02-28 16:27:10 +01:00
Tobias Brunner
660e06b048 ike-sa: Fix check for make-before-break when handling DELETE failure
Fixes: a5e80cf5e451 ("libcharon: Enable make_before_break option by default")
2025-02-28 16:27:10 +01:00
michael-dev
bff500dfd0 ike-natd: Float to the NAT-T port early when not connecting to port 500
When using port 4500 for IKE_SA_INIT, Windows Server 2016, 2025 and
possibly others send back all packets to the port initially used by the
client, not the one floated to before sending IKE_AUTH. So if UDP
encapsulation is used, no traffic can be received as the initial socket
can't have UDP decapsulation enabled.

tcpdump output:
```
IP <client-ip>.47547 > <server-ip>.4500: UDP-encap: ESP(spi=0xfd4e5fc2,seq=...)
IP <server-ip>.4500 > <client-ip>.57962: UDP-encap: ESP(spi=0xccc5e213,seq=...)
```

Avoid this by floating early if a non-default destination port is used.
This also ensures we don't send packets from port 500 (without non-ESP
marker) if ephemeral source ports are not used.

Closes strongswan/strongswan#2664

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2025-02-28 16:25:32 +01:00
Tobias Brunner
882b19c1df ike-sa: Only query last use time of CHILD_SAs if UDP-encap is used
Without UDP-encapsulation, the IKE and ESP traffic is not directly related
(other than via IPs), so firewalls might no keep the state for IKE traffic
alive if there is no IKE traffic for a while and constant ESP traffic
prevents DPDs from being exchanged because inbound ESP traffic is
considered.

Closes strongswan/strongswan#1759
2025-02-28 16:19:02 +01:00
Tobias Brunner
57703fa089 eap-radius: Add support to specify and bind a specific source address
Using a specific address can be useful in scenarios where dynamic routing
could change the path to the RADIUS server and a changing source address
is a problem for the server.

Closes strongswan/strongswan#2598
2025-02-28 16:16:48 +01:00
Tobias Brunner
c3ae859b9b Merge branch 'ha-multi-ke'
Adds support for multiple key exchanges to the ha plugin.  Also,
because of the delayed key derivation and the not synced IntAuth
values, incomplete IKE_SAs are now destroyed during a failover.

Closes strongswan/strongswan#2550
2025-02-28 16:11:59 +01:00
Tobias Brunner
97bd0e2297 ha: Destroy incomplete IKE_SAs after de-/activating a segment
The node that gets activated usually won't be able to complete the
IKE_SA mainly because the IKE keys are now derived delayed, so the key
material required to process a message often won't be available (only
later IKE_AUTH messages and retransmits of earlier messages that the
active node already received and synced the keys for may be decrypted).

A second issue affects IKE_SAs with multiple key exchanges.  Because the
IntAuth value(s) are currently not synced, which are necessary to
verify/create the AUTH payloads, the IKE_AUTH exchange couldn't be
completed.
2025-02-28 16:02:41 +01:00
Jean-François Hren
fd6ac87fc3 testing: Add ha/active-passive-multi-ke scenario 2025-02-28 16:02:41 +01:00
Tobias Brunner
e7848e36fa ha: Add support to sync IKE and Child SAs with multiple key exchanges
Synchronization for the additional transforms in the IKE and Child SA
proposals is added.  Details of the IKE_SA synchronization are changed
to support IKE_INTERMEDIATE exchanges that cause multiple HA_IKE_ADD
messages and key derivations.  The cache has been extended to handle
multiple such messages.

Co-authored-by: Thomas Egerer <thomas.egerer@secunet.com>
2025-02-28 16:02:41 +01:00
Tobias Brunner
f717bb5249 kernel-netlink: Don't fallback to peer address as gateway
This doesn't really seem useful (perhaps it was before we started to
configure the outbound interface on our routes). And it can actually
cause the route installation to fail e.g. for routes over point-to-point
interfaces where we'd get "Error: Nexthop has invalid gateway" errors.

Closes strongswan/strongswan#2548
2025-02-28 16:01:49 +01:00
Tobias Brunner
9c97ecbb31 scripts: Add support for out-of-tree builds to test script
Can be useful when using the script locally.
2025-02-28 14:21:49 +01:00
Tobias Brunner
e385a83f5e vici: Fix out-of-tree builds with Perl module enabled
Not really building it out-of-tree for now, though.
2025-02-28 14:21:49 +01:00
Tobias Brunner
fad99c7a88 github: Explicitly install required packages for Linux builds
The runner images have some software pre-installed, which isn't the
case on regular Ubuntu images.
2025-02-28 14:21:41 +01:00
Tobias Brunner
8e4ea2cbbd github: Use all available CPU cores when building 2025-02-28 12:55:12 +01:00
Tobias Brunner
8c4e9f8c7b github: Call Botan configure script directly
This should find the required Python binary automatically (`python` might
not be available if not explicitly installed).
2025-02-28 12:55:12 +01:00
Tobias Brunner
f740faccac github: Don't use pip3 to install Python packages anymore
Currently, the runner images enable break-system-packages globally.
However, this workaround will be removed by the end of March.  So
we switch to installing these packages as intended via distro (the
alternative would be to use pipx, at least for tox).
2025-02-28 12:55:12 +01:00
Tobias Brunner
0bce9839c9 Merge branch 'android-reauth-fix'
Fixes issues with reauthentication, in particular, to reestablish the
SA if MOBIKE is disabled.  The app currently can't handle
make-before-break reauthentication.  In part because necessary events are
currently not triggered.  So for now, we switch back to the classic
reauthentication approach.
2025-02-27 11:23:52 +01:00
Tobias Brunner
a299a4d3ce android: New release after fixing reauthentication regression 2025-02-25 15:21:56 +01:00
Tobias Brunner
40a37b6ffc android: Disable make-before-break reauthentication
The service implementation with its handling of reauth callbacks and
no-DNS TUN device etc. can't handle make-before-break reauthentication
at the moment.
2025-02-25 14:57:00 +01:00
Tobias Brunner
9d4decbde8 github: Remove runs on Ubuntu 20.04
They will start to fail on certain days in March before the images are
removed on April 1st.
2025-02-21 14:46:08 +01:00
Tobias Brunner
5468759c71 github: Check test vectors with output in crypto plugin tests
This way we see what was actually tested. Increasing the verbosity for
the general test run produces too much output.
2025-02-21 14:13:26 +01:00
Tobias Brunner
31c44a758f test-vectors: Add a soft dependency on DRBG used for KEM tests
Depending on the loaded plugins, it's not necessary. So it's not a hard
dependency.
2025-02-21 11:06:17 +01:00
Tobias Brunner
e12540025d gmp: Declare dependency on DRBG to generate private keys 2025-02-21 11:06:02 +01:00
Tobias Brunner
ff50db8758 cirrus: Use FreeBSD 13.4 and 14.2 2025-02-20 16:30:11 +01:00
Tobias Brunner
1f0dd8d585 github: Use OpenSSL 3.4.1 for tests
There was an issue with OPENSSL_armcap_P in Android's static build for
OpenSSL 3.1.1+. This was finally fixed with this release (and was also
backported to older versions).
2025-02-20 16:30:11 +01:00
Tobias Brunner
827c572efd github: Use AWS-LC 1.46.1 for tests 2025-02-20 11:59:55 +01:00
Tobias Brunner
e4d6bcef48 android: Move annotation to method where startActivityAndCollapse() is called
Fixes: 5237bf3a5c6f ("android: Suppress deprecation warning because of startActivityAndCollapse()")
2025-02-20 11:59:55 +01:00
Tobias Brunner
b93141985b Merge branch 'android-passwords'
Adds support to import passwords via managed configuration and profile
files. Also fixes several deprecation warnings.

Closes strongswan/strongswan#2589
Closes strongswan/strongswan#2642
Closes strongswan/strongswan#2643
2025-02-20 11:08:29 +01:00
Tobias Brunner
f0f986c55d android: New release after adding support for passwords in managed configs and profile files
Also fixes some bugs and deprecation warnings.
2025-02-18 14:19:40 +01:00
Tobias Brunner
a47e282d09 android: Imported VPN profile files may contain passwords
A warning is displayed to the users, reminding them that there is a
cleartext password in the file.
2025-02-18 14:12:43 +01:00
Tobias Brunner
0b6d42661d android: Consistently use *Start/End in layouts and remove redundant old settings 2025-02-18 14:12:43 +01:00
Tobias Brunner
b021406f6b android: Suppress deprecation warning because of stopForeground() 2025-02-18 14:12:43 +01:00
Tobias Brunner
5237bf3a5c android: Suppress deprecation warning because of startActivityAndCollapse() 2025-02-18 14:12:43 +01:00
Tobias Brunner
4e2c88f7ed android: Handle deprecated getParcelable* and getSerializable methods 2025-02-18 14:12:43 +01:00
Tobias Brunner
288bd41aca android: Suppress warning in implementation only used for Android < 33 2025-02-18 14:12:43 +01:00
Tobias Brunner
26eef1f095 android: Replace deprecated onBackPressed() and enable predictive back gestures
Doesn't really make a difference it seems.
2025-02-18 14:12:43 +01:00
Tobias Brunner
9a92088bb4 android: Replace deprecated fragment menu APIs 2025-02-18 14:12:43 +01:00
Tobias Brunner
10d8b66f05 android: Ignore empty strings for settings in managed profiles
Unspecified settings should be set to null, while some MDMs might send
them as empty strings, which could cause issues (like an empty password
or trying to parse an empty DNS server address).
2025-02-18 14:12:43 +01:00
Tobias Brunner
4f808cb2b0 android: Allow setting the password in managed profiles
To avoid complicated changes in the UI, users can still update it.  But
the default, if they clear the field, will be the managed password.
2025-02-18 14:12:43 +01:00
Tobias Brunner
87610799f2 android: Properly deinit library if parsing an IP fails
This can happen with empty strings, which might be set for managed
profiles, which caused the refcounting to be askew and the resolver not
to work after connecting once because it was flushed and disabled.
2025-02-18 14:12:43 +01:00
Tobias Brunner
ff2010c8da android: Update NDK version and enable support for 16KiB page tables 2025-02-18 14:12:43 +01:00
Tobias Brunner
e6b040265d android: Fix updating password for managed profiles
Without data source set on the profile, this caused the app to crash
with a null pointer dereference when it is updated.
2025-02-18 14:12:43 +01:00
Tobias Brunner
19925fd893 unit-tests: Document additional supported env variables 2025-02-10 15:41:52 +01:00
Tobias Brunner
e0fc0adc93 Merge branch 'nm-gui-ts'
Adds fields for local and remote TS to the GUI.

Closes strongswan/strongswan#2580
2025-02-07 13:27:37 +01:00
Tobias Brunner
4e634f4511 nm: Add German translation for traffic selector fields 2025-02-07 12:01:00 +01:00
Jiří Matěják
418ef2a7a1
nm: Expose local-ts
Signed-off-by: Jiří Matěják <matejak@merica.cz>
2025-02-06 21:01:50 +01:00
Jiří Matěják
d0dd7b561b
nm: Expose remote-ts
Signed-off-by: Jiří Matěják <matejak@merica.cz>
2025-02-06 21:00:48 +01:00
Tobias Brunner
9aa2be8411 charon-nm: Add option to configure local traffic selectors
Closes strongswan/strongswan#2084
2025-02-06 17:20:25 +01:00
Tobias Brunner
941b7194a5 github: Use AWS-LC 1.45.0 for tests 2025-02-06 08:29:09 +01:00
Tobias Brunner
36c1cb4f8c Use Botan 3.7.1 for tests 2025-02-05 14:14:40 +01:00
Tobias Brunner
c2e5c00df3 Merge branch 'dhcp-receive'
This fixes a regression introduced with pf_handler_t in 5.9.14.  It also
binds the packet sockets correctly to the configured interface, and adds
an option for the dhcp plugin that allows binding the send and receive
sockets to different interfaces.
2025-01-31 11:21:04 +01:00
Tobias Brunner
a50ed3006e dhcp: Add option to bind the receive socket to a different interface
This can be useful if the DHCP server runs on the same server. On Linux,
the response is then sent via `lo`, so packets won't be received if both
sockets are bound to e.g. a bridge interface.
2025-01-31 11:20:42 +01:00
Tobias Brunner
00d8c36d6f pf-handler: Correctly bind packet socket to an interface
Binding such sockets via SO_BINDTODEVICE does not work at all. Instead,
bind() has to be used, as described in the packet(7) man page.
2025-01-31 11:20:32 +01:00
Tobias Brunner
abbf9d28b0 pf-handler: Accept loopback interfaces as packet source
In some setups the responses from the DHCP server are sent via lo, which
does not have an address of type `ARPHRD_ETHER` (the address length is
the same, though, just all zeros, by default).  Note that the dhcp plugin
doesn't actually care for the MAC address or interface details, that's
only used by the farp plugin.

Fixes: 187c72d1afdc ("dhcp: Port the plugin to FreeBSD/macOS")
2025-01-31 11:19:42 +01:00
Nathan Tran
543a4c86f9 ikev2: Handle INVALID_SYNTAX after IKE_AUTH by deleting IKE_SA
When serving as a responder and receiving an INFORMATIONAL exchange
containing INVALID_SYNTAX after IKE_AUTH, the IKE_SA should be deleted.
Currently, it only gets deleted after receiving AUTHENTICATION_FAILED.
RFC7296 section 2.21.2 says:

 In an IKE_AUTH exchange, or in the INFORMATIONAL exchange immediately
 following it (in case an error happened when processing a response to
 IKE_AUTH), the UNSUPPORTED_CRITICAL_PAYLOAD, INVALID_SYNTAX, and
 AUTHENTICATION_FAILED notifications are the only ones to cause the
 IKE SA to be deleted or not created, without a Delete payload.

Closes strongswan/strongswan#2636
2025-01-29 17:31:40 +01:00
Tobias Brunner
d38eaa6dd7 sonarcloud: Ignore that we don't define loop variables inside the loop
Also add the official description for the other ignored rules.
2025-01-21 15:16:33 +01:00
Nathan Tran
1d5c5a1d72 openssl: Require min version 3.0.0 for HKDF to support larger MODP groups and nonces
Also enables the `kdf` plugin automatically if building against an older
version of OpenSSL.

Closes strongswan/strongswan#2602

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2025-01-15 18:11:18 +01:00
Tobias Brunner
d860c26e95 plugin-loader: Properly support compilation without dlopen()/dlsym() etc.
This only works if plugins are built monolithically and linked statically.

Closes strongswan/strongswan#2615
2025-01-13 17:51:14 +01:00
Tobias Brunner
41538cf259 sw-collector: Fix build with DEBUG_LEVEL < 1 2025-01-13 15:33:33 +01:00
Tobias Brunner
0784ebdd2d pts: Fix build with DEBUG_LEVEL < 1 2025-01-13 15:04:13 +01:00
Tobias Brunner
e248f0f3c2 libtnccs: Fix build with DEBUG_LEVEL < 1 2025-01-13 15:04:13 +01:00
Tobias Brunner
47d5adc96a eap-sim-file: Fix build with DEBUG_LEVEL < 1 2025-01-13 15:04:13 +01:00
Tobias Brunner
52771c1392 simaka-manager: Fix build with DEBUG_LEVEL < 1 2025-01-13 12:02:17 +01:00
Tobias Brunner
a0353af6df gmp: Fix build with DEBUG_LEVEL < 1 2025-01-13 11:36:32 +01:00
Tobias Brunner
504e6033d9 optionsfrom: Fix build with DEBUG_LEVEL < 1 2025-01-10 18:53:57 +01:00
Tobias Brunner
4cf0a5b631 credential-factory: Fix build with DEBUG_LEVEL < 1
Newer versions of clang complain here.
2025-01-10 18:53:57 +01:00
Tobias Brunner
227d7ef9a2 tnc-imv: Add missing argument to IMV recommendations constructor
This avoids the following warning/error:

tnc_imv_manager.c:244:39: error: passing arguments to 'tnc_imv_recommendations_create' without a prototype is deprecated in all versions of C and is not supported in C23 [-Werror,-Wdeprecated-non-prototype]
  244 |         return tnc_imv_recommendations_create(this->imvs);
      |                                              ^
2025-01-10 18:53:57 +01:00
Tobias Brunner
f1f0bd9de6 ctr: Remove parameter-less constructor prototype
Useless and causes a compiler warning/error:

  error: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C23, conflicting with a subsequent declaration [-Werror,-Wdeprecated-non-prototype]
2025-01-10 18:53:57 +01:00
Tobias Brunner
7af260a5f1 coverage: Exclude generated static proposal keywords
The lines in the gperf-generated proposal_keywords_static.c are now
mapped to the (much shorter) .txt source file, which causes mismatches
like these:

  genhtml: ERROR: no data for line:190, TLA:GNC, file:/home/runner/work/strongswan/strongswan/src/libstrongswan/crypto/proposal/proposal_keywords_static.txt

We could ignore "unmapped" errors in genhtml, but since the file is
generated anyway, we can also exclude it from the results and still
get such errors in case this happens for other files.  Another alternative
would be to remove the `#line` macros in the generated file.  Then the
coverage of the actual C file would get reported (but again, it's
generated, so there isn't much value in it).

Also updated the branch coverage option as the one with `lcov_` prefix
is deprecated.
2025-01-10 18:53:57 +01:00
Tobias Brunner
71f4c3dc4e coverage: Use atomic profiling updates to avoid issues with multi-threaded test cases 2025-01-10 18:53:39 +01:00
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")
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 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 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
Andreas Steffen
6735c3d7ca Define new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
558529afe2 testing: Migrated wolfssl scenarios 2024-11-22 14:14:53 +01:00
Andreas Steffen
2e4c062512 testing: Migrated tnc scenarios to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
11bb0a73b8 testing: Migrated tkm scenarios to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
89acb24bd7 testing: Migrated sql scenarios to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
b891da52b4 testing: Migrated route-based scenarios to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
8fc6340c05 testing: Migrated pfkey scenarios to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
93b6162d74 testing: Migrated p2pnat scenarios to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
bd93dfb09b testing: Migrated libipsec scenarios to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
0cf08b45dd testing: Migrated ha scenarios to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
dc69cf2f65 testing: Migrated gcrypt-ikev2 scenarios 2024-11-22 14:14:53 +01:00
Andreas Steffen
b9e5764b75 testing: Migrated botan scenarios 2024-11-22 14:14:53 +01:00
Andreas Steffen
17e0f20f57 testing: Migrated af-alg scenarios 2024-11-22 14:14:53 +01:00
Andreas Steffen
fdc9e69523 testing: Migrated ike scenarios to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
6ae40ac581 testing: Migrated ikev1-stroke to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
950d4fe7a0 testing: Migrated ikev2-stroke scenarios to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
2dbcb15338 testing: Migrated ipv6-stroke scenarios to new default plugins 2024-11-22 14:14:53 +01:00
Andreas Steffen
38bacea63b testing: Migrated ipv6 scenarios to new default plugins 2024-11-22 14:14:52 +01:00
Andreas Steffen
e7166c342b testing: Distributed openssl-ikev1 scenarios 2024-11-22 14:14:52 +01:00
Andreas Steffen
c9883d612b testing: Migrated ikev1-algs scenarios to new default plugins 2024-11-22 14:14:52 +01:00
Andreas Steffen
8060541f53 testing: Migrated ikev1 scenarios to new default plugins 2024-11-22 14:14:52 +01:00
Andreas Steffen
4df94b56c0 testing: Distributed openssl-ikev2 scenarios 2024-11-22 14:14:52 +01:00
Andreas Steffen
f766a7ed49 testing: Migrated ikev2-algs scenarios to new default plugins 2024-11-22 14:14:52 +01:00
Andreas Steffen
2099a52618 testing: Migrated ikev2 scenarios to new default plugins 2024-11-22 14:14:52 +01:00
Tobias Brunner
9de4efb1ae ml: Store decoded public/private key and matrix A on initiator
While this does require quite a bit of memory, on initiators there are
usually fewer concurrent SAs getting created so this should be less of
an issue than on a gateway that handles lots of SAs as responder.

The speed up is about 30% on the initiator during the decapsulation,
while the key generation does take a bit more time (about 3%).
2024-11-22 14:14:10 +01:00
Tobias Brunner
89f4b345e3 ml: Add software implementation of ML-KEM
This follows FIPS 203 relatively closely but takes some ideas from the
reference implementation.  In particular, how to avoid potential
side-channels via direct C division/modulo operations.  However, it just
uses Barrett reduction (no Montgomery reduction) and no negative
coefficients to avoid number format conversions and keep the
implementation clearer.
2024-11-22 14:14:08 +01:00
Tobias Brunner
930381228b memory: Add helper function to conditionally copy data in constant time 2024-11-22 14:09:53 +01:00
Andreas Steffen
3b7c49bc31 mgf1: Support of RSA PSS with SHA3 hash 2024-11-22 14:05:36 +01:00
Andreas Steffen
1265d78cac ntru: Remove legacy NTRU key exchange method 2024-11-22 14:05:36 +01:00
Andreas Steffen
8e3a373e18 newhope: Remove legacy Newhope key exchange method 2024-11-22 14:05:36 +01:00
Andreas Steffen
4833f29b15 bliss: Remove legacy BLISS signatures 2024-11-22 14:05:36 +01:00
Gerardo Ravago
ec982171d9 openssl: Add ML-KEM support with AWS-LC
This registers support for the ML_KEM_{512,768,1024} key exchange
algorithms in the `openssl` plugin when built using AWS-LC as the
libcrypto. To do this, we introduce the `openssl_kem` source files
which implement the key exchange algorithm using the Key Encapsulation
Mechanism (KEM) API. Future KEM algorithms can be implemented
generically using this interface by substituting the appropriate NIDs.

It also supports both seeded (via DRBG) and unseeded modes depending
on the user's requirements for KATs or entropy sources.

It should be noted that this does not add support for KEM algorithms
within upstream OpenSSL and is API incompatible. Future work will need
to condition out the incompatibilities as-appropriate. However, the
high-level logic should be the same for all KEMs and KEM APIs.

References strongswan/strongswan#2228
Closes strongswan/strongswan#2490
2024-11-22 14:04:02 +01:00
Tobias Brunner
d14bb3881b botan: Add support for ML-KEM 2024-11-22 14:03:17 +01:00
Tobias Brunner
974f9c37df Use Botan 3.6.1 for tests
With 3.6.0 support for ML-KEM was added.
2024-11-22 14:03:17 +01:00
Tobias Brunner
ebdaab6861 botan: Add support for AES in ECB mode to support DRBG_CTR_AES
This DRBG is used to test ML-KEM.
2024-11-22 14:03:17 +01:00
Tobias Brunner
0a3889086d botan: Fix include issue that prevented parsing public keys
Botan stopped including build.h in ffi.h with 3.4.0, so we have to
add this here explicitly to check for the enabled key types.
2024-11-22 14:03:17 +01:00
Tobias Brunner
1bb6f1dd73 wolfssl: Add support for ML-KEM 2024-11-22 14:03:17 +01:00
Tobias Brunner
307dea6b5f Use wolfSSL 5.7.4 for tests
This adds support for ML-KEM etc.
2024-11-22 14:03:17 +01:00
Tobias Brunner
cc53a04c7a test-vectors: Add ML-KEM test vectors
The vectors are generated using the `kat_kem` utility of the liboqs
project and then converted using the `nist_kem_kat` script.
2024-11-22 14:03:16 +01:00
Andreas Steffen
ee19c3e7dd scripts: Add script formatting NIST KEM KAT records into ke_test vectors 2024-11-22 14:03:16 +01:00
Tobias Brunner
f58fdcddad dh-speed: Use method call order compatible with KEMs
Also prints the speed of the derivation (or decapsulation) for the
initiator.
2024-11-22 14:03:16 +01:00
Tobias Brunner
09636199e6 key-exchange: Document how the interface is used with KEMs 2024-11-21 14:26:35 +01:00
Andreas Steffen
40676786aa key-exchange: Joint ke_test_vector format for DH and KEM
Both Diffie-Hellman (DH) and Key Encapsulation Mechanism (KEM) based
key exchange methods use a common ke_test_vector format. The
set_seed() function is used to provide deterministic private key
material for the crypto tests.
2024-11-21 14:26:35 +01:00
Tobias Brunner
47de9ef9a1 key-exchange: Add identifiers for ML-KEM algorithms 2024-11-21 14:26:35 +01:00
Tobias Brunner
8ea6997482 swanctl: Document soft lifetime defaults if hard lifetimes are configured 2024-10-30 12:07:04 +01:00
Tobias Brunner
d4a0dd9f93 mem-pool: Fix issue with make-before-break reauth and multiple IKE_SAs
If uniqueness checks are disabled and multiple IKE_SAs with the same
identities are created, an offline lease could have gotten reassigned
during a make-before-break reauthentication if such an SA was closed
earlier.  Checking for an online lease for the same client (IP/port)
first ensures that the correct IP is reassigned during the
reauthentication.

References strongswan/strongswan#2472
2024-10-25 14:52:46 +02:00
Tobias Brunner
f09b8203d3 file-logger: Take options as a struct and combine ms/us suffix options
References strongswan/strongswan#2475
2024-10-25 14:49:11 +02:00
Tobias Brunner
768fec23bc file-logger: Add support to log timestamp in microseconds
Closes strongswan/strongswan#2475
2024-10-25 14:48:17 +02:00
Tobias Brunner
a2fba6db4a file-logger: Add option to log messages as JSON objects
Closes strongswan/strongswan#2222
2024-10-25 14:45:12 +02:00
Tobias Brunner
c87aae300a socket-default: Always open IPv4 sockets before IPv6 sockets
Since we now open sockets for each address family independently (via
IPV6_V6ONLY) and without SO_REUSEADDR, it could happen with the previous
order on Linux that opening the port that was allocated as ephemeral
port for IPv6 was already used by a different process for IPv4.

Most IPv6 sockets on ephemeral ports will not have IPV6_V6ONLY set, so
the same port is also reserved for IPv4.  Therefore, it's save to assume
that any ephemeral port we first get for IPv4 is free for IPv6.

References strongswan/strongswan#2494
2024-10-25 14:40:35 +02:00
Tobias Brunner
3d0f6958a9 openssl: Add support for new API to squeeze data from XOFs
This new API doesn't require a temporary buffer and generating a lot
of already consumed output.
2024-10-25 14:28:40 +02:00
Tobias Brunner
bee06c9ec5 leak-detective: Whitelist OpenSSL 3.2 function 2024-10-25 14:28:35 +02:00
Andreas Steffen
0be6fd7735 certificate_printer: Fix spacing for additional CRL/OCSP URIs
Multiple occurences of CRL and OCSP URIs where not indented correctly.
2024-10-18 15:45:07 +02:00
Tobias Brunner
5019e3ece0 nm: Update build files and switch from intltool to gettext
gnome-common has been deprecated, so has intltool.  This follows GNOME's
recommended migration paths.
2024-10-16 08:16:43 +02:00
Tobias Brunner
faf40b8d74 Revert "conf: Add support for escaping dots in section/option names"
This reverts commit 84a3077e780e7b25bf536da42a583bdc18448362.

Support for dots in names of settings was removed quite a while ago and
now the \. sequence caused `SyntaxWarning: invalid escape sequence`.
2024-10-15 12:59:41 +02:00
Tobias Brunner
60336ceecb wolfssl: Don't undef PARSE_ERROR as headers included later might refer to it 2024-10-15 11:14:35 +02:00
Tobias Brunner
8e020bc9e3 vici-config: Same order for default ESP proposals if unset or set to "default"
The order was different when not setting `esp_proposals` or explicitly
configuring `default`.

Fixes: 33412158f58c ("ike: Send AEAD ESP default proposal first")
2024-10-02 10:33:05 +02:00
Tobias Brunner
089977b69d generator: Make debug log for payload substructure rules more clear
Similar to the previous commit.  Instead of

  generating rule 10 (1258)

followed by (or not if the list is empty)

  generating payload of type PROPOSAL_SUBSTRUCTURE

we now get

  generating rule 10 LIST of PROPOSAL_SUBSTRUCTURE

in the debug log.
2024-10-02 10:08:51 +02:00
Tobias Brunner
2ec6d50a3c parser: Make debug log for payload substructure rules more clear
Instead of this

  parsing rule 10 (1258)

we now see this

  parsing rule 10 LIST of PROPOSAL_SUBSTRUCTURE

in the debug log. Particularly useful if the list is empty as there won't
be a message like this following it:

  x bytes left, parsing recursively PROPOSAL_SUBSTRUCTURE
2024-10-02 10:07:36 +02:00
Tobias Brunner
be0af46d89 Merge branch 'tun-device-ipv6'
Adds support for IPv6 addresses on TUN devices, in particular, to support
virtual IPv6 addresses on FreeBSD/macOS.

Closes strongswan/strongswan#2465
2024-09-25 16:12:49 +02:00
Tobias Brunner
bf165afb78 kernel-pfroute: Route via interface if we don't have a next hop
Compared to RTA_IFP, the format is different when passing an interface
as RTA_GATEWAY, it requires the interface's address and not its name.
2024-09-25 16:12:34 +02:00
Tobias Brunner
fccc76449d tun-device: Fix handling of IPv6 addresses
struct ifreq can't be used for IPv6 as the ifr_addr member is not large
enough.  Actually, configuring an IPv6 address via an AF_INET socket won't
work anyway.  And unfortunately, it's not standardized how IPv6 addresses
are installed, so we have to do this quite differently on Linux and on BSD.
However, we already use SIOCAIFADDR for IPv4 on newer FreeBSD systems,
which wasn't the case when this patch was originally created in 2014.
2024-09-25 15:45:32 +02:00
Tobias Brunner
74208e2cc3 Merge branch 'tkm-multi-ke'
Adds support for multiple key exchanges to charon-tkm.
2024-09-19 15:20:31 +02:00
Tobias Brunner
2b1885b892 testing: Add TKM scenarios with multiple key exchanges 2024-09-19 14:39:13 +02:00
Tobias Brunner
5a8f0767b8 charon-tkm: Add tests with multiple key exchanges 2024-09-19 14:39:13 +02:00
Stefan Berghofer
7975a0cfa4 charon-tkm: Adapt to interface changes to support multiple key exchanges
Also includes ESA flags.

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2024-09-19 14:39:13 +02:00
Tobias Brunner
301abbeaff Merge branch 'vici-reload-tasks'
Consider queued child-creating tasks when reloading configs that have
`start` as start action.  Besides some possible corner cases it fixes
handling IKE_SAs that are current getting established and have no
established CHILD_SAs yet.

Closes strongswan/strongswan#2418
2024-09-19 10:11:49 +02:00
Tobias Brunner
a4a3dcf6c2 vici-config: Consider queued tasks when terminating IKE/CHILD_SAs
This is particularly important for IKE_SAs that are not yet established,
which would get terminated as they have no established CHILD_SAs yet.

Fixes: 72f9a21b22e9 ("Merge branch 'vici-reload-actions'")
2024-09-18 11:53:17 +02:00
Tobias Brunner
961763b84d quick-mode: Allow "aborting" task if it's currently active
Basically the same as the previous commit.
2024-09-18 11:53:17 +02:00
Tobias Brunner
e81cf3bd36 child-create: Allow "aborting" task if it's currently active
We can't actually abort an active exchange, but we can delete the SA
immediately after its creation.
2024-09-18 11:53:17 +02:00
Tobias Brunner
cf3c90dba6 quick-mode: Add getter for child config 2024-09-18 11:53:17 +02:00
Tobias Brunner
04c9316db5 child-create: Add getter for child config 2024-09-18 11:53:17 +02:00
Tobias Brunner
9d4c7bebfc checksum: Avoid compiler warning/error when building monolithic
References strongswan/strongswan#2446
2024-09-18 11:49:35 +02:00
Tobias Brunner
decccd4f63 github: Update AWS-LC to 1.35.0 for tests 2024-09-18 08:49:52 +02:00
Thomas Egerer
cf7fb47788 array: Don't use realloc() with zero size in array_compress()
The behavior of realloc(3) with zero size was apparently implementation
defined.  While glibc documents the behavior as equivalent to free(3),
that might not apply to other C libraries.  With C17, this behavior has
been deprecated, and with C23, the behavior is now undefined.  It's also
why valgrind warns about this use.

Hence, when array_compress() would call realloc() with a zero size, we
now call free() explicitly and set the pointer to NULL.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2024-09-12 08:53:26 +02:00
Andreas Steffen
957aae8f64 cert-enroll: Fixed typo
This typo prevented the cert-enroll script from successfully
signalling a detected change of the sub CA certificate.
2024-09-07 17:17:07 +02:00
Tobias Brunner
55a660d9f7 github: Use more verbose output for apt-get calls
With -qq we don't see any detailed error messages.
2024-09-05 10:59:20 +02:00
Tobias Brunner
6928709886 ike-cfg: Only consider port information if the IP matches
Otherwise, all configs would be considered to even some degree as the
ports usually match.

Closes strongswan/strongswan#2441

Fixes: 9228a5109b8d ("ike-cfg: Consider port information in IKE config match")
2024-09-05 10:22:25 +02:00
Tobias Brunner
12d2b6e2b4 key-exchange: Pass prefix array directly, not a pointer to it 2024-08-08 11:19:16 +02:00
Tobias Brunner
8e2fde6230 child-create: Remove redundant variable assignment 2024-08-08 11:18:24 +02:00
Tobias Brunner
3a850ae191 Merge branch 'multi-ke'
This adds support for multiple key exchanges (no KEMs yet as none are
standardized so far).  Work on this started over five years ago and went
through multiple iterations (first our own protocol, then standardized
extensions in different variations).

IKE_INTERMEDIATE exchanges, defined RFC 9242, are used to transport
multiple KE payloads between the IKE_SA_INIT and IKE_AUTH exchanges.
To rekey IKE and CHILD_SAs with multiple key exchanges, IKE_FOLLOWUP_KE
exchanges are used, as defined in RFC 9370.

In proposals, additional key exchange methods are configured via `keX_`
prefix, where X is a number between 1 and 7.  For example, `ke1_ecp256`
adds ECP_256 as additional KE method.  As with regular key exchanges,
peers have to agree on a method for each round unless no algorithms are
defined by both or `keX_none` is configured to make that round explicitly
optional.

Also changed is how rekey collisions are handled, which makes CHILD_SAs
properly trackable via child_rekey() hook.
2024-08-07 16:20:42 +02:00
Tobias Brunner
f3c7e5227c testing: Add ikev2/rw-cert-multi-ke scenario 2024-08-07 16:20:19 +02:00
Tobias Brunner
ddb9b274c2 unit-tests: Ensure listeners can track SAs via ike/child_updown/rekey()
Previously, it could happen that child_rekey() was triggered twice for
the same "old" SA.  For listeners that would mean they'd loose track as
they'd be tracking a new SA that wasn't relevant anymore and for which
no updown event would ever get triggered (it was the redundant SA in a
collision).  This new assert ensures that events are triggered in a
predictable way and listeners can track SAs properly.
2024-08-07 16:20:19 +02:00
Tobias Brunner
d2b2e1b3fa ikev2: Make CHILD_SAs properly trackable during rekey collisions
As the winner of a rekey collision, we previously always triggered the
child_rekey() event once when creating the redundant SA on behalf of the
peer in the passive child-rekey task and then a second time when
creating the winning SA in the active task.  However, both calls passed
the replaced CHILD_SA as "old". This made tracking CHILD_SAs impossible
because there was no transition from the redundant, "new" SA of the
first event to the "new", winning SA of the second.  Of course, when the
second event was triggered, the redundant SA might not have existed
anymore because the peer is expected to delete it, which could happen
before the CREATE_CHILD_SA response arrives at the initiator.

This refactoring ensures that the child_rekey() event is triggered in
a way that makes the CHILD_SAs trackable in all reasonable (and even
some unreasonable) scenarios.  The event is generally only triggered
once after installing the outbound SA for the new/winning CHILD_SA.
This can be when processing the CREATE_CHILD_SA in the active child-rekey
task, or when processing the DELETE for the old SA in a passive
child-delete task.  There are some cases where the event is still
triggered twice, but it is now ensured that listeners can properly
transition to the winning SA.

Some corner cases are now also handled correctly, e.g. if a responder's
DELETE for the new CHILD_SA arrives before its CREATE_CHILD_SA response
that actually creates it on the initiator.  Also handled properly are
responders of rekeyings that incorrectly send a DELETE for the old
CHILD_SA (previously this caused both, the new and the old SA, to get
deleted).
2024-08-07 16:20:19 +02:00
Tobias Brunner
7ad610a140 ike-init: Indicate support for IKE_INTERMEDIATE 2024-08-07 16:20:19 +02:00
Tobias Brunner
012d99ecf4 proposal: Prevent selection of duplicate key exchange methods
All additional (and the initial) key exchanges must use a different method.
2024-08-07 16:20:19 +02:00
Tobias Brunner
1d5e921911 proposal: Add helper to check if additional key exchanges are contained 2024-08-07 16:20:19 +02:00
Tobias Brunner
882ff93bfd proposal: Accept NONE for additional key exchanges also for IKE proposals 2024-08-07 16:20:19 +02:00
Tobias Brunner
33e421320a unit-tests: Add tests for CHILD_SA rekeying with multiple key exchanges 2024-08-07 16:20:19 +02:00
Tobias Brunner
37eeafa37f unit-tests: Add tests for CHILD_SA creation with multiple key exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
329a7b331d unit-tests: Add tests for IKE_SA rekeying with multiple key exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
37c56affa1 unit-tests: Support multiple proposals in exchange tests 2024-08-07 16:20:18 +02:00
Andreas Steffen
d4fb07911f vici: Increase maximum proposal length 2024-08-07 16:20:18 +02:00
Andreas Steffen
355f917532 vici: List additional key exchanges
Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2024-08-07 16:20:18 +02:00
Tobias Brunner
c5a6938b9e proposal: Add prefix for additional key exchanges when logging proposals 2024-08-07 16:20:18 +02:00
Tobias Brunner
e05d86b27a key-exchange: Add dynamic parser for additional key exchange methods 2024-08-07 16:20:18 +02:00
Tobias Brunner
95275d2fe5 child-rekey: Support CHILD_SA rekeying with multiple key exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
c200bd1668 unit-tests: Fix CHILD_SA rekey tests after INVALID_KE_PAYLOAD handling changed
The responder doesn't create a CHILD_SA and allocate an SPI anymore
when responding with an INVALID_KE_PAYLOAD notify.
2024-08-07 16:20:18 +02:00
Tobias Brunner
d7760416d6 child-create: Add support for multiple key exchanges
It also changes that payloads are built before installing the CHILD_SA
on the responder, that is, the KE payload is generated before keys are
derived, so that key_exchange_t::get_public_key() is called before
get_shared_secret(), or its internal equivalent, which could be relevant
for KE implementations that want to ensure that the key can't be
accessed again after the key derivation.
2024-08-07 16:20:18 +02:00
Tobias Brunner
ca3e6d2d14 ike-rekey: Support IKE_SA rekeying with multiple key exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
0d49ddec2e ike-init: Add support for multiple key exchanges
Initially, this is handled with a key derivation for each
IKE_INTERMEDIATE exchange.  When rekeying, the keys are derived only
once all IKE_FOLLOWUP_KE exchanges are done.
2024-08-07 16:20:18 +02:00
Tobias Brunner
eff0c43a17 bus: Support multiple key exchanges in ike/child_keys() events 2024-08-07 16:20:18 +02:00
Tobias Brunner
c14e4ab2a8 keymat_v2: Support key derivation with multiple key exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
c36eaf42da key-exchange: Add helper to concatenate shared secrets of several key exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
ec0ec55070 keymat_v2: Proper cleanup if derive_ike_keys() is called multiple times 2024-08-07 16:20:18 +02:00
Tobias Brunner
f6b2e6a21f ike-auth: Calculate and collect IntAuth for IKE_INTERMEDIATE exchanges
The message ID of the first IKE_AUTH exchange is a safe-guard against
potential truncation attacks if IKE_INTERMEDIATE exchanges are not used
for multiple key exchanges but some other future use where the number of
exchanges might not depend on the selected proposal.
2024-08-07 16:20:18 +02:00
Tobias Brunner
1212780b32 pubkey-authenticator: Handle IntAuth data 2024-08-07 16:20:18 +02:00
Tobias Brunner
c4dac17d8c psk-authenticator: Handle IntAuth data 2024-08-07 16:20:18 +02:00
Tobias Brunner
5c69262ce6 eap-authenticator: Handle IntAuth data 2024-08-07 16:20:18 +02:00
Tobias Brunner
e5828d26ea keymat_v2: Include optional IntAuth in signed octets 2024-08-07 16:20:18 +02:00
Tobias Brunner
91f09b8d25 authenticator: Add optional method to set IntAuth data 2024-08-07 16:20:18 +02:00
Tobias Brunner
515b9303de message: Store original encrypted payload when generating fragments
If we don't do this, get_plain() will fail after generating the message
fragmented unless it was generated non-fragmented previously.
2024-08-07 16:20:18 +02:00
Tobias Brunner
b9c69f9080 message: Add method to generate data to authenticate IKE_INTERMEDIATE exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
5c439bb8a3 generator: Make pointer to length field optional
Only useful if we generate an IKE header.
2024-08-07 16:20:18 +02:00
Tobias Brunner
a24993213e keymat_v2: Add method to calculate IntAuth for IKE_INTERMEDIATE exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
b8358936aa message: Add rules for IKE_FOLLOWUP_KE exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
414db6cab1 ike-header: Add IKE_FOLLOWUP_KE exchange type 2024-08-07 16:20:18 +02:00
Tobias Brunner
041358976b notify-payload: Add notify types for multiple key exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
aedf73f7cf ikev2: Reject IKE_INTERMEDIATE requests after IKE_AUTH
We currently only support these exchanges for additional key exchanges,
so once we have the final keys derived and the ike-init task is removed,
we don't expect any more of them.
2024-08-07 16:20:18 +02:00
Tobias Brunner
25f2cdfc56 message: Add rules for IKE_INTERMEDIATE exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner
a45d454e94 ike-header: Add IKE_INTERMEDIATE exchange type 2024-08-07 16:20:18 +02:00
Tobias Brunner
cc9ab450d6 notify-payload: Add notify type for IKE_INTERMEDIATE exchange 2024-08-07 16:20:18 +02:00
Tobias Brunner
3e0495745c proposal-substructure: Encode additional key exchange methods 2024-08-07 16:20:18 +02:00
Tobias Brunner
9cc5f4a511 proposal: Make all key exchange transforms optional in ESP/AH proposals 2024-08-07 16:20:18 +02:00
Tobias Brunner
fb6b8c833b proposal: Skip all KE transforms if PROPOSAL_SKIP_KE given 2024-08-07 16:20:18 +02:00
Tobias Brunner
2e059e0c27 transform: Add helper to check if transform type negotiates key exchange 2024-08-07 16:20:18 +02:00
Tobias Brunner
22550bd262 transform: Add additional key exchange transform types 2024-08-07 16:20:18 +02:00
Tobias Brunner
a7f617ab33 kernel-pfkey: Fix list of extension type names on FreeBSD
The list was extended earlier this year.
2024-08-07 15:09:45 +02:00
Tobias Brunner
abdc7878a4 Merge branch 'sa-dir'
Configures the direction of IPsec SAs in the Linux kernel if
possible (6.10+).
2024-08-07 15:00:56 +02:00
Tobias Brunner
22eded1da4 kernel-netlink: Set replay window 0 if kernel supports SA direction attribute
The kernel now allows a 0 replay window with ESN for SAs that are
explicitly tagged as outbound SAs.  But not just that, it actually
rejects outbound SAs with replay windows > 0.  So we add a version check
to control the replay window size.  Note that adding the attribute
unconditionally would be fine even for older kernels, but if somebody
backports the direction patches, the installation of outbound SAs might
fail if the replay window is not adjusted accordingly.
2024-08-07 14:41:28 +02:00
Tobias Brunner
661f6bd0ad kernel-netlink: Add SA direction attribute 2024-08-07 14:41:28 +02:00
Tobias Brunner
2601fabbb4 kernel-netlink: Only disable DF-flag copying on outbound SAs
This will cause errors on inbound SAs if the SA direction attribute is
used.
2024-08-07 14:41:28 +02:00
Tobias Brunner
dc8fa1b3e8 kernel-netlink: Add missing names for XFRM message types and attributes 2024-08-07 14:41:28 +02:00
Tobias Brunner
b05628dd2d include: Update XFRM header for SA direction attribute 2024-08-07 14:41:28 +02:00
Thomas Egerer
84bd011752 ike-sa: Add address family specific configuration of fragment size
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2024-08-07 14:19:41 +02:00
Tobias Brunner
9b9cf2001f android: Fix import of an already existing VPN profile 2024-08-07 08:58:12 +02:00
Tobias Brunner
740cbb2c0a Merge branch 'android-14'
Updates target SDK to Android 14 (34) and fixes compatibility issues.
2024-08-06 18:02:18 +02:00
Tobias Brunner
fe1c9dedb7 android: New release after updating target SDK and fixing some compatibility issues 2024-08-06 18:01:54 +02:00
Tobias Brunner
6064209872 android: Increase targetSdkVersion to 34 (Android 14) 2024-08-06 18:01:54 +02:00
Tobias Brunner
880e273985 android: Avoid using deprecated ViewCompat methods 2024-08-06 18:01:54 +02:00
Tobias Brunner
01c81ca15f android: Replace deprecated Observer/Observable with PropertyChangeListener etc.
Kinda misusing the interface as there is no specific property, but
otherwise seems like a 1:1 replacement.
2024-08-06 18:01:54 +02:00
Tobias Brunner
51f746161d android: Add workaround for a bug preventing background service starts from TileService
When targeting Android 14, we get a "Background activity launch blocked!"
exception when trying to start the connection in the background (closing
the drawer works).  Which is apparently a bug:

  https://issuetracker.google.com/issues/305035828

The workaround here is kinda ugly.  In particular, because it's not
possible anymore since a few versions to open a dialog that allows users
to directly grant the required permission to the app.  We can only open
the generic settings dialog where users have to search for the app and
grant the permission themselves (we could add a dialog with an explanation
similar to the one for the power whitelist if necessary).  Hopefully this
gets fixed at some point (the current beta of Android 15 still has the
same bug, though).
2024-08-06 18:01:54 +02:00
Tobias Brunner
3286f75ffe android: Use PendingIntent-version of startActivityAndCollapse()
The other version has been deprecated and throws an exception when
targeting Android 14+.
2024-08-06 18:01:54 +02:00
Tobias Brunner
38160c5cb7 android: Explicitly mark receiver as not exported during registration 2024-08-06 18:01:54 +02:00
Tobias Brunner
9c4ceced1c android: Declare foreground service type for VpnService instance
Required for Android 14 (34).  Since no other type fits we use specialUse,
which also requires a new permission and a description for why we use it.
2024-08-06 18:01:54 +02:00
Tobias Brunner
4f2e65f3d0 android: Fix label for name field in managed profiles
The field is not actually optional.
2024-08-06 18:01:54 +02:00
Tobias Brunner
81041b55d2 android: Fix crash when opening list of apps for new profiles
Fixes: 150dc5ab6401 ("android: Make selected apps read-only")
2024-08-06 18:01:54 +02:00
Tobias Brunner
8a14c20ec7 android: Update dependencies 2024-08-06 18:01:54 +02:00
Tobias Brunner
7b78e35ff6 android: Update Gradle plugin 2024-08-06 18:01:54 +02:00
Matteo Carnelos
bed04baf21 init: Add Wants= dependencies to systemd units
If no other units have dependencies on network-online.target or
syslog.target they might not get initialized resulting in a possibly
non-ideal startup order.

Closes strongswan/strongswan#2279
2024-08-06 15:16:30 +02:00
Tobias Brunner
59a4c9c416 ike-auth: Default IDi/IDr to subject DN instead of IP if a certificate is available
This avoids sending a likely unconfirmed identity if no identity is
configured and received (in case of IDr).

Closes strongswan/strongswan#2353
2024-07-30 14:27:15 +02:00
Tobias Brunner
e9a7c9822d ike-sa: Assign function pointers for mediation extension separately
Using preprocessor directives in calls of function-like macros is
not recommended as it might lead to undefined behavior.
2024-07-30 10:29:36 +02:00
Tobias Brunner
72f9a21b22 Merge branch 'vici-reload-actions'
This improves the behavior when reloading or unloading connections that
have `start` included in their `start_actiton`.

Closes strongswan/strongswan#2324
2024-07-30 10:27:50 +02:00
Tobias Brunner
56b6eeb385 testing: Add ikev2/start-action-start scenario
This tests the behavior for configs with start_action=start during
reloads of the config (updates/removal).
2024-07-26 16:56:32 +02:00
Tobias Brunner
7bfaa9acb6 vici: Improve handling of start action when reloading configs
The previous code had some issues because it handled each child config
separately.  Not only was this quite inefficient because all IKE_SAs had
to be enumerated for every config, it also caused problems with the check
for other CHILD_SAs in order to decide whether to delete the IKE_SA or
not.  Because CHILD_SAs are deleted with an INFORMATIONAL exchange, they
are not immediately gone.  This caused a race condition and with more
than one child config and SAs the IKE_SA could be kept because it
could appear as if other, unrelated CHILD_SAs were still there.

Another race condition, which is fixed by the previous commit, occurred
when only changing child configs.  Then it could happen that the code
deemed the IKE_SA empty and a delete for it was queued.  If that happened
while the IKE_SA was deleting one of the CHILD_SAs (or was busy with some
other exchange), the IKE_SA was not switched to IKE_DELETING.  So it
looked usable and create-child tasks for the updated configs might have
gotten queued.  Unfortunately, once the ike-delete task is eventually
executed, these tasks would be gone and the replacement CHILD_SAs never
created.  This commit additionally avoids actually deleting the IKE_SA
even if all child configs change or get removed if any new CHILD_SAs are
to be initiated.
2024-07-26 16:40:57 +02:00
Tobias Brunner
da00a04f60 ike-sa-manager: Avoid initiating CHILD_SAs on IKE_SAs with queued DELETE
The IKE_SA might be busy with a different task while a request to
terminate it is getting queued, we don't want to use such an IKE_SA to
initiate new CHILD_SAs as these tasks will get lost once the IKE_SA is
terminated.
2024-07-26 11:34:44 +02:00
Tobias Brunner
07ce6b44c5 testing: Enable IPv6 guest-to-guest communication
Not sure what changed, but without this setting, ND packets would not
get through to other hosts connected to the same bridge.
2024-07-26 11:34:44 +02:00
Tobias Brunner
0602ed1043 unit-tests: Fix compiler warning with empty message assertion
The empty array of rules for `assert_message_empty()` and the resulting
size 0 triggers warnings like these:

  allocation of insufficient size '0' for type 'listener_message_rule_t' with size '12'

Using calloc() with `nmemb` set to 0 triggers the same warning.
2024-07-15 16:55:29 +02:00
Tobias Brunner
6eec5cc07d daemon: Use correct argument order for calloc() to fix compiler warning
The number of elements is the first argument, their size the second.
The previous code triggered the following warning:

  'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument
2024-07-12 14:00:15 +02:00
Tobias Brunner
574bfad1c0 backtrace: Fix compiler warning on Windows
This change avoids a "variable 'got' might be clobbered by 'longjmp' or
'vfork'" warning with -Wextra.
2024-07-12 11:48:03 +02:00
Tobias Brunner
d759bd9efa Use wolfSSL 5.7.2 for tests 2024-07-11 15:57:12 +02:00
Tobias Brunner
c4bce2b79b testing: Enable mgf1 plugin for scenarios where FreeRADIUS uses PSS signatures
Looks like a cipher suite without DHE was selected previously.

Could be a side-effect of dc1085734f34 ("testing: Remove unnecessary
FreeRADIUS dh_file option as recommended in the log").
2024-06-26 14:56:22 +02:00
Tobias Brunner
a9ced3ccb4 testing: Fix IP pool scenarios after changing base address
Fixes: 2b11764b705d ("mem-pool: Adjust the base address if it's the network ID")
2024-06-26 14:56:22 +02:00
Maxim Uvarov
dd256e730d testing: Enable error code checks for load-testconfig
Errors in load-testconfig are hidden due to not checking scp
return code and mute all errors. Add -e to trap script on
any errors in this script.

References strongswan/strongswan#2310

Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
2024-06-26 14:55:52 +02:00
Maxim Uvarov
d8c6fa3b9a testing: Enable sftp subsystem in default sshd_config
OpenSSH defaults have changed and scp stopped to work with newer versions.
There are 2 options to fix it, either use -O (legacy scp protocol)
with scp, or enable the sftp subsystem in the SSH server config.
This fix uses the second variant.

Closes strongswan/strongswan#2310

Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
2024-06-26 14:54:38 +02:00
Tobias Brunner
710973f0b0 cirrus: Use FreeBSD 13.3 and 14.1 2024-06-18 16:25:08 +02:00
Tobias Brunner
d02aea9c2c quick-mode: Get a reference when adopting the reqid of a rekeyed CHILD_SA 2024-06-17 14:58:47 +02:00
Tobias Brunner
2b11764b70 mem-pool: Adjust the base address if it's the network ID
Instead of just adding the offset internally, this way the reported
base address is always the first assignable address (e.g. for
192.168.0.0/24 vs. 192.168.0.1/24).

Closes strongswan/strongswan#2264
2024-06-17 14:55:43 +02:00
Tobias Brunner
1cbcf198ab testing: Make RADIUS server enforce client identity in certificate's CN 2024-06-17 14:47:11 +02:00
Tobias Brunner
dc1085734f testing: Remove unnecessary FreeRADIUS dh_file option as recommended in the log 2024-06-17 14:47:11 +02:00
Tobias Brunner
49cb7b016f charon-nm: Use a different routing table than the regular IKE daemon
If the regular daemon is running, it creates an unconditional routing
rule for the routing table.  The rule that charon-nm tries to create,
which excludes marked IKE/ESP traffic to avoid a routing loop, then
can't be installed and we'd end up with said loop.

Closes strongswan/strongswan#2230
2024-06-17 14:45:52 +02:00
Tobias Brunner
59587783ff cirrus: Explicitly install tpm2-tss-sys package on Alpine
The libraries were previously shipped with the -dev package.
2024-05-27 14:08:08 +02:00
Tobias Brunner
fc6556fd18 github: Use AWS-LC 1.28.0 for tests 2024-05-27 10:42:37 +02:00
Tobias Brunner
8e88d56206 x509: Encode challenge passwords as PrintableString if possible
As recommended by RFC 2985, section 5.4.1:

  ChallengePassword attribute values generated in accordance with this
  version of this document SHOULD use the PrintableString encoding
  whenever possible.  If internationalization issues make this
  impossible, the UTF8String alternative SHOULD be used.

Even though the RFC continues with

  PKCS #9-attribute processing systems MUST be able to recognize and
  process all string types in DirectoryString values.

there might be older SCEP server implementations that don't accept
UTF8String-encoded passwords.  In particular because previous versions of
PKCS#9 defined this attribute's type as a CHOICE between PrintableString
and T61String.

References strongswan/strongswan#1831
2024-05-17 14:04:20 +02:00
Tobias Brunner
f8c6ff1fc1 streams: Add ability to listen on any VSOCK CID
Can be useful if the CID inside the VM is not known.

The \htmlonly\endhtmlonly hack is used to avoid compiler warnings due
to /* inside a block comment.
2024-05-17 14:00:12 +02:00
Thomas Egerer
3d7d527ad9 streams: Add support for AF_VSOCK sockets on Linux
These allow, for instance, a vici client on a host to communicate with
an IKE daemon running in a VM.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2024-05-17 14:00:12 +02:00
Thomas Egerer
9228a5109b ike-cfg: Consider port information in IKE config match
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2024-05-17 13:53:00 +02:00
Tobias Brunner
287ef047a9 github: Use tpm2-tss 3.2.3 for tests 2024-04-29 16:10:39 +02:00
Tobias Brunner
059249bae7 configure: Enable counters plugin also if vici is enabled but stroke is disabled 2024-04-18 08:59:18 +02:00
Tobias Brunner
f8e6fd30de gitignore: Don't ignore proposal_keywords.c
If somebody copies our .gitignore and tries to import the source code,
the proposal_keywords.c file will not be added as it's ignored by the
`*keywords.c` pattern we use to ignore gperf-generated source files.

Closes strongswan/strongswan#2014
2024-04-15 18:29:42 +02:00
Tobias Brunner
5f99a28381 mem-pool: Reject the creation of unintentionally empty pools
If a base address is configured, we don't expect the pool to be empty,
so reject the creation (e.g. with the broadcast address as base).

References strongswan/strongswan#2205
2024-04-15 09:50:41 +02:00
Tobias Brunner
afeac365fd swanctl: Document possibility of non-zero base addresses for in-memory pools
References strongswan/strongswan#2205
2024-04-15 09:50:34 +02:00
Tobias Brunner
907079bd13 Use AWS-LC 1.24.0 for tests 2024-04-12 14:59:32 +02:00
Tobias Brunner
3a20170324 github: Don't search for coverage results
We explicitly pass the final .info file prepared with lcov, so there is
no need to search for other files (that then won't work anyway).  The
search also finds the uncleaned .info file, which includes the test code.

The latter should have gotten ignored anyway, but the patterns are
apparently not correct anymore. So fixing that as well just to be sure.
2024-04-04 15:00:13 +02:00
Tobias Brunner
75c5c5667d github: Update coverage data upload to Codecov
Since the script and action have issues with the directory structure, we
upload the lcov results instead.
2024-04-04 09:25:12 +02:00
Tobias Brunner
9c208c4e46 Merge branch 'openwrt-fixes'
Closes strongswan/strongswan#2185
2024-04-03 11:28:24 +02:00
Philip Prindeville
e5bc3a50f6 wolfssl: Avoid conflict with RNG when built without EdDSA or FIPS enabled
There are definitions of RNG in <wolfssl/wolfcrypt/settings.h> and
<wolfssl/wolfcrypt/random.h> that play havoc with the literal RNG being
used in the expansions of PLUGIN_*(RNG, ...) when ##-concatenated to
build the enum value FEATURE_RNG.

The #undef in wolfssl_cmmon.h only had an effect if wolfSSL was built
with EdDSA or FIPS enabled, otherwise, the headers that define RNG were
not pulled in before it.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2024-04-03 08:48:46 +02:00
Noel Kuntze
1b19053919 uci: Upstream patch to adapt to option datatype abstraction
This is a patch from the OpenWrt package sources necessary to adapt to
changes from 2008 that abstracted the option datatype (added a list
type).

Signed-off-by: Noel Kuntze <noel.kuntze@thermi.consulting>
Reviewed-by: Philip Prindeville <philipp@redfish-solutions.com>
2024-04-03 08:41:42 +02:00
Tobias Brunner
b73a476c1f cirrus: Add build on Alpine Linux with musl C library 2024-04-02 14:21:56 +02:00
Tobias Brunner
56f4b2096a sha3: Fix Keccak when compiled with GCC 13.x
With GCC 13, the compiler apparently applies new aliasing optimizations
when compiled with -O2 and without -fno-strict-aliasing.  This caused
the application of the second padding bit, where the state was accessed
via uint8_t[], to be moved before the loop that absorbs the buffer into
the state, where the state is accessed via uint64_t[], resulting in
incorrect output.  By only accessing the state via uint64_t[] here the
compiler won't reorder the instructions.
2024-04-02 14:19:40 +02:00
Tobias Brunner
ac713746c9 unit-tests: Adhere to TESTS_NO_IPV6 in HTTP fetcher test suite 2024-04-02 14:18:49 +02:00
Tobias Brunner
9ac6c469a5 bliss: Fix build with built-in printf-specifiers
This won't work for monolithic builds because the plugin and the
executable are built before libstrongswan.
2024-04-02 14:18:43 +02:00
Tobias Brunner
84166508f8 Use wolfSSL 5.7.0 for tests 2024-03-22 11:43:39 +01:00
Tobias Brunner
540881627f farp: Fix build with musl C library
Same issue as described in the previous commit.

Fixes: 187c72d1afdc ("dhcp: Port the plugin to FreeBSD/macOS")
2024-03-22 11:41:13 +01:00
Tobias Brunner
f5b1ca4ef6 pf-handler: Fix build with musl C library
musl's headers define a lot of networking structs.  For some, the
definition in the Linux UAPI headers is then suppressed by e.g.
__UAPI_DEF_ETHHDR.

Since we included musl's net/ethernet.h, which includes netinet/if_ether.h
that defines `struct ethhdr` (and the above constant), **after** we
include linux/if_ether.h, there was a compilation error because the
struct was defined multiple times.

However, simply moving that include doesn't fix the problem because for
ARP-specific structs the Linux headers don't provide __UAPI_DEF* checks.
So instead of directly including the linux/ headers, we include those
provided by the C library.  For glibc these usually just include the
Linux headers, but for musl this allows them to define the struct
directly.  We also need to move if.h and add packet.h, which define
other structs (or include headers that do so) that we use.

Fixes: 187c72d1afdc ("dhcp: Port the plugin to FreeBSD/macOS")
2024-03-22 11:40:15 +01:00
Thomas Egerer
f3c8e02c69 ike-sa-manager: Unlock mutex if allocating SPI fails to avoid lock contention
Fixes: 5d91d8c46937 ("Check rng return value when generating SPIs in ike_sa_manager_t")
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2024-03-20 13:18:57 +01:00
Andreas Steffen
dea8493f3a Version bump to 5.9.14 2024-03-19 11:56:44 +01:00
Tobias Brunner
470ead96ea github: Use AWS-LC 1.23.0 for tests 2024-03-18 09:00:38 +01:00
Wataru Ashihara
c3f8642e72 save-keys: Fix Wireshark algorithm identifier for 3DES
Wireshark has shown the following error dialogue because the identifier
was incorrect [1]:

Error loading table 'ESP SAs': esp_sa:18: invalid value: TripleDes-CBC [RFC2451]

[1] 3757f42e5f/epan/dissectors/packet-ipsec.c (L203)

Closes strongswan/strongswan#2013
2024-03-18 08:54:41 +01:00
Tobias Brunner
9acd90575a ike-cfg: Change how OCSP certificate requests are enabled
The previous option caused such requests to be enabled if not explicitly
disabled, which only the vici plugin did, for all other backends requests
would have been sent.

References strongswan/strongswan#2016
2024-03-15 15:38:19 +01:00
Tobias Brunner
cfc7be004d peer-cfg: Renumber ocsp_policy_t values so the same default applies for all backends
Only the vici plugin previously set OCSP_SEND_REPLY explicitly, all other
backends would have defaulted to OCSP_SEND_BOTH.

References strongswan/strongswan#2016
2024-03-15 15:37:50 +01:00
Tobias Brunner
a2ace8a6bb kernel-pfroute: Log ignored interfaces when listing known interfaces 2024-03-15 13:47:23 +01:00
Tobias Brunner
e9df6f5c3d kernel-netlink: Log ignored interfaces when listing known interfaces 2024-03-15 13:45:08 +01:00
Tobias Brunner
dad4624756 NEWS: Add news for 5.9.14 2024-03-14 17:33:56 +01:00
Tobias Brunner
b2f957f5f1 pkcs11: Fix cleanup when verifying signature fails because scheme isn't supported
Fixes: 49769fff53f3 ("pkcs11: Support RSA-PSS signatures")
2024-03-14 13:58:02 +01:00
Tobias Brunner
c035e4ca93 smp: Make code that encodes identities more readable
In particular for static code analyzers.  The previous nesting of case
statements inside of a while loop that's inside a switch statement and
a wrapping block with declaration was quite weird and Coverity didn't
like it (it figured that `type` was uninitialized even when it assumed
that get_type() returned a known type for which a case statement
existed).
2024-03-14 13:51:06 +01:00
Andreas Steffen
91f209b878 Version bump to 5.9.14rc1 2024-03-13 20:24:54 +01:00
Tobias Brunner
500207e35c systime-fix: Fix declaration of validator constructor 2024-03-13 16:50:46 +01:00
Tobias Brunner
6628c523c2 unit-tests: Point out if ECDSA public key was rejected after private keys was not
AWS-LC rejects public keys with explicitly encoded parameters but allows
private keys that use explicit encodings of the NIST curves.  Since the
more important aspect is that public keys are rejected, this addition to
the warning message points that out.

References strongswan/strongswan#1907
2024-03-13 16:47:20 +01:00
Andreas Steffen
6f8275abab testing: Added RFC4806 tests 2024-03-13 15:11:00 +01:00
Jean-François Hren
15612b3a42 Add support for IKEv2 OCSP extensions (RFC 4806)
Closes strongswan/strongswan#2016

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2024-03-13 15:10:50 +01:00
Tobias Brunner
ddd926b698 Merge branch 'name-constraints'
This refactors the name constraints validation in the revocation plugin
so it aligns with what's specified in RFC 5820.

It also expands the subnet/range matching for identities.

Closes strongswan/strongswan#2114
2024-03-13 15:05:14 +01:00
Tobias Brunner
b29be6029e constraints: Properly validate name constraints according to RFC 5280
The previous code was in a way too simple which resulted in it being too
strict.  For instance, it enforced that intermediate CA certificates
inherited the name constraints of their parents.  That's not required by
RFC 5280 and prevented e.g. adding constraints in an intermediate CA
certificate that's followed by another that doesn't contain any
name constraints.  That's perfectly fine as the set of constraints
specified by the parent continue to apply to that CA certificate and
the children it issues.

Name constraints were previously also applied to all identities of a
matching type, which is way too strict except for some very simple
cases.  It basically prevented multiple constraints of the same type
as e.g. an intermediate CA certificate that has permitted name constraints
for example.org and example.com couldn't issue acceptable certificates
because any SAN with one domain would get rejected by the other
constraint.  According to RFC 5280 matching one constraint is enough.

Also fixed is an issue with name constraints for IP addresses which were
previously only supported for a single level.
2024-03-12 09:14:44 +01:00
Tobias Brunner
ea6a6344d3 identification: Add support to match subnets/ranges against each other
Previously, it was only possible to match addresses against subnets and
ranges, but not the other way around or subnets and ranges against each
other.
2024-03-12 09:14:44 +01:00
Tobias Brunner
bb67838c53 configure: Load constraints plugin in pki
This allows --verify to check e.g. name constraints.
2024-03-08 11:16:48 +01:00
Gerardo Ravago
1301c762d4 github: Add AWS-LC CI job
AWS-LC is an OpenSSL derivative which can be used with the openssl plugin.
This adds a CI job that resembles the openssl-3 test case. It downloads
the source tarball for an AWS-LC release, builds that source using
CMake/Ninja, and then builds/tests strongSwan using the same technique
used by openssl-3.

References strongswan/strongswan#1907
Closes strongswan/strongswan#2151
2024-03-08 11:14:39 +01:00
Etay Bogner
fac42f7168 starter: Use correct type for uniqueids field
Enum arguments (ARG_ENUM with .list != LST_bool) are assumed to be of
type/size int in assign_args() in args.c.

Fixes: 0644ebd3de62 ("implemented IKE_SA uniqueness using ipsec.conf uniqueids paramater additionally supports a "keep" value to keep the old IKE_SA")

Closes strongswan/strongswan#2148
2024-03-07 15:08:00 +01:00
Gerardo Ravago
8237968c2c leak-detective: Add whitelist entries for AWS-LC
AWS-LC (and likely BoringSSL) uses thread specific data to store internal
library state which gets freed via a registered destructor when the thread
terminates. If this thread happens to be the main thread, which runs the
leak-detective evaluation, the detective won't observe the corresponding free
of the related memory and erroneously reports it as a leak.

The two places this happens are:
- `RAND_bytes` for storing internal RNG state.
- `ERR_put_error` for storing the per-thread OpenSSL error queue.

References strongswan/strongswan#1907
Closes strongswan/strongswan#2147
2024-03-07 15:06:40 +01:00
Gerardo Ravago
44e241fccc openssl: Handle BoringSSL-style ASN1_INTEGERs in cert serials
OpenSSL stores the serial number for an X509 certificate as an
`ASN1_INTEGER` type. Within BoringSSL (and AWS-LC), the library
represents the value of zero as an empty array [1] which is different
from OpenSSL which represents it as the 1-byte array [0x00]. Though the
value of zero for the certificate serial number is illegal under
X.509 [2], we need to handle/encode it consistently within strongSwan.
From 18082ce2b061 ("certificates: Retrieve serial numbers in canonical
form"), we infer that the canonical representation of the zero serial
is [0x00]. To do this, we introduce `openssl_asn1_int2chunk` to
complement the existing string version that allows us to handle the
special case for zero instead of always returning a reference to the
library-dependent encodings.

References strongswan/strongswan#1907
Closes strongswan/strongswan#2138

[1] bdc35b6361
[2] https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.2
2024-03-05 08:51:16 +01:00
Andreas Steffen
06afb5f109 cert-enroll: add init.d support to cert-install-sssd 2024-03-03 17:12:48 +01:00
Tobias Brunner
f994e0a428 utils: Define ignore_result() so it requires a semicolon
It previously also added its own empty statement.
2024-02-29 16:02:28 +01:00
Tobias Brunner
6dee8587f0 Remove obvious empty statements (i.e. stray semicolons) 2024-02-29 15:30:40 +01:00
Tobias Brunner
9d1f325a77 github: Update GitHub-provided actions for Node.js update 2024-02-29 09:06:59 +01:00
Tobias Brunner
a380dc4989 utils: Define DESTROY_*_IF() macros without terminating semicolon
This avoids double semicolons (i.e. empty statements) and is how
DESTROY_IF() is already defined.
2024-02-29 09:06:43 +01:00
Tobias Brunner
b21178b43c android: New release after adding fix for existing shortcuts/Intents 2024-02-26 11:14:14 +01:00
Tobias Brunner
45371da846 android: Add fallback for the old name of the profile ID extra
This fixes existing shortcuts and automation via Intents.

Fixes: 8e3b921abed7 ("android: Always use UUID to access profiles")
2024-02-26 11:01:55 +01:00
Tobias Brunner
1f5aa8017f Revert "kernel-netlink: Never use XFRMA_REPLAY_ESN_VAL to configure zero replay windows"
This reverts commit 8b9b11919d92e9738bb52901c9dbcc72e35b9fed.

Since ESN was negotiated via proposal, just configuring the SA without
ESN won't work as the ICV will be incorrect if the peer enabled ESN
on its SA.  While the Linux kernel currently doesn't support disabling
replay protection for SAs that use ESN, this at least gets users an
explicit error not just dropped packets, and it will automatically work
if the kernel supports this combination at some point.

References strongswan/strongswan#2117
2024-02-23 18:00:32 +01:00
Andreas Steffen
f566a85fcf Version bump to 5.9.14dr1 2024-02-22 15:51:24 +01:00
Tobias Brunner
b7fdc10a3c Use Botan 3.3.0 for tests 2024-02-22 13:49:46 +01:00
Tobias Brunner
4be75c5ab1 Merge branch 'android-managed-configurations'
This adds support for managed configurations via enterprise mobility
management (EMM) systems. Also changes details regarding the SQL data
source.
2024-02-22 13:37:01 +01:00
Tobias Brunner
7db629e4bc android: New release after adding support for managed configurations 2024-02-21 12:24:53 +01:00
Tobias Brunner
51a5d96b36 android: Add translations for managed configuration strings
Not actually translating anything, but making the linter happy.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
8c6b3019a7 android: Update managed certificates if config changes 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
b0ba845e27 android: Add manager for managed user certificates
This can be used to install, replace or delete currently installed user
certificates based on the app's current managed configuration.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
aa06d75491 android: Add manager for managed trusted certificates
This is used to install, replace or delete currently installed trusted
certificates based on the app's current managed configuration.

Certificates that are shared between multiple profiles are protected
and not uninstalled if a profile that uses it remains.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
9cb23f650a android: Add utility class to determine differences in two lists of objects
This allows determining the difference between two lists in the form of
inserts, updates and deletes (and unchanged elements).
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
97cb35afe5 android: Add repository for managed user certificates 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
99dfa8cb0e android: Add repository for managed trusted certificates 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
a04798a796 android: Add base repository for installed managed certificates 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
cd67c30fd1 android: Add installer for managed user certificates/keys
This installs the configured user certificate into Android's key store
using the DevicePolicyManager.

This is only accessible if the app is installed on an enrolled device and
has been granted the CERT_INSTALL delegate scope.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
fb302d967c android: Add installer for managed trusted certificates
This installs a configured CA or server certificate into the app's local
key store.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
e2f505350e android: Add database migration for managed certificates 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
6882f17741 android: Add trusted and user certificates to ManagedVpnProfile 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
9cbc03e84f android: Add entities for CA/server and user certificates 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
22bce57e4c android: Add utility that parses a PKCS#12 container and extracts a KeyPair 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
4ac9fc327e android: Add utility that converts a Base64 string to a X509Certificate 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
afcb56400e android: Add utility class that pairs a certificate with a private key 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
8a50651212 android: Add password for client certificate to managed config 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
9a917252e2 android: Provide global database helper instance 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
861ac0109a android: Extend database helper with table definition
This simplifies database migration.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
802047cae8 android: Move database helper into separate class
Reduce strong coupling between database helper and VPN profiles, to
prepare for the addition of other tables.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
42626c1dd8 android: Hide unmanaged profiles by default
Such profiles could exist if a user already had strongSwan installed.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
0af501ef26 android: Disable access to settings depending on managed configuration 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
fe13782e3c android: Hide menu items depending on managed configuration
Hide and disable menu items when disabled by the managed configuration.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
4bfeb3b000 android: Add data source for managed VPN profiles
Include the managed VPN profile data source in the profile source,
to show profiles from both sources in the UI.
2024-02-21 12:24:53 +01:00
Tobias Brunner
8f04d15dfd android: Expose static instance for Application object
While it seems to be possible to cast Context.getApplicationContext()
to the application class, there really is no documented reason why that
should actually be the same object.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
36f62585bb android: Expose managed configuration globally and notify listeners on changes
Triggers a broadcast if the configuration changed and updates the
profile list accordingly (previously only handled removal of multiple
profiles).

If the app resumes, the configuration is also loaded and listeners are
notified in case the config was updated while the app was in the
background.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
8796e9bb31 android: Add ManagedConfigurationService and related classes
Add service that provides access to managed configurations.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
c2007d5b09 android: Add managed_configuration.xml
Add managed configuration and associated English strings.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
01ea7b92bd android: Make VpnType#fromIdentifier null-safe 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
a5167a69e0 android: Add data source to VpnProfile 2024-02-21 12:24:53 +01:00
Markus Pfeiffer
5f9f279a33 android: Show warning message for read-only profiles in detail view
Show a message explaining that a managed profile can't be edited in
its detail view.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
c9c65a94c9 android: Add label to read-only profiles in list
Show "Managed profile" in the list of VPN profiles, to make it
immediately obvious that a profile is managed/read-only.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
d3f5c3a760 android: Disable copy/delete for read-only profiles
If a profile is marked as read-only, do not allow users to copy or
delete the profile.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
150dc5ab64 android: Make selected apps read-only
Also prevent users from changing selected apps in read-only VPN profiles.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
3391f7a465 android: Prevent editing of read-only profiles
Do not allow users to edit read-only VPN profiles, with the exception of
the profile's password.
2024-02-21 12:24:53 +01:00
Markus Pfeiffer
9618c83c03 android: Add read-only flag to VpnProfile 2024-02-21 12:24:52 +01:00
Markus Pfeiffer
8e3b921abe android: Always use UUID to access profiles
Use the UUID rather than the ID to ensure there are no conflicts between
profiles from the database and managed profiles.
2024-02-21 12:24:52 +01:00
Markus Pfeiffer
d629e1d358 android: Fix version number on port column
The onUpgrade method creates this column for database version 6. Update
the DbColumn definition to match that version number.
2024-02-21 12:24:52 +01:00
Markus Pfeiffer
7c8773dea5 android: Add interface for VPN data source
Change VPN profile source to an interface. Preparation to allow managed
configurations as a second source.
2024-02-21 12:24:52 +01:00
Markus Pfeiffer
b687f0c22f android: Use try-with-resources for IO 2024-02-21 12:24:52 +01:00
Markus Pfeiffer
73af77709a android: Remove unnecessary @TargetApi
The minSdkVersion is 21, remove unnecessary @TargetApi annotations.
2024-02-21 12:24:52 +01:00
Markus Pfeiffer
a3e895b4d8 android: Remove unnecessary API checks
The minSdkVersion is 21, remove unnecessary checks and code that target
older API versions.
2024-02-21 12:24:52 +01:00
Markus Pfeiffer
5d192246e8 android: Remove AndroidX legacy support 2024-02-21 12:24:52 +01:00
Markus Pfeiffer
ff6b6b5b49 Add ._.DS_Store to .gitignore 2024-02-21 12:24:52 +01:00
Andreas Steffen
ad08ced8b2 pki: Added key and cert handles to --ocsp command 2024-02-21 12:22:33 +01:00
Andreas Steffen
49769fff53 pkcs11: Support RSA-PSS signatures 2024-02-21 11:22:33 +01:00
Andreas Steffen
f739657aac pkcs11: Updated pkcs11.h header file based on OpenSC 2024-02-21 11:22:33 +01:00
Gerardo Ravago
e56b597af1 openssl: Condition out unsupported curves for AWS-LC
AWS-LC lacks support for a number of elliptic curve algorithms so this
adds some conditional macros to avoid registering the related plugin
features. Support for curves ed448 and x448 is completely absent and are
not planned for implementation as they are no longer recommended for use.
While ed25519 is supported by the library, a single missing API for
ASN.1 DER encoding of its private keys is missing which prevents its
use in strongSwan. Future work may remove this limitation, but for now
we will disable the functionality.

Closes strongswan/strongswan#2109
2024-02-21 08:42:48 +01:00
Gerardo Ravago
7f1ba3cc68 openssl: Add conditional macros around SHA_CTX for AWS-LC
AWS-LC is a BoringSSL-based libcrypto implementation. SHA_CTX is declared with
the hash data specified as an array rather than as a field in upstream OpenSSL.
Since AWS-LC builds against C99, we are unable to handle this with anonymous
unions like BoringSSL. The workaround I propose is to add these conditional
macros around the accessors within openssl_sha1_prf. After this change,
everything builds successfully with AWS-LC headers.

Closes strongswan/strongswan#2103
2024-02-19 10:01:51 +01:00
Tobias Brunner
a7493ab57d pf-handler: Always free the object even if no socket has been opened yet 2024-02-19 09:49:08 +01:00
Dan James
187c72d1af dhcp: Port the plugin to FreeBSD/macOS
This also refactors the BPF handling so it can be shared between the
dhcp and farp plugins.  The latter is adapted accordingly.

Closes strongswan/strongswan#2047

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2024-02-19 09:17:53 +01:00
Tobias Brunner
10a876d54c github: Use new property to pass token for sonarcloud
sonar.login is deprecated.
2024-02-16 14:50:16 +01:00
Tobias Brunner
b940ce25e9 Merge branch 'ref-overflows'
Different users in the strongSwan code base use the refcount helpers to
allocate incrementing unique values. So far the risk of overflows for
these unsigned 32-bit values has been considered mostly theoretical, as
it requires a longer uptime and a lot of activity to hit such an overflow.

At least for the Netlink sequence numbers, this is not only theoretical,
though, and an overflow has been hit on a productive setup. Unfortunately,
the consequences are rather unpleasant, as the response with a zero
sequence number can't be matched to the request. This results in the
offending thread to block indefinitely while holding the Netlink mutex.

So add a helper to allocate incrementing unique identifiers that checks
for overflows and never returns 0. Use it for Netlink sequence numbers
and some other potential users affected, namely those allocating
IKE_SA/CHILD_SA unique identifiers, marks and interface identifiers.

Closes strongswan/strongswan#2062
2024-02-16 14:06:17 +01:00
Martin Willi
1a740bf3f3 child-sa: Handle refcount overflow for unique mark/if_id allocation gracefully
The refcount_t for allocating unique marks and interface IDs may overflow or
hit the special value for unique marks/if_ids, in the worst case not setting it
on CHILD_SAs that should have one.

As (potentially two) marks/if_ids are allocated only for newly created CHILD_SAs,
but not for rekeying, this not very likely. Still, if a setup uses
aggressive re-authentication and or re-creates CHILD_SAs every minute,
a gateway with 100'000 tunnels may hit the overflow within a month uptime.
2024-02-16 14:04:17 +01:00
Martin Willi
dde40bcb9e child-sa: Move unique mark allocation to a separate helper function
This aligns the code with unique interface ID allocation, which uses a helper
function for the same purpose and mechanic as well.
2024-02-16 10:42:43 +01:00
Martin Willi
4aac88fadd child-sa: Handle CHILD_SA unique identifier refcount overflow gracefully
CHILD_SA unique identifier allocation starts at 1. If the counter overflows,
a unique ID of 0 is assigned to an CHILD_SA, which may have unclear
consequences.

Overflowing the unique ID counter is theoretical for most setups, but on
a Gateway terminating 100'000 tunnels and rekeying CHILD_SAs every 60s
overflows the counter after a month uptime. So avoid a 0 unique identifier
by using ref_get_nonzero().
2024-02-16 10:11:11 +01:00
Martin Willi
f634a3300c ike-sa: Handle IKE_SA unique identifier refcount overflow gracefully
IKE_SA unique identifier allocation starts at 1. If the counter overflows,
a unique ID of 0 is assigned to an IKE_SA, which may have unclear consequences.

Overflowing the unique ID counter is theoretical for most setups, but on
a Gateway terminating 100'000 tunnels and rekeying the IKE_SA every 60s
overflows the counter after a month uptime. So avoid a 0 unique identifier
by using ref_get_nonzero().
2024-02-16 10:11:11 +01:00
Martin Willi
cdf865e0b8 kernel-netlink: Handle Netlink sequence number counter overflows gracefully
A refcount variable is used to allocate sequential unique identifiers for
Netlink sequence numbers, subject to overflows. The risk of an overflow
has so far not been considered practical, as it requires 2^32 netlink
requests.

It seems that this issue is not only theoretical. A host with thousands
of tunnels doing aggressive rekeying and/or aggressive status checking
(via vici list-sas) may trigger the overflow after a few weeks uptime.

The consequences are rather devastating: Once the refcount overflows, a
Netlink request is sent with sequence number 0. This request is answered
by the kernel, but can't be matched to the request, resulting in the error:
"received unknown netlink seq 0, ignored". Without Netlink timeouts, the
thread indefinitely waits for a response while holding the Netlink mutex,
bringing all threads to a halt.

So at all costs avoid zero sequence numbers. Also, start at sequence number
1 instead of the arbitrary 201, so the same range is used on start and after
an overflow.
2024-02-16 10:11:11 +01:00
Martin Willi
0cd46df377 atomics: Add a ref_get() variant returning non-zero on overflows
This is useful for users using ref_get() for unique identifier allocation,
but the zero value has special meaning.
2024-02-16 10:11:11 +01:00
Gerardo Ravago
31f55ba6e9 openssl: Add missing error checking when encoding ED private key
This applies the same logic found in other private key implementations
like that for ECDSA.

Closes strongswan/strongswan#2097
2024-02-14 17:57:41 +01:00
Florian Bezannier
e6176bf19c auth-cfg: Improve log message for identity constraint mismatch error
Closes strongswan/strongswan#2088
2024-02-12 10:25:23 +01:00
Tobias Brunner
0d61efdf02 github: Use NDK version in build.gradle to build OpenSSL
Also fix the path to the sdkmanager (the old one was removed in the latest
images and the incorrect path caused a weird sudo error) and install
Java 17 as that's necessary for newer versions of the Gradle plugin.
2024-01-16 11:01:01 +01:00
Tobias Brunner
980491ebcd android: Replace PowerMock with mechanism provided by newer Mockito versions
PowerMock isn't maintained anymore and causes issues with newer Java
versions.  We only used it to mock static methods, which Mockito now
supports as well.  Instead of using the try-with-resources construct,
this uses a @Before and @After method so we don't have to change all the
test methods.
2024-01-16 11:00:29 +01:00
Tobias Brunner
1cab544c75 android: Update Gradle plugin and build scripts and dependencies
This also references the NDK via ndkVersion and replaces the custom
ndk-build tasks.  It also replaces the deprecated compileSdkVersion and
increases it because dependencies of updated dependencies require that.

targetSdkVersion is not yet updated because there might be some work
required for Android 14 compatibility.
2024-01-16 11:00:29 +01:00
Tobias Brunner
be832378db github: Also run tests on macOS 13
Uses a newer version of clang and doesn't seem to have the issue with
process_t.
2024-01-16 11:00:29 +01:00
Tobias Brunner
2b74b63691 github: Increase timeout for process_t tests
This seems to be necessary on macOS 12 for some reason (note that handling
timeouts in these test cases doesn't really work).
2024-01-16 11:00:29 +01:00
Tobias Brunner
798e25f313 github: Use newer gperf version on macOS
The gperf version that's already available on the system generates
function declarations with K&R syntax (separate arguments) for which newer
compilers produce a warning as C23 doesn't support that syntax anymore.
2024-01-16 11:00:29 +01:00
Tobias Brunner
fea02fb297 simaka-crypto: Fix constructor declaration
Prototype didn't match the implementation.
2024-01-16 11:00:29 +01:00
Tobias Brunner
cb139ce4b3 cirrus: Use FreeBSD 14.0
FreeBSD 12.4 has been removed.
2024-01-16 11:00:29 +01:00
Tobias Brunner
52d6189892 unit-tests: Use function pointers to test generic return_* helper functions
These functions are declared without arguments, passing arguments to them
causes warnings such as the following with newer compilers:

  passing arguments to 'return_null' without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]

We only use them via function pointers, which doesn't trigger any warnings
and hopefully continues to work.
2024-01-16 11:00:29 +01:00
Tobias Brunner
bf017a9d17 curl: Fix issue with printf checks in newer curl versions
Newer curl versions (as used on macOS via Homebrew) add attributes like

  __attribute__ ((format(printf, a, b)))

to their `curl_*printf*` functions, which fails if we redefine `printf`
as e.g. `builtin_printf` (pulled in via library.h).  We could disable
these checks via CURL_NO_FMT_CHECKS, but reordering the headers should
do the trick as well.
2024-01-16 11:00:29 +01:00
Tobias Brunner
67f0990530 Suppress compiler warnings with specific bison and compiler combinations
Bison generates code that only increases the yynerrs counter, it's never
read.  This causes a warning in newer compilers (in particular clang).
Newer versions of bison mark yynerrs with __attribute__((unused)), but
at least on FreeBSD 14 that's not yet available.
2024-01-16 11:00:29 +01:00
Tobias Brunner
22fc539edd leak-detective: Add implementation of malloc_usable_size()
systemd seems to use this and if we indirectly use libraries provided
by it, which can e.g. happen via getgrnam_r() and nss-systemd, this may
be called on pointers returned by leak detective's malloc(), which will
not point to the original start of the block and cause a segmentation
fault.

Closes strongswan/strongswan#2045
2024-01-16 10:59:59 +01:00
Tobias Brunner
f3578d3de8 Merge branch 'linux-strongswan'
Closes strongswan/strongswan#2026
2023-12-14 11:30:08 +01:00
Tobias Brunner
fff2996a22 ipsec: Remove mention of NETKEY stack 2023-12-14 11:27:25 +01:00
Tobias Brunner
7550463d51 Replace some other mentions of "Linux strongSwan" 2023-12-14 11:27:19 +01:00
Jose Luis Duran
454069e094 ipsec: strongSwan is not exclusive to Linux kernels
The project is now called "the strongSwan project" rather than "Linux
strongSwan" to better reflect this.
2023-12-09 18:42:27 +00:00
Andreas Steffen
c8ef91c786 Version bump to 5.9.13 2023-12-01 07:26:22 +01:00
Andreas Steffen
04794e703d Version bump to 5.9.13rc1 2023-11-25 17:16:59 +01:00
Tobias Brunner
b4a9058b61 Merge branch 'ocsp-fixes'
Fixes a regression with handling OCSP error responses and adds a new
option to specify the length of nonces in OCSP requests.  Also adds some
other improvements for OCSP handling and fuzzers for OCSP
requests/responses.

Closes strongswan/strongswan#2011
2023-11-24 17:44:45 +01:00
Tobias Brunner
9c4846cdbe x509: Make sure the status in OCSP responses has the correct length 2023-11-24 17:41:18 +01:00
Tobias Brunner
ebf5afcefa fuzz: Add fuzzing targets for OCSP requests/responses 2023-11-24 17:41:18 +01:00
Tobias Brunner
f3af1704d9 x509: Make length of nonces in OCSP requests configurable
Some servers might not support a length of 32 and return a malformed
request error. Lowering the value to the previous default of 16 could
help in that case.
2023-11-24 17:41:18 +01:00
Tobias Brunner
945be4ece5 pki: Generate internal error OCSP response if no signer certificate is found
That can happen if a request is sent to the wrong OCSP server.
2023-11-24 17:41:18 +01:00
Tobias Brunner
05a1f5b9c5 certificate-printer: Add some output for empty OCSP responses 2023-11-24 17:41:18 +01:00
Tobias Brunner
6d345b3dde revocation: Reject OCSP error responses
Otherwise, there is lengthy code that tries to validate such responses,
even though they don't contain any signatures.
2023-11-24 17:41:18 +01:00
Tobias Brunner
b3e66aca5c x509: Add getter for status of OCSP responses 2023-11-24 17:41:18 +01:00
Tobias Brunner
e7a58f46f9 x509: Correctly parse responderId as ASN.1 CHOICE in OCSP response
The two OPTs that were used previously allowed to omit it completely (hence
the fallback to ID_ANY), but that's invalid, so it's better to fail
parsing.
2023-11-24 17:41:18 +01:00
Tobias Brunner
585c40095a x509: Correctly handle missing responder ID when parsing OCSP response errors
The has_issuer() and issued_by() methods relied on it to be defined, so
if the OCSP response wasn't successful (i.e. OCSP status indicates an
error and no OCSP response is parsed), a null-pointer dereference was
caused if the caller checked if the OCSP response was issued by a
specific certificate.

That's a side-effect of the referenced commit.  Previously, error codes
caused the OCSP response to not get parsed successfully, which technically
wasn't correct as it's well formed and successfully parsed, it's just
indicating an error state.

Fixes: 00ab8d62c089 ("x509: Support generation of OCSP responses")
2023-11-24 17:41:18 +01:00
Andreas Steffen
da45cf9f38 cert-enroll: Set the environment variables needed by cert-install-ssl 2023-11-23 19:05:22 +01:00
Andreas Steffen
11dbc8e7f2 Version bumpt to 5.9.12 2023-11-20 12:10:34 +01:00
Tobias Brunner
46aa264430 NEWS: Add info about CVE-2023-41913 2023-11-17 17:24:35 +01:00
Tobias Brunner
96d7937189 charon-tkm: Validate DH public key to fix potential buffer overflow
Seems this was forgotten in the referenced commit and actually could lead
to a buffer overflow.  Since charon-tkm is untrusted this isn't that
much of an issue but could at least be easily exploited for a DoS attack
as DH public values are set when handling IKE_SA_INIT requests.

Fixes: 0356089d0f94 ("diffie-hellman: Verify public DH values in backends")
Fixes: CVE-2023-41913
2023-11-17 17:24:34 +01:00
Tobias Brunner
74ae71d2b8 x509: Ensure extensions are encoded even if others are missing
As with the previous commit, this is probably never an issue in practice
as most certificates contain at least one SAN.
2023-11-15 17:08:46 +01:00
Tobias Brunner
ba08e01b86 x509: Also encode extendedKeyUsage in cert requests if there are no SANs or certificate type
Probably never was an issue in practice as most certificates contain at
least one SAN.
2023-11-15 17:01:02 +01:00
Tobias Brunner
14cc5b845e pki: Mention --index in description 2023-11-15 15:16:51 +01:00
Tobias Brunner
0dbb6867d8 NEWS: Add news for 5.9.12 2023-11-15 14:14:49 +01:00
Tobias Brunner
724e64cac4 Move ocsp_responder_t interface as it's not a certificate 2023-11-14 10:35:47 +01:00
Tobias Brunner
14bd0bc743 Fixed some typos, courtesy of codespell 2023-11-14 10:11:16 +01:00
Andreas Steffen
02a4c8cfa9 Version bump to 5.9.12rc1 2023-11-14 08:12:00 +01:00
Andreas Steffen
6941dcb17a x509: Fix regression introduced by commit a22147a
Instead of the CA certificate's subjectKeyIdentifier erroneously
the CA's authorityKeyIdentifier was used as the authorityKeyIdentfier
of the certificate to be issued. This might work with a root CA
where the authorityKeyIdentifier equals its subjectKeyIdentfier
but introduces a severe regression when an intermediate CA is used.
2023-11-14 08:00:27 +01:00
Tobias Brunner
a1224b6c80 Merge branch 'ocsp-responder-index'
Adds support for multiple OCSP responders in `pki --ocsp` and one that
is based on OpenSSL-style index.txt files.  The parser for these files
also accepts simplified files that only specify the status, serial number
and optional revocation date/reason.  The OCSP test scenarios are also
updated to use this OCSP responder including one that shows the multi-CA
capabilities of the --ocsp command and the --index option.
2023-11-13 12:55:49 +01:00
Tobias Brunner
801c6c32e5 testing: Use a single OCSP responder for ikev2-multi-ca/ocsp-signers scenario
This demonstrates the multi-CA capabilities of the pki --ocsp command.
2023-11-13 12:50:47 +01:00
Tobias Brunner
c10a13589e testing: Use pki --ocsp as OCSP responder
The only exception is the ikev2/ocsp-no-signer-cert scenario as the
pki command won't sign an OCSP response with a certificate that isn't
the CA certificate or marked as an OCSP signer.
2023-11-13 12:50:47 +01:00
Tobias Brunner
5764e1e506 pki: Pre-process common arguments
This way the position of --debug doesn't matter for it to apply to the
parsing of all command-specific arguments.
2023-11-13 12:50:47 +01:00
Tobias Brunner
95c7d49954 pki: Add option to load certificate status information from index.txt
Each index.txt is associated with the most recently loaded CA
certificate.
2023-11-13 12:50:47 +01:00
Tobias Brunner
f26ca67d8c pki: Add index.txt-based OCSP responder 2023-11-13 12:50:47 +01:00
Tobias Brunner
1e8a72e7a0 chunk: Add helper to hash chunks via pointer 2023-11-13 12:50:47 +01:00
Tobias Brunner
3e42b2f5cb pki: Drop legacy registration for OCSP responders 2023-11-13 12:50:45 +01:00
Tobias Brunner
efac611566 openxpki: Register as OCSP responder 2023-11-13 12:50:24 +01:00
Tobias Brunner
515cecfe3e pki: Use OCSP responder manager for --ocsp --respond 2023-11-13 12:50:22 +01:00
Tobias Brunner
dab7c893a6 library: Add manager for OCSP responders
Registered OCSP responders should return VALIDATION_SKIPPED for issuer
certificates they are not responsible for. However, VALIDATION_FAILED is
currently treated the same way, so that's fine as well.
2023-11-13 12:45:54 +01:00
Tobias Brunner
3197523bd5 Merge branch 'ocsp-responder'
Implements a new --ocsp command for the pki tool that can produce OCSP
responses based on information provided by a plugin.  A first plugin
that accesses the OpenXPKI database is also added.

Closes strongswan/strongswan#1958
2023-11-13 12:42:00 +01:00
Andreas Steffen
821d7784a3 man: Extended pki man page and added pki --ocsp man page 2023-11-13 12:40:58 +01:00
Andreas Steffen
a0c9f9b842 pki: Added ocsp command
The pki --ocsp command implements an OCSP responder.
2023-11-13 12:40:58 +01:00
Andreas Steffen
ec325b4c09 pki: Added ocsp-req and ocsp-rsp types to pki --print 2023-11-13 12:40:58 +01:00
Andreas Steffen
a0f672d3d1 unit-tests: Update test_serial_gen suite 2023-11-13 12:40:55 +01:00
Andreas Steffen
00ab8d62c0 x509: Support generation of OCSP responses 2023-11-13 12:40:55 +01:00
Andreas Steffen
aa0fe149d6 certificates: Added ocsp_single_response object 2023-11-13 12:40:55 +01:00
Andreas Steffen
199c7083e1 openxpki: OCSP responder plugin accessing OpenXPKI
The openxpki plugin directly access the certificates table in
the OpenXPKI's MariaDB in order to retrieve the status of an
issued X.509 certificate based on its serial number.
2023-11-13 12:40:55 +01:00
Andreas Steffen
24d45de633 crl-reason: Fixed typo 2023-11-13 12:40:52 +01:00
Andreas Steffen
d72d0c0dfa utils: Added chunk_to_dec() function 2023-11-13 12:39:10 +01:00
Andreas Steffen
9381559754 x509: Support parsing of OCSP requests 2023-11-13 12:39:10 +01:00
Andreas Steffen
09e2a9ff50 pki --pkcs7: Set default to res = 1 2023-11-13 12:39:10 +01:00
Tobias Brunner
3cb8434367 kernel-netlink: Don't add replay state twice when updating SAs
The kernel includes the XFRMA_REPLAY_ESN_VAL attribute when dumping
SAs since it was added with 2.6.39.  So we basically added this attribute
twice to the message sent to the kernel, potentially exceeding the
message buffer if the window size is large.

The XFRMA_REPLAY_VAL attribute is only dumped since 3.19, so that might
still be relevant (Google seems to maintain a 3.18 kernel) and since we
have to query the current lifetime stats anyway, we can just avoid adding
this attribute twice.

Closes strongswan/strongswan#1967
2023-11-13 12:36:57 +01:00
Tobias Brunner
b345eb3051 Merge branch 'uri-san'
Adds support to encode SANs of type uniformResourceIdentifier in
certificates.  They currently don't have any use in strongSwan, but
might be required for other applications.

Closes strongswan/strongswan#1983
2023-11-13 12:34:32 +01:00
Tobias Brunner
9c2ca27b62 identification: Support explicit uri: prefix for SANs of type uniformResourceIdentifier 2023-11-13 12:33:39 +01:00
Tobias Brunner
500cacf6d8 x509: Add support to encode SANs of type uniformResourceIdentifier 2023-11-13 12:33:39 +01:00
Tobias Brunner
a22147a1b2 x509: Use issuer certificate's subjectKeyIdentifier if available
Instead of just generating an authorityKeyIdentifier based on the
issuer's public key, this allows CA certificates to be issued by a
different tool that doesn't use a SHA-1 hash of the subjectPublicKey
for the subjectKeyIdentifier.

Closes strongswan/strongswan#1992
References strongswan/strongswan#1975
2023-11-13 12:32:32 +01:00
Tobias Brunner
1a1dcf93a5 Merge branch 'pkcs12-no-pw'
This adds support for password-less PKCS#12 containers and PKCS#8 files.

A new option for charon-cmd also allows loading private keys of any
type (previously only RSA keys were supported).

References strongswan/strongswan#1955
2023-11-13 12:27:31 +01:00
Tobias Brunner
8581a19dd7 charon-cmd: Add support for key types other than RSA 2023-11-13 12:26:07 +01:00
Tobias Brunner
799511d90f pkcs12: Add support for PKCS#12 containers with empty or no password 2023-11-13 12:26:07 +01:00
Tobias Brunner
bdd8f14354 pkcs7: Add supported for unprotected PKCS#7 encrypted-data 2023-11-13 12:26:07 +01:00
Tobias Brunner
dc704cf206 pkcs8: Add support for unprotected PKCS#8 containers 2023-11-13 12:26:07 +01:00
Tobias Brunner
ad804fa036 pkcs12: Treat empty string and no password differently
When deriving the PKCS#12 key, the empty string should result in a
non-zero length Unicode string (two bytes for the 0 terminator).
2023-11-13 12:26:07 +01:00
Tobias Brunner
7bb6aed5ab openssl: Add support for unprotected PKCS#12 containers 2023-11-13 12:26:07 +01:00
Tobias Brunner
bae841ea04 Merge branch 'x509-ipaddress-constraints'
Adds support for nameConstraints of type iPAddress, which represent a
subnet, to the x509, openssl and constraints plugins.  SANs of type
iPAddress are matched against such constraints.

Closes strongswan/strongswan#1991
2023-11-13 12:24:31 +01:00
Tobias Brunner
1589f2d9ae constraints: Add support for IP address nameConstraints 2023-11-13 12:23:33 +01:00
Tobias Brunner
1c3096fe50 openssl: Add support for IP address nameConstraints 2023-11-13 12:23:33 +01:00
Tobias Brunner
ede96fe3db x509: Add support for IP address nameConstraints
According to RFC 5280, section 4.2.1.10, these are encoded as address
followed by a network mask of the same length.
2023-11-13 12:23:33 +01:00
Tobias Brunner
f781b9d326 openssl: Add support for nameConstraints X.509 extension
Closes strongswan/strongswan#1990
2023-11-13 12:23:02 +01:00
Tobias Brunner
ed2d548fee Merge branch 'reqid-refcount'
This fixes issues with CHILD_SAs getting reestablished concurrently.
We intend to reuse the reqid of the previous CHILD_SA, however, previously
the reqids were released and up for reassignment to any other CHILD_SA
or trap policy.  This could cause the reqid to get associated with
completely different traffic selectors, as the reestablished CHILD_SA
would eventually get the requested reqid because the traffic selectors
explicitly don't have to match (to allow narrowing for CHILD_SAs based
on trap policies).

Closes strongswan/strongswan#1855
2023-11-13 12:02:25 +01:00
Tobias Brunner
00d054aae5 ikev2: Correctly maintain allocated reqid during make-before-break reauth 2023-11-13 12:02:11 +01:00
Tobias Brunner
04bfe83f71 trap-manager: Maintain allocated reqids when handling acquires 2023-11-13 12:02:11 +01:00
Tobias Brunner
f9a9188a36 quick-delete: Correctly maintain allocated reqid when recreating CHILD_SA 2023-11-13 12:02:11 +01:00
Tobias Brunner
c923022733 child-delete: Correctly maintain allocated reqid when recreating CHILD_SA
The old CHILD_SA is destroyed even before the new task is queued, this
makes sure we always maintain a reference to the reqid.
2023-11-13 12:02:11 +01:00
Tobias Brunner
c2a4c8e38a ike-sa: Correctly maintain allocated reqid when recreating CHILD_SA
Maintaining the reqid when recreating a CHILD_SA from scratch night not
strictly be necessary as we usually don't have to replace any temporary
states in the kernel.  However, there could be concurrent acquires that
might actually make it necessary (we use the reqid to keep track of
acquires and it's also part of the duplicate check).
2023-11-13 12:02:11 +01:00
Tobias Brunner
f2bc526dbb ikev1: Only set reqid on rekeyed CHILD_SA if it was allocated dynamically 2023-11-13 12:02:11 +01:00
Tobias Brunner
bc39a3aecb child-rekey: Only set reqid on new CHILD_SA if it was allocated dynamically
Keeping a reference ensures that if the old SA expires before the new
one is installed, the previous reqid isn't reallocated to a concurrently
established CHILD_SA with different selectors.
2023-11-13 12:02:11 +01:00
Tobias Brunner
4ea739baf4 quick-mode: Maintain reference to reqid while CHILD_SA is established 2023-11-13 12:02:11 +01:00
Tobias Brunner
4bfd93b8db child-create: Maintain reference to reqid while CHILD_SA is established 2023-11-13 12:02:11 +01:00
Tobias Brunner
ff269f7f1f child-sa: Add method that returns a reference to an allocated reqid 2023-11-13 12:02:11 +01:00
Tobias Brunner
13771206d4 child-sa: Keep a reference to the previous reqid
The reference is kept until the reqid is either confirmed (i.e.
re-allocated) or replaced by a different reqid, which happens only once
we know the final traffic selectors, or the SA is destroyed without
installing it.
2023-11-13 12:02:11 +01:00
Tobias Brunner
e623f5792b kernel-interface: Add method to increase refcount for allocated reqid 2023-11-13 12:02:11 +01:00
Tobias Brunner
02180ae2ff kernel-interface: Remove unnecessary parameters for release_reqid()
These are not included in the initial lookup anymore. Also simplified
the implementation as we always add the same entry to the two hash
tables.
2023-11-13 12:02:11 +01:00
Tobias Brunner
90cf0078e1 kernel-interface: Use reqid as sole key in hash table
Every reqid is allocated once, we don't store the same reqid with e.g.
different marks or interface IDs that would make it necessary to make
them part of the key in that table (that's different in the other table).

To preserve the current behavior, that is, allocating a new reqid if e.g.
the marks are different, the additional selector values (which will
result in an additional policy in the Linux kernel) are compared after
the initial lookup.
2023-11-13 12:02:11 +01:00
Tobias Brunner
04c17ab56a credential-manager: Add option to reject trusted end-entity certificates
This allows preventing peers from authenticating with certificates
that are locally trusted, in particular, our own local certificate (which
safeguards against accidental reuse of certificates on multiple peers).

On the other hand, if this option is enabled, end-entity certificates
for peers can't be configured anymore explicitly (e.g. via remote.certs
in swanctl.conf).
2023-11-13 12:01:41 +01:00
Andreas Steffen
28ccdff692 cert-enroll: Preventing some errors that might occur 2023-11-13 11:57:51 +01:00
Andreas Steffen
f328ef0e04 cert-enroll: Install TLS client/server credentials
Install the generated key, host certificate and associated CA certificates
as credentials for a TLS-protected client-server connection.
2023-11-13 11:57:51 +01:00
Tobias Brunner
b5e4bf4b6c tls-server: Also change DH group when selecting a different EC curve
If we initially selected a group the peer doesn't support (e.g. because
curve25519 is the first ECDH group provided by plugins), then found
a supported curve, we previously still instantiated a DH object for the
original group and might have formatted the parameters incorrectly.
2023-11-06 11:00:51 +01:00
Tobias Brunner
595fa077b6 ike-sa: Fix handling of redirects during IKE_AUTH
Since the referenced commit, the state switch to IKE_ESTABLISHED doesn't
happen immediately after completing the authentication but only after
the remaining tasks have finished.  Due to that redirects during IKE_AUTH
were treated like those during IKE_SA_INIT causing the IKE_SA and task
manager to get reset.  However, unlike the ike-init task, the ike-auth
task returned SUCCESS and, therefore, got destroyed, while a different
task was removed from the array that was modified during the reset.
This later caused a dereference of the freed ike-auth task and a crash.

Fixes: 5ce1c91b58a2 ("ikev2: Trigger ike_updown() event after all IKE-specific tasks ran")
2023-11-06 10:41:57 +01:00
Tobias Brunner
46c012b664 github: Use latest Sonar scanner 2023-11-03 09:28:51 +01:00
Tobias Brunner
eda91911fa Use wolfSSL 5.6.4 for tests 2023-11-03 09:28:51 +01:00
Andreas Steffen
51872a0a0c Version bump to 5.9.12dr2 2023-10-30 22:42:55 +01:00
Andreas Steffen
d6bfdf2b2b cert-enroll: Pack all source files into EXTRA_DIST 2023-10-26 15:15:37 +02:00
Tobias Brunner
b576024387 Merge branch 'reject-explicit-ecdsa'
There is a relatively recent NIAP requirement to reject certificates with
ECDSA keys that explicitly encode the curve parameters (TD0527, Test 8b).

Since explicit encoding is pretty rare (if used at all and e.g. wolfSSL
already rejects it, by default), we should follow that requirement and
just reject such keys/certificates completely.

This currently can be enforced in all crypto plugins except when using
older versions of OpenSSL (< 1.1.1h) and Botan (< 3.2.0).

Closes strongswan/strongswan#1949
References strongswan/strongswan#1796
2023-10-13 09:12:02 +02:00
Tobias Brunner
bb14a28671 unit-tests: Add a test case for explicit ECDSA parameters
Currently only warns about it as older OpenSSL versions (AppVeyor)
don't reject them.
2023-10-13 09:10:46 +02:00
Tobias Brunner
578b561a22 Use Botan 3.2.0 for tests
This includes a change that allows checking EC keys for explicit
param encoding.
2023-10-13 09:10:46 +02:00
Tobias Brunner
0b989c7b20 botan: Reject EC keys with explicitly encoded parameters
This requires a function that will be added in the upcoming Botan 3.2
release.
2023-10-13 09:10:46 +02:00
Tobias Brunner
2bccdefc2c openssl: Reject EC keys with explicitly encoded parameters
EC_KEY_decoded_from_explicit_params() was added with 1.1.1h but has been
deprecated with 3.0.
2023-10-13 09:10:46 +02:00
Tobias Brunner
a69184fb9d wolfssl: Reject EC keys with explicitly encoded parameters
These are not allowed in X.509 certificates according to RFC 5480 and
some newer validations apparently explicitly check for this.

Note that WolfSSL rejects such keys, by default.  Only when compiled with
WOLFSSL_NO_ASN_STRICT are they accepted.
2023-10-13 09:10:46 +02:00
Andreas Steffen
6f0cd19fd6 cert-enroll: Fixed path in cert-install-openxpki 2023-10-12 08:14:38 +02:00
Tobias Brunner
b56c264041 cirrus: Use FreeBSD 12.4
FreeBSD 12.3 is officially EOL.
2023-10-09 15:22:41 +02:00
Tobias Brunner
7e2e463285 cirrus: Use FreeBSD 13.2
This should fix an error thrown by bison:

 ld-elf.so.1: /lib/libc.so.7: version FBSD_1.7 required by /usr/local/bin/bison not found
2023-10-09 15:22:41 +02:00
Andreas Steffen
7dfb88ead2 Version bump to 5.9.12dr2 2023-10-04 08:15:54 +02:00
Andreas Steffen
cbfc12b330 cert-enroll: certificate checking and enrollment
The cert-enroll script handles the initial enrollment of an X.509
host certificate with a PKI server via the EST or SCEP protocols.

Run as a systemd timer or via a crontab entry the script daily
checks the expiration date of the host certificate. When a given
deadline is reached, the host certificate is automatically renewed
via EST or SCEP re-enrollment based on the possession of the old
private key and the matching certificate.
2023-10-03 08:45:22 +02:00
Tobias Brunner
80e27fe9fd ike-sa: Destroy CHILD_SAs in order
This works around an issue that occurs when recreating an IKE_SA with
multiple CHILD_SAs that use dynamically allocated reqids.

We currently try to preserve the reqid when reestablishing, so the
create-child task gets the reqid of the previous CHILD_SA and will try
to reallocate that once the CHILD_SA is installed.  Before that, the old
CHILD_SA is destroyed and the reqid is released and added to the array
of reqids to get reused.  However, because of the reverse order used here,
the first reqid in the array is the one of the last CHILD_SA.

So it can happen that a newly created CHILD_SA gets a reqid reassigned
that a later CHILD_SA will then also claim for itself and get assigned
because an entry with that reqid exists.  So multiple CHILD_SAs with
different traffic selectors could then share the same reqid.

References strongswan/strongswan#1855
2023-09-28 09:41:53 +02:00
Boi Sletterink
190d8cbe19 libipsec: Also install routes without preferred source to forward traffic
Fixes a problem installing policies with source traffic selectors that do
not contain/match any of the local addresses.

When installing a route for a source TS that does contain one or more
local addresses, a preferred source address should be set in the route
(analogous to the `src` option in `ip route add`). This address is used
when the host itself sends traffic via that route (in contrast to
forwarding it).

When the source TS does not encompass any of the local addresses, the
host is not allowed to send traffic via this route and does not need to
set the preferred source address. However, the code would just return a
failure because it could not find a matching local address. This commit
changes this so routes without preferred source IP are installed to
allow non-local traffic to get forwarded via TUN device.

Closes strongswan/strongswan#1766
2023-09-04 16:54:37 +02:00
Antony Antony
cdc34ddea2 configure: Fix in6_pktinfo auto detection
This commit fixes auto detection of in6_pktinfo.
When negotiating an IPv6 IKE session charon reported an error

"Jun 30 16:42:49 03[NET] error reading IP header"

The cause of error was missing in6_pktinfo declaration, which is
auto detected. This auto detection may fail with an error depending
on compiler flags:

configure:19850: checking for in6_pktinfo
configure:19870: gcc -c -g -O0 -Wall -Wno-format -Wno-format-security
-Wno-pointer-sign -Werror -Wfatal-errors -Wno-error=stringop-truncation
conftest.c >&5
conftest.c: In function 'main':
conftest.c:73:11: error: 'pi.ipi6_ifindex' is used uninitialized in this
function [-Werror=uninitialized]
   73 |     if (pi.ipi6_ifindex)
      |         ~~^~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: all warnings being treated as errors

Signed-off-by: Antony Antony <antony.antony@secunet.com>
2023-09-04 14:31:19 +02:00
Tobias Brunner
0bff5c98bc vici: Fix connecting to socket in Python bindings on Windows
socket.connect() takes a single argument with the address that depends
on the address family, for TCP it's a tuple with IP and port.

Fixes: 00a75e332f29 ("vici: Create default TCP socket on Windows in Python bindings")
Closes strongswan/strongswan#1874
2023-08-31 11:39:52 +02:00
Tobias Brunner
e2bba1e2cf android: New release after updating target SDK to 33 2023-08-29 18:35:57 +02:00
Tobias Brunner
dfbafffc45 android: Increase compile-/targetSdkVersion to 33 (Android 13) 2023-08-29 18:03:30 +02:00
Tobias Brunner
ddf84c165d android: Request permission to display notifications on Android 13
Note that displaying the notification for the background service is
apparently not strictly necessary.  So it's fine if the user wants to
hide it.  That the service is running can still be seen in the task
manager (pull down the status drawer twice, there is a bullet with a number
at the bottom if the service is running).

Simply use the system dialog.  If the user denies it twice, it won't show
up again.  The explanation dialog would not show up the first time (i.e.
shouldShowRequestPermissionRationale() returns false), only once the user
denied the permission once.  Currently seems like a bit much work
as we don't need the user to allow notifications.
2023-08-29 18:03:30 +02:00
Tobias Brunner
3839bcfe87 android: Compile OpenSSL with hardware acceleration 2023-08-29 18:03:30 +02:00
Tobias Brunner
6d87a86510 android: Use new sockets to determine source IP
Particularly on Samsung devices, the connect() call to dissolve the
previous connection on an existing socket via AF_UNSPEC does fail in
some situations with ECONNREFUSED:

  [KNL] failed to disconnect socket: Connection refused

While creating a new socket is potentially a bit more overhead, this
should avoid the issue.

Closes strongswan/strongswan#1691
2023-08-29 18:03:30 +02:00
Tobias Brunner
5005c2e4ab testing: Use pip from venv to download dependencies
pip3 isn't installed in the base image anymore since 21bf3e41f94a
("testing: Use venv for strongTNC").
2023-08-28 17:49:26 +02:00
Tobias Brunner
a619356b5f kernel-pfroute: Maintain virtual flag when repopulating interface addrs
When adding a virtual IP on a TUN interface, the interface might get
activated (in terms of receiving the event) after we've already set the
virtual flag for the added address.  As the activation repopulates the
addresses on the interface, this cleared the flag and the address would
no longer be treated as virtual IP when installing routes for CHILD_SAs
that reference it in their local traffic selectors.

Closes strongswan/strongswan#1807
2023-07-27 08:21:26 +02:00
Tobias Brunner
006839b06a Merge branch 'netlink-buf'
Fixes an infinite loop if e.g. Netlink event sockets get too many
packets queued and poll() just returns POLLERR for the socket.  Also
increases the default receive buffer size for Netlink sockets to better
support systems with lots of route updates.

Closes strongswan/strongswan#1757
2023-07-26 15:16:57 +02:00
Tobias Brunner
ba9228ab00 watcher: Change handling of POLLERR and remove WATCHER_EXCEPT
We can't actually explicitly listen for errors by passing POLLERR in
`events` (the man page for poll() clearly states it's ignored).  On the
other hand, POLLERR can be returned for any FD and, even worse, it might
be the only event indicated.

The latter caused an infinite loop as we didn't notify the callback nor
clear the error by calling `getsockopt(..., SOL_SOCKET, SO_ERROR, ...)`.
And while the latter would be able to reset the state to break the loop,
it seems to leave the FD in a defunct state where no further events will
be returned by poll().  Notifying the callback works better (the error
is then reported by e.g. recvfrom()) and automatically happened already
if POLLERR was returned together with e.g. POLLIN.

So we now treat POLLERR like the other error indicators we handle (POLLHUP
and POLLINVAL) and just notify the callbacks.
2023-07-26 15:14:50 +02:00
Tobias Brunner
5971fc36c9 kernel-netlink: Also set the receive buffer size on event sockets
This was weirdly overlooked and could cause issues e.g. on hosts with
lots of route changes.
2023-07-26 15:14:50 +02:00
Tobias Brunner
714c939018 kernel-netlink: Increase the default receive buffer size
Also simplify how we try to exceed the system-wide maximum.  We basically
just try to force the value and simply fall back to the regular call.
The kernel actually won't let the latter fail if the value is too big,
it just caps it at the internal maximum.
2023-07-26 15:14:50 +02:00
Tobias Brunner
0b47357091 ike: Fix untracking IKE_SA_INITs with non-zero MIDs and SPIs as half-open SAs
We track all IKE_SA_INIT requests as half-open IKE_SAs but didn't
correctly untrack them if their message ID or responder SPI was non-zero.

References strongswan/strongswan#1775

Fixes: b866ee88bf54 ("ike: Track unprocessed initial IKE messages like half-open IKE_SAs")
2023-07-26 15:13:43 +02:00
Tobias Brunner
849c2c9707 child-rekey: Correctly encode protocol/SPI in CHILD_SA_NOT_FOUND notify
As specified in RFC 7296, section 2.25:

   The SA that the initiator attempted to rekey is indicated by the SPI
   field in the Notify payload, which is copied from the SPI field in
   the REKEY_SA notification.

So we copy that and the protocol verbatim.
2023-07-26 15:09:49 +02:00
Tobias Brunner
10a3c44a41 notify-payload: Add methods to simplify encoding and retrieving IKE SPIs
The get_spi_data() method is currently not used, so that has been
simplified so it can be used for any protocol type and any SPI length.
Same for set_spi_data(), which is currently used for IKEv1 to encode
two SPIs.
2023-07-26 15:09:49 +02:00
Tobias Brunner
e0e99c1dd3 sha3: Make sure to wipe the internal Keccak state 2023-07-26 15:08:33 +02:00
Tobias Brunner
b7d7a6be3a pki: Make sure to wipe decrypted PKCS#7 data 2023-07-26 15:08:33 +02:00
Tobias Brunner
bbbd15dd5c pkcs12: Make sure to wipe potentially decrypted PKCS#7 data 2023-07-26 15:08:33 +02:00
Tobias Brunner
b4694aef49 pkcs7: Make sure to wipe decrypted content 2023-07-26 15:08:33 +02:00
Tobias Brunner
ad8484a6cc aesni: Make sure to wipe salt 2023-07-26 15:08:33 +02:00
Tobias Brunner
9bda4a4415 ccm: Make sure to wipe salt 2023-07-26 15:08:33 +02:00
Tobias Brunner
0abb37b830 gcm: Make sure to wipe salt and H 2023-07-26 15:08:33 +02:00
Tobias Brunner
e8f8d32494 charon-nm: Use configured interface name if available
If connection.interface-name is configured, we use that instead of the
randomly generated name.

References strongswan/strongswan#1747
2023-07-26 15:07:36 +02:00
Tobias Brunner
27a7537d10 charon-nm: Also log basic connection details 2023-07-26 15:07:22 +02:00
Tobias Brunner
69e0c1161d charon-nm: Actually use the created XFRM interface
The created XFRM interface was not actually used (no interface IDs on the
SAs, no routes via interface).  It was basically treated like the dummy
TUN device.  To actually install the routes via XFRM interface, we have
to create it before we install the SAs and policies, signal_ip_config()
happens too late.  We also have to mark the ESP packets the same as IKE
the packets to avoid a routing loop if the server's IP is included in
the remote traffic selector (in particular if it's 0.0.0.0/0 or ::/0).

Fixes: 58f278f93239 ("charon-nm: Use an XFRM interface if available")
2023-07-26 15:07:22 +02:00
Tobias Brunner
36b1a6d76c Use Botan 3.1.1 for tests
The all-zero Ed25519 public key is rejected by botan_pubkey_check_key()
when the key is loaded.

Note that Botan 3 requires GCC 11 or CLANG 14, i.e. can't easily be built
on Debian bullseye or Ubuntu 20.04.

The thread-local storage function gets flagged via various botan FFI
functions when using Botan 3, whitelist that instead of all of them.
2023-07-26 13:09:22 +02:00
Tobias Brunner
1762040ef8 Merge branch 'testing-bookworm'
Use Debian bookworm as base image for testing.
2023-07-26 13:07:37 +02:00
Tobias Brunner
4ba857930c testing: Format total time in a more readable way 2023-07-26 13:06:40 +02:00
Tobias Brunner
99bd7ca2fd testing: Change memory allocation for alice and winnetou and switch to MiB
The services running on alice seem to require a bit more memory with
Debian bookworm, so increase the memory allocation.  But at the same
time reduce winnetou's allocation by the same amount as it really doesn't
require that much memory.

The unit change makes it easier to read.
2023-07-20 15:59:49 +02:00
Tobias Brunner
732909ce1e testing: Hardcode /testresults mount point in winnetou's fstab
Because do-tests runs the restore-defaults script, fstab would get reset
to the default version and the mount point wouldn't be available anymore
after stopping and restarting the guests (unless the guest images were
rebuilt in between).
2023-07-20 15:59:21 +02:00
Tobias Brunner
872781734d testing: Copy guest-specific files after default files
This allows overriding some files per guest.
2023-07-20 15:59:21 +02:00
Tobias Brunner
79ad33bfba testing: Use Debian 12 (bookworm) 2023-07-13 12:41:51 +02:00
Tobias Brunner
043e10ebb8 testing: Use Debian bookworm to test TKM 2023-07-13 12:41:51 +02:00
Tobias Brunner
dee9bfb682 testing: Update TKM dependencies to fix compilation with newer GNAT versions 2023-07-13 10:48:53 +02:00
Tobias Brunner
6f7fdcadd1 testing: Add support for Debian bookworm base images
By default, rsyslog is not installed anymore to avoid storing everything
twice (since journald is the default).  If this becomes an issue, we
could delete /var/log/journal to only log via rsyslog.
2023-07-13 10:48:53 +02:00
Tobias Brunner
21bf3e41f9 testing: Use venv for strongTNC
Also updated to a newer version to fix dependency issues.
2023-07-13 10:48:53 +02:00
Tobias Brunner
9b8f26b407 testing: Install python-daemon via Debian package
System-wide installation via pip isn't easily possible anymore on Debian
bookworm, so just use the Debian package for this (is available in old
releases as well).
2023-07-13 10:48:53 +02:00
Tobias Brunner
55273157b0 libimcv: Add Debian 12 (bookworm) to database
Because libcrypto and libssl are measured, we need a new group for Debian
versions with OpenSSL 3 (I've rather added a suffix to the old group as
that could eventually get removed, although we might need a 3.1 variant
in the future - maybe we should measure some other files?).
2023-07-13 10:48:53 +02:00
Tobias Brunner
995d7785b9 testing: Fix vici updown script on Debian bookworm
OOM-killer is now already triggered with `import daemon`, so set the
limit before that.  Also some PEP8 fixes (including an exclusion for
the above fix as that causes imports to not be at the beginning of the
file).
2023-07-13 10:48:53 +02:00
Tobias Brunner
744955f8ce testing: Whitelist all Git repositories in the root image
Without this, Git refuses to operate on the build dirs that are mounted
with weird ownership.  When running as root in the chroot, Git checks
SUDO_UID, which won't match.
2023-07-13 10:48:53 +02:00
Tobias Brunner
e0f0f812c7 testing: Create traditional RSA keys with OpenSSL 3
This is necessary because TKM can't read PKCS#8 files and in some
scenarios we don't have the pkcs8 plugin loaded that would be required
to read/decrypt the non-traditional files.
2023-07-13 10:48:53 +02:00
Tobias Brunner
6b8b67be81 testing: Fix systemctl wrapper and adapt enabling services on winnetou
The wrapper called the command twice for any unit but "strongswan" and
it didn't return the correct exit code.  This was noticed when an
if-updown script tried to check if systemd-resolved is active and always
succeeded, which caused failing attempts to configure it.

But now that the return code is correct, trying to enable bind9 won't
fail silently anymore if the unit doesn't exist (similar on older systems
for named), so this is adapted.
2023-07-13 10:48:53 +02:00
Tobias Brunner
c1dbce29ed testing: Remove support for Debian stretch 2023-07-13 10:48:53 +02:00
Tobias Brunner
fbc25f1c25 leak-detective: Whitelist C++'s __cxa_get_globals() 2023-07-13 10:48:53 +02:00
Tobias Brunner
e604947df8 testing: Switch to MDB backend for OpenLDAP (slapd)
The BDB and HDB backends were long deprecated and have finally been
removed with OpenLDAP 2.5 that's shipped with Debian bookworm.
2023-07-13 10:48:53 +02:00
Tobias Brunner
ab13c1c808 testing: Configure curve25519-sha256 as key exchange for SSH
With Debian bookworm, the PQC KE sntrup761x25519-sha512 is negotiated, by
default.  This increases the overhead significantly, in particular, the
size of the KE message, which wouldn't get through IPsec tunnels without
MSS clamping.
2023-07-13 10:48:53 +02:00
Tobias Brunner
0e621f60f8 sonarcloud: Update filter rules as recommended 2023-07-12 11:21:27 +02:00
Tobias Brunner
46d98bc249 testing: Fix example configure options for charon-tkm Docker build
Fixes: b1ce8772367f ("charon-tkm: Use built-in plugins instead of OpenSSL")
2023-07-11 18:02:13 +02:00
Tobias Brunner
4c2747fbfc Use wolfSSL 5.6.3 for tests 2023-06-21 15:31:53 +02:00
Tobias Brunner
2e88ab0069 dhcp: Fix warning with newer compilers 2023-06-19 14:56:24 +02:00
Tobias Brunner
8238ad480a resolve: Maintain order of DNS servers also when installing in resolv.conf
This always writes the complete set of DNS servers to make modifications
simpler.
2023-06-19 14:56:24 +02:00
Tobias Brunner
6440975bb4 resolve: Try to maintain the order of DNS servers if using resolvconf
Since 17fd304e60df ("resolve: Don't install individual servers via
resolvconf"), DNS servers were sorted if getting installed via resolvconf.
In some setups the order might be important (even though relying on it
isn't a good idea in general as stub resolvers are free to use all of
the servers as they please).
2023-06-19 14:56:24 +02:00
Tobias Brunner
2d1006963e charon-svc: Add missing closing parenthesis in version output 2023-06-19 14:55:48 +02:00
Tobias Brunner
43975f33ef Use wolfSSL 5.6.2 for tests
ECC keys can now be smaller so we can't access the private key directly
anymore.
2023-06-13 10:13:29 +02:00
Andreas Steffen
4e1dc0a224 Version bump to 5.9.11 2023-06-12 07:50:02 +02:00
Andreas Steffen
0ba7aefdc9 Version bump to 5.9.11rc1 2023-06-08 10:42:17 +02:00
Tobias Brunner
285ebb24e3 NEWS: Add news for 5.9.11 2023-06-02 17:52:28 +02:00
Tobias Brunner
c593443432 pki: Add --label options to --est* command synopsis
Also fixes some formatting in the man pages.
2023-06-02 12:56:03 +02:00
Tobias Brunner
03c08423dd github: Use new cache storage properties for sonarcloud 2023-06-02 11:37:06 +02:00
Tobias Brunner
89ce398c3d openssl: Fix memory leak if FIPS provider isn't available 2023-06-02 11:27:39 +02:00
Tobias Brunner
ee9a663b01 Fixed some typos, courtesy of codespell 2023-06-02 10:36:47 +02:00
Tobias Brunner
efdcbd13cb credential-manager: Improve selection of local certificate and trust chain
The previous code was problematic if a certificate request for a known
but unrelated CA was received and the local trust chain was incomplete.
Due to the received anchor, the incomplete trust chain was dismissed and
any intermediate CA certificates were, therefore, not sent to the peer.

This new approach doesn't dismiss an incomplete trust chain, but prefers
one that can be resolved to a received anchor.  If no such chain is found,
the first one is used.
2023-06-02 10:04:39 +02:00
Tobias Brunner
0e88b8a817 github: Use OpenSSL 3.1.1 for tests 2023-05-31 15:45:02 +02:00
Tobias Brunner
e3cb756dbf Merge branch 'libipsec-raw-esp'
This adds support for sending/receiving ESP packets without UDP
encapsulation to libipsec and kernel-libipsec.  Only Linux is currently
supported and the feature is disabled by default.
2023-05-23 13:19:57 +02:00
Tobias Brunner
5db9b26e32 testing: Add libipsec scenarios that exchange raw ESP packets 2023-05-23 13:19:47 +02:00
Tobias Brunner
e306fa5f73 kernel-libipsec: Add support to send/receive raw ESP packets
This is currently only supported on Linux and with the appropriate
permissions.

Since it's experimental, it's disabled by default.

The log messages for each sent and received ESP message are logged in NET
like the ones in the socket-default plugin for UDP-encapsulated messages.
2023-05-23 13:19:47 +02:00
Tobias Brunner
29e8cb3f90 libipsec: Move restrictions regarding UDP encapsulation to users 2023-05-23 13:19:47 +02:00
Tobias Brunner
8ddfaf5857 libipsec: Instruct ESP sender whether to use UDP encapsulation 2023-05-23 13:19:47 +02:00
Tobias Brunner
61f9843453 android: Use CALLBACK for libipsec-related callbacks 2023-05-23 13:19:47 +02:00
Tobias Brunner
a049868d78 kernel-libipsec: Use CALLBACK for libipsec callbacks 2023-05-23 13:19:47 +02:00
Tobias Brunner
dbd5707077 ipsec-sa: Store whether to use UDP encapsulation on the SA 2023-05-23 13:19:47 +02:00
Tobias Brunner
23d20bbb96 Merge branch 'libipsec-trap'
This adds support for trap policies to libipsec.
2023-05-23 13:17:19 +02:00
Tobias Brunner
cb049e14c8 testing: Add libipsec/net2net-trap scenario 2023-05-23 11:53:53 +02:00
Tobias Brunner
b0eb88f703 kernel-libipsec: Forward acquires from libipsec to the daemon 2023-05-23 11:53:53 +02:00
Tobias Brunner
9192ef1620 ipsec-processor: Trigger acquire if no matching outbound SA is found 2023-05-23 11:53:53 +02:00
Tobias Brunner
4e9acf98d0 ipsec-sa-mgr: Optionally keep track of acquires for outbound SAs
Currently just based on the reqid.  An acquire for the same reqid is
triggered at most every 10 seconds (gets ignored in trap_manager_t if
the SA is still getting established).

Entries are only cleaned up if an SA is eventually installed (similar to
the allocated SPIs).  Should that ever be a problem, we could probably
schedule a job that regularly flushes old entries.
2023-05-23 11:53:51 +02:00
Tobias Brunner
ec503ade58 libipsec: Add possibility to relay acquire events
Keeping it simple and just forwarding the reqid.
2023-05-22 16:15:49 +02:00
Tobias Brunner
6ceb39b1da ike: Use a struct to store retransmission settings
The calculation of the timeout is also shared now and the total
timeout in seconds is corrected in case retransmit_base is <= 1.

This could make it easier in the future to apply different retransmission
settings to messages/exchanges.
2023-05-17 15:58:28 +02:00
Tobias Brunner
5f8eb09dd6 pki: Make --dn optional for certificate renewals via --scep command
When using OpenXPKI, the subject DN in the renewal request has to match
the previous DN exactly.  However, because OpenXPKI may add a bunch of
DC/O RDNs to subjects of issued certificates, running --scep with the
same --dn that was used for the original request won't work (results in
a "Client error / malformed request badRequest" error even after enabling
`renewal_via_pkcs_req`).  This simplifies renewals as --dn can just be
omitted and extracted from the original certificate to avoid this issue.

References strongswan/strongswan#1689
2023-05-17 15:56:12 +02:00
Tobias Brunner
7fa85ff379 Merge branch 'debug-level-build'
This fixes the build with DEBUG_LEVEL < 4, which was broken when building
from the repository since --enable-warnings was made the default.

Although, most issues only occurred with the level reduced to 0/-1.  And
while removing debug statements at compile time completely is probably
not useful in production, there might be use cases in certain benchmarking
scenarios.  Also, with the recent changes to the controller there should
only rarely be a listener registered at a higher log level so the overhead
for those higher-level DBG statements is minimal.

Anyway, reducing the log level at compile time is a documented feature and
at least DEBUG_LEVEL=3 could be useful to prevent leaking sensitive
information via logs from the outset.  So we should make sure compilation
doesn't fail.
2023-05-16 13:05:33 +02:00
Tobias Brunner
027ba4d12e github: Add build with DBG completely disabled 2023-05-08 17:32:18 +02:00
Tobias Brunner
21f01808ff sec-updater: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
8e78d9fcec sw-collector: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
16c2def3ae conftest: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
3804b2adf9 pki: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
72f8794d83 selinux: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
4620f43eba radattr: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
74b2628301 systime-fix: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
d0ef504614 kernel-netlink: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:18 +02:00
Tobias Brunner
b0ce4ef8db ha: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
35716df9bc dhcp: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
e72ab6a818 tnc-ifmap: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:18 +02:00
Tobias Brunner
68f35b48d8 eap-peap: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
e252e1b465 eap-ttls: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
cbedbf3ef1 eap-radius: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:18 +02:00
Tobias Brunner
2d3967cb4c eap-dynamic: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
65dc1801cf eap-mschapv2: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:17 +02:00
Tobias Brunner
e0eece0465 vici: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
86aa454c88 forecast: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
a7ea181f0d save-keys: Fix build with DEBUG_LEVEL < 0 2023-05-08 17:32:17 +02:00
Tobias Brunner
800cef35db mode-config: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:17 +02:00
Tobias Brunner
ab919c62da keymat_v1: Fix build with DEBUG_LEVEL < 3 2023-05-08 17:32:17 +02:00
Tobias Brunner
963398c2c3 ike-init: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:17 +02:00
Tobias Brunner
5e32be1bb5 ike-config: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:17 +02:00
Tobias Brunner
7a883c4b37 child-create: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:17 +02:00
Tobias Brunner
675082114c pubkey-authenticator: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:17 +02:00
Tobias Brunner
117e13e7f1 eap-authenticator: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:17 +02:00
Tobias Brunner
5408b50160 ike-sa: Fix build with DEBUG_LEVEL < 1 2023-05-08 17:32:17 +02:00
Tobias Brunner
79d49ea05b message: Fix build with DEBUG__LEVEL < 1 2023-05-08 17:32:17 +02:00
Tobias Brunner
9b9464fdcd generator: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
36490eefa3 backend-manager: Fix build with DEBUG_LEVEL < 3 2023-05-08 17:32:17 +02:00
Tobias Brunner
0841280cdd libimcv: Fix build with DEBUG_LEVEL < 3 2023-05-08 17:32:17 +02:00
Tobias Brunner
522bd965d1 libtpmtss: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
4a28488a7e tnccs-20: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
a0ee0cbf90 tnccs-11: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
874562fc1c radius-client: Fix build with DEBUG_LEVEL < 3 2023-05-08 17:32:17 +02:00
Tobias Brunner
6086029056 libtls: Fix build with DEBUG_LEVEL < 3 2023-05-08 17:32:17 +02:00
Tobias Brunner
bb06b7a4bb simaka-manager: Fix counter in log message when getting quintuplets
Also fixes the build with DEBUG_LEVEL < 1.
2023-05-08 17:32:17 +02:00
Tobias Brunner
777d0ef7b0 esp-packet: Fix build with DEBUG_LEVEL < 3 2023-05-08 17:32:17 +02:00
Tobias Brunner
1b58e8c386 drbg: Fix build with DEBUG_LEVEL < 4 2023-05-08 17:32:17 +02:00
Tobias Brunner
94cbd6469a bliss: Fix build with DEBUG_LEVEL < 2 2023-05-08 17:32:17 +02:00
Tobias Brunner
b158c210cd sqlite: Fix build with DEBUG_LEVEL < 2 2023-05-08 14:07:18 +02:00
Tobias Brunner
a9a2c040ba pkcs7: Fix build with DEBUG_LEVEL < 2 2023-05-08 14:07:18 +02:00
Tobias Brunner
7ea431cf70 constraints: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:07:18 +02:00
Tobias Brunner
984f8cbcde revocation: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:07:18 +02:00
Tobias Brunner
c0a281472f x509: Fix build with DEBUG_LEVEL < 2 for structures that ignore unknown critical extensions 2023-05-08 14:07:18 +02:00
Tobias Brunner
a551f80e4f plugin-loader: Fix build with DEBUG_LEVEL < 3 2023-05-08 14:06:43 +02:00
Tobias Brunner
1b59031cc3 auth-cfg: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:06:43 +02:00
Tobias Brunner
5a98f8f4ab certificate: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:06:43 +02:00
Tobias Brunner
b39105b5b4 credential-factory: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:06:43 +02:00
Tobias Brunner
f73d8699b3 crypto-tester: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:06:43 +02:00
Tobias Brunner
d7750dff9b asn1: Fix build with DEBUG_LEVEL < 2 2023-05-08 14:06:43 +02:00
Tobias Brunner
2d4a98d0d3 debug: Add macro to mark variables that are only used in DBG statements
Some variables that are only assigned to be used in DBG statements
will otherwise trigger a "set but not used" warning/error if DEBUG_LEVEL
is too low.
2023-05-08 11:51:10 +02:00
Tobias Brunner
7b453ae409 doxygen: Enable JS search engine 2023-05-04 16:35:51 +02:00
Tobias Brunner
8eaddbb805 doxygen: Fix syntax for some output parameters 2023-05-04 16:35:47 +02:00
Tobias Brunner
69914a2dc5 ikev1: Migrate CHILD_SAs when IKE_SA is reset during reauthentication
When we reset the initiator SPI, we have to migrate the adopted children
again so the correct IKE_SA can later be checked out.

Closes strongswan/strongswan#1663
2023-05-01 10:19:59 +02:00
Tobias Brunner
5e46e101a6 vici: Improve log messages for terminate/rekey() in case of combined filters
As long as any `child*` selector is received, only CHILD_SAs will be
terminated or rekeyed.  Any passed `ike*` selectors will only be used to
filter the IKE_SAs when looking for matching CHILD_SAs.  However, the
previous log messages seemed to indicate that IKE_SAs will also be
terminated/rekeyed.

References strongswan/strongswan#1655
2023-05-01 10:19:29 +02:00
Tobias Brunner
00a75e332f vici: Create default TCP socket on Windows in Python bindings
This uses the same value as VICI_DEFAULT_URI.

References strongswan/strongswan#1655
2023-05-01 10:19:29 +02:00
Tobias Brunner
d12e6c9e55 charon-systemd: Add a log message when the daemon is starting
While there is a status message sent to systemd (can be seen e.g. in
systemctl status), the version etc. is currently not logged to the
journal, syslog or any log files.
2023-04-27 13:52:34 +02:00
Tobias Brunner
0bf061d737 leak-detective: Add on_exit(3) to whitelist
Seems to allocate some TLS value in newer glibc versions.
2023-04-27 13:52:34 +02:00
Tobias Brunner
d96d15b588 controller: Add parameter for maximum log level to initiate/terminate_*()
Previously, the logger installed by the controller always announced
LEVEL_PRIVATE(4), which produced completely useless logging calls with
the common clients (vici/stroke) whose default log level is LEVEL_CTRL(1).
This can produce quite some overhead if there are e.g. a lot of concurrent
initiate() calls.
2023-04-27 13:52:34 +02:00
Tobias Brunner
77b9f3abb0 controller: Ignore log messages unrelated to IKE_SA affected by a command
Until we know which IKE_SA is affected by an initiate() or terminate_*()
command, unrelated log messages that don't have any IKE context (i.e.
the passed `ike_sa` is NULL) would previously get logged.
2023-04-27 13:52:34 +02:00
Tobias Brunner
30803f90eb watcher: Prevent busy wait if callback is active and other FDs have events
Exiting the loop previously could cause watcher to busy wait (i.e.
rebuild the array and call poll() repeatedly) until the active callback
was done.

Assume watcher observes two FDs 15 and 22, which are in the list in that
order.  FD 15 is signaled and its callback gets triggered.  The array of
FDs is rebuilt and does not include 15 anymore.  Now FD 22 is ready for
reading.  However, when enumerating all registered FDs, the loop previously
was exited when reaching FD 15 and seeing that it's active.  FD 22 was
never checked and the array was immediately rebuilt and poll() called.
If the callback for 15 took longer, this was repeated over and over.

This basically reverts d16d5a245f0b ("watcher: Avoid queueing multiple
watcher callbacks at the same time"), whose goal is quite unclear to me.
If it really wanted to allow only a single callback for all FDs, it didn't
achieve that as any FD before an active one would get notified and if
multiple FDs are ready concurrently, they'd all get triggered too.
Skipping entries with active callback makes sense as it avoids a lookup
in the FD array and subsequent revents checks.  But why would we need to
rebuild the array if we see such an entry?  Once the callback is done,
the watcher is notified and the array rebuilt anyway (also if any other
FD was ready and jobs get queued).
2023-04-27 13:52:34 +02:00
Tobias Brunner
53208b0ba4 watcher: Move debug log messages out of mutex
The list of FDs is recreated quite often (e.g. due to the kernel-netlink
event sockets) and if a logger depends on watcher_t in some way this
might cause conflicts if the mutex is held.
2023-04-27 13:52:34 +02:00
Tobias Brunner
705a20619f watcher: Make sure to re-activate the correct entry after a callback
Since the same FD may be added multiple times (e.g. with separate
callbacks for WATCHER_READ and WATCHER_WRITE), the previous check
might not have found the correct entry.  As the entry can't be removed
while in a callback, the pointer comparison is fine.
2023-04-27 13:52:34 +02:00
Tobias Brunner
34e9cdbcac watcher: Log when watched FDs are added, removed or updated 2023-04-27 13:52:27 +02:00
Tobias Brunner
0a806d9717 watcher: Only log number of managed FDs
Adding the internal notify FD might be confusing.
2023-04-27 13:45:32 +02:00
Tobias Brunner
7c657e78ff watcher: Avoid logging on level 1 while holding the mutex
This could be problematic in case loggers in some way rely on watcher_t
themselves.  This particular log message should rarely occur if at all,
but still avoid holding the mutex.
2023-04-27 13:45:32 +02:00
Tobias Brunner
2cb6d144a6 vici: Don't lock connection in write mode when enabling on_write() callback
This should prevent a deadlock that could previously be caused when a
control-log event was raised.  The deadlock looked something like this:

 * Thread A holds the read lock on bus_t and raises the control-log event.
   This requires acquiring the connection entry in write mode to queue the
   outgoing message.  If it is already held by another thread, this blocks
   on a condvar.

 * Thread B is registering the on_write() callback on the same connection's
   stream due to a previous log message.  Before this change, the code
   acquired the entry in write mode as well, thus, blocking thread A.  To
   remove/add the stream, the mutex in watcher_t needs to be acquired.

 * Thread C is in watcher_t's watch() and holds the mutex while logging on
   level 2 or 3.  The latter requires the read lock on bus_t, which should
   usually be acquirable even if thread A holds it.  Unless writers are
   concurrently waiting on the lock and the implementation is blocking
   new readers to prevent writer starvation.

 * Thread D is removing a logger from the bus (e.g. after an initiate()
   call) and is waiting to acquire the write lock on bus_t and is thereby
   blocking thread C.

With this change, thread B should not block thread A anymore.  So thread D
and thread C should eventually be able to proceed as well.

Thread A could be held up a bit if there is a thread already sending
messages for the same connection, but that should only cause a delay, no
deadlock, as on_write() and do_write() don't log (or lock) anything while
keeping the entry locked in write mode.

Closes strongswan/strongswan#566
2023-04-26 15:52:40 +02:00
Tobias Brunner
0615b86b49 sonarcloud: Ignore "User-defined types should not be passed as variadic arguments"
This triggers an error for functions that take chunk_t as variadic
arguments (cat, debug, builders, ASN.1 wrap).

Since we are not using C++, this should be fine as we are only passing
POD types anyway.
2023-04-25 12:19:49 +02:00
Andreas Steffen
b420857123 Version bump to 5.9.11dr3 2023-04-21 16:36:23 +02:00
Andreas Steffen
47e8b21c76 cert_cache: Replace cached stale OCSP responses in-place 2023-04-21 16:04:26 +02:00
Andreas Steffen
ef94a5b4ab Version bump to 5.9.11dr2 2023-04-19 04:24:18 +02:00
Harald Gutmann
5284cecddc pki: Filter whitespace in base64 encoded EST responses
As clarified in RFC 8951, section 3.1 [1].

[1] https://www.rfc-editor.org/rfc/rfc8951#name-white-space-processing

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
Closes strongswan/strongswan#1616
2023-04-03 15:10:37 +02:00
Harald Gutmann
f6dc47f591 pki: Add support for EST server label
As specified in EST RFC 7030, Section 3.1 [1].

[1] https://www.rfc-editor.org/rfc/rfc7030.html#section-3.1
2023-04-03 13:59:48 +02:00
Tobias Brunner
7a47adb4f0 Merge branch 'pkcs7-signatures'
Adds support for CMS-style signatures in PKCS#7 containers, which allows
verifying RSA-PSS and ECDSA signatures.

Ed25519 signatures should be supported when verifying, however, they
currently can't be created.  Ed448 signatures are currently not supported.
That's because RFC 8419 has very strict requirements in regards to the
hash algorithms used for signed attributes.  With Ed25519 only SHA-512 is
allowed (pki currently has an issue with Ed25519 in combination with
SHA-512 due to its associated HASH_IDENTITY) and with Ed448 only SHAKE256
with 512-bit output, which has to be encoded in the algorithmIdentifier
parameters (something we currently don't support at all).

Closes strongswan/strongswan#1615
2023-03-31 09:29:12 +02:00
Tobias Brunner
b4e1863fa6 pki: Allow specifying signature scheme for PKCS#7 signatures
Also changed the error handling a bit so it is more like in the other
pki commands.
2023-03-31 09:11:20 +02:00
Tobias Brunner
e2a2674476 pki: Unify parsing of RSA padding scheme and fix disabling PSS
If PSS padding is enabled by default, not all commands allowed disabling
it explicitly.
2023-03-31 09:11:17 +02:00
Tobias Brunner
47d9590556 openssl: Add support for CMS-style signatures in PKCS#7 (RSA-PSS, ECDSA) 2023-03-30 10:46:46 +02:00
Tobias Brunner
5e76bc1634 pkcs7: Add support for CMS-style signatures (RSA-PSS, ECDSA)
For the legacy schemes with rsaEncryption nothing changes, but if an
actual signature scheme is encoded we use that to find the key and
verify the signature.

The descriptions for the PKCS#7 structure are adapted for CMS.
2023-03-30 10:46:46 +02:00
Tobias Brunner
1326f805a8 asn1: Allow suppressing log messages when parsing algorithm identifiers 2023-03-30 10:46:46 +02:00
Tobias Brunner
4e73e9d3e9 botan: Pass n and e separately for RSA public keys
Some encoders, like those provided by the dnskey and sshkey plugins,
require these separately when encoding keys.

Also fixes the type for the ASN.1 encoding (which is a subjectPublicKeyInfo
structure) depending on the key type.  This worked fine for PEM encoding
as the pem plugin doesn't care what the actual type of the key is (which
is encoded in the SPKI structure), but other plugins do (e.g. the sshkey
plugin).
2023-03-30 10:45:04 +02:00
Tobias Brunner
7be55adf05 ipseckey: Add support for ECDSA and EdDSA public keys 2023-03-30 10:35:09 +02:00
Tobias Brunner
e288c507b6 Use wolfSSL 5.6.0 for tests
The `--enable-heapmath` configure option has been deprecated.  As
already described in eae30af029b1 ("Use wolfSSL 5.4.0 for tests"), the
alternative is to configure `--with-max-rsa-bits=8192` instead in order
to test the modp6144 and modp8192 DH groups.
2023-03-30 10:32:45 +02:00
Andreas Steffen
67e9cb161d Version bump to 5.9.11dr1 2023-03-28 16:27:04 +02:00
Tobias Brunner
9e17a0ed88 revocation: Suppress some log messages for cached OCSP responses
We don't have any information on the issuer of cached OCSP responses, in
particular if the OCSP response is issued by a dedicated OCSP signer,
whose certificate might not be contained in the response or even signed
by the same CA but could just be locally installed.  So the only way to
determine if a response applies to the current certificate and its CA
is searching for the response's issuer certificate and verifying that.

However, when using multiple CAs that provide revocation checking via
OCSP, in particular with multi-level CAs (e.g. like the
ikev2-multi-ca/ocsp-signers test scenario), we might have unrelated OCSP
responses in the cache when verifying a particular certificate.  In this
case we don't need any confusing

  ocsp response verification failed, no signer certificate '...' found

error messages because the response was for a different CA.

Similarly, if lots of clients of the same CA connect there could be lots
of OCSP responses in the cache that, while being applicable to the current
CA, don't have any information on the certificate we are currently
checking.  In this case all the

  ocsp response correctly signed by "..."
  ocsp response contains no status on our certificate

messages don't provide any value.

In the mentioned test scenario, we suppress the

  ocsp response verification failed, no signer certificate 'C=CH, O=strongSwan Project, OU=Research OCSP Signing Authority, CN=ocsp.research.strongswan.org' found

message from the cached OCSP response for carol's end-entity certificate
when verifying the "Research" intermediate CA certificate that issued
carol's certificate.

Then the

  ocsp response verification failed, no signer certificate 'C=CH, O=strongSwan Project, OU=Research OCSP Signing Authority, CN=ocsp.research.strongswan.org' found
  ocsp response verification failed, no signer certificate 'C=CH, O=strongSwan Project, OU=OCSP Signing Authority, CN=ocsp.strongswan.org' found

messages from the cached OCSP responses for carol's end-entity and
intermediate CA certificates when verifying dave's end-entity certificate.

And finally the

  ocsp response verification failed, no signer certificate 'C=CH, O=strongSwan Project, OU=Research OCSP Signing Authority, CN=ocsp.research.strongswan.org' found
    ocsp response correctly signed by "C=CH, O=strongSwan Project, OU=OCSP Signing Authority, CN=ocsp.strongswan.org"
    ocsp response contains no status on our certificate
  ocsp response verification failed, no signer certificate 'C=CH, O=strongSwan Project, OU=Sales OCSP Signing Authority, CN=ocsp.sales.strongswan.org' found

messages from the cached OCSP responses for carol's end-entity
certificate, the applicable but unrelated response for carol's "Research"
intermediate CA certificate and the response for dave's end-entity
certificate when verifying dave's "Sales" intermediate CA.
2023-03-28 16:26:01 +02:00
Tobias Brunner
6abad65cd7 testing: Fix installation of swid-generator with newer versions of setuptools
With version 60.0.0 setuptools changed to a local installation of
distutils.  This seems to break the installation of swid-generator (causing
an `importlib.metadata.PackageNotFoundError: swid-generator` error).

Note that while Debian ships setuptools 52.0.0, `python-daemon` recently
added a dependency on `setuptools>=62.4.0`, which installs that version
that's then later used to install swid-generator.

The main difference seems to be that the local version installs the
package in `/usr/lib/python3.9/site-packages`, while the stdlib version
does so in `/usr/local/lib/python3.9/dist-packages` (similarly for the
`swid_generator` script and the `distro` dependency).

Not sure if there is a better/proper way to fix this.  Might just be an
issue with Debian bullseye and mixing system packages with those installed
via pip3.
2023-03-28 13:05:26 +02:00
Tobias Brunner
7dc82dea34 Merge branch 'crl-sign'
Enforces that the certificate that signed a CRL either encodes the
cRLSign keyUsage (even if it is a CA certificate) or is a CA certificate
without a keyUsage extension (which should rarely be the case nowadays).

This is in compliance with RFC 5280, section 6.3.3. (f):

  If a key usage extension is present in the CRL issuer's certificate,
  verify that the cRLSign bit is set.

strongSwan encodes a keyUsage extension with cRLSign bit set in all CA
certificates it generates since 1ec8f22de222 ("set Certificate Sign and
CRL Sign flags in keyUsage extension if CA is true"), which was 13 years
ago.  Before that the extension was not encoded so those CA certificates
would also still be accepted as CRL issuer (if they are still valid, but
considering the SHA-1 deprecation that happened since then, they were
most likely replaced anyway).

References strongswan/strongswan#1548
2023-03-24 17:55:24 +01:00
Tobias Brunner
01ec54afc9 openssl: Only allow certificates with cRLSign keyUsage to sign CRLs 2023-03-21 16:34:14 +01:00
Tobias Brunner
7d1f221211 x509: Only allow certificates with cRLSign keyUsage to sign CRLs 2023-03-21 16:34:14 +01:00
Tobias Brunner
d12a4f5d23 openssl: Set X509_CRL_SIGN for CA certificates without keyUsage extension 2023-03-21 16:34:14 +01:00
Tobias Brunner
7414c06669 x509: Set X509_CRL_SIGN for CA certificates without keyUsage extension 2023-03-21 16:34:14 +01:00
Tobias Brunner
8bb772a9fa appveyor: Build eap-radius plugin on Windows 2023-03-21 16:33:03 +01:00
Tobias Brunner
c9c76278c3 libradius: Link to winsock32 on Windows 2023-03-21 16:33:03 +01:00
Tobias Brunner
9b391f86fe eap-radius: Don't include socket.h explicitly
We rely on the includes via utils.h so this compiles on Windows.
2023-03-21 16:33:03 +01:00
Tobias Brunner
993dd54c8d windows: Fix compat define for sendto(2) 2023-03-21 16:33:03 +01:00
Tobias Brunner
8c0a67f700 kernel-wfp: Install bypass policies also on FWPM_SUBLAYER_IPSEC_TUNNEL sublayer
This is apparently necessary to bypass tunnel mode SAs/policies.

References strongswan/strongswan#1552
2023-03-21 16:30:09 +01:00
Tobias Brunner
8f5c0c9ca9 windows: Fix invalid pointer dereference when terminating service thread
When running as a service, the libraries are initialized/deinitialized
not by the main thread but by a separate thread that runs the registered
main service procedure.  When the service is stopped, the libraries are
deinitialized by that thread and the thread lock and hashtable are
destroyed.  But afterwards the DllMain callback is also triggered for
that thread so we have to prevent it from accessing these objects again.

References strongswan/strongswan#1567
2023-03-21 16:27:10 +01:00
Tobias Brunner
e6a354a996 controller: Immediately return after re-initiating an existing IKE_SA childless
If no CHILD_SA is initiated, we wait for a state change to IKE_ESTABLISHED
but that will never happen for already established IKE_SAs.

References strongswan/strongswan#1553
2023-03-21 16:25:51 +01:00
Tobias Brunner
dd79253e2d vici: Fix fallback to remote ID if no mediation peer ID is configured
Also adds error reporting via VICI for issues with mediation settings.

Fixes: 229cdf6bc8f2 ("vici: Order auth rounds by optional `round` parameter instead of by position in the request")
References strongswan/strongswan#1569
2023-03-21 16:21:48 +01:00
Tobias Brunner
3c8887326a dhcp: Don't use get_source_addr() to determine source address
That method is subject to interface filtering, which isn't ideal for
DHCP traffic that probably uses an internal interface on which the IKE
daemon might be disabled.  In that case `giaddr` is set to an incorrect
public IP, which in turn might prevent the plugin from receiving the
DHCP server's unicast response, in particular if the DHCP socket
is bound to the internal interface.

This new approach connects the client socket and thereby determines the
source address to reach the DHCP server.

Closes strongswan/strongswan#1573
2023-03-21 16:13:22 +01:00
Tobias Brunner
8bf683c469 pki: Fix enum for SCEP CA capabilities
As indicated by the comparisons and the parsing in scep_parse_caps()
this should be a bitmask.

Fixes: 7c7a5a0260ca ("pki: Enroll an X.509 certificate with a SCEP server")
Closes strongswan/strongswan#1607
2023-03-21 16:11:49 +01:00
Tobias Brunner
3d0d3f5d02 eap-tls: Fix server implementation with TLS 1.2 and earlier
With 5401a74d3608 ("eap-tls: Add support for TLS 1.3") a TLS application
was added to implement TLS 1.3's protected success indication.  For
earlier TLS versions, its build() method simply returned SUCCESS as
there was nothing to send.  However, that had the unintended side-effect
of also not sending the final TLS handshake messages (ChangeCipherSpec
and Finished).

The reason is that the TLS stack first checks for remaining handshake
messages but then also asks the registered application for data to
piggyback to that response (before the commit there was no application,
so that step was skipped).  The problem is that the status returned by
the application is directly forwarded through the TLS stack.  So not
returning INVALID_STATE caused the session to get concluded immediately
instead of resulting in ALREADY_DONE that would trigger sending the
final EAP message instead of an EAP-Success.

Fixes: 5401a74d3608 ("eap-tls: Add support for TLS 1.3")
2023-03-21 16:11:49 +01:00
Tobias Brunner
db87087fae tls: Only return EAP MSK if TLS handshake is complete
The MSK is generated when the keys are derived.  For TLS 1.3 that's also
when the handshake is complete.  However, for TLS 1.2 it happens when
generating or processing the ClientKeyExchange message, which, on the
client, happens before the final Finished handshake message has been
received from the server.  This caused the EAP-TLS client to accept an
EAP-Success message instead of the server's final TLS handshake
messages, unintentionally allowing servers to cut the exchange short by
two EAP messages (in the regular exchange the response to the server's
final handshake messages is an empty EAP-Response, which is then
followed by the server's EAP-Success).

While this is not correct, it does not seem to pose a security issue.
If DH is used as key exchange, the server signs the ServerKeyExchange
message and the client is sure to communicate with a trusted server
before it derives the MSK.  If RSA encryption is used as key exchange,
the client sends the premaster secret, on which the MSK is based,
encrypted with the server's public key (as extracted from the trusted
certificate).  An attacker won't be able to decrypt this and, therefore,
can't derive the same MSK to generate a valid AUTH payload and the IKE
authentication will fail.
2023-03-21 16:11:49 +01:00
Tobias Brunner
67c7303181 github: Add LSan workaround for tests on Ubuntu 20.04 again
This was removed with 0fea6a7f8e7e ("github: Adapt to switch to Ubuntu
22.04 for ubuntu-latest") as it didn't seem necessary anymore.  But
recently there have been such random crashes again with the 20.04 image.
2023-03-21 16:11:49 +01:00
Tobias Brunner
c0fc048775 github: Use OpenSSL 3.1.0 for tests 2023-03-21 16:11:49 +01:00
Jean-Tiare Le Bigot
bb6174a4d1 vici: Generalize timeout support in Python bindings
Since 3dd5dc50119d ("Merge branch 'vici-python-timeout'"), any timeout
set directly on the socket is reset by `vici.Transport.receive()` unless
called by `vici.Session.listen()`. This prevents configuring a default
timeout directly on the socket.

However, setting a timeout directly on the socket also had drawbacks
since it can cause `vici.Transport.receive()` to raise a timeout error
while a subset of the data have been received, with no way to recover.

This commit merges both approaches by considering the timeout configured
on the socket by default (when no timeout is explicitly set) and
keeping the switch to blocking receive once the first byte has been
received. When the full expected data have been received, the timeout
configured on the socket is restored.

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
Signed-off-by: Jean-Tiare Le Bigot <jt@yadutaf.fr>

Closes strongswan/strongswan#1562
2023-03-10 09:10:44 +01:00
Tobias Brunner
89936186a8 github: Don't build on Ubuntu 18.04 anymore
The Ubuntu 18.04 image is deprecated and builds will start to fail
temporarily during four 24 hour periods from now until the final
deprecation on April 1st.  So better remove these runs now.
2023-03-07 14:51:10 +01:00
Tobias Brunner
d250620970 appveyor: Fix LDFLAGS for Windows build
With newer OpenSSL builds, the DLL files contain parts of the version
number and the architecture in their name, e.g. for OpenSSL 1.1.1 the
DLL for libcrypto is called libcrypto-1_1-x64.dll.  So referencing that
directly could be kinda tricky.  And by using `-lcrypto` we therefore
didn't link those DLLs but the OpenSSL version installed by msys2.
Since the latter ships OpenSSL 3 since January and the VS 2019 image
was updated recently, our builds broke as we used the headers from
the 1.1.1 installation but then tried to link OpenSSL 3.

Luckily, in the lib/ directory of the OpenSSL installation, there is a
libcrypto.lib file, which is an import library (containing the symbols
and a reference to the DLL).  We can use that to link the right library
via `-lcrypto`.

With the old OpenSSL 1.0.2 build on the VS 2015 image, there is also
such a .lib file but it seems the linker is too old or otherwise incapable
of finding the DLL.  But since the DLL is just called libeay32.dll there,
we use that directly and don't reference the lib/ dir.

Also removed a superfluous AC_MSG_RESULT() if libeay32 isn't found.
2023-03-06 15:07:57 +01:00
Tobias Brunner
38871d62ad appveyor: Install gperf manually on newer versions of msys2 2023-03-02 15:02:42 +01:00
Andreas Steffen
c0ae81fc83 Version bump to 5.9.10 2023-03-02 09:58:24 +01:00
Tobias Brunner
ed839b3067 NEWS: Add info about CVE-2023-26463 2023-03-02 09:39:52 +01:00
Tobias Brunner
8aa13a1797 eap-peap: Initiate Phase 2 immediately for TLS 1.3
Before TLS 1.3, the server sent the last handshake message and had the
option to piggyback the EAP-Identity request directly onto the packet
with the TLS Finished message, or wait for the empty message by the
client that acknowledges the completion of the handshake.  With TLS 1.3,
the client finishes the handshake after the server.  So this option
is irrelevant there and we immediately start with Phase 2.
2023-03-02 09:31:52 +01:00
Andreas Steffen
edd3c797b0 testing: Negotiate TLS 1.3 for part of the EAP-TLS scenarios 2023-03-02 09:02:38 +01:00
Tobias Brunner
d605584a7a NEWS: Add news for 5.9.10 2023-02-24 16:05:58 +01:00
Tobias Brunner
8e9b2bd27f pki: Add possibility to add/remove flags in requests when issuing certificates 2023-02-23 17:36:38 +01:00
Tobias Brunner
8325eeff06 pki: Allow overriding EKU flags from certificate request via command line
The flags encoded in the PKCS#10 structure (or derived from the encoded
profile name) might not be appropriate in some instances. This allows
overriding them without having to issue a new certificate request.
2023-02-23 16:55:57 +01:00
Andreas Steffen
350101abad Version bump to 5.9.10rc1 2023-02-22 20:00:18 +01:00
Tobias Brunner
bc1a5111bb testing: Add a failing client to the ikev2/rw-eap-tls-only scenario 2023-02-22 17:10:03 +01:00
Tobias Brunner
501483b313 libvici: Fix Doxygen comment for vici_on_close()
Fixes: 9e5533fef940 ("libvici: Add callback invoked if connection is closed by daemon")
2023-02-22 14:33:34 +01:00
Tobias Brunner
a5ba701783 swanctl: Fix Windows build of --monitor-sas command
Fixes: 4784c92c557f ("swanctl: Terminate --monitor-sa command if daemon closes connection")
2023-02-22 14:33:34 +01:00
Tobias Brunner
18d73a9a5c utils: Add counterpart to wait_sigint() to explicitly stop waiting 2023-02-22 14:33:34 +01:00
Tobias Brunner
292eb7893f Merge branch 'nm-xfrmi'
Use XFRM interfaces instead of dummy TUN devices to avoid issues with
name resolution if supported by the kernel.

Closes strongswan/strongswan#1048
2023-02-22 13:44:10 +01:00
Tobias Brunner
58f278f932 charon-nm: Use an XFRM interface if available
This allows NM more freedom in regards to how it wants to use the passed
device.  In particular, if dnsmasq is used with NM as that binds to the
interface to send requests via VPN.

Installing the VIPs on lo avoids weird address removal/addition events
that happen for IPv6 on the physical interface (which would cause the VIP
to get incorrectly detected as non-VIP address and ignored during
deletion).

We could let NM install routes via XFRM interface, however, that causes
problems with e.g. the bypass-lan plugin (the throw routes in table 220
wouldn't have any effect).  We could let it install regular routes in
the main table, but determining the physical interface would be tricky
as the routes installed by NM, also in the main table, would conflict.

So instead we let the kernel-netlink interface install routes via XFRM
interface and to avoid routing the IKE traffic that way, we set a mark
on the IKE socket and exclude traffic with that mark from our routing
table.
2023-02-22 13:43:17 +01:00
Tobias Brunner
04486507b2 kernel-netlink: Add an option to install routes for SAs with XFRM interfaces
Since these might conflict with IKE traffic, this requires special care.
One option is to install bypass policies for the peer, which install
appropriate (throw) routes.  However, that won't work if the traffic to
the gateway itself should be protected, in particular, for host-to-host
tunnels.  So an alternative is to set a mark for the IKE socket and then
exclude that traffic from table 220 via the kernel-netlink plugin's
fwmark option.
2023-02-22 13:37:45 +01:00
Tobias Brunner
0cc780d317 kernel-netlink: Automatically bring up XFRM interfaces after creation 2023-02-22 13:37:45 +01:00
Tobias Brunner
e1ff1eefcf kernel-netlink: Add manager for XFRM interfaces
The manager will allow charon-nm to create XFRM interfaces if supported
by the kernel instead of creating an unused dummy TUN interface.

The xfrmi tool is mostly obsolete nowadays as iproute2 supports creating
XFRM interfaces since 5.1.0 (2019-05).  Older Debians don't ship that and
early versions didn't list the interface IDs.  So there might still be
some uses for this tool.
2023-02-22 13:37:45 +01:00
Tobias Brunner
85d56b1c6a charon-nm: Tie lifetime of dummy TUN device to connection
NM doesn't terminate charon-nm after disconnecting, so the TUN device
previously stayed around even if no connection was established.  This
might be a bit more what users expect.
2023-02-22 13:37:45 +01:00
Tobias Brunner
5401a74d36 eap-tls: Add support for TLS 1.3
As defined in RFC 9190, a "protected success indication" (0x00) is sent
from the server to the client over the TLS connection when using TLS 1.3.

The client responds with an empty EAP message, which is interpreted as
acknowledgement in our stack.

If we ever support session resumption with tunneled methods such as
EAP-TTLS, we'd have to send such an indication there too.
2023-02-22 13:34:53 +01:00
Tobias Brunner
06abdf1d31 tls-crypto: Fix MSK calculation for TLS 1.3
As noted in 121ac4b9e37e ("tls-crypto: Generate MSK for TLS 1.3"), the
calculation was only preliminary.  It is now fixed according to RFC 9190
and draft-ietf-emu-tls-eap-types (soon to become an RFC, currently in
the RFC editor queue).

Fixes: 121ac4b9e37e ("tls-crypto: Generate MSK for TLS 1.3")
2023-02-22 13:34:31 +01:00
Tobias Brunner
5a512ff56b Merge branch 'kernel-netlink-sa-lastused'
Adds support for a change in Linux kernel 6.2 that allows retrieving
the last use time of an SA from the SA itself instead of having to query
the policies.
2023-02-22 13:21:31 +01:00
Tobias Brunner
346a050c36 kernel-netlink: Increase log level for dumped Netlink messages
Some of these contain key material so they should be logged on level 4.
2023-02-22 13:20:10 +01:00
Tobias Brunner
1138b629fb android: Announce support for TFC padding
Has been supported by libipsec for a long time (since 5.1.1).  UDP encap
is already enforced via config, this just makes the flags the same as
in kernel-libipsec.
2023-02-22 13:20:10 +01:00
Tobias Brunner
e21290ec30 kernel-netlink: Read last use time from SA if possible
Since 6.2 the Linux kernel updates the last use time per SA.  In
previous releases the attribute was only updated and reported for
specific outbound IPv6 SAs.

Using this reduces the number of kernel queries per CHILD_SA: for DPDs
from two policy queries (IN/FWD) to a single query of the inbound SA,
and for status reports the three policy queries (IN/FWD/OUT) can be
omitted and only the two SAs have to be queried.  For NAT keepalives the
number of queries doesn't change but a policy query (OUT) is replaced by
a query for the outbound SA.

While we could use the existence of the attribute as indicator for its
support, we don't know this until we queried an SA.  By using a version
check we can announce the feature from the start.
2023-02-22 13:20:10 +01:00
Tobias Brunner
6301b880df child-sa: Query policies only if querying SAs doesn't update the use time 2023-02-22 13:20:10 +01:00
Tobias Brunner
b9131c34d3 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).
2023-02-22 13:20:10 +01:00
Tobias Brunner
1efdb0f791 ikev2: Add option to prefer childless IKE_SAs as initiator 2023-02-22 13:19:46 +01:00
Tobias Brunner
4784c92c55 swanctl: Terminate --monitor-sa command if daemon closes connection 2023-02-22 11:44:14 +01:00
Tobias Brunner
9e5533fef9 libvici: Add callback invoked if connection is closed by daemon 2023-02-22 11:44:14 +01:00
Tobias Brunner
2b206eaf6a 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
2023-02-20 14:50:02 +01:00
Tobias Brunner
cbd69ec732 android: Update the README for the build via NDK 2023-02-20 14:11:59 +01:00
Tobias Brunner
af93db93e6 android: New release after OpenSSL plugin fix 2023-02-17 16:59:13 +01:00
Tobias Brunner
48ef9bfbb6 openssl: Fix size of plugin feature array
Fixes: 312847e1a322 ("openssl: Add curve25519 and curve448 after ECDH groups")
2023-02-17 16:58:19 +01:00
Tobias Brunner
27d41a2442 android: New release after fixing interoperability issue with Zyxel firewalls 2023-02-17 16:42:42 +01:00
Tobias Brunner
312847e1a3 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.
2023-02-17 16:40:59 +01:00
Tobias Brunner
4d3fc90caf 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")
2023-02-17 15:11:43 +01:00
Tobias Brunner
0de42047a9 enum: Add functions to add and remove mappings from enum names
Co-authored-by: Thomas Egerer <thomas.egerer@secunet.com>
2023-02-17 13:37:38 +01:00
Tobias Brunner
3cf5653640 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
2023-02-17 13:29:56 +01:00
Tobias Brunner
15c6360145 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.
2023-02-16 14:45:57 +01:00
Tobias Brunner
77a5c9514c kernel-netlink: Use event socket wrapper for XFRM and networking events 2023-02-16 13:25:35 +01:00
Tobias Brunner
cb0bdb847d kernel-netlink: Add simple wrapper for Netlink event sockets 2023-02-16 13:25:35 +01:00
Tobias Brunner
e323539428 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").
2023-02-16 13:25:35 +01:00
Tobias Brunner
30cb3bd4d5 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").
2023-02-16 13:25:35 +01:00
Tobias Brunner
d7ccb44354 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").
2023-02-16 13:25:35 +01:00
Tobias Brunner
4e91ff7d8c 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.
2023-02-16 13:25:34 +01:00
Tobias Brunner
68ccb1930c 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).
2023-02-16 13:25:34 +01:00
Tobias Brunner
763014c028 shunt-manager: Pass HW offload mode when installing policies 2023-02-16 13:25:34 +01:00
Tobias Brunner
2b8f26308f vici: Update offloading configuration for full packet HW offloading 2023-02-16 13:25:34 +01:00
Tobias Brunner
55719d7de5 kernel-netlink: Add support for full packet and policy HW offloading 2023-02-16 13:25:34 +01:00
Tobias Brunner
46cfebe4ab child-sa: Pass HW offload mode for policies 2023-02-16 13:25:34 +01:00
Tobias Brunner
af1eeda08b kernel-ipsec: Add HW offload mode to policies 2023-02-16 13:25:34 +01:00
Tobias Brunner
056f3e7742 Merge branch 'android-updates'
Switched from BoringSSL to OpenSSL. A script is provided to build the
library as needed.
2023-02-15 14:50:12 +01:00
Tobias Brunner
5390da1412 android: New release after switching to OpenSSL 2023-02-13 15:46:53 +01:00
Tobias Brunner
65aff933f1 android: Use correct language code for Ukrainian
While UA is the country code, the language code is apparently uk.
2023-02-13 15:46:53 +01:00
Tobias Brunner
937f726154 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.
2023-02-13 15:30:58 +01:00
Tobias Brunner
eac27ce677 android: Use custom-built OpenSSL for GH action 2023-02-13 15:30:58 +01:00
Tobias Brunner
f959157d31 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.
2023-02-13 15:30:58 +01:00
Tobias Brunner
7e5c4bbb32 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).
2023-02-13 15:30:58 +01:00
Tobias Brunner
2fc8b14918 android: Add the application ID to the log 2023-02-10 11:27:44 +01:00
Tobias Brunner
12c925a7e7 android: Update screenshots and add more with advanced settings 2023-02-09 18:04:07 +01:00
Tobias Brunner
7361078d3d android: Update Gradle plugin 2023-02-09 18:04:07 +01:00
Tobias Brunner
77bd5ab1a8 github: Use OpenSSL 3.0.8 for tests 2023-02-07 18:06:16 +01:00
Tobias Brunner
1a8106ee0d github: Use tpm2-tss 3.2.2 for tests 2023-01-31 17:22:44 +01:00
Andreas Steffen
bf3e4c85d0 Revert "libipsec: Added Windows tun device support"
This reverts commit 77b91e6d0eaffb3c69b47221c3de3bb8ff80e01a.
2023-01-31 15:19:58 +01:00
Andreas Steffen
77b91e6d0e libipsec: Added Windows tun device support 2023-01-31 14:59:57 +01:00
xujielong
ba5b5f03b6 child-sa: Fix typo in comment
Closes strongswan/strongswan#1527
2023-01-30 11:29:02 +01:00
Tobias Brunner
805cc3a69f 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.
2023-01-23 11:17:33 +01:00
Tobias Brunner
d11868fb38 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.
2023-01-23 11:17:33 +01:00
Tobias Brunner
e99de2aee9 Merge branch 'man-sysconfdir'
Closes strongswan/strongswan#1511
2023-01-16 11:41:17 +01:00
Tobias Brunner
29e3247097 swanctl: Don't use hard-coded path to sysconfdir 2023-01-16 11:39:29 +01:00
Tobias Brunner
1c0b14baa3 conf: Add swanctl.conf and swanctl man pages to SEE ALSO 2023-01-16 11:37:27 +01:00
Tobias Brunner
7e43a5f3d2 conf: Replace hard-coded /etc where appropriate
Also document the actual value of ${sysconfdir}.
2023-01-16 11:36:58 +01:00
Petr Menšík
ee046552bb man: Use configured path for config files in man pages 2023-01-16 11:21:15 +01:00
Petr Menšík
ab4ed21b5c 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.
2023-01-16 11:20:44 +01:00
Andreas Steffen
8effb06d6c pki: Use X.509v3 EKU extension in CSR 2023-01-11 19:19:09 +01:00
Tobias Brunner
41b0dff92b 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
2023-01-10 16:34:07 +01:00
Tobias Brunner
7dbe702269 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
2023-01-06 15:31:03 +01:00
Tobias Brunner
632834af91 dh-speed: Add wolfssl and BP ECDH to test script 2023-01-06 15:31:03 +01:00
Tobias Brunner
e396dbeca5 dh-speed: Dynamically look up KE method 2023-01-06 15:31:00 +01:00
Tobias Brunner
a59a6d4783 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.
2023-01-06 12:13:12 +01:00
Andreas Steffen
0c7bfec7af Version bump to 5.9.9 2023-01-01 11:55:50 +01:00
Andreas Steffen
7928deece1 Version bump to 5.9.9rc2 2022-12-23 11:19:06 +01:00
Tobias Brunner
a6312f2ae9 testing: Abort kernel build if patch can't be applied 2022-12-23 10:31:14 +01:00
Tobias Brunner
613cd016ee NEWS: Add news for 5.9.9 2022-12-22 19:59:51 +01:00
Tobias Brunner
ac190ce6c9 kernel-netlink: Explicitly ignore the result of setsockopt() 2022-12-22 19:03:37 +01:00
Tobias Brunner
cf6f56f619 Fixed some typos, courtesy of codespell 2022-12-22 19:03:37 +01:00
Andreas Steffen
4aa5868d8e Version bump to 5.9.9rc1 2022-12-22 13:24:34 +01:00
Thomas Egerer
5e9f5fb32e Make format string a string literal in some debug statements
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2022-12-21 17:33:37 +01:00
Tobias Brunner
cb6516cc0a Use wolfSSL 5.5.4 for tests 2022-12-21 16:41:36 +01:00
Tobias Brunner
7988aea7d8 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.
2022-12-21 16:21:49 +01:00
Tobias Brunner
17fd304e60 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
2022-12-19 16:14:25 +01:00
Tobias Brunner
bd6014a97b 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
2022-12-19 16:14:01 +01:00
Tobias Brunner
dee1916e4c 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
2022-12-19 16:12:46 +01:00
Tobias Brunner
2c7f6cd93f github: Adapt TKM build to changed plugin list 2022-12-14 16:35:03 +01:00
Tobias Brunner
b1ce877236 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).
2022-12-14 16:25:19 +01:00
Tobias Brunner
98be74914d sha1: Clarify license of the implementation 2022-12-14 13:38:38 +01:00
Tobias Brunner
2192bfb9ec github: Use tpm2-tss 3.2.1 for tests 2022-12-13 16:32:02 +01:00
Tobias Brunner
da0d0ecc45 vici: Add Python 3.10 and 3.11 2022-12-12 16:57:01 +01:00
Tobias Brunner
03541c73a0 github: Fix Python build with custom OpenSSL version 2022-12-12 16:57:01 +01:00
Tobias Brunner
3dd5dc5011 Merge branch 'vici-python-timeout'
Closes strongswan/strongswan#1416
2022-12-12 14:38:46 +01:00
Martin Willi
484c0f8dd0 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)
2022-12-12 14:38:09 +01:00
Martin Willi
254d4075fe vici: Add some initial session level unit-tests 2022-12-12 14:38:09 +01:00
Martin Willi
aa0da01fde vici: Add simple Python transport layer tests, including timeout 2022-12-12 14:38:09 +01:00
Martin Willi
248a188d21 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.
2022-12-12 14:38:09 +01:00
Martin Willi
11b18f65b1 vici: Remove support for Python 2
Python 2 is dead and unmaintained for a while now. Time to stop carrying
on its support.
2022-12-12 14:38:09 +01:00
Tobias Brunner
a2b1e06f07 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
2022-12-12 14:24:50 +01:00
Dmitriy Alexandrov
b450865615 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
2022-12-12 14:24:32 +01:00
Tobias Brunner
44378d2521 github: CodeQL currently doesn't support ccache
Just disable it but keep everything in place for now.
2022-12-06 09:41:42 +01:00
Andreas Steffen
8329455628 testing: Check canonical OCSP/CRL serial numbers 2022-12-05 20:18:24 +01:00
Andreas Steffen
0d88c76abc unit-tests: Check encoding/retrieval of serial numbers 2022-12-05 20:18:24 +01:00
Andreas Steffen
18082ce2b0 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.
2022-12-05 20:18:24 +01:00
Tobias Brunner
cb5ae75ac1 github: Remove obsolete LGTM workflow
lgtm.com will be shutdown soon.
2022-12-05 16:49:07 +01:00
Tobias Brunner
0d3fcd100d github: Add CodeQL workflow 2022-12-05 16:49:07 +01:00
Tobias Brunner
b1482f5204 github: Fix path to Android lint report
Has a -debug suffix now.
2022-12-02 16:09:41 +01:00
Tobias Brunner
ef525ff980 github: Update GitHub-provided actions so they don't use deprecated Node.js 12 2022-12-02 16:09:41 +01:00
Tobias Brunner
0fea6a7f8e 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").
2022-12-02 16:09:04 +01:00
Tobias Brunner
7991871bd6 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.
2022-12-02 14:58:23 +01:00
Tobias Brunner
74e319c3f5 fuzz: Force make check to fail if fuzz target fails 2022-12-02 14:58:23 +01:00
Tobias Brunner
30cda14426 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).
2022-12-02 14:58:23 +01:00
Tobias Brunner
9628c771ad 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.
2022-12-02 14:57:55 +01:00
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 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 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
Tobias Brunner
ef68a7056b android: Update dependencies 2022-09-21 15:15:18 +02:00
Tobias Brunner
232623dd44 android: Set compile-/targetSdkVersion to 32 2022-09-21 15:15:18 +02:00
Tobias Brunner
9db90f8c26 android: Fix "Format string ... is not valid format string..." error
The linter complained that two of the strings don't actually contain any
printf-specifiers (i.e. don't expect any arguments) and therefore
shouldn't be used with String.format().
2022-09-21 15:15:18 +02:00
Tobias Brunner
563407e42a android: Mark PendingIntents as immutable via FLAG_IMMUTABLE
Setting this or explicitly FLAG_MUTABLE is required when targeting
Android 12.

References strongswan/strongswan#1151
2022-09-21 15:14:23 +02:00
Tobias Brunner
86b69f26e4 android: Explicitly mark Activities/Services with intent-filter as exported
Required when targeting Android 12.
2022-09-21 13:54:37 +02:00
Tobias Brunner
6ab9297b5d android: Move package namespace declaration from Manifest to build file 2022-09-21 13:54:37 +02:00
Tobias Brunner
a09727465c android: Remove unused jni directory spec from sourceSets 2022-09-21 13:54:37 +02:00
Tobias Brunner
cd698bf46b android: Update Gradle plugin 2022-09-21 13:54:37 +02:00
Tobias Brunner
357d680649 socket-win: Don't set SO_REUSEADDR on IKE sockets anymore
Same as the change for socket-default in a previous commit.
2022-09-21 13:53:44 +02:00
Tobias Brunner
5f9ad62a81 socket-dynamic: Don't set SO_REUSEADDR on IKE sockets anymore
Same as the previous commit.
2022-09-21 13:53:44 +02:00
Tobias Brunner
83da133712 socket-default: Don't set SO_REUSEADDR on IKE sockets anymore
This was originally required when pluto and charon both bound sockets to
the same port to send messages.  Pluto also received messages on them but
charon didn't and used a raw socket instead.  Since the removal of pluto
we don't need to set this option anymore, which might actually mask
mistakes like running charon and charon-systemd concurrently (that could
result in messages getting sent fine by both daemons but only received
by one).

Note that a failure to create/bind the sockets will not immediately
result in a shutdown of the daemon.  Instead, there will be an error
once the receiver tries to read any messages and also whenever the sender
attempts to send a request.
2022-09-21 13:53:44 +02:00
Tobias Brunner
0da8cae671 Merge branch 'eap-vendor-id'
Changes the type for EAP vendor IDs from uint32_t to pen_t, which has
explicitly been added to represent three-byte IANA-allocated Private
Enterprise Numbers (PEN), which the EAP RFC called "SMI Network
Management Private Enterprise Codes".

References strongswan/strongswan#581
2022-09-21 13:53:44 +02:00
Tobias Brunner
cdeb724839 eap: Make sure eap_type_t is large enough to hold vendor-specific types
Unless compiled with `-fshort-enumes` that's usually the case already.
2022-09-21 13:53:44 +02:00
Tobias Brunner
9efd7d7e90 eap: Print vendor (PEN) names for vendor-specific EAP methods 2022-09-21 13:53:44 +02:00
Tobias Brunner
f6e6fcd2f6 eap: Use pen_t instead of uint32_t for vendor ID 2022-09-21 13:53:44 +02:00
Andreas Steffen
8f5ff23d6c Version bump to 5.9.8dr4 2022-09-20 16:37:44 +02:00
Andreas Steffen
063ef084e4 pki: Base64 encoding of username:password in HTTP basic authentication 2022-09-20 11:07:33 +02:00
Martin Willi
a708e96906 pki: Always and implicitly use base64 encoding for EST requests/response
Content-Transfer-Encoding is actually not a valid HTTP header, but a MIME
header, and must not be used. The original RFC7030 specifies this wrong,
and an errata discusses this issue.

The use of base64 encoding has been clarified in RFC8951, and the
recommendation is to always use/expect base64 encoding, but not send/expect
the Content-Transfer-Encoding header.
2022-09-20 11:07:33 +02:00
Tobias Brunner
75d820de8b scepclient: Remove documentation about removal of scepclient
There should be no need for such a persistent documentation on a removed
component in the repository.  The commit history is enough.  And besides
that, there is user-facing documentation about it in the docs and the
changelog/NEWS.
2022-09-20 10:50:36 +02:00
Tobias Brunner
231df029b0 pki: Add SCEP utility functions and enums to Doxygen doc 2022-09-20 10:18:36 +02:00
Tobias Brunner
f21ef43b0c vici: Ignore NULL message in raise_event()
There are a lot of calls like this:

  this->dispatcher->raise_event(this->dispatcher, "...", 0,
                                b->finalize(b));

However, if finalize() fails, e.g. because a previous call to add()
failed due to the size limit, it returns NULL.  This then caused a
segmentation fault in raise_event() when it interacted with that value.

Closes strongswan/strongswan#1278
2022-09-20 10:15:13 +02:00
Tobias Brunner
33f5e23c4e Merge branch 'ike-sa-flush'
This fixes a race condition during shutdown between the main thread
flushing the IKE_SA manager and worker threads still creating IKE_SAs.

Closes strongswan/strongswan#1252
2022-09-20 10:09:59 +02:00
Tobias Brunner
2740c50bb8 ike-sa-manager: Make sure flush() removes entries that might get added concurrently
Because flush() has to release the segment locks intermittently, threads
might add new entries (even with the change in the previous commit as the
IKE_SA might already be created, just not registered/checked in yet).

Since those entries are added to the front of the segment lists, the
enumerator in the previous step 2 didn't notice them and did not wait
for them to get checked in.  However, step 3 and 4 then proceeded to
delete and destroy the entry and IKE_SA, which could lead to a crash
once the other thread attempts to check in the already destroyed IKE_SA.

This change combines the three loops of steps 2-4 but then loops over
the whole table until it's actually empty.  This way we wait for and
destroy newly added entries.
2022-09-20 10:06:14 +02:00
Tobias Brunner
6f456afe39 ike-sa-manager: Prevent new IKE_SA from getting created when flush() is called
Without ability to create SPIs, other threads are prevented from creating
new IKE_SAs while we are flushing existing IKE_SAs.  However, there could
still be IKE_SAs already created that might get checked in while the
segments are temporarily unlocked to wait for threads to check existing
SAs in.
2022-09-20 10:04:06 +02:00
Tobias Brunner
69995ed2c4 ike-sa: Always set ike_cfg_t when setting peer_cfg_t
This is more consistent and e.g. allows to properly take into account
some settings that are also relevant during IKE_AUTH (e.g. childless).

We also already use the peer_cfg_t's ike_cfg_t when rekeying,
reauthenticating and reestablishing an IKE_SA (and e.g. for DSCP).

Also changed are some IKEv1 cases where get_ike_cfg() is called before
set_peer_cfg() without taking a reference to the ike_cfg_t that might
get replaced/destroyed (none of the cases were problematic, though, but
it also wasn't necessary to keep the ike_cfg_t around).

Closes strongswan/strongswan#1238
2022-09-20 10:03:02 +02:00
Tobias Brunner
48e9267d7a cred-encoding: Avoid potential use after free when caching encodings
The pattern currently is to call get_cache(), generate the encoding
if that failed and then store it with cache().  The latter adopts the
passed encoding and frees any stored encoding.  However, the latter means
that if two threads concurrently fail to get a cached encoding and then
both generate and store one, one of the threads might use an encoding
that was freed by the other thread.

Since encodings are not expected to change, we can avoid this issue by
not replacing an existing cache entry and instead return that (while
freeing the passed value instead of the cached one).

Closes strongswan/strongswan#1231
2022-09-20 09:53:13 +02:00
Tobias Brunner
724b1a8ae8 kernel-pfkey: Increase debug level of the "querying ..." log messages
References strongswan/strongswan#1271
2022-09-16 16:46:45 +02:00
Noel Kuntze
cf16556248 kernel-netlink: Increase debug level of the "querying [...]" log messages
When watching the output of `swanctl -l` during debugging, the debug
messages in query_sa/policy() cause a lot of noise in the logs (level 2
for DBG_KNL still has actually useful information that we want to see
in the logs) and they're not very useful.

Compared to the messages in the functions above, the ones in update_sa()
and get_replay_state() are not seen often. But since there already is a
log message on level 2 in update_sa(), they're kinda redundant.

Closes strongswan/strongswan#1271
2022-09-16 16:40:06 +02:00
Tobias Brunner
88c80df6f4 Merge branch 'asan'
Enables AddressSanitizer in most CI builds that don't use leak-detective.
For custom builds it can easily be enabled via --enable-asan.
2022-09-16 15:28:16 +02:00
Tobias Brunner
d29af802bb github: Enable AddressSanitizer if leak-detective is disabled
At least for the tests where it is available and works.  It conflicts
with the instrumentation used by the coverage and fuzzing (and possibly
sonarcloud) tests, the toolchain for the Windows builds doesn't seem to
support it, and on FreeBSD the test executables hang due to a
compatibility issue with FreeBSD's qsort(), which has been fixed [1],
but that has not made it into the clang version in the base system.

For the custom OpenSSL build, debug symbols are enabled so we can
suppress some leaks properly.

[1] https://github.com/llvm/llvm-project/issues/46176
2022-09-16 15:26:43 +02:00
Tobias Brunner
8a57c2ab52 configure: Add an option to build with AddressSanitizer 2022-09-15 18:23:57 +02:00
Tobias Brunner
c4563abc2e github: Use OpenSSL 3.0.5 for tests 2022-09-15 12:16:12 +02:00
Tobias Brunner
a7e8cb8f61 tun-device: Fix compiler warning
Only the second was reported by the compiler (depending on the version
and similarly to the previous commit only with AddressSanitizer active).
The strncpy() call for UTUN_CONTROL_NAME was simply wrong.
2022-09-15 12:16:12 +02:00
Tobias Brunner
eab9cd8661 kernel-netlink: Fix compiler warnings with strncpy()
Normally, GCC sees that we terminate the destination with a zero byte.
However, when using `-fsanitize=address`, there seems to be additional
instrumentation code after strncpy() so GCC produces warnings like
these:

‘__builtin_strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
2022-09-15 12:16:12 +02:00
Tobias Brunner
ae9d110dd9 configure: Log if -Werror is enabled 2022-09-15 12:16:12 +02:00
Tobias Brunner
c9c8911478 unit-tests: Don't link files from libimcv into the test executable
This causes odr-violation errors with libasan as some symbols will be
defined twice, once in the linked libimcv and once in the test
executable itself.
2022-09-15 12:16:12 +02:00
Thomas Egerer
996f557c40 unit-tests: Use allocated listener instead of stack object in exchange tests
When using the statement expression and a stack object along with
clang-11 and libasan, we get quite a lot of errors about reading
invalid memory. This is due to clang making the actual listener_t local
to the block, such that the access outside of the macros using
_assert_payload is (correctly) considered an error.
By using a heap allocated object, we can destroy it once the listener
returns FALSE (cleaning up properly), and since bus_t does not touch the
listener after that, we don't get any errors from libasan.

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2022-09-15 12:16:12 +02:00
Tobias Brunner
bdc7f84a23 unit-tests: Don't use test data on stack for TLS socket tests
The stack of that function might not be valid anymore once data is read.
2022-09-15 12:16:12 +02:00
Tobias Brunner
80b2c6cdc5 gcrypt: Return correct IV length (0) for ECB mode 2022-09-15 12:16:12 +02:00
Tobias Brunner
7217ff5fc5 aesni: Fix out-of-bound read when loading 192-bit AES keys 2022-09-15 12:16:12 +02:00
Tobias Brunner
f2456376ae ike-rekey: Correctly destroy colliding rekey task
Using DESTROY_IF() this way doesn't correctly check if the pointer
is set.

Fixes: 7ffeed01c0d7 ("ike-rekey: Remove collision task type checks")
2022-09-15 12:16:12 +02:00
Tobias Brunner
5eeeb894d1 test-runner: Clean up collected run times 2022-09-15 12:16:12 +02:00
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
a345e635c4 Version bumpt to 5.9.8dr3 2022-09-07 06:38:42 +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
Andreas Steffen
bf3f678551 testing: Fixed two issues 2022-09-06 21:14:07 +02:00
Tobias Brunner
f4931ce7e6 testing: Add missing kernel config for 5.19
The config went missing when 057b3806aad4 ("Version bump to 5.9.8dr1")
changed the default kernel version.
2022-09-06 16:56:31 +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
Boi Sletterink
c6b6ad8d89 testing: Add missing css dir to distribution tarballs
Add the css dir to the EXTRA_DIST variable in the Makefile for the test
environment. This dir was missing when generating distribution tarballs.
Adding it enables successful builds of the test environment from the
dist tarballs.

Fixes: 63f35993d9fb ("testing: Use sans-serif font for test results")
Closes strongswan/strongswan#1266
2022-09-06 09:49:45 +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
73f6047a77 conf: Remove config snippet for scepclient 2022-09-06 09:33:00 +02:00
Tobias Brunner
c9ccec9bc3 configure: Remove AC_SUBST for unused variable 2022-09-06 09:33:00 +02:00
Tobias Brunner
7bc491a7fa android: Remove scepclient from old top-level Android.mk 2022-09-06 09:33:00 +02:00
Tobias Brunner
73901d2cc3 github: Remove --enable-scepclient from macOS build options 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 9664ef4ba60f ("libtls: Fixed encoding of TLS 1.3 certificate
extension") but for the server.
2022-09-06 09:33:00 +02:00
Tobias Brunner
023070b6d0 Use wolfSSL 5.5.0 for tests 2022-09-06 09:33:00 +02:00
Andreas Steffen
af3b8c49c5 Version bump to 5.9.8dr2 2022-09-02 06:32:13 +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
057b3806aa Version bump to 5.9.8dr1 2022-08-26 12:32:04 +02:00
Andreas Steffen
e4cb9a59d2 testing: Fixed typo of mfg1 to mgf1 plugin 2022-08-26 12:31:33 +02:00
Andreas Steffen
74893da403 Merge branch 'pki-scep' 2022-08-26 12:19:17 +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
77a15f55be libtls: unit tests with crypto libs need additional plugins
In order for libtls to run with the gcrypt libraryi, additionally the
random, pem, gcm, hmac, kdf, x509, constraints, and the curve2519
plugins are needed.

The botan library additionally need the hmac (for HMAC_MD5), x509 and
constraints plugins.

The wolfssl library additionally need the pkcs1, pkcs8, x509 and constraints
plugins.
2022-08-25 10:51:05 +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
71b0c031c2 android: Slightly increase NDK version
This version was installed in the base image until Aug 1st (the other we
installed was not actually used for a while).
2022-08-18 09:42:34 +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
Andreas Steffen
49ddfe91f0 Version bump to 5.9.7 2022-07-29 06:54:09 +02:00
Tobias Brunner
80dec436ce NEWS: Add news for 5.9.7 2022-07-26 15:58:33 +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
Andreas Steffen
1e444454e1 Version bump to 5.9.7rc1 2022-07-23 14:38:36 +02:00
Andreas Steffen
c01d765c11 testing: Increased memory of KVM instance sun 2022-07-23 14:36:50 +02:00
Andreas Steffen
67f7d8fe8a testing: Replace deprecated tempfile command by mktemp 2022-07-23 11:28:08 +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
Tobias Brunner
833333eae9 child-cfg: Skip non-matching TS instead of replacing them for transport mode
get_traffic_selectors() is called the same way also as responder when
selecting child configs via peer_cfg_t::select_child_cfg().  Replacing
TS for all child configs could lead to selecting one that later fails
to actually narrow the traffic selectors.  Ignoring non-matching TS also
helps if we have a trap config with multiple remote subnets (otherwise,
we'd have to filter duplicates afterwards).

When installing traps, the hosts might be %any, in which case we allow
the configured (technically non-matching) TS for the wildcard use case.

Fixes: da82786b2d8c ("child-cfg: Always apply hosts to traffic selectors if proposing transport mode")
Closes strongswan/strongswan#1143
2022-07-18 12:44:20 +02:00
Tobias Brunner
1f242e772b configure: Add option to build with extended compiler warnings and -Werror
Setting -Werror in CFLAGS passed to configure is not ideal as that affects
all the checks performed by the script.

This caused an issue with newer versions of Autoconf and the AC_PROG_LEX
macro that insisted on finding a lexer library.  But due to warnings from
the generated test lexer (misleading indentation) that got turned into
errors no library was found (none would have been necessary), so LEX was
not set and no lexers were built.

With this option enabled, we add -Werror to CFLAGS after all tests ran.
It also enables additional warnings via -Wextra.

The option is auto-enabled when building from the repository.
2022-07-18 12:42:24 +02:00
Tobias Brunner
9c86787de5 libfast: Fix incompatible function types warning 2022-07-18 12:42:24 +02:00
Tobias Brunner
36d16e5b24 forecast: Fix incompatible function types warning 2022-07-18 12:42:24 +02:00
Tobias Brunner
b37a3e249a test-runner: Fix compiler warning
Making the variable volatile avoids a "variable ‘failure’ might be
clobbered by ‘longjmp’" warning (or error when compiling with
-Werror) that's triggered via -Wextra.
2022-07-18 12:42:24 +02:00
Tobias Brunner
1656e3806b configure: Add noyywrap option to AC_PROG_LEX for Autoconf 2.70+
FreeBSD packages 2.71 and that spits out a deprecation warning if we
don't set this.
2022-07-18 12:42:24 +02:00
Tobias Brunner
eae30af029 Use wolfSSL 5.4.0 for tests
The 5.4.0 update changed the default bignum implementation to what
could explicitly be enabled via `--enable-sp-math-all`.  Since this uses
fixed-sized buffers sufficient for key sizes of SP_INT_BITS, with a default
of 4096, modp6144 and modp8192 didn't work anymore (wc_DhGenerateKeyPair()
returned MP_EXPTMOD_E).  So we have to adapt the feature checks for this.

To support the larger DH groups we can either increase the buffer size
via `--with-max-rsa-bits` or add `--enable-heapmath` so buffers get
(re-)allocated as needed.  We go with the latter for now.
2022-07-18 12:42:24 +02:00
Andreas Steffen
110e8e6608 doc: Removed the standards directory
This collection of Internet standards and drafts hadn't been
updated for a long time and the documents are readily available
on the Internet anyway. The strongSwan documentation page

  https://docs.strongswan.org/docs/5.9/features/ietf.html

specifies which standards are currently supported.
2022-07-12 10:24:42 +02:00
Andreas Steffen
2b474073d9 pem: Support PEM-encoded PKCS#7 container 2022-07-06 20:38:00 +02:00
2703 changed files with 101530 additions and 86771 deletions

View File

@ -30,8 +30,8 @@ install:
IF "%IMG%" == "2019" set OPENSSL=OpenSSL-v111
set OPENSSL_DIR=/c/%OPENSSL%-%TEST%
C:\%OPENSSL%-%TEST%\bin\openssl.exe version -a
# newer versions of msys2 don't provide autotools via base-devel anymore
- IF "%IMG%" == "2019" %MSYS_SH% --login -c ". /etc/profile && pacman --noconfirm -S --needed autotools"
# newer versions of msys2 don't provide autotools or gperf via base-devel anymore
- IF "%IMG%" == "2019" %MSYS_SH% --login -c ". /etc/profile && pacman --noconfirm -S --needed autotools gperf"
build_script:
- '%MSYS_SH% --login -c ". /etc/profile && cd $APPVEYOR_BUILD_FOLDER && ./scripts/test.sh deps"'

View File

@ -1,11 +1,11 @@
task:
freebsd_task:
matrix:
- name: FreeBSD 13.0
- name: FreeBSD 14.2
freebsd_instance:
image_family: freebsd-13-0
- name: FreeBSD 12.3
image_family: freebsd-14-2
- name: FreeBSD 13.4
freebsd_instance:
image_family: freebsd-12-3
image_family: freebsd-13-4
env:
TESTS_REDUCED_KEYLENGTHS: yes
@ -16,3 +16,18 @@ task:
install_script: ./scripts/test.sh deps
script: ./scripts/test.sh
alpine_task:
container:
image: alpine:latest
env:
TESTS_REDUCED_KEYLENGTHS: yes
TESTS_NO_IPV6: yes
LEAK_DETECTIVE: no
MONOLITHIC: no
TEST: alpine
OS_NAME: alpine
install_script: ./scripts/test.sh deps
script: ./scripts/test.sh

View File

@ -1,3 +1,3 @@
ignore:
- "*/suites/*"
- "*/tests/*"
- "**/suites/"
- "**/tests/"

View File

@ -2,6 +2,7 @@
name: "🐛 Bug report"
about: Report a reproducible bug or regression
labels: bug, new
type: Bug
---
<!--

View File

@ -2,6 +2,7 @@
name: Feature request
about: Suggest an idea for this project
labels: enhancement, new
type: Feature
---
<!--

View File

@ -5,9 +5,6 @@ runs:
- name: "Install Dependencies"
run: ./scripts/test.sh deps
shell: bash
- name: "Install Python Dependencies"
run: ./scripts/test.sh pydeps
shell: bash
- name: "Build Dependencies"
run: ./scripts/test.sh build-deps
shell: bash

102
.github/active-transforms/botan vendored Normal file
View File

@ -0,0 +1,102 @@
AES_ECB[botan]
AES_ECB[botan]
AES_ECB[botan]
AES_CBC[botan]
AES_CBC[botan]
AES_CBC[botan]
AES_CFB[botan]
AES_CFB[botan]
AES_CFB[botan]
AES_GCM_16[botan]
AES_GCM_16[botan]
AES_GCM_16[botan]
AES_GCM_12[botan]
AES_GCM_12[botan]
AES_GCM_12[botan]
AES_GCM_8[botan]
AES_GCM_8[botan]
AES_GCM_8[botan]
AES_CCM_16[botan]
AES_CCM_16[botan]
AES_CCM_16[botan]
AES_CCM_12[botan]
AES_CCM_12[botan]
AES_CCM_12[botan]
AES_CCM_8[botan]
AES_CCM_8[botan]
AES_CCM_8[botan]
CHACHA20_POLY1305[botan]
HMAC_SHA1_96[botan]
HMAC_SHA1_96[hmac]
HMAC_SHA1_128[botan]
HMAC_SHA1_128[hmac]
HMAC_SHA1_160[botan]
HMAC_SHA1_160[hmac]
HMAC_SHA2_256_128[botan]
HMAC_SHA2_256_128[hmac]
HMAC_SHA2_256_256[botan]
HMAC_SHA2_256_256[hmac]
HMAC_SHA2_384_192[botan]
HMAC_SHA2_384_192[hmac]
HMAC_SHA2_384_384[botan]
HMAC_SHA2_384_384[hmac]
HMAC_SHA2_512_256[botan]
HMAC_SHA2_512_256[hmac]
HMAC_SHA2_512_512[botan]
HMAC_SHA2_512_512[hmac]
HMAC_MD5_96[hmac]
HMAC_MD5_128[hmac]
HASH_MD5[botan]
HASH_SHA1[botan]
HASH_SHA2_224[botan]
HASH_SHA2_256[botan]
HASH_SHA2_384[botan]
HASH_SHA2_512[botan]
HASH_SHA3_224[botan]
HASH_SHA3_256[botan]
HASH_SHA3_384[botan]
HASH_SHA3_512[botan]
HASH_IDENTITY[botan]
PRF_HMAC_SHA1[botan]
PRF_HMAC_SHA1[hmac]
PRF_HMAC_SHA2_256[botan]
PRF_HMAC_SHA2_256[hmac]
PRF_HMAC_SHA2_384[botan]
PRF_HMAC_SHA2_384[hmac]
PRF_HMAC_SHA2_512[botan]
PRF_HMAC_SHA2_512[hmac]
PRF_HMAC_MD5[hmac]
KDF_PRF[botan]
KDF_PRF_PLUS[botan]
DRBG_CTR_AES256[drbg]
DRBG_CTR_AES128[drbg]
DRBG_CTR_AES192[drbg]
DRBG_HMAC_SHA1[drbg]
DRBG_HMAC_SHA256[drbg]
DRBG_HMAC_SHA384[drbg]
DRBG_HMAC_SHA512[drbg]
RNG_WEAK[botan]
RNG_STRONG[botan]
RNG_TRUE[botan]
MODP_3072[botan]
MODP_4096[botan]
MODP_6144[botan]
MODP_8192[botan]
MODP_2048[botan]
MODP_2048_224[botan]
MODP_2048_256[botan]
MODP_1536[botan]
MODP_1024[botan]
MODP_1024_160[botan]
MODP_768[botan]
MODP_CUSTOM[botan]
ECP_256[botan]
ECP_384[botan]
ECP_521[botan]
ECP_256_BP[botan]
ECP_384_BP[botan]
ECP_512_BP[botan]
CURVE_25519[botan]
ML_KEM_512[botan]
ML_KEM_768[botan]
ML_KEM_1024[botan]

81
.github/active-transforms/gcrypt vendored Normal file
View File

@ -0,0 +1,81 @@
AES_CTR[gcrypt]
AES_CTR[gcrypt]
AES_CTR[gcrypt]
AES_CBC[gcrypt]
AES_CBC[gcrypt]
AES_CBC[gcrypt]
AES_ECB[gcrypt]
AES_ECB[gcrypt]
AES_ECB[gcrypt]
AES_CFB[gcrypt]
AES_CFB[gcrypt]
AES_CFB[gcrypt]
BLOWFISH_CBC[gcrypt]
CAMELLIA_CTR[gcrypt]
CAMELLIA_CTR[gcrypt]
CAMELLIA_CTR[gcrypt]
CAMELLIA_CBC[gcrypt]
CAMELLIA_CBC[gcrypt]
CAMELLIA_CBC[gcrypt]
CAST_CBC[gcrypt]
3DES_CBC[gcrypt]
DES_CBC[gcrypt]
DES_ECB[gcrypt]
SERPENT_CBC[gcrypt]
SERPENT_CBC[gcrypt]
SERPENT_CBC[gcrypt]
TWOFISH_CBC[gcrypt]
TWOFISH_CBC[gcrypt]
AES_GCM_8[gcm]
AES_GCM_8[gcm]
AES_GCM_8[gcm]
AES_GCM_12[gcm]
AES_GCM_12[gcm]
AES_GCM_12[gcm]
AES_GCM_16[gcm]
AES_GCM_16[gcm]
AES_GCM_16[gcm]
HMAC_SHA1_96[hmac]
HMAC_SHA1_128[hmac]
HMAC_SHA1_160[hmac]
HMAC_MD5_96[hmac]
HMAC_MD5_128[hmac]
HMAC_SHA2_256_128[hmac]
HMAC_SHA2_256_256[hmac]
HMAC_SHA2_384_192[hmac]
HMAC_SHA2_384_384[hmac]
HMAC_SHA2_512_256[hmac]
HMAC_SHA2_512_512[hmac]
HASH_MD4[gcrypt]
HASH_MD5[gcrypt]
HASH_SHA1[gcrypt]
HASH_SHA2_224[gcrypt]
HASH_SHA2_256[gcrypt]
HASH_SHA2_384[gcrypt]
HASH_SHA2_512[gcrypt]
HASH_IDENTITY[curve25519]
PRF_HMAC_SHA1[hmac]
PRF_HMAC_MD5[hmac]
PRF_HMAC_SHA2_256[hmac]
PRF_HMAC_SHA2_384[hmac]
PRF_HMAC_SHA2_512[hmac]
KDF_PRF[kdf]
KDF_PRF_PLUS[kdf]
RNG_WEAK[gcrypt]
RNG_STRONG[gcrypt]
RNG_STRONG[random]
RNG_TRUE[gcrypt]
RNG_TRUE[random]
MODP_3072[gcrypt]
MODP_4096[gcrypt]
MODP_6144[gcrypt]
MODP_8192[gcrypt]
MODP_2048[gcrypt]
MODP_2048_224[gcrypt]
MODP_2048_256[gcrypt]
MODP_1536[gcrypt]
MODP_1024[gcrypt]
MODP_1024_160[gcrypt]
MODP_768[gcrypt]
MODP_CUSTOM[gcrypt]
CURVE_25519[curve25519]

108
.github/active-transforms/openssl vendored Normal file
View File

@ -0,0 +1,108 @@
AES_ECB[openssl]
AES_ECB[openssl]
AES_ECB[openssl]
AES_CBC[openssl]
AES_CBC[openssl]
AES_CBC[openssl]
AES_CTR[openssl]
AES_CTR[openssl]
AES_CTR[openssl]
AES_CFB[openssl]
AES_CFB[openssl]
AES_CFB[openssl]
CAMELLIA_CBC[openssl]
CAMELLIA_CBC[openssl]
CAMELLIA_CBC[openssl]
CAMELLIA_CTR[openssl]
CAMELLIA_CTR[openssl]
CAMELLIA_CTR[openssl]
CAST_CBC[openssl]
BLOWFISH_CBC[openssl]
3DES_CBC[openssl]
DES_CBC[openssl]
DES_ECB[openssl]
NULL[openssl]
AES_GCM_16[openssl]
AES_GCM_16[openssl]
AES_GCM_16[openssl]
AES_GCM_12[openssl]
AES_GCM_12[openssl]
AES_GCM_12[openssl]
AES_GCM_8[openssl]
AES_GCM_8[openssl]
AES_GCM_8[openssl]
AES_CCM_16[openssl]
AES_CCM_16[openssl]
AES_CCM_16[openssl]
AES_CCM_12[openssl]
AES_CCM_12[openssl]
AES_CCM_12[openssl]
AES_CCM_8[openssl]
AES_CCM_8[openssl]
AES_CCM_8[openssl]
CHACHA20_POLY1305[openssl]
HMAC_MD5_96[openssl]
HMAC_MD5_128[openssl]
HMAC_SHA1_96[openssl]
HMAC_SHA1_128[openssl]
HMAC_SHA1_160[openssl]
HMAC_SHA2_256_128[openssl]
HMAC_SHA2_256_256[openssl]
HMAC_SHA2_384_192[openssl]
HMAC_SHA2_384_384[openssl]
HMAC_SHA2_512_256[openssl]
HMAC_SHA2_512_512[openssl]
HASH_MD4[openssl]
HASH_MD5[openssl]
HASH_SHA1[openssl]
HASH_SHA2_224[openssl]
HASH_SHA2_256[openssl]
HASH_SHA2_384[openssl]
HASH_SHA2_512[openssl]
HASH_SHA3_224[openssl]
HASH_SHA3_256[openssl]
HASH_SHA3_384[openssl]
HASH_SHA3_512[openssl]
HASH_IDENTITY[openssl]
PRF_KEYED_SHA1[openssl]
PRF_HMAC_MD5[openssl]
PRF_HMAC_SHA1[openssl]
PRF_HMAC_SHA2_256[openssl]
PRF_HMAC_SHA2_384[openssl]
PRF_HMAC_SHA2_512[openssl]
XOF_SHAKE128[openssl]
XOF_SHAKE256[openssl]
KDF_PRF[openssl]
KDF_PRF_PLUS[openssl]
DRBG_CTR_AES256[drbg]
DRBG_CTR_AES128[drbg]
DRBG_CTR_AES192[drbg]
DRBG_HMAC_SHA1[drbg]
DRBG_HMAC_SHA256[drbg]
DRBG_HMAC_SHA384[drbg]
DRBG_HMAC_SHA512[drbg]
RNG_WEAK[openssl]
RNG_STRONG[openssl]
MODP_3072[openssl]
MODP_4096[openssl]
MODP_6144[openssl]
MODP_8192[openssl]
MODP_2048[openssl]
MODP_2048_224[openssl]
MODP_2048_256[openssl]
MODP_1536[openssl]
MODP_1024[openssl]
MODP_1024_160[openssl]
MODP_768[openssl]
MODP_CUSTOM[openssl]
ECP_256[openssl]
ECP_384[openssl]
ECP_521[openssl]
ECP_224[openssl]
ECP_192[openssl]
ECP_256_BP[openssl]
ECP_384_BP[openssl]
ECP_512_BP[openssl]
ECP_224_BP[openssl]
CURVE_25519[openssl]
CURVE_448[openssl]

111
.github/active-transforms/openssl-3 vendored Normal file
View File

@ -0,0 +1,111 @@
AES_ECB[openssl]
AES_ECB[openssl]
AES_ECB[openssl]
AES_CBC[openssl]
AES_CBC[openssl]
AES_CBC[openssl]
AES_CTR[openssl]
AES_CTR[openssl]
AES_CTR[openssl]
AES_CFB[openssl]
AES_CFB[openssl]
AES_CFB[openssl]
CAMELLIA_CBC[openssl]
CAMELLIA_CBC[openssl]
CAMELLIA_CBC[openssl]
CAMELLIA_CTR[openssl]
CAMELLIA_CTR[openssl]
CAMELLIA_CTR[openssl]
CAST_CBC[openssl]
BLOWFISH_CBC[openssl]
3DES_CBC[openssl]
DES_CBC[openssl]
DES_ECB[openssl]
NULL[openssl]
AES_GCM_16[openssl]
AES_GCM_16[openssl]
AES_GCM_16[openssl]
AES_GCM_12[openssl]
AES_GCM_12[openssl]
AES_GCM_12[openssl]
AES_GCM_8[openssl]
AES_GCM_8[openssl]
AES_GCM_8[openssl]
AES_CCM_16[openssl]
AES_CCM_16[openssl]
AES_CCM_16[openssl]
AES_CCM_12[openssl]
AES_CCM_12[openssl]
AES_CCM_12[openssl]
AES_CCM_8[openssl]
AES_CCM_8[openssl]
AES_CCM_8[openssl]
CHACHA20_POLY1305[openssl]
HMAC_MD5_96[openssl]
HMAC_MD5_128[openssl]
HMAC_SHA1_96[openssl]
HMAC_SHA1_128[openssl]
HMAC_SHA1_160[openssl]
HMAC_SHA2_256_128[openssl]
HMAC_SHA2_256_256[openssl]
HMAC_SHA2_384_192[openssl]
HMAC_SHA2_384_384[openssl]
HMAC_SHA2_512_256[openssl]
HMAC_SHA2_512_512[openssl]
HASH_MD4[openssl]
HASH_MD5[openssl]
HASH_SHA1[openssl]
HASH_SHA2_224[openssl]
HASH_SHA2_256[openssl]
HASH_SHA2_384[openssl]
HASH_SHA2_512[openssl]
HASH_SHA3_224[openssl]
HASH_SHA3_256[openssl]
HASH_SHA3_384[openssl]
HASH_SHA3_512[openssl]
HASH_IDENTITY[openssl]
PRF_KEYED_SHA1[openssl]
PRF_HMAC_MD5[openssl]
PRF_HMAC_SHA1[openssl]
PRF_HMAC_SHA2_256[openssl]
PRF_HMAC_SHA2_384[openssl]
PRF_HMAC_SHA2_512[openssl]
XOF_SHAKE128[openssl]
XOF_SHAKE256[openssl]
KDF_PRF[openssl]
KDF_PRF_PLUS[openssl]
DRBG_CTR_AES256[drbg]
DRBG_CTR_AES128[drbg]
DRBG_CTR_AES192[drbg]
DRBG_HMAC_SHA1[drbg]
DRBG_HMAC_SHA256[drbg]
DRBG_HMAC_SHA384[drbg]
DRBG_HMAC_SHA512[drbg]
RNG_WEAK[openssl]
RNG_STRONG[openssl]
MODP_3072[openssl]
MODP_4096[openssl]
MODP_6144[openssl]
MODP_8192[openssl]
MODP_2048[openssl]
MODP_2048_224[openssl]
MODP_2048_256[openssl]
MODP_1536[openssl]
MODP_1024[openssl]
MODP_1024_160[openssl]
MODP_768[openssl]
MODP_CUSTOM[openssl]
ML_KEM_512[openssl]
ML_KEM_768[openssl]
ML_KEM_1024[openssl]
ECP_256[openssl]
ECP_384[openssl]
ECP_521[openssl]
ECP_224[openssl]
ECP_192[openssl]
ECP_256_BP[openssl]
ECP_384_BP[openssl]
ECP_512_BP[openssl]
ECP_224_BP[openssl]
CURVE_25519[openssl]
CURVE_448[openssl]

98
.github/active-transforms/openssl-awslc vendored Normal file
View File

@ -0,0 +1,98 @@
AES_ECB[openssl]
AES_ECB[openssl]
AES_ECB[openssl]
AES_CBC[openssl]
AES_CBC[openssl]
AES_CBC[openssl]
AES_CTR[openssl]
AES_CTR[openssl]
AES_CTR[openssl]
AES_CFB[openssl]
AES_CFB[openssl]
AES_CFB[openssl]
BLOWFISH_CBC[openssl]
3DES_CBC[openssl]
DES_CBC[openssl]
DES_ECB[openssl]
NULL[openssl]
AES_GCM_16[openssl]
AES_GCM_16[openssl]
AES_GCM_16[openssl]
AES_GCM_12[openssl]
AES_GCM_12[openssl]
AES_GCM_12[openssl]
AES_GCM_8[openssl]
AES_GCM_8[openssl]
AES_GCM_8[openssl]
AES_CCM_16[openssl]
AES_CCM_16[openssl]
AES_CCM_16[openssl]
AES_CCM_12[openssl]
AES_CCM_12[openssl]
AES_CCM_12[openssl]
AES_CCM_8[openssl]
AES_CCM_8[openssl]
AES_CCM_8[openssl]
CHACHA20_POLY1305[openssl]
HMAC_MD5_96[openssl]
HMAC_MD5_128[openssl]
HMAC_SHA1_96[openssl]
HMAC_SHA1_128[openssl]
HMAC_SHA1_160[openssl]
HMAC_SHA2_256_128[openssl]
HMAC_SHA2_256_256[openssl]
HMAC_SHA2_384_192[openssl]
HMAC_SHA2_384_384[openssl]
HMAC_SHA2_512_256[openssl]
HMAC_SHA2_512_512[openssl]
HASH_MD4[openssl]
HASH_MD5[openssl]
HASH_SHA1[openssl]
HASH_SHA2_224[openssl]
HASH_SHA2_256[openssl]
HASH_SHA2_384[openssl]
HASH_SHA2_512[openssl]
HASH_SHA3_224[openssl]
HASH_SHA3_256[openssl]
HASH_SHA3_384[openssl]
HASH_SHA3_512[openssl]
HASH_IDENTITY[openssl]
PRF_KEYED_SHA1[openssl]
PRF_HMAC_MD5[openssl]
PRF_HMAC_SHA1[openssl]
PRF_HMAC_SHA2_256[openssl]
PRF_HMAC_SHA2_384[openssl]
PRF_HMAC_SHA2_512[openssl]
XOF_SHAKE128[openssl]
XOF_SHAKE256[openssl]
KDF_PRF[openssl]
KDF_PRF_PLUS[openssl]
DRBG_CTR_AES256[drbg]
DRBG_CTR_AES128[drbg]
DRBG_CTR_AES192[drbg]
DRBG_HMAC_SHA1[drbg]
DRBG_HMAC_SHA256[drbg]
DRBG_HMAC_SHA384[drbg]
DRBG_HMAC_SHA512[drbg]
RNG_WEAK[openssl]
RNG_STRONG[openssl]
MODP_3072[openssl]
MODP_4096[openssl]
MODP_6144[openssl]
MODP_8192[openssl]
MODP_2048[openssl]
MODP_2048_224[openssl]
MODP_2048_256[openssl]
MODP_1536[openssl]
MODP_1024[openssl]
MODP_1024_160[openssl]
MODP_768[openssl]
MODP_CUSTOM[openssl]
ML_KEM_512[openssl]
ML_KEM_768[openssl]
ML_KEM_1024[openssl]
ECP_256[openssl]
ECP_384[openssl]
ECP_521[openssl]
ECP_224[openssl]
CURVE_25519[openssl]

103
.github/active-transforms/wolfssl vendored Normal file
View File

@ -0,0 +1,103 @@
AES_ECB[wolfssl]
AES_ECB[wolfssl]
AES_ECB[wolfssl]
AES_CTR[wolfssl]
AES_CTR[wolfssl]
AES_CTR[wolfssl]
AES_CBC[wolfssl]
AES_CBC[wolfssl]
AES_CBC[wolfssl]
AES_CFB[wolfssl]
AES_CFB[wolfssl]
AES_CFB[wolfssl]
CAMELLIA_CBC[wolfssl]
CAMELLIA_CBC[wolfssl]
CAMELLIA_CBC[wolfssl]
3DES_CBC[wolfssl]
DES_CBC[wolfssl]
DES_ECB[wolfssl]
NULL[wolfssl]
AES_GCM_16[wolfssl]
AES_GCM_16[wolfssl]
AES_GCM_16[wolfssl]
AES_GCM_12[wolfssl]
AES_GCM_12[wolfssl]
AES_GCM_12[wolfssl]
AES_GCM_8[wolfssl]
AES_GCM_8[wolfssl]
AES_GCM_8[wolfssl]
AES_CCM_16[wolfssl]
AES_CCM_16[wolfssl]
AES_CCM_16[wolfssl]
AES_CCM_12[wolfssl]
AES_CCM_12[wolfssl]
AES_CCM_12[wolfssl]
AES_CCM_8[wolfssl]
AES_CCM_8[wolfssl]
AES_CCM_8[wolfssl]
CHACHA20_POLY1305[wolfssl]
HMAC_MD5_96[wolfssl]
HMAC_MD5_128[wolfssl]
HMAC_SHA1_96[wolfssl]
HMAC_SHA1_128[wolfssl]
HMAC_SHA1_160[wolfssl]
HMAC_SHA2_256_128[wolfssl]
HMAC_SHA2_256_256[wolfssl]
HMAC_SHA2_384_192[wolfssl]
HMAC_SHA2_384_384[wolfssl]
HMAC_SHA2_512_256[wolfssl]
HMAC_SHA2_512_512[wolfssl]
HASH_MD5[wolfssl]
HASH_SHA1[wolfssl]
HASH_SHA2_224[wolfssl]
HASH_SHA2_256[wolfssl]
HASH_SHA2_384[wolfssl]
HASH_SHA2_512[wolfssl]
HASH_SHA3_224[wolfssl]
HASH_SHA3_256[wolfssl]
HASH_SHA3_384[wolfssl]
HASH_SHA3_512[wolfssl]
HASH_IDENTITY[wolfssl]
PRF_KEYED_SHA1[wolfssl]
PRF_HMAC_MD5[wolfssl]
PRF_HMAC_SHA1[wolfssl]
PRF_HMAC_SHA2_256[wolfssl]
PRF_HMAC_SHA2_384[wolfssl]
PRF_HMAC_SHA2_512[wolfssl]
XOF_SHAKE256[wolfssl]
KDF_PRF[wolfssl]
KDF_PRF_PLUS[wolfssl]
DRBG_CTR_AES256[drbg]
DRBG_CTR_AES128[drbg]
DRBG_CTR_AES192[drbg]
DRBG_HMAC_SHA1[drbg]
DRBG_HMAC_SHA256[drbg]
DRBG_HMAC_SHA384[drbg]
DRBG_HMAC_SHA512[drbg]
RNG_WEAK[wolfssl]
RNG_STRONG[wolfssl]
ECP_256[wolfssl]
ECP_384[wolfssl]
ECP_521[wolfssl]
ECP_224[wolfssl]
ECP_256_BP[wolfssl]
ECP_384_BP[wolfssl]
ECP_512_BP[wolfssl]
ECP_224_BP[wolfssl]
MODP_3072[wolfssl]
MODP_4096[wolfssl]
MODP_6144[wolfssl]
MODP_8192[wolfssl]
MODP_2048[wolfssl]
MODP_2048_224[wolfssl]
MODP_2048_256[wolfssl]
MODP_1536[wolfssl]
MODP_1024[wolfssl]
MODP_1024_160[wolfssl]
MODP_768[wolfssl]
MODP_CUSTOM[wolfssl]
ML_KEM_512[wolfssl]
ML_KEM_768[wolfssl]
ML_KEM_1024[wolfssl]
CURVE_25519[wolfssl]
CURVE_448[wolfssl]

11
.github/codeql/config.yml vendored Normal file
View File

@ -0,0 +1,11 @@
queries:
- uses: ./.github/codeql/cpp-queries
query-filters:
# don't explicitly point out FIXME comments
- exclude:
id: cpp/fixme-comment
# this rule produces too many false positives due to our custom specifiers and
# the use of void pointers in swanctl
- exclude:
id: cpp/wrong-type-format-argument

View File

@ -10,8 +10,7 @@
* @precision very-high
*/
import cpp
import DataFlow::PathGraph
import semmle.code.cpp.dataflow.DataFlow
import semmle.code.cpp.dataflow.new.DataFlow
class ChunkFromChars extends Expr {
ChunkFromChars() {
@ -23,29 +22,30 @@ class ChunkFromChars extends Expr {
}
}
class ChunkFromCharsUsage extends DataFlow::Configuration {
ChunkFromCharsUsage() { this = "ChunkFromCharsUsage" }
override predicate isSource(DataFlow::Node source) {
module ChunkFromCharsConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source.asExpr() instanceof ChunkFromChars
}
override predicate isSink(DataFlow::Node sink) {
predicate isSink(DataFlow::Node sink) {
exists(sink.asExpr())
}
override predicate isBarrierOut(DataFlow::Node node) {
predicate isBarrierOut(DataFlow::Node node) {
/* don't track beyond function calls */
exists(FunctionCall fc | node.asExpr().getParent*() = fc)
}
}
module ChunkFromCharsFlow = DataFlow::Global<ChunkFromCharsConfig>;
import ChunkFromCharsFlow::PathGraph
BlockStmt enclosingBlock(BlockStmt b) {
result = b.getEnclosingBlock()
}
from ChunkFromCharsUsage usage, DataFlow::PathNode source, DataFlow::PathNode sink
from ChunkFromCharsFlow::PathNode source, ChunkFromCharsFlow::PathNode sink
where
usage.hasFlowPath(source, sink)
ChunkFromCharsFlow::flowPath(source, sink)
and not source.getNode().asExpr().getEnclosingBlock() = enclosingBlock*(sink.getNode().asExpr().getEnclosingBlock())
select source, source, sink, "Invalid use of chunk_from_chars() result in sibling/parent block."

3
.github/codeql/cpp-queries/qlpack.yml vendored Normal file
View File

@ -0,0 +1,3 @@
name: strongswan/cpp-queries
dependencies:
codeql/cpp-all: "*"

View File

@ -2,6 +2,10 @@ name: Android
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPRESS: true
@ -18,7 +22,7 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
android:
needs: pre-check
@ -26,28 +30,39 @@ jobs:
runs-on: ubuntu-latest
env:
TEST: android
# since the NDK is newly installed every time, we have to use this to avoid cache misses
# since the NDK might be newly installed, we have to use this to avoid cache misses
CCACHE_COMPILERCHECK: content
steps:
# even though we don't specify a specific version in our gradle files, the
# build fails without this because some arbitrary NDK version, that's
# weirdly not installed, is requested
- uses: actions/checkout@v4
# make sure the NDK we reference is installed and exported so we can use it to build OpenSSL
- name: Install NDK
run: yes | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install 'ndk;21.0.6113669'
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: ndk-install
run: |
NDK_VERSION=$(grep "ndkVersion" src/frontends/android/app/build.gradle | sed -e 's/.*"\(.*\)"/\1/')
echo Using NDK ${NDK_VERSION}
yes | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;${NDK_VERSION}"
echo "ANDROID_NDK_ROOT=${ANDROID_HOME}/ndk/${NDK_VERSION}" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: ~/.ccache
path: ~/.cache/ccache
key: ccache-android-${{ github.sha }}
restore-keys: |
ccache-android-
# necessary for newer versions of the Gradle plugin
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
- uses: ./.github/actions/default
env:
ANDROID_NDK_ROOT: ${{ steps.ndk-install.outputs.ANDROID_NDK_ROOT }}
- run: ccache -s
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: Lint Results
path: src/frontends/android/app/build/reports/lint-results.xml
path: src/frontends/android/app/build/reports/lint-results*.xml

78
.github/workflows/codeql.yml vendored Normal file
View File

@ -0,0 +1,78 @@
name: "CodeQL"
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 200M
# CodeQL currently doesn't support ccache
CCACHE_DISABLE: true
OS_NAME: linux
jobs:
pre-check:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip-check.outputs.should_skip }}
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content_newer'
analyze:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'python', 'ruby' ]
steps:
- uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/config.yml
- if: matrix.language == 'python' || matrix.language == 'ruby'
name: Autobuild
uses: github/codeql-action/autobuild@v3
# this follows the steps of the Linux workflow
- if: matrix.language == 'cpp'
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-ubuntu-latest-gcc-codeql-${{ github.sha }}
restore-keys: |
ccache-ubuntu-latest-gcc-codeql
ccache-ubuntu-latest-gcc-all-${{ github.sha }}
ccache-ubuntu-latest-gcc-all-
ccache-ubuntu-latest-gcc-
- if: matrix.language == 'cpp'
run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
- if: matrix.language == 'cpp'
env:
TEST: codeql
uses: ./.github/actions/default
- if: matrix.language == 'cpp'
run: ccache -s
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"

View File

@ -1,37 +0,0 @@
name: lgtm.com
on: [push]
env:
OS_NAME: linux
jobs:
pre-check:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip-check.outputs.should_skip }}
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
lgtm:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
env:
TEST: lgtm
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
# we don't use github/codeql-action because we can't exclude queries there,
# so we continue to use the approach we used on Travis
- env:
LGTM_TOKEN: ${{ secrets.LGTM_TOKEN }}
LGTM_PROJECT: ${{ secrets.LGTM_PROJECT }}
BUILD_NUMBER: ${{ github.run_number }}
COMMIT_ID: ${{ github.sha }}
COMMIT_BASE: ${{ github.event.before }}
uses: ./.github/actions/default

View File

@ -2,6 +2,10 @@ name: Linux
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# this test case does not actually test anything but tries to access system
# directories that might be inaccessible on build hosts
@ -21,12 +25,12 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
latest:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
matrix:
test: [ all, default, printf-builtin ]
@ -44,7 +48,13 @@ jobs:
- test: apidoc
- test: coverage
- test: dist
- test: nm-no-glib
- test: nm
- test: no-dbg
- test: no-dbg
compiler: clang
- test: no-testable-ke
- test: no-testable-ke
compiler: clang
- test: fuzzing
compiler: clang
monolithic: yes
@ -54,18 +64,18 @@ jobs:
CC: ${{ matrix.compiler || 'gcc' }}
TEST: ${{ matrix.test }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.ccache
path: ~/.cache/ccache
# with regards to ccache, monolithic builds don't differ from regular
# builds and, similarly, builds with leak-detective only differ in two
# files (LD itself and library.c); but different tests build different
# dependencies, so different caches are needed
key: ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.sha }}
key: ccache-ubuntu-latest-${{ env.CC }}-${{ matrix.test }}-${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-
ccache-${{ runner.os }}-${{ env.CC }}-
ccache-ubuntu-latest-${{ env.CC }}-${{ matrix.test }}-
ccache-ubuntu-latest-${{ env.CC }}-
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
@ -73,74 +83,109 @@ jobs:
- uses: ./.github/actions/default
- run: ccache -s
- if: ${{ success() && matrix.test == 'coverage' }}
run: bash <(curl -s https://codecov.io/bash)
uses: codecov/codecov-action@v4
with:
disable_search: true
fail_ci_if_error: true
file: coverage/coverage.cleaned.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Logs ${{ github.job }}
path: config.log
retention-days: 5
crypto-plugins:
crypto:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
test: [ botan, wolfssl, openssl, openssl-3, gcrypt ]
test: [ botan, wolfssl, openssl, openssl-3, openssl-awslc, gcrypt ]
os: [ ubuntu-latest, ubuntu-22.04 ]
leak-detective: [ no, yes ]
env:
LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
TEST: ${{ matrix.test }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-
ccache-${{ runner.os }}-${{ env.CC }}-
ccache-${{ runner.os }}-${{ env.CC }}-all-${{ github.sha }}
ccache-${{ runner.os }}-${{ env.CC }}-all-
ccache-${{ runner.os }}-${{ env.CC }}-
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
- uses: ./.github/actions/default
- run: ccache -s
- if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: Logs ${{ github.job }}
path: config.log
retention-days: 5
bionic:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-18.04
strategy:
matrix:
test: [ all ]
compiler: [ gcc, clang ]
include:
- test: nm
exclude:
# test custom-built libs only on the latest platform
- os: ubuntu-22.04
test: botan
- os: ubuntu-22.04
test: wolfssl
- os: ubuntu-22.04
test: openssl-3
- os: ubuntu-22.04
test: openssl-awslc
env:
LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
CC: ${{ matrix.compiler || 'gcc' }}
TEST: ${{ matrix.test }}
UBUNTU_BIONIC: yes
ACTIVE_TRANSFORMS_REF: .github/active-transforms/${{ matrix.test }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.ccache
key: ccache-bionic-${{ env.CC }}-${{ matrix.test }}-${{ github.sha }}
# path is different on newer systems
path: |
~/.cache/ccache
~/.ccache
key: ccache-${{ matrix.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.sha }}
restore-keys: |
ccache-bionic-${{ env.CC }}-${{ matrix.test }}-
ccache-bionic-${{ env.CC }}-
ccache-${{ matrix.os }}-${{ env.CC }}-${{ matrix.test }}-
ccache-${{ matrix.os }}-${{ env.CC }}-all-${{ github.sha }}
ccache-${{ matrix.os }}-${{ env.CC }}-all-
ccache-${{ matrix.os }}-${{ env.CC }}-
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
echo "TESTS_ACTIVE_TRANSFORMS=$HOME/active-transforms.log" >> $GITHUB_ENV
- uses: ./.github/actions/default
- name: Upload active transforms
uses: actions/upload-artifact@v4
with:
name: active-transforms-${{ matrix.test }}-${{ matrix.os }}-${{ matrix.leak-detective }}
path: ${{ env.TESTS_ACTIVE_TRANSFORMS }}
retention-days: 5
- name: Verify active transforms
run: |
test ! -f $ACTIVE_TRANSFORMS_REF || diff -u --color=always $ACTIVE_TRANSFORMS_REF $TESTS_ACTIVE_TRANSFORMS
- run: ccache -s
- if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: Logs ${{ github.job }}
path: config.log
retention-days: 5
older:
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04 ]
test: [ all, nm ]
compiler: [ gcc, clang ]
exclude:
- test: nm
compiler: clang
env:
LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
CC: ${{ matrix.compiler || 'gcc' }}
TEST: ${{ matrix.test }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
# path is different on newer systems
path: |
~/.cache/ccache
~/.ccache
key: ccache-${{ matrix.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.sha }}
restore-keys: |
ccache-${{ matrix.os }}-${{ env.CC }}-${{ matrix.test }}-
ccache-${{ matrix.os }}-${{ env.CC }}-
- run: |
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
@ -148,7 +193,7 @@ jobs:
- uses: ./.github/actions/default
- run: ccache -s
- if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Logs ${{ github.job }}
path: config.log

View File

@ -2,6 +2,10 @@ name: macOS
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TESTS_REDUCED_KEYLENGTHS: yes
CCACHE_BASEDIR: ${{ github.workspace }}
@ -18,22 +22,28 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
macos:
strategy:
matrix:
os: [macos-latest, macos-14]
needs: pre-check
if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
runs-on: macos-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 20
env:
TEST: macos
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/Library/Caches/ccache
key: ccache-${{ runner.os }}-${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-
# workaround for conflict between Python installed in the image and via brew
- run: find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete -print
- run: |
brew install ccache
echo "PATH=$(brew --prefix)/opt/ccache/libexec:$PATH" >> $GITHUB_ENV
@ -41,7 +51,7 @@ jobs:
- uses: ./.github/actions/default
- run: ccache -s
- if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Logs ${{ github.job }}
path: config.log

View File

@ -2,6 +2,10 @@ name: SonarCloud
on: [push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPRESS: true
@ -17,7 +21,7 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
sonarcloud:
needs: pre-check
@ -26,14 +30,13 @@ jobs:
env:
TEST: sonarcloud
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.ccache
~/.sonar-cache
~/.cache/ccache
key: ccache-sonarcloud-${{ github.sha }}
restore-keys: |
ccache-sonarcloud-
@ -41,24 +44,17 @@ jobs:
sudo apt-get install -qq ccache
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
ccache -z
# using SonarSource/sonarcloud-github-action is currently not recommended
# for C builds, so we follow the "any CI" instructions
- name: Install sonar-scanner
- uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6.0.0
- run: |
echo "BUILD_WRAPPER_OUT_DIR=$HOME/bw-output" >> $GITHUB_ENV
- uses: ./.github/actions/default
- uses: SonarSource/sonarqube-scan-action@v6.0.0
env:
SONAR_SCANNER_VERSION: 4.6.2.2472
run: |
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "SONAR_SCANNER_OPTS=-server" >> $GITHUB_ENV
curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "PATH=$HOME/.sonar/build-wrapper-linux-x86:$SONAR_SCANNER_HOME/bin:$PATH" >> $GITHUB_ENV
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ github.run_id }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_PROJECT: ${{ secrets.SONAR_PROJECT }}
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
uses: ./.github/actions/default
with:
args: >
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT }}
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }}
-Dsonar.cfamily.threads=2
-Dsonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json
- run: ccache -s

View File

@ -2,6 +2,10 @@ name: TKM
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_CONTAINER: /root/.ccache
@ -18,7 +22,7 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
tkm:
needs: pre-check
@ -27,8 +31,8 @@ jobs:
env:
TEST: tkm
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-tkm-${{ github.sha }}
@ -54,9 +58,9 @@ jobs:
autoreconf -i /strongswan || exit 1
CFLAGS="-g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -Werror" \
/strongswan/configure --disable-defaults --enable-silent-rules \
--enable-ikev2 --enable-kernel-netlink --enable-openssl \
--enable-pem --enable-socket-default --enable-swanctl \
--enable-tkm || exit 1
--enable-ikev2 --enable-kernel-netlink --enable-pem --enable-pkcs1 \
--enable-random --enable-sha1 --enable-socket-default --enable-swanctl \
--enable-tkm --enable-x509 || exit 1
# run tests without TKM first
make -j check TESTS_RUNNERS=tkm || exit 1

View File

@ -2,6 +2,10 @@ name: Windows
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TESTS_REDUCED_KEYLENGTHS: yes
CCACHE_BASEDIR: ${{ github.workspace }}
@ -21,7 +25,7 @@ jobs:
- id: skip-check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
concurrent_skipping: 'same_content_newer'
cross-compile:
needs: pre-check
@ -34,10 +38,10 @@ jobs:
OS_NAME: linux
TEST: ${{ matrix.test }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.ccache
path: ~/.cache/ccache
key: ccache-${{ runner.os }}-${{ matrix.test }}-${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-${{ matrix.test }}-
@ -48,7 +52,7 @@ jobs:
- uses: ./.github/actions/default
- run: ccache -s
- if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Logs ${{ github.job }}
path: config.log

3
.gitignore vendored
View File

@ -27,6 +27,7 @@ libtool
y.tab.[ch]
lex.yy.c
*keywords.c
!proposal_keywords.c
plugin_constructors.c
Doxyfile
apidoc/
@ -38,6 +39,7 @@ fuzzing-corpora/
*.tar.bz2
*.tar.gz
.DS_Store
._.DS_Store
coverage/
*.gcno
*.gcda
@ -53,3 +55,4 @@ coverage/
/*.includes
test-driver
nbproject/
*.[si]

View File

@ -1,46 +0,0 @@
queries:
- exclude: cpp/fixme-comment
# this rule produces too many false positives due to our custom specifiers and
# the use of void pointers in swanctl
- exclude: cpp/wrong-type-format-argument
extraction:
cpp:
prepare:
packages:
# for tss2
- libssl-dev
- libjson-c-dev
- libcurl4-openssl-dev
after_prepare:
- export DEPS_BUILD_DIR=$LGTM_WORKSPACE/deps
- mkdir -p $DEPS_BUILD_DIR
- export DEPS_PREFIX=$DEPS_BUILD_DIR/usr
- mkdir -p $DEPS_PREFIX
- export PKG_CONFIG_PATH="$DEPS_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
- export LD_LIBRARY_PATH="$DEPS_PREFIX/lib:$LD_LIBRARY_PATH"
- mkdir -p $LGTM_WORKSPACE/bin
# sudo doesn't work on the build hosts
- ln -s /usr/bin/nice $LGTM_WORKSPACE/bin/sudo
# for ldconfig we don't have enough permissions
- ln -s /bin/true $LGTM_WORKSPACE/bin/ldconfig
# likewise for apt-get
- ln -s /bin/echo $LGTM_WORKSPACE/bin/apt-get
- export PATH=$LGTM_WORKSPACE/bin:$PATH
- export TEST=all
- ./scripts/test.sh build-deps
- rm $LGTM_WORKSPACE/bin/*
configure:
command:
# follows the "all" build in test.sh (without custom-compiled stuff)
- ./autogen.sh
- ./configure --enable-all --disable-android-dns --disable-android-log
--disable-kernel-pfroute --disable-keychain
--disable-lock-profiler --disable-padlock --disable-fuzzing
--disable-osx-attr --disable-tkm --disable-uci
--disable-unwind-backtraces
--disable-svc --disable-dbghelp-backtraces --disable-socket-win
--disable-kernel-wfp --disable-kernel-iph --disable-winhttp
--disable-af-alg --disable-coverage
--disable-python-eggs-install
--disable-monolithic --disable-leak-detective

8
.lsan.suppressions Normal file
View File

@ -0,0 +1,8 @@
leak:EVP_CIPHER_fetch
leak:EVP_KEYEXCH_fetch
leak:EVP_KEYMGMT_fetch
leak:EVP_RAND_fetch
leak:OSSL_DECODER_do_all_provided
leak:OSSL_ENCODER_do_all_provided
leak:OSSL_PROVIDER_load
leak:OSSL_PROVIDER_try_load

View File

@ -7,12 +7,9 @@ include $(CLEAR_VARS)
# possible executables are
# starter - allows to control and configure the daemon from the command line
# charon - the IKE daemon
# scepclient - SCEP client
# if you enable starter or scepclient (see above) uncomment the proper
# lines here
# if you enable starter (see above) uncomment the following line
# strongswan_BUILD_STARTER := true
# strongswan_BUILD_SCEPCLIENT := true
# this is the list of plugins that are built into libstrongswan and charon
# also these plugins are loaded by default (if not changed in strongswan.conf)
@ -20,17 +17,8 @@ strongswan_CHARON_PLUGINS := android-log openssl fips-prf random nonce pubkey \
pkcs1 pkcs8 pem xcbc hmac kdf kernel-netlink socket-default android-dns \
stroke eap-identity eap-mschapv2 eap-md5 eap-gtc
ifneq ($(strongswan_BUILD_SCEPCLIENT),)
# plugins loaded by scepclient
strongswan_SCEPCLIENT_PLUGINS := openssl curl fips-prf random pkcs1 pkcs7 pem
endif
strongswan_STARTER_PLUGINS := kernel-netlink
# list of all plugins - used to enable them with the function below
strongswan_PLUGINS := $(sort $(strongswan_CHARON_PLUGINS) \
$(strongswan_STARTER_PLUGINS) \
$(strongswan_SCEPCLIENT_PLUGINS))
strongswan_PLUGINS := $(sort $(strongswan_CHARON_PLUGINS))
include $(LOCAL_PATH)/Android.common.mk
@ -106,10 +94,5 @@ strongswan_BUILD += \
ipsec
endif
ifneq ($(strongswan_BUILD_SCEPCLIENT),)
strongswan_BUILD += \
scepclient
endif
include $(addprefix $(LOCAL_PATH)/src/,$(addsuffix /Android.mk, \
$(sort $(strongswan_BUILD))))

View File

@ -1,3 +1,3 @@
Please refer to the [developer documentation](https://docs.strongswan.org/docs/5.9/devs/devs.html)
Please refer to the [developer documentation](https://docs.strongswan.org/docs/latest/devs/devs.html)
in our documentation for details regarding **code style** and
[**contribution requirements**](https://docs.strongswan.org/docs/5.9/devs/contributions.html).
[**contribution requirements**](https://docs.strongswan.org/docs/latest/devs/contributions.html).

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,6 @@ the code, you need the following tools:
- autoconf
- libtool
- pkg-config
- gettext
- perl
- python
- lex/flex

View File

@ -144,4 +144,4 @@ Contents
For a more up-to-date list of recommended modules refer to:
* https://docs.strongswan.org/docs/5.9/install/kernelModules.html
* https://docs.strongswan.org/docs/latest/install/kernelModules.html

View File

@ -65,10 +65,11 @@ cov-reset: cov-reset-common
cov-report:
@mkdir $(top_builddir)/coverage
lcov -c -o $(top_builddir)/coverage/coverage.info -d $(top_builddir) \
--rc lcov_branch_coverage=1
--rc branch_coverage=1
lcov -r $(top_builddir)/coverage/coverage.info '*/tests/*' '*/suites/*' '/usr*' \
'*proposal_keywords_static.*' \
-o $(abs_top_builddir)/coverage/coverage.cleaned.info \
--rc lcov_branch_coverage=1
--rc branch_coverage=1
genhtml --num-spaces 4 --legend --branch-coverage --ignore-errors source \
-t "$(PACKAGE_STRING)" \
-o $(top_builddir)/coverage/html \

390
NEWS
View File

@ -1,3 +1,389 @@
strongswan-6.0.2
----------------
- Support for per-CPU SAs (RFC 9611) has been added (Linux 6.13+).
- Basic support for AGGFRAG mode (RFC 9347) has been added (Linux 6.14+).
- POSIX regular expressions can be used to match remote identities.
- Switching configs based on EAP-Identities is supported. Setting
`remote.eap_id` now always initiates an EAP-Identity exchange.
- On Linux, sequence numbers from acquires are used when installing SAs. This
allows handling narrowing properly.
- During rekeying, the narrowed traffic selectors are now proposed instead of
the configured ones.
- The default AH/ESP proposals contain all supported key exchange methods plus
`none` to make PFS optional and accept proposals of older peers.
- GRO for ESP in enabled for NAT-T UDP sockets, which can improve performance
if the esp4|6_offload modules are loaded.
- charon-nm sets the VPN connection as persistent, preventing NetworkManager
from tearing down the connection if the network connectivity changes.
- ML-KEM is supported via OpenSSL 3.5+.
- The wolfssl plugin is now compatible to wolfSSL's FIPS module.
- The libsoup plugin has been migrated to libsoup 3, libsoup 2 is not supported
anymore.
- The long defunct uci plugin has been removed.
- Log messages by watcher_t are now logged in a separate log group (`wch`).
strongswan-6.0.1
----------------
- The ha plugin supports IKE and Child SAs with multiple key exchanges.
Incomplete IKE_SAs are now destroyed during a failover.
- The new `interface_receive` option for the dhcp plugin allows binding the
receive socket to a different interface than the send socket. Also fixed a
regression if the DHCP server is running on the same host.
- The new `source` option for the eap-radius plugin allows sending RADIUS
messages from a specific IP address.
- Self-signed root CAs without policies are now excluded from policy validation.
- Inbound traffic on IPsec SAs is now ignored when sending DPDs unless
UDP-encapsulation is used.
- Send IKE_SA_INIT from NAT-T socket if not connecting to port 500.
- Local traffic selectors can be configured for charon-nm. Its default
retransmission settings have been set to those of the Android app.
- The vici Python wheel is now built via `build` frontend instead of calling
setup.py directly if --enable-python-wheels is used (the option to build eggs
has been removed). There is no option to automatically install the wheel (use
pip instead) and the --enable-python-eggs-install option has been removed.
strongswan-6.0.0
----------------
- Support of multiple post-quantum (and classic) key exchanges using the
IKE_INTERMEDIATE exchange (RFC 9242) and the Additional Key Exchange
transform types 1..7 (RFC 9370).
- ML-KEM is provided by the botan, wolfssl, openssl (only via AWS-LC) and the
new ml plugins.
- Handling of CHILD_SA rekey collisions has been improved, which makes CHILD_SAs
properly trackable via chiled_rekey() hook.
- The behavior when reloading or unloading connections that include `start` in
their `start_action` has been improved.
- The default identity is now the subject DN instead of the IP address if a
certificate is available.
- The file logger supports logging as JSON objects and can add timestamps
in microseconds.
- The cert-enroll script now supports three generations of CA certificates.
- charon-nm uses a different routing table than the regular IKE daemon to avoid
conflicts if both are running.
- AF_VSOCK sockets are supported on Linux to communicate with a daemon that runs
in a VM.
- TUN devices can properly handle IPv6 addresses.
- For compatibility with older SCEP implementations, challenge passwords in
PKCS#10 containers are again encoded as PrintableString if possible.
- The legacy stroke plugin is no longer enabled by default.
- The openssl plugin is now enabled by default, while the following crypto
plugins are no longer enabled by default: aes, curve25519, des, fips-prf, gmp,
hmac, md5, pkcs12, rc2, sha1, sha2.
- The following deprecated plugins have been removed: bliss, newhope, ntru.
- charon.make_before_break is now enabled by default.
strongswan-5.9.14
-----------------
- Support for the IKEv2 OCSP extensions (RFC 4806) has been added, which allows
peers to request and send OCSP responses directly in IKEv2.
- Validation of X.509 name constraints in the constraints plugin has been
refactored to align with RFC 5280.
- The dhcp plugin has been ported to FreeBSD/macOS.
- The openssl plugin is now compatible with AWS-LC.
- Overflows of unique identifiers (e.g. Netlink sequence numbers or reqids) are
now handled gracefully.
- Updated the pkcs11.h header based on the latest OpenSC version in order to
include new algorithm and struct definitions for the pkcs11 plugin.
Added support for PSS padding in smartcard-based RSA signatures using either
on-chip or external data hashing.
- Added keyid and certid handles in the pki --ocsp command so that keys and/or
certificates can be stored on a smartcard or in a TPM 2.0 device.
- Fail SA installation on Linux if replay protection is disabled while ESN is
enabled, which the kernel currently doesn't support.
strongswan-5.9.13
-----------------
- Fixes a regression with handling OCSP error responses and adds a new
option to specify the length of nonces in OCSP requests. Also adds some
other improvements for OCSP handling and fuzzers for OCSP
requests/responses.
strongswan-5.9.12
-----------------
- Fixed a vulnerability in charon-tkm related to processing DH public values
that can lead to a buffer overflow and potentially remote code execution.
This vulnerability has been registered as CVE-2023-41913.
- The new `pki --ocsp` command produces OCSP responses based on certificate
status information provided by plugins.
Two sources are currently available, the openxpki plugin that directly
accesses the OpenXPKI database and the `--index` argument, which reads
certificate status information from OpenSSL-style index.txt files.
- The cert-enroll script handles the initial enrollment of an X.509 host
certificate with a PKI server via the EST or SCEP protocols.
Run as a systemd timer or via a crontab entry the script daily checks the
expiration date of the host certificate. When a given deadline is reached,
the host certificate is automatically renewed via EST or SCEP re-enrollment
based on the possession of the old private key and the matching certificate.
- The --priv argument for charon-cmd allows using any type of private key.
- Support for nameConstraints of type iPAddress has been added (the openssl
plugin previously didn't support nameConstraints at all).
- SANs of type uniformResourceIdentifier can now be encoded in certificates.
- Password-less PKCS#12 and PKCS#8 files are supported.
- A new global option allows preventing peers from authenticating with trusted
end-entity certificates (i.e. local certificates).
- ECDSA public keys that encode curve parameters explicitly are now rejected by
all plugins that support ECDSA.
- charon-nm now actually uses the XFRM interfaces added with 5.9.10, it can
also use the name in connection.interface-name.
- The resolve plugin tries to maintain the order of installed DNS servers.
- The kernel-libipsec plugin always installs routes even if no address is found
in the local traffic selectors.
- Increased the default receive buffer size for Netlink sockets to 8 MiB and
simplified its configuration.
- Copy the issuer's subjectKeyIdentifier as authorityKeyIdentifier instead of
always generating a hash of the subjectPublicKey.
- Fixed issues while reestablishing multiple CHILD_SAs (e.g. after a DPD
timeout) that could cause a reqid to get assigned to multiple CHILD_SAs with
unrelated traffic selectors.
- Fixed a possible infinite loop issue in watcher_t and removed WATCHER_EXCEPT,
instead callbacks are always invoked even if only errors are signaled.
- Fixed a regression in the IKE_SA_INIT tracking code added with 5.9.6 when
handling invalid messages.
- Fixed adding the XFRMA_REPLAY_ESN_VAL attribute twice when updating SAs.
- Correctly encode SPI from REKEY_SA notify in CHILD_SA_NOT_FOUND notify if
CHILD_SA is not found during rekeying.
- The testing environment is now based on Debian 12 (bookworm), by default.
strongswan-5.9.11
-----------------
- A deadlock in the vici plugin has been fixed that could get triggered when
multiple connections were initiated/terminated concurrently and control-log
events were raised by the watcher_t component.
- CRLs have to be signed by a certificate that has the cRLSign keyUsage bit
encoded (even if it's a CA), or a CA certificate without keyUsage extension.
- Optional CA labels in EST server URIs are supported by `pki --est/estca`.
- CMS-style signatures in PKCS#7 containers are supported by the pkcs7 and
openssl plugins, which allows verifying RSA-PSS and ECDSA signatures.
- Fixed a regression in the server implementation of EAP-TLS with TLS 1.2 or
earlier that was introduced with 5.9.10.
- Ensure the TLS handshake is complete in the EAP-TLS client with TLS <= 1.2.
- kernel-libipsec can process raw ESP packets on Linux (disabled by default) and
gained support for trap policies.
- The dhcp plugin uses an alternate method to determine the source address
for unicast DHCP requests that's not affected by interface filtering.
- Certificate and trust chain selection as initiator has been improved in case
the local trust chain is incomplete and an unrelated certreq is received.
- ECDSA and EdDSA keys in IPSECKEY RRs are supported by the ipseckey plugin.
- To bypass tunnel mode SAs/policies, the kernel-wfp plugin installs bypass
policies also on the FWPM_SUBLAYER_IPSEC_TUNNEL sublayer.
- Stale OCSP responses are now replace in-place in the certificate cache.
- Fixed parsing of SCEP server capabilities by `pki --scep/scepca`.
strongswan-5.9.10
-----------------
- Fixed a vulnerability related to certificate verification in TLS-based EAP
methods that leads to an authentication bypass followed by an expired pointer
dereference that results in a denial of service and possibly even remote code
execution.
This vulnerability has been registered as CVE-2023-26463.
- Added support for full packet hardware offload for IPsec SAs and policies with
Linux 6.2 kernels to the kernel-netlink plugin.
- TLS-based EAP methods now use the standardized key derivation when used
with TLS 1.3.
- The eap-tls plugin properly supports TLS 1.3 according to RFC 9190, by
implementing the "protected success indication".
- With the `prefer` value for the `childless` setting, initiators will create
a childless IKE_SA if the responder supports the extension.
- Routes via XFRM interfaces can optionally be installed automatically by
enabling the `install_routes_xfrmi` option of the kernel-netlink plugin.
- charon-nm now uses XFRM interfaces instead of dummy TUN devices to avoid
issues with name resolution if they are supported by the kernel.
- The `pki --req` command can encode extendedKeyUsage (EKU) flags in the
PKCS#10 certificate signing request.
- The `pki --issue` command adopts EKU flags from CSRs but allows modifying them
(replace them completely, or adding/removing specific flags).
- On Linux 6.2 kernels, the last use times of CHILD_SAs are determined via the
IPsec SAs instead of the policies.
- For libcurl with MultiSSL support, the curl plugin provides an option to
select the SSL/TLS backend.
strongswan-5.9.9
----------------
- The charon.reqid_base setting allows specifying the first reqid that's
automatically assigned to a CHILD_SA.
- The path/command for resolvconf(8) used by the resolve plugin is now
configurable.
- The resolve plugin doesn't generate unique interface names for name servers
anymore. Instead, all available name servers are associated with a single,
configurable interface name.
- Serial numbers of certificates and CRLs are now always returned in canonical
form (i.e. without leading zeros).
- The kernel-netlink plugin now logs extended ACK error/warning messages.
strongswan-5.9.8
----------------
- Fixed a vulnerability related to accessing untrusted OCSP URIs and CDPs in
certificates that could lead to a denial-of-service attack.
This vulnerability has been registered as CVE-2022-40617.
- The pki --scep|--scepca commands support the HTTP-based "Simple Certificate
Enrollment Protocol" (RFC 8894 SCEP) replacing the old and long deprecated
scepclient that has been removed.
- The pki --est|estca commands support the HTTPS-based "Enrollment over Secure
Transport" (RFC 7030 EST) protocol.
- The pki --req command can create a certificate request based on an existing
PKCS#10 template by replacing the public key and re-generating the signature
with the new private key.
- For IKEv2, the ike_updown() "up" event and the state change to IKE_ESTABLISHED
are now triggered after all IKE-related tasks are done.
- The ike_cfg_t object is now always replaced together with the peer_cfg_t
object that's set on an IKE_SA during authentication.
- The gcm plugin has been enabled by default, so that the TLS 1.3 unit tests
can be completed successfully with just the default plugins.
- The socket plugins don't set the SO_REUSEADDR option anymore on the IKE UDP
sockets, so an error is triggered if e.g. two daemons (e.g. charon and
charon-systemd) are running concurrently using the same ports.
- The charon.rsa_pss_trailerfield setting generates an algorithmIdentifier with
explicit trailerField.
strongswan-5.9.7
----------------
- The IKEv2 key derivation is now delayed until the keys are actually needed for
the next message. Instead of deriving the keys while processing an IKE_SA_INIT
request, it's delayed until the corresponding IKE_AUTH request is received.
DH implementations now must do costly public key validation and the key
derivation in get_shared_secret().
- Inbound IKEv2 messages are not parsed immediately anymore, instead we first
check a request's MID and compare its hash to that of the previous request to
decide if it's a valid retransmit (for fragmented message we only keep track
of the first fragment, so we don't have to wait for all fragments and
reconstruct the message, which we did before).
- The retransmission logic in the dhcp plugin has been fixed so that four
retransmits are sent per DHCP request over a total of 15 seconds (previously,
it could happen that all were sent within the same second without any time
to actually wait for a response).
- The connmark plugin now considers configured masks in installed firewall
rules, which allows using the upper parts of the mark value for other
purposes. Just consider that the daemon might have to be restarted regularly
to reset the global unique mark counter as that's unaware of any masks.
- Child config selection has been improved as responder in cases where multiple
children use transport mode traffic selectors.
- The outbound SA/policy is now also removed after IKEv1 CHILD_SA rekeyings.
- The openssl plugin supports AES and Camellia in CTR mode.
strongswan-5.9.6
----------------
@ -90,7 +476,7 @@ strongswan-5.9.4
salt lengths.
This vulnerability has been registered as CVE-2021-41990.
- Fixed a denial-of-service vulnerabililty in the in-memory certificate cache
- Fixed a denial-of-service vulnerability in the in-memory certificate cache
if certificates are replaced and a very large random value caused an integer
overflow.
This vulnerability has been registered as CVE-2021-41991.
@ -1502,7 +1888,7 @@ strongswan-5.0.3
PT-TLS (RFC 6876), a Posture Transport Protocol over TLS.
- The charon systime-fix plugin can disable certificate lifetime checks on
embedded systems if the system time is obviously out of sync after bootup.
embedded systems if the system time is obviously out of sync after boot-up.
Certificates lifetimes get checked once the system time gets sane, closing
or reauthenticating connections using expired certificates.

View File

@ -566,7 +566,7 @@ to generate a traditional 3072 bit RSA key and store it in binary DER format.
As an alternative a **TPM 2.0** *Trusted Platform Module* available on every
recent Intel platform could be used as a virtual smartcard to securely store an
RSA or ECDSA private key. For details, refer to the TPM 2.0
[HOWTO](https://docs.strongswan.org/docs/5.9/tpm/tpm2.html).
[HOWTO](https://docs.strongswan.org/docs/latest/tpm/tpm2.html).
In a next step the command

View File

@ -16,11 +16,11 @@ options = \
options/charon-systemd.opt \
options/imcv.opt \
options/imv_policy_manager.opt \
options/iptfs.opt \
options/manager.opt \
options/medsrv.opt \
options/pki.opt \
options/pool.opt \
options/scepclient.opt \
options/starter.opt \
options/swanctl.opt \
options/tnc.opt \
@ -32,7 +32,6 @@ plugins = \
plugins/android_log.opt \
plugins/attr.opt \
plugins/attr-sql.opt \
plugins/bliss.opt \
plugins/botan.opt \
plugins/bypass-lan.opt \
plugins/certexpire.opt \
@ -78,8 +77,8 @@ plugins = \
plugins/kernel-pfroute.opt \
plugins/load-tester.opt \
plugins/lookip.opt \
plugins/ntru.opt \
plugins/openssl.opt \
plugins/openxpki.opt \
plugins/osx-attr.opt \
plugins/p-cscf.opt \
plugins/pkcs11.opt \

View File

@ -55,14 +55,6 @@ man pages) the following format can be used:
full.section.name.include files/to/include
Description of this include statement
Dots in section/option names may be escaped with a backslash. For instance,
with the following section description
charon.filelog./var/log/daemon\.log {}
Section to define logging into /var/log/daemon.log
/var/log/daemon.log will be the name of the last section.
"""
import sys
@ -74,10 +66,10 @@ from functools import cmp_to_key, total_ordering
@total_ordering
class ConfigOption:
"""Representing a configuration option or described section in strongswan.conf"""
def __init__(self, path, default = None, section = False, commented = False, include = False):
self.path = path
self.name = path[-1]
self.fullname = '.'.join(path)
def __init__(self, fullname, default = None, section = False, commented = False, include = False):
self.path = fullname.split('.')
self.name = self.path[-1]
self.fullname = fullname
self.default = default
self.section = section
self.commented = commented
@ -141,8 +133,7 @@ class Parser:
if m:
if self.__current:
self.__add_option(self.__current)
path = self.__split_name(m.group('name'))
self.__current = ConfigOption(path, m.group('default'),
self.__current = ConfigOption(m.group('name'), m.group('default'),
commented = not m.group('assign'))
return
# section definition
@ -150,8 +141,7 @@ class Parser:
if m:
if self.__current:
self.__add_option(self.__current)
path = self.__split_name(m.group('name'))
self.__current = ConfigOption(path, section = True,
self.__current = ConfigOption(m.group('name'), section = True,
commented = m.group('comment'))
return
# include definition
@ -159,8 +149,7 @@ class Parser:
if m:
if self.__current:
self.__add_option(self.__current)
path = self.__split_name(m.group('name'))
self.__current = ConfigOption(path, m.group('pattern'), include = True)
self.__current = ConfigOption(m.group('name'), m.group('pattern'), include = True)
return
# paragraph separator
m = re.match(r'^\s*$', line)
@ -171,10 +160,6 @@ class Parser:
if m and self.__current:
self.__current.add(m.group('text'))
def __split_name(self, name):
"""Split the given full name in a list of section/option names"""
return [x.replace('\.', '.') for x in re.split(r'(?<!\\)\.', name)]
def __add_option(self, option):
"""Adds the given option to the abstract storage"""
option.desc = [desc for desc in option.desc if len(desc)]
@ -194,12 +179,14 @@ class Parser:
"""Searches/Creates the option (section) based on a list of section names"""
option = None
options = self.options
for i, name in enumerate(path, 1):
fullname = ""
for name in path:
fullname += '.' + name if len(fullname) else name
option = next((x for x in options if x.name == name and x.section), None)
if not option:
if not create:
break
option = ConfigOption(path[:i], section = True)
option = ConfigOption(fullname, section = True)
options.append(option)
if self.sort:
options.sort()
@ -208,7 +195,7 @@ class Parser:
def get_option(self, name):
"""Retrieves the option with the given name"""
return self.__get_option(self.__split_name(name))
return self.__get_option(name.split('.'))
class TagReplacer:
"""Replaces formatting tags in text"""
@ -254,6 +241,7 @@ class GroffTagReplacer(TagReplacer):
if not punct:
punct = ''
text = re.sub(r'[\r\n\t]', ' ', m.group('text'))
text = re.sub(r'"', '""', text)
return '{0}.R{1} "{2}" "{3}" "{4}"\n'.format(nl, format, brack, text, punct)
return replacer
@ -318,7 +306,8 @@ class ManFormatter:
def __groffize(self, text):
"""Encode text as groff text"""
text = self.__tags.replace(text)
text = re.sub(r'(?<!\\)-', r'\\-', text)
text = re.sub(r'\\(?!-)', '\\[rs]', text)
text = re.sub(r'(?<!\\)-', '\\-', text)
# remove any leading whitespace
return re.sub(r'^\s+', '', text, flags = re.MULTILINE)

View File

@ -26,8 +26,18 @@ charon.filelog.<name>.flush_line = no
Enabling this option disables block buffering and enables line buffering.
charon.filelog.<name>.ike_name = no
Prefix each log entry with the connection name and a unique numerical
identifier for each IKE_SA.
Add the connection name and a unique numerical identifier for the current
IKE_SA to each log entry if available.
charon.filelog.<name>.json = no
If enabled, each log entry is written to the file as a JSON object.
Enables writing each log entry as a JSON object to the file. The properties
are "time" (if `time_format` is set), "thread", "group", "level" and "msg".
Newlines, double quotes and backslashes are escaped in the latter. If
`ike_name` is enabled, "ikesa-uniqueid" and "ikesa-name" are added to the
object if available. The `log_level` option does not apply if this is
enabled.
charon.filelog.<name>.log_level = no
Add the log level of each message after the subsystem (e.g. [IKE2]).
@ -36,9 +46,10 @@ charon.filelog.<name>.time_format
Prefix each log entry with a timestamp. The option accepts a format string
as passed to **strftime**(3).
charon.filelog.<name>.time_add_ms = no
Adds the milliseconds within the current second after the timestamp
(separated by a dot, so _time_format_ should end with %S or %T).
charon.filelog.<name>.time_precision =
Add the milliseconds (_ms_) or microseconds (_us_) within the current second
after the timestamp (separated by a dot, so _time_format_ should end
with %S or %T). By default, nothing is added.
charon.syslog {}
Section to define syslog loggers, see LOGGER CONFIGURATION in

View File

@ -1,3 +1,55 @@
charon-nm {}
Section with settings specific to the NetworkManager backend `charon-nm`.
Settings from the `charon` section are not inherited, but many can be used
here as well. Defaults for some settings are chosen very deliberately and
should only be changed in case of conflicts.
charon-nm.ca_dir = <default>
Directory from which to load CA certificates if no certificate is
configured.
charon-nm.install_virtual_ip_on = lo
Interface on which virtual IP addresses are installed. Note that NM
also installs the virtual IPs on the XFRM interface.
charon-nm.mtu = 1400
MTU for XFRM interfaces created by the NM plugin.
charon-nm.port = 0
Source port when sending packets to port 500. Defaults to an ephemeral
port. May be set to 500 if firewall rules require a static port.
charon-nm.port_nat_t = 0
Source port when sending packets to port 4500 or a custom server port.
Defaults to an ephemeral port. May be set to e.g. 4500 if firewall rules
require a static port.
charon-nm.retransmit_base = 1.4
Base to use for calculating exponential back off, see IKEv2 RETRANSMISSION
in **strongswan.conf**(5). Default retransmission settings for charon-nm are
deliberately lower to fail and possibly reestablish SAs more quickly.
charon-nm.retransmit_timeout = 2.0
Timeout in seconds before sending first retransmit.
charon-nm.retransmit_tries = 3
Number of times to retransmit a packet before giving up.
charon-nm.routing_table = 210
Table where routes via XFRM interface are installed. Should be different
than the table used for the regular IKE daemon due to the mark.
charon-nm.routing_table_prio = 210
Priority of the routing table. Higher than the default priority used for the
regular IKE daemon.
charon-nm.plugins.kernel-netlink.fwmark = !210
Make packets with this mark ignore the routing table. Must be the same mark
set in charon-nm.plugins.socket-default.fwmark.
charon-nm.plugins.socket-default.fwmark = 210
Mark applied to IKE and ESP packets to ignore the routing table and avoid
routing loops when using XFRM interfaces.
charon-nm.syslog.daemon.default = 1
Default to logging via syslog's daemon facility on level 1.

View File

@ -38,8 +38,8 @@ charon.cert_cache = yes
charon.cache_crls = no
Whether Certificate Revocation Lists (CRLs) fetched via HTTP or LDAP should
be saved under a unique file name derived from the public key of the
Certification Authority (CA) to **/etc/ipsec.d/crls** (stroke) or
**/etc/swanctl/x509crl** (vici), respectively.
Certification Authority (CA) to **${sysconfdir}/ipsec.d/crls** (stroke) or
**${sysconfdir}/swanctl/x509crl** (vici), respectively.
charon.check_current_path = no
Whether to use DPD to check if the current path still works after any
@ -154,8 +154,16 @@ charon.fragment_size = 1280
Maximum size (complete IP datagram size in bytes) of a sent IKE fragment
when using proprietary IKEv1 or standardized IKEv2 fragmentation, defaults
to 1280 (use 0 for address family specific default values, which uses a
lower value for IPv4). If specified this limit is used for both IPv4 and
IPv6.
lower value for IPv4). Unless overridden, this limit is used for both IPv4
and IPv6 if specified.
charon.fragment_size_v4 = charon.fragment_size
Maximum size (complete IPv4 datagram size in bytes) of a sent IKE fragment
when using proprietary IKEv1 or standardized IKEv2 fragmentation.
charon.fragment_size_v6 = charon.fragment_size
Maximum size (complete IPv6 datagram size in bytes) of a sent IKE fragment
when using proprietary IKEv1 or standardized IKEv2 fragmentation.
charon.group
Name of the group the daemon changes to after startup.
@ -283,7 +291,7 @@ charon.max_ikev1_exchanges = 3
charon.max_packet = 10000
Maximum packet size accepted by charon.
charon.make_before_break = no
charon.make_before_break = yes
Initiate IKEv2 reauthentication with a make-before-break scheme.
Initiate IKEv2 reauthentication with a make-before-break instead of a
@ -302,6 +310,13 @@ charon.nbns1
charon.nbns2
WINS servers assigned to peer via configuration payload (CP).
charon.ocsp_nonce_len = 32
Length of nonces in OCSP requests (1-32).
Length of nonces in OCSP requests. According to RFC 8954, valid values are
between 1 and 32, with new clients required to use 32. Some servers might
not support that so lowering the value to e.g. 16 might be necessary.
charon.port = 500
UDP port used locally. If set to 0 a random port will be allocated.
@ -372,9 +387,16 @@ charon.receive_delay_request = yes
charon.receive_delay_type = 0
Specific IKEv2 message type to delay, 0 for any.
charon.reject_trusted_end_entity = no
Reject peers that use trusted end-entity certificates (i.e. local
certificates).
charon.replay_window = 32
Size of the AH/ESP replay window, in packets.
charon.reqid_base = 1
Value of the first reqid to be automatically assigned to a CHILD_SA.
charon.retransmit_base = 1.8
Base to use for calculating exponential back off, see IKEv2 RETRANSMISSION
in **strongswan.conf**(5).
@ -392,7 +414,7 @@ charon.retransmit_jitter = 0
charon.retransmit_limit = 0
Upper limit in seconds for calculated retransmission timeout (0 to disable).
charon.retry_initiate_interval = 0
charon.retry_initiate_interval = 0s
Interval in seconds to use when retrying to initiate an IKE_SA (e.g. if DNS
resolution failed), 0 to disable retries.
@ -408,6 +430,10 @@ charon.routing_table_prio
charon.rsa_pss = no
Whether to use RSA with PSS padding instead of PKCS#1 padding by default.
charon.rsa_pss_trailerfield = no
Whether to encode an explicit trailerField value of 0x01 in the RSA-PSS
algorithmIdentifier (CONTEXT3) or using the DEFAULT value by omitting it.
charon.send_delay = 0
Delay in ms for sending packets, to simulate larger RTT.

38
conf/options/iptfs.opt Normal file
View File

@ -0,0 +1,38 @@
charon.iptfs {}
Global settings for IP-TFS (RFC 9347). The Linux kernel supports this mode
since 6.14. However, it currently only supports aggregation/fragmentation of
tunneled IP packets in ESP/AGGFRAG packets. It doesn't yet support other
IP-TFS features like sending packets at a constant rate or congestion control.
charon.iptfs.drop_time = 1000000
Time in microseconds to wait for out-of-order packets when processing
inbound traffic.
charon.iptfs.reorder_window = 3
Number of packets that may arrive out of order when processing inbound
traffic.
charon.iptfs.init_delay = 0
Time in microseconds to wait for subsequent packets to aggregate together
when sending outbound traffic. Only relevant if no packets are already
queued to be sent.
charon.iptfs.max_queue_size = 1048576
Maximum number of bytes allowed to be queued for sending on the tunnel
(default 1 MiB). If the queue is full, packets are dropped.
charon.iptfs.packet_size = 0
Maximum outer packet size (layer 3) when sending packets. The default of 0
will use the PMTU as packet size. Note that the kernel currently doesn't
pad smaller packets.
charon.iptfs.accept_fragments = yes
Whether fragments of inner packets across multiple AGGFRAG payloads are
accepted. This is an IKEv2 option, so if the peer doesn't adhere to this
request and still sends such fragments, they will be processed by the
kernel.
charon.iptfs.dont_frag = no
Force disabling fragmenting inner packets across multiple AGGFRAG payloads
when sending outbound traffic (fragmentation is automatically disabled if
the peer indicates that it doesn't support handling such packets).

View File

@ -1,2 +1,12 @@
pki.load =
Plugins to load in ipsec pki tool.
Plugins to load in the pki tool.
pki.scep.http_bind
Source IP address to bind for HTTP operations.
pki.scep.http_timeout = 30s
Timeout for HTTP operations.
pki.scep.renewal_via_pkcs_req = no
Some SCEP servers (e.g. openxpki) are incorrectly doing certificate renewal
via messageType PKCSReq (19) instead of RenewalReq (17).

View File

@ -1,2 +0,0 @@
scepclient.load =
Plugins to load in ipsec scepclient tool.

View File

@ -1,2 +0,0 @@
charon.plugins.bliss.use_bliss_b = yes
Use the enhanced BLISS-B key generation and signature algorithm.

View File

@ -1,3 +1,11 @@
charon.plugins.curl.redir = -1
Maximum number of redirects followed by the plugin, set to 0 to disable
following redirects, set to -1 for no limit.
charon.plugins.curl.tls_backend =
The SSL/TLS backend to configure in curl if multiple are available.
The SSL/TLS backend to configure in curl if multiple are available (requires
libcurl 7.56 or newer). A list of available options is logged on level 2 if
nothing is configured. Similar but on level 1 if the selected backend isn't
available.

View File

@ -36,3 +36,13 @@ charon.plugins.dhcp.interface
Interface name the plugin uses for address allocation. The default is to
bind to any (0.0.0.0) and let the system decide which way to route the
packets to the DHCP server.
charon.plugins.dhcp.interface_receive = charon.plugins.dhcp.interface
Interface name the plugin uses to bind its receive socket.
Interface name the plugin uses to bind its receive socket. The default is
to use the same interface as the send socket. Set it to the empty string
to avoid binding the receive socket to any interface while the send socket
is bound to one. If the server runs on the same host and the send socket is
bound to an interface, it might be necessary to set this to `lo` or the
empty string.

View File

@ -11,7 +11,8 @@ charon.plugins.eap-peap.phase2_method = mschapv2
Phase2 EAP client authentication method.
charon.plugins.eap-peap.phase2_piggyback = no
Phase2 EAP Identity request piggybacked by server onto TLS Finished message.
Phase2 EAP Identity request piggybacked by server onto TLS Finished message,
relevant only if TLS 1.2 or earlier is negotiated.
charon.plugins.eap-peap.phase2_tnc = no
Start phase2 EAP TNC protocol after successful client authentication.

View File

@ -5,7 +5,7 @@ charon.plugins.eap-radius.accounting_close_on_timeout = yes
Close the IKE_SA if there is a timeout during interim RADIUS accounting
updates.
charon.plugins.eap-radius.accounting_interval = 0
charon.plugins.eap-radius.accounting_interval = 0s
Interval in seconds for interim RADIUS accounting updates, if not specified
by the RADIUS server in the Access-Accept message.
@ -84,6 +84,9 @@ charon.plugins.eap-radius.secret =
charon.plugins.eap-radius.server =
IP/Hostname of RADIUS server.
charon.plugins.eap-radius.source =
Optional specific source IP to use.
charon.plugins.eap-radius.retransmit_base = 1.4
Base to use for calculating exponential back off.
@ -96,12 +99,12 @@ charon.plugins.eap-radius.retransmit_tries = 4
charon.plugins.eap-radius.servers {}
Section to specify multiple RADIUS servers.
Section to specify multiple RADIUS servers. The **nas_identifier**,
**secret**, **sockets** and **port** (or **auth_port**) options can be
specified for each server. A server's IP/Hostname can be configured using
the **address** option. The **acct_port** [1813] option can be used to
specify the port used for RADIUS accounting. For each RADIUS server a
priority can be specified using the **preference** [0] option. The
Section to specify multiple RADIUS servers. The **source**,
**nas_identifier**, **secret**, **sockets** and **port** (or **auth_port**)
options can be specified for each server. A server's IP/Hostname can be
configured using the **address** option. The **acct_port** [1813] option can
be used to specify the port used for RADIUS accounting. For each RADIUS
server a priority can be specified using the **preference** [0] option. The
retransmission time for each server can set set using **retransmit_base**,
**retransmit_timeout** and **retransmit_tries**.

View File

@ -5,3 +5,10 @@ charon.plugins.kernel-libipsec.allow_peer_ts = no
installed for such traffic (via TUN device) usually prevents further IKE
traffic. The fwmark options for the _kernel-netlink_ and _socket-default_
plugins can be used to circumvent that problem.
charon.plugins.kernel-libipsec.fwmark = charon.plugins.socket-default.fwmark
Firewall mark to set on outbound raw ESP packets.
charon.plugins.kernel-libipsec.raw_esp = no
Whether to send and receive ESP packets without UDP encapsulation if
supported on this platform and no NAT is detected.

View File

@ -1,14 +1,6 @@
charon.plugins.kernel-netlink.buflen = <min(PAGE_SIZE, 8192)>
Buffer size for received Netlink messages.
charon.plugins.kernel-netlink.force_receive_buffer_size = no
Force maximum Netlink receive buffer on Netlink socket.
If the maximum Netlink socket receive buffer in bytes set by
_receive_buffer_size_ exceeds the system-wide maximum from
/proc/sys/net/core/rmem_max, this option can be used to override the limit.
Enabling this option requires special privileges (CAP_NET_ADMIN).
charon.plugins.kernel-netlink.fwmark =
Firewall mark to set on the routing rule that directs traffic to our routing
table.
@ -28,6 +20,16 @@ charon.plugins.kernel-netlink.hw_offload_feature_interface = lo
cannot be used to obtain the appropriate feature flag, this option can
be used to specify an alternative interface for offload feature detection.
charon.plugins.kernel-netlink.install_routes_xfrmi = no
Whether to install routes for SAs that reference XFRM interfaces.
Whether routes via XFRM interfaces are automatically installed for SAs that
reference such an interface via _if_id_out_. If the traffic selectors
include the IKE traffic to the peer, this requires special care (e.g.
installing bypass policies and/or routes, or setting a mark on the IKE
socket and excluding such packets from the configured routing table via
_fwmark_ option).
charon.plugins.kernel-netlink.mss = 0
MSS to set on installed routes, 0 to disable.
@ -64,14 +66,16 @@ charon.plugins.kernel-netlink.process_rules = no
currently only useful if the kernel based route lookup is used (i.e. if
route installation is disabled or an inverted fwmark match is configured).
charon.plugins.kernel-netlink.receive_buffer_size = 0
charon.plugins.kernel-netlink.receive_buffer_size = 8388608
Maximum Netlink socket receive buffer in bytes.
Maximum Netlink socket receive buffer in bytes. This value controls how many
bytes of Netlink messages can be received on a Netlink socket. The default
value is set by /proc/sys/net/core/rmem_default. The specified value cannot
exceed the system-wide maximum from /proc/sys/net/core/rmem_max, unless
_force_receive_buffer_size_ is enabled.
bytes of Netlink messages can be queued to a Netlink socket. If set to 0,
the default from /proc/sys/net/core/rmem_default will apply. Note that the
kernel doubles the configured value to account for overhead. To exceed the
system-wide maximum from /proc/sys/net/core/rmem_max, special privileges
(CAP_NET_ADMIN) are necessary, otherwise, the kernel silently caps the
value.
charon.plugins.kernel-netlink.roam_events = yes
Whether to trigger roam events when interfaces, addresses or routes change.

View File

@ -1,4 +0,0 @@
charon.plugins.ntru.parameter_set = optimum
The following parameter sets are available: **x9_98_speed**,
**x9_98_bandwidth**, **x9_98_balance** and **optimum**, the last set not
being part of the X9.98 standard but having the best performance.

View File

@ -0,0 +1,4 @@
charon.plugins.openxpki.database =
Database URI connecting to the OpenXPKI **certificate** database. If it
contains a password, make sure to adjust the permissions of the config
file accordingly.

View File

@ -30,3 +30,8 @@ charon.plugins.pkcs11.use_pubkey = no
charon.plugins.pkcs11.use_rng = no
Whether the PKCS#11 modules should be used as RNG.
charon.plugins.pkcs11.use_rsa_pss_hashers = no
Whether the PKCS#11 modules should try to use internal hashing for RSA-PSS
signatures (some PKCS#11 libraries don't implement internal hashing
in conjunction with RSA-PSS correctly).

View File

@ -1,11 +1,20 @@
charon.plugins.resolve.file = /etc/resolv.conf
File where to add DNS server entries.
File where to add DNS server entries if not using resolvconf(8).
charon.plugins.resolve.resolvconf.iface_prefix = lo.inet.ipsec.
Prefix used for interface names sent to resolvconf(8).
charon.plugins.resolve.resolvconf.iface = lo.ipsec
Interface name/protocol sent to resolvconf(8).
Prefix used for interface names sent to **resolvconf**(8). The nameserver
address is appended to this prefix to make it unique. The result has to be
a valid interface name according to the rules defined by resolvconf. Also,
it should have a high priority according to the order defined in
**interface-order**(5).
The interface name and protocol sent to **resolvconf**(8). This has to be a
valid interface name according to the rules defined by resolvconf. Also, it
should have a high priority according to the order defined in
**interface-order**(5) if relevant on the system.
charon.plugins.resolve.resolvconf.path = /sbin/resolvconf
Path/command for resolvconf(8).
Path/command for **resolvconf**(8). The command is executed by a shell, so
"resolvconf" will work if it's in $PATH of the daemon.
If not configured, **resolvconf**(8) will be used if found at the default
location. Otherwise, the file in _charon.plugins.resolve.file_ will be
modified directly.

View File

@ -4,4 +4,5 @@ charon.plugins.revocation.enable_ocsp = yes
charon.plugins.revocation.enable_crl = yes
Whether CRL validation should be enabled.
charon.plugins.revocation.timeout = 10s
Timeout used when fetching OCSP/CRL.

View File

@ -1,7 +1,7 @@
charon.plugins.unbound.resolv_conf = /etc/resolv.conf
File to read DNS resolver configuration from.
charon.plugins.unbound.trust_anchors = /etc/ipsec.d/dnssec.keys
charon.plugins.unbound.trust_anchors = ${sysconfdir}/ipsec.d/dnssec.keys
File to read DNSSEC trust anchors from (usually root zone KSK).
File to read DNSSEC trust anchors from (usually root zone KSK). The format

View File

@ -59,6 +59,27 @@ An example file in this format might look like this:
.PP
Indentation is optional, you may use tabs or spaces.
.SH NUMBER FORMATS
Options that define an integer value can be specified as decimal (the default)
or hexadecimal ("0x" prefix, upper- or lowercase letters are accepted).
Locale-dependent strings (e.g. the thousands separator of the current locale)
may also be accepted in locales other than "C".
.PP
Options that define a floating-point value can be specified as decimal (the
default) or hexadecimal ("0x" prefix, upper- or lowercase letters are accepted).
The radix character (decimal separator) in either case is locale-dependent,
usually ".".
.SH TIME FORMATS
Unless stated otherwise, options that define a time are specified in seconds.
The "s", "m", "h" and "d" suffixes may be used to automatically convert values
given in seconds, minutes, hours or days (for instance, instead of configuring
a rekey time of 4 hours as "14400" seconds, "4h" may be used).
.PP
There are some global options that don't accept these suffixes as they are
configured as integer values in seconds or milliseconds, or even as
floating-point numbers (e.g. the retransmission timeout). Options that accept
the suffixes have a corresponding default value.
.SH REFERENCING OTHER SECTIONS
It is possible to inherit settings and sections from another section. This

View File

@ -458,6 +458,7 @@ The variables used above are configured as follows:
.na
${piddir} @piddir@
${prefix} @prefix@
${sysconfdir} @sysconfdir@
${random_device} @random_device@
${urandom_device} @urandom_device@
.ad
@ -467,18 +468,19 @@ ${urandom_device} @urandom_device@
.
.nf
.na
/etc/strongswan.conf configuration file
/etc/strongswan.d/ directory containing included config snippets
/etc/strongswan.d/charon/ plugin specific config snippets
@sysconfdir@/strongswan.conf configuration file
@sysconfdir@/strongswan.d/ directory containing included config snippets
@sysconfdir@/strongswan.d/charon/ plugin specific config snippets
.ad
.fi
.
.SH SEE ALSO
\fBswanctl.conf\fR(5), \fBswanctl\fR(8),
\fBipsec.conf\fR(5), \fBipsec.secrets\fR(5), \fBipsec\fR(8), \fBcharon-cmd\fR(8)
.SH HISTORY
Written for the
.UR http://www.strongswan.org
.UR https://www.strongswan.org
strongSwan project
.UE
by Tobias Brunner, Andreas Steffen and Martin Willi.

View File

@ -1,6 +1,6 @@
#
# Copyright (C) 2007-2017 Tobias Brunner
# Copyright (C) 2006-2019 Andreas Steffen
# Copyright (C) 2007-2022 Tobias Brunner
# Copyright (C) 2006-2022 Andreas Steffen
# Copyright (C) 2006-2014 Martin Willi
#
# Copyright (C) secunet Security Networks AG
@ -20,7 +20,7 @@
# initialize & set some vars
# ============================
AC_INIT([strongSwan],[5.9.7dr2])
AC_INIT([strongSwan],[6.0.3dr1])
AM_INIT_AUTOMAKE(m4_esyscmd([
echo tar-ustar
echo subdir-objects
@ -33,21 +33,18 @@ AM_INIT_AUTOMAKE(m4_esyscmd([
esac
]))
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_MACRO_DIR([m4/config])
AC_CONFIG_MACRO_DIRS([m4/config m4/macros])
AC_CONFIG_HEADERS([config.h])
AC_DEFINE([CONFIG_H_INCLUDED], [], [defined if config.h included])
AC_DISABLE_STATIC
PKG_PROG_PKG_CONFIG
m4_include(m4/macros/split-package-version.m4)
SPLIT_PACKAGE_VERSION
# =================================
# check --enable-xxx & --with-xxx
# =================================
m4_include(m4/macros/with.m4)
ARG_WITH_SUBST([random-device], [/dev/random], [set the device to read real random data from])
ARG_WITH_SUBST([urandom-device], [/dev/urandom], [set the device to read pseudo random data from])
ARG_WITH_SUBST([strongswan-conf], [${sysconfdir}/strongswan.conf], [set the strongswan.conf file location])
@ -70,7 +67,7 @@ ARG_WITH_SET([mpz_powm_sec], [yes], [use the more side-channel resistant
ARG_WITH_SET([dev-headers], [no], [install strongSwan development headers to directory.])
ARG_WITH_SET([printf-hooks], [auto], [force the use of a specific printf hook implementation (auto, builtin, glibc, vstr).])
ARG_WITH_SET([rubygemdir], ["gem environment gemdir"], [path to install ruby gems to])
ARG_WITH_SET([pythoneggdir], ["main site-packages directory"], [path to install python eggs to to])
ARG_WITH_SET([testable-ke], [yes], [make key exchange implementations testable by providing a set_seed() method])
if test -n "$PKG_CONFIG"; then
systemdsystemunitdir_default=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
@ -129,42 +126,38 @@ fi
# convert script name to uppercase
AC_SUBST(ipsec_script_upper, [`echo -n "$ipsec_script" | tr a-z A-Z`])
m4_include(m4/macros/enable-disable.m4)
# crypto plugins
ARG_DISBL_SET([aes], [disable AES software implementation plugin.])
ARG_ENABL_SET([aes], [enable AES software implementation plugin.])
ARG_ENABL_SET([af-alg], [enable AF_ALG crypto interface to Linux Crypto API.])
ARG_ENABL_SET([bliss], [enable BLISS software implementation plugin.])
ARG_ENABL_SET([blowfish], [enable Blowfish software implementation plugin.])
ARG_ENABL_SET([botan], [enables the Botan crypto plugin.])
ARG_ENABL_SET([ccm], [enables the CCM AEAD wrapper crypto plugin.])
ARG_ENABL_SET([chapoly], [enables the ChaCha20/Poly1305 AEAD plugin.])
ARG_DISBL_SET([cmac], [disable CMAC crypto implementation plugin.])
ARG_ENABL_SET([ctr], [enables the Counter Mode wrapper crypto plugin.])
ARG_DISBL_SET([des], [disable DES/3DES software implementation plugin.])
ARG_ENABL_SET([des], [enable DES/3DES software implementation plugin.])
ARG_DISBL_SET([drbg], [disable the NIST Deterministic Random Bit Generator plugin.])
ARG_DISBL_SET([fips-prf], [disable FIPS PRF software implementation plugin.])
ARG_ENABL_SET([gcm], [enables the GCM AEAD wrapper crypto plugin.])
ARG_ENABL_SET([fips-prf], [enable FIPS PRF software implementation plugin.])
ARG_ENABL_SET([gcm], [enable the GCM AEAD wrapper crypto plugin.])
ARG_ENABL_SET([gcrypt], [enables the libgcrypt plugin.])
ARG_DISBL_SET([gmp], [disable GNU MP (libgmp) based crypto implementation plugin.])
ARG_DISBL_SET([curve25519], [disable Curve25519 Diffie-Hellman plugin.])
ARG_DISBL_SET([hmac], [disable HMAC crypto implementation plugin.])
ARG_ENABL_SET([gmp], [enable GNU MP (libgmp) based crypto implementation plugin.])
ARG_ENABL_SET([curve25519], [enable Curve25519 Diffie-Hellman plugin.])
ARG_ENABL_SET([hmac], [enable HMAC crypto implementation plugin.])
ARG_DISBL_SET([kdf], [disable KDF (prf+) implementation plugin.])
ARG_ENABL_SET([md4], [enable MD4 software implementation plugin.])
ARG_DISBL_SET([md5], [disable MD5 software implementation plugin.])
ARG_ENABL_SET([md5], [enable MD5 software implementation plugin.])
ARG_ENABL_SET([mgf1], [enable the MGF1 software implementation plugin.])
ARG_ENABL_SET([newhope], [enable New Hope crypto plugin.])
ARG_ENABL_SET([ml], [enable Module-Lattice-based crypto (ML-KEM) plugin.])
ARG_DISBL_SET([nonce], [disable nonce generation plugin.])
ARG_ENABL_SET([ntru], [enables the NTRU crypto plugin.])
ARG_ENABL_SET([openssl], [enables the OpenSSL crypto plugin.])
ARG_DISBL_SET([openssl], [disable the OpenSSL crypto plugin.])
ARG_ENABL_SET([wolfssl], [enables the wolfSSL crypto plugin.])
ARG_ENABL_SET([padlock], [enables VIA Padlock crypto plugin.])
ARG_DISBL_SET([random], [disable RNG implementation on top of /dev/(u)random.])
ARG_DISBL_SET([rc2], [disable RC2 software implementation plugin.])
ARG_ENABL_SET([rc2], [enable RC2 software implementation plugin.])
ARG_ENABL_SET([rdrand], [enable Intel RDRAND random generator plugin.])
ARG_ENABL_SET([aesni], [enable Intel AES-NI crypto plugin.])
ARG_DISBL_SET([sha1], [disable SHA1 software implementation plugin.])
ARG_DISBL_SET([sha2], [disable SHA256/SHA384/SHA512 software implementation plugin.])
ARG_ENABL_SET([sha1], [enable SHA1 software implementation plugin.])
ARG_ENABL_SET([sha2], [enable SHA256/SHA384/SHA512 software implementation plugin.])
ARG_ENABL_SET([sha3], [enable SHA3_224/SHA3_256/SHA3_384/SHA3_512 software implementation plugin.])
ARG_DISBL_SET([xcbc], [disable xcbc crypto implementation plugin.])
# encoding/decoding plugins
@ -174,10 +167,11 @@ ARG_DISBL_SET([pgp], [disable PGP key decoding plugin.])
ARG_DISBL_SET([pkcs1], [disable PKCS1 key decoding plugin.])
ARG_DISBL_SET([pkcs7], [disable PKCS7 container support plugin.])
ARG_DISBL_SET([pkcs8], [disable PKCS8 private key decoding plugin.])
ARG_DISBL_SET([pkcs12], [disable PKCS12 container support plugin.])
ARG_ENABL_SET([pkcs12], [enable PKCS12 container support plugin.])
ARG_DISBL_SET([pubkey], [disable RAW public key support plugin.])
ARG_DISBL_SET([sshkey], [disable SSH key decoding plugin.])
ARG_DISBL_SET([x509], [disable X509 certificate implementation plugin.])
ARG_ENABL_SET([openxpki], [enable OCSP responder accessing OpenXPKI certificate database.])
# fetcher/resolver plugins
ARG_ENABL_SET([curl], [enable CURL fetcher plugin to fetch files via libcurl. Requires libcurl.])
ARG_ENABL_SET([files], [enable simple file:// URI fetcher.])
@ -236,10 +230,9 @@ ARG_DISBL_SET([socket-default], [disable default socket implementation for charo
ARG_ENABL_SET([socket-dynamic], [enable dynamic socket implementation for charon])
ARG_ENABL_SET([socket-win], [enable Winsock2 based socket implementation for charon])
# configuration/control plugins
ARG_DISBL_SET([stroke], [disable charons stroke configuration backend.])
ARG_ENABL_SET([stroke], [enable the stroke configuration backend.])
ARG_ENABL_SET([smp], [enable SMP configuration and control interface. Requires libxml.])
ARG_ENABL_SET([sql], [enable SQL database configuration backend.])
ARG_ENABL_SET([uci], [enable OpenWRT UCI configuration plugin.])
ARG_DISBL_SET([vici], [disable strongSwan IKE generic IPC interface plugin.])
# attribute provider/consumer plugins
ARG_ENABL_SET([android-dns], [enable Android specific DNS handler.])
@ -302,12 +295,12 @@ ARG_ENABL_SET([medcli], [enable mediation client configuration database
ARG_ENABL_SET([medsrv], [enable mediation server web frontend and daemon plugin.])
ARG_ENABL_SET([nm], [enable NetworkManager backend.])
ARG_DISBL_SET([pki], [disable pki certificate utility.])
ARG_DISBL_SET([scepclient], [disable SCEP client tool.])
ARG_DISBL_SET([scripts], [disable additional utilities (found in directory scripts).])
ARG_ENABL_SET([svc], [enable charon Windows service.])
ARG_ENABL_SET([systemd], [enable systemd specific IKE daemon charon-systemd.])
ARG_DISBL_SET([swanctl], [disable swanctl configuration and control tool.])
ARG_ENABL_SET([tkm], [enable Trusted Key Manager support.])
ARG_ENABL_SET([cert-enroll], [enable automatic certificate enrollment via EST or SCEP.])
# optional features
ARG_ENABL_SET([bfd-backtraces], [use binutils libbfd to resolve backtraces for memory leaks and segfaults.])
ARG_ENABL_SET([dbghelp-backtraces],[use dbghlp.dll on Windows to create and print backtraces for memory leaks and segfaults.])
@ -319,21 +312,24 @@ ARG_ENABL_SET([mediation], [enable IKEv2 Mediation Extension.])
ARG_ENABL_SET([unwind-backtraces],[use libunwind to create backtraces for memory leaks and segfaults.])
ARG_ENABL_SET([ruby-gems], [enable build of provided ruby gems.])
ARG_ENABL_SET([ruby-gems-install],[enable installation of provided ruby gems.])
ARG_ENABL_SET([python-eggs], [enable build of provided python eggs.])
ARG_ENABL_SET([python-eggs-install],[enable installation of provided python eggs.])
ARG_ENABL_SET([python-wheels], [enable build of provided python wheels.])
ARG_ENABL_SET([python-eggs], [legacy alias for --enable-python-wheels.])
ARG_ENABL_SET([perl-cpan], [enable build of provided perl CPAN module.])
ARG_ENABL_SET([perl-cpan-install],[enable installation of provided CPAN module.])
ARG_ENABL_SET([selinux], [enable SELinux support for labeled IPsec.])
ARG_ENABL_SET([tss-trousers], [enable the use of the TrouSerS Trusted Software Stack])
ARG_ENABL_SET([tss-tss2], [enable the use of the TSS 2.0 Trusted Software Stack])
ARG_ENABL_SET([cert-enroll-timer],[enable installation of cert-enroll as a systemd timer.])
# compile options
ARG_ENABL_SET([asan], [enable build with AddressSanitizer (ASan).])
ARG_ENABL_SET([coverage], [enable lcov coverage report generation.])
ARG_ENABL_SET([git-version], [use output of 'git describe' as version information in executables.])
ARG_ENABL_SET([leak-detective], [enable malloc hooks to find memory leaks.])
ARG_ENABL_SET([lock-profiler], [enable lock/mutex profiling code.])
ARG_ENABL_SET([log-thread-ids], [use thread ID, if available, instead of an incremented value starting from 1, to identify threads.])
ARG_ENABL_SET([monolithic], [build monolithic version of libstrongswan that includes all enabled plugins. Similarly, the plugins of charon are assembled in libcharon.])
ARG_ENABL_SET([warnings], [enable extended compiler warnings and -Werror (auto-enabled when building from the repository).])
# ===================================
# option to disable default options
@ -366,7 +362,7 @@ fi
# ===========================
if test -z "$CFLAGS"; then
CFLAGS="-g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign"
CFLAGS="-g -O2"
fi
AC_SUBST(PLUGIN_CFLAGS)
AC_PROG_CC
@ -383,7 +379,7 @@ LT_INIT
AC_PROG_INSTALL
AC_PROG_EGREP
AC_PROG_AWK
AC_PROG_LEX
AC_PROG_LEX(noyywrap)
AC_PROG_YACC
AM_PATH_PYTHON(,,[:])
AC_PATH_PROG([PERL], [perl], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
@ -452,7 +448,7 @@ if test x$tnc_imc = xtrue -o x$tnc_imv = xtrue -o x$tnccs_11 = xtrue -o x$tnccs_
tnc_tnccs=true;
fi
if test x$eap_tls = xtrue -o x$eap_ttls = xtrue -o x$eap_peap = xtrue -o x$tnc_tnccs = xtrue; then
if test x$eap_tls = xtrue -o x$eap_ttls = xtrue -o x$eap_peap = xtrue -o x$tnc_tnccs = xtrue -o x$pki = xtrue; then
tls=true;
fi
@ -466,6 +462,10 @@ if test x$fips_prf = xtrue; then
fi
fi
if test x$pkcs12 = xtrue; then
rc2=true;
fi
if test x$swanctl = xtrue; then
vici=true
fi
@ -491,8 +491,8 @@ if test x$ruby_gems_install = xtrue; then
ruby_gems=true
fi
if test x$python_eggs_install = xtrue; then
python_eggs=true
if test x$python_eggs = xtrue; then
python_wheels=true
fi
if test x$perl_cpan_install = xtrue; then
@ -507,28 +507,51 @@ if test x$tpm = xtrue; then
tss_tss2=true
fi
if test x$gmp = xtrue -o x$ntru = xtrue -o x$bliss = xtrue; then
if test x$gmp = xtrue; then
mgf1=true
fi
if test x$stroke = xtrue; then
if test x$stroke = xtrue -o x$vici = xtrue; then
counters=true
fi
if test x$cert_enroll = xtrue; then
pki=true
fi
if test x$kdf = xfalse; then
openssl_hkdf=false
if test x$openssl = xtrue; then
AC_MSG_CHECKING(for OpenSSL >= 3.0 for HKDF)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <openssl/opensslv.h>]],
[[#if OPENSSL_VERSION_NUMBER < 0x30000000L && !defined(OPENSSL_IS_AWSLC)
#error OpenSSL version unusable
#endif]])],
[AC_MSG_RESULT([yes]); openssl_hkdf=true],
[AC_MSG_RESULT([no])]
)
fi
if test x$aesni = xtrue -o x$cmac = xtrue -o x$xcbc = xtrue; then
AC_MSG_WARN(m4_normalize([
kdf plugin is required for possible use of PRF_AES128_XCBC/CMAC
by one of these plugins: aesni, cmac, xcbc]))
kdf=true
elif test x$botan = xfalse -a x$openssl = xfalse -a x$wolfssl = xfalse; then
elif test x$botan = xfalse -a x$openssl_hkdf = xfalse -a x$wolfssl = xfalse; then
AC_MSG_WARN(m4_normalize([
kdf plugin is required because none of the following plugins is
enabled: botan, openssl, wolfssl]))
enabled or usable: botan, openssl, wolfssl]))
kdf=true
fi
fi
# enable warnings and -Werror by default when building from the repo (check with
# -e as .git is a file in worktrees)
if test x$warnings_given = xfalse -a -e "$srcdir"/.git; then
warnings=true
fi
# ===========================================
# check required libraries and header files
# ===========================================
@ -581,6 +604,10 @@ AC_LINK_IFELSE(
AC_SUBST(ATOMICLIB)
LIBS=$saved_LIBS
# Some platforms require explicit linking to use POSIX regular expressions
AC_SEARCH_LIBS([regcomp], [regex], [AC_DEFINE([HAVE_REGEX], [], [have regcomp() etc.])])
# ------------------------------------------------------
AC_MSG_CHECKING(for dladdr)
@ -699,6 +726,11 @@ AC_CHECK_HEADERS([netinet/ip6.h linux/fib_rules.h], [], [],
#include <sys/types.h>
#include <netinet/in.h>
])
AC_CHECK_HEADERS([linux/vm_sockets.h], [have_vm_sockets=true], [],
[
#include <sys/socket.h>
])
AM_CONDITIONAL(USE_VM_SOCKETS, [test "x$have_vm_sockets" = xtrue])
AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [],
[
@ -737,7 +769,7 @@ AC_COMPILE_IFELSE(
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>]],
[[struct in6_pktinfo pi;
[[struct in6_pktinfo pi = {};
if (pi.ipi6_ifindex)
{
return 0;
@ -1012,7 +1044,7 @@ if test x$unbound = xtrue; then
fi
if test x$soup = xtrue; then
PKG_CHECK_MODULES(soup, [libsoup-2.4])
PKG_CHECK_MODULES(soup, [libsoup-3.0])
AC_SUBST(soup_CFLAGS)
AC_SUBST(soup_LIBS)
fi
@ -1023,14 +1055,16 @@ if test x$xml = xtrue; then
AC_SUBST(xml_LIBS)
fi
if test x$systemd = xtrue; then
if test x$systemd = xtrue -o x$cert_enroll_timer = xtrue; then
AC_MSG_CHECKING([for systemd system unit directory])
if test -n "$systemdsystemunitdir" -a "x$systemdsystemunitdir" != xno; then
AC_MSG_RESULT([$systemdsystemunitdir])
else
AC_MSG_ERROR([not found (try --with-systemdsystemunitdir)])
fi
fi
if test x$systemd = xtrue; then
PKG_CHECK_MODULES(systemd, [libsystemd >= 209],
[AC_SUBST(systemd_CFLAGS)
AC_SUBST(systemd_LIBS)],
@ -1162,7 +1196,7 @@ if test x$openssl = xtrue; then
if test "x$windows" = xtrue; then
openssl_lib=eay32
AC_CHECK_LIB([$openssl_lib],[EVP_CIPHER_CTX_new],[LIBS="$LIBS"],
[AC_MSG_RESULT([no]);openssl_lib=""],[$DLLIB])
[openssl_lib=""],[$DLLIB])
fi
if test -z "$openssl_lib"; then
openssl_lib=crypto
@ -1200,15 +1234,10 @@ if test x$botan = xtrue; then
AC_SUBST(botan_LIBS)
saved_LIBS=$LIBS
LIBS="$botan_LIBS"
AC_CHECK_FUNCS(botan_rng_init_custom)
AC_CHECK_FUNCS(botan_rng_init_custom botan_pubkey_ecc_key_used_explicit_encoding)
LIBS=$saved_LIBS
fi
if test x$uci = xtrue; then
AC_CHECK_LIB([uci],[uci_alloc_context],[LIBS="$LIBS"],[AC_MSG_ERROR([UCI library libuci not found])],[])
AC_CHECK_HEADER([uci.h],,[AC_MSG_ERROR([UCI header uci.h not found!])])
fi
if test x$android_dns = xtrue; then
AC_CHECK_LIB([cutils],[property_get],[LIBS="$LIBS"],[AC_MSG_ERROR([Android library libcutils not found])],[])
AC_CHECK_HEADER([cutils/properties.h],,[AC_MSG_ERROR([Android header cutils/properties.h not found!])])
@ -1316,14 +1345,16 @@ if test x$unwind_backtraces = xtrue; then
AC_SUBST(UNWINDLIB)
fi
if test "x$testable_ke" = xyes; then
AC_DEFINE([TESTABLE_KE], [1], [Define to 1 if key exchange methods should be testable.])
fi
AM_CONDITIONAL(USE_DEV_HEADERS, [test "x$dev_headers" != xno])
if test x$dev_headers = xyes; then
dev_headers="$includedir/strongswan"
fi
AC_SUBST(dev_headers)
CFLAGS="$CFLAGS -include `pwd`/config.h"
if test x$tkm = xtrue; then
AC_PATH_PROG([GPRBUILD], [gprbuild], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
if test x$GPRBUILD = x; then
@ -1341,7 +1372,7 @@ if test x$coverage = xtrue; then
AC_MSG_ERROR([genhtml not found])
fi
COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage"
COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage -fprofile-update=atomic"
COVERAGE_LDFLAGS="-fprofile-arcs"
AC_SUBST(COVERAGE_CFLAGS)
AC_SUBST(COVERAGE_LDFLAGS)
@ -1374,6 +1405,27 @@ if test x$fuzzing = xtrue; then
esac
fi
if test x$asan = xtrue; then
# adding this here and not earlier or passed to the script avoids issues
# e.g. with libpthread (libasan provides stubs for its functions but no full
# implementation so configure does not detect that -lpthread is required
# when GCC is used, clang always adds -lpthread)
CFLAGS="$CFLAGS -fsanitize=address -fno-omit-frame-pointer"
# this is necessary so AddressSanitizer can resolve symbols e.g. for
# C++ exceptions that are used in libbotan
if test x$botan = xtrue; then
LDFLAGS="$LDFLAGS -lstdc++"
fi
if test x$openssl = xtrue; then
# we need to suppress some leaks with OpenSSL 3 as we don't deinitialze
# it properly
AC_SUBST(LSAN_OPTIONS, [suppressions=\${abs_top_srcdir}/.lsan.suppressions])
# use this instead of AM_TESTS_ENVIRONMENT as we don't use the parallel
# test harness
AC_SUBST(TESTS_ENVIRONMENT, ['export LSAN_OPTIONS="$(LSAN_OPTIONS)";'])
fi
fi
if test x$ruby_gems = xtrue; then
AC_PATH_PROG([GEM], [gem], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
if test x$GEM = x; then
@ -1386,24 +1438,12 @@ if test x$ruby_gems = xtrue; then
fi
AM_CONDITIONAL(RUBY_GEMS_INSTALL, [test "x$ruby_gems_install" = xtrue])
if test x$python_eggs = xtrue; then
if test x$python_wheels = xtrue; then
PYTHON_PACKAGE_VERSION=`echo "$PACKAGE_VERSION" | $SED 's/dr/.dev/'`
AC_SUBST([PYTHON_PACKAGE_VERSION])
if test x$python_eggs_install = xtrue; then
AC_PATH_PROG([EASY_INSTALL], [easy_install], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
if test x$EASY_INSTALL = x; then
AC_MSG_ERROR(Python easy_install not found)
fi
fi
if test "x$pythoneggdir" = "xmain site-packages directory"; then
AC_SUBST(PYTHONEGGINSTALLDIR, "")
else
AC_SUBST(PYTHONEGGINSTALLDIR, "--install-dir $pythoneggdir")
fi
AC_PATH_PROG([TOX], [tox], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
AC_PATH_PROG([PY_TEST], [py.test], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
fi
AM_CONDITIONAL(PYTHON_EGGS_INSTALL, [test "x$python_eggs_install" = xtrue])
AM_CONDITIONAL(PERL_CPAN_INSTALL, [test "x$perl_cpan_install" = xtrue])
@ -1441,18 +1481,44 @@ if test x$git_version = xtrue -a "$GIT_VERSION" != "UNKNOWN"; then
AC_DEFINE_UNQUOTED(VERSION, ["$GIT_VERSION"])
fi
# modify CFLAGS as needed, do this late so we don't affect configure checks
CFLAGS="$CFLAGS -include $(pwd)/config.h"
AC_MSG_CHECKING([for use of -Werror and additional warnings])
WARN_CFLAGS=
if test x$warnings = xtrue; then
WARN_CFLAGS="-Werror -Wall -Wextra"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
# disable some warnings, whether explicitly enabled above or by default
# these are not compatible with our custom printf specifiers
WARN_CFLAGS="$WARN_CFLAGS -Wno-format"
WARN_CFLAGS="$WARN_CFLAGS -Wno-format-security"
# we generally use comments, but GCC doesn't seem to recognize many of them
WARN_CFLAGS="$WARN_CFLAGS -Wno-implicit-fallthrough"
# we often omit fields when initializing structs (e.g. when using INIT)
WARN_CFLAGS="$WARN_CFLAGS -Wno-missing-field-initializers"
# allow assigning char* to u_char* (e.g. in chunk_create())
WARN_CFLAGS="$WARN_CFLAGS -Wno-pointer-sign"
# allow comparing e.g. int with chunk_t::len or countof(...)
WARN_CFLAGS="$WARN_CFLAGS -Wno-sign-compare"
# allow defensive checks like e.g. unsigned_var < CONST(= currently 0)
WARN_CFLAGS="$WARN_CFLAGS -Wno-type-limits"
# we often don't use function parameters when implementing interfaces
WARN_CFLAGS="$WARN_CFLAGS -Wno-unused-parameter"
# add the flags before existing CFLAGS so warning flags can be overridden
CFLAGS="$WARN_CFLAGS $CFLAGS"
# ===============================================
# collect plugin list for strongSwan components
# ===============================================
m4_include(m4/macros/add-plugin.m4)
# plugin lists for all components
charon_plugins=
starter_plugins=
pool_plugins=
attest_plugins=
scepclient_plugins=
pki_plugins=
scripts_plugins=
fuzz_plugins=
@ -1469,48 +1535,48 @@ s_plugins=
t_plugins=
p_plugins=
ADD_PLUGIN([test-vectors], [s charon scepclient pki])
ADD_PLUGIN([test-vectors], [s charon pki])
ADD_PLUGIN([unbound], [s charon scripts])
ADD_PLUGIN([ldap], [s charon scepclient scripts nm cmd])
ADD_PLUGIN([ldap], [s charon scripts nm cmd])
ADD_PLUGIN([pkcs11], [s charon pki nm cmd])
ADD_PLUGIN([tpm], [p charon pki nm cmd])
ADD_PLUGIN([aesni], [s charon scepclient pki scripts medsrv attest nm cmd aikgen])
ADD_PLUGIN([aes], [s charon scepclient pki scripts nm cmd])
ADD_PLUGIN([des], [s charon scepclient pki scripts nm cmd])
ADD_PLUGIN([blowfish], [s charon scepclient pki scripts nm cmd])
ADD_PLUGIN([rc2], [s charon scepclient pki scripts nm cmd])
ADD_PLUGIN([sha2], [s charon scepclient pki scripts medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([sha3], [s charon scepclient pki scripts medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([sha1], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([md4], [s charon scepclient pki nm cmd])
ADD_PLUGIN([md5], [s charon scepclient pki scripts attest nm cmd aikgen])
ADD_PLUGIN([mgf1], [s charon scepclient pki scripts medsrv attest nm cmd aikgen])
ADD_PLUGIN([rdrand], [s charon scepclient pki scripts medsrv attest nm cmd aikgen])
ADD_PLUGIN([random], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([aesni], [s charon pki scripts medsrv attest nm cmd aikgen])
ADD_PLUGIN([aes], [s charon pki scripts nm cmd])
ADD_PLUGIN([des], [s charon pki scripts nm cmd])
ADD_PLUGIN([blowfish], [s charon pki scripts nm cmd])
ADD_PLUGIN([rc2], [s charon pki scripts nm cmd])
ADD_PLUGIN([sha2], [s charon pki scripts medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([sha3], [s charon pki scripts medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([sha1], [s charon pki scripts manager medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([md4], [s charon pki nm cmd])
ADD_PLUGIN([md5], [s charon pki scripts attest nm cmd aikgen])
ADD_PLUGIN([mgf1], [s charon pki scripts medsrv attest nm cmd aikgen])
ADD_PLUGIN([rdrand], [s charon pki scripts medsrv attest nm cmd aikgen])
ADD_PLUGIN([random], [s charon pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([nonce], [s charon nm cmd aikgen])
ADD_PLUGIN([x509], [s charon scepclient pki scripts attest nm cmd aikgen fuzz])
ADD_PLUGIN([x509], [s charon pki scripts attest nm cmd aikgen fuzz])
ADD_PLUGIN([revocation], [s charon pki nm cmd])
ADD_PLUGIN([constraints], [s charon nm cmd])
ADD_PLUGIN([constraints], [s charon pki nm cmd])
ADD_PLUGIN([acert], [s charon])
ADD_PLUGIN([pubkey], [s charon pki cmd aikgen])
ADD_PLUGIN([pkcs1], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([pkcs7], [s charon scepclient pki scripts nm cmd])
ADD_PLUGIN([pkcs12], [s charon scepclient pki scripts cmd])
ADD_PLUGIN([pkcs1], [s charon pki scripts manager medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([pkcs7], [s charon pki scripts nm cmd])
ADD_PLUGIN([pkcs12], [s charon pki scripts cmd])
ADD_PLUGIN([pgp], [s charon])
ADD_PLUGIN([dnskey], [s charon pki])
ADD_PLUGIN([sshkey], [s charon pki nm cmd])
ADD_PLUGIN([dnscert], [c charon])
ADD_PLUGIN([ipseckey], [c charon])
ADD_PLUGIN([pem], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([pem], [s charon pki scripts manager medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([padlock], [s charon])
ADD_PLUGIN([openssl], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([wolfssl], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([gcrypt], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([botan], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([pkcs8], [s charon scepclient pki scripts manager medsrv attest nm cmd])
ADD_PLUGIN([af-alg], [s charon scepclient pki scripts medsrv attest nm cmd aikgen])
ADD_PLUGIN([openssl], [s charon pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([wolfssl], [s charon pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([gcrypt], [s charon pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([botan], [s charon pki scripts manager medsrv attest nm cmd aikgen])
ADD_PLUGIN([pkcs8], [s charon pki scripts manager medsrv attest nm cmd])
ADD_PLUGIN([af-alg], [s charon pki scripts medsrv attest nm cmd aikgen])
ADD_PLUGIN([fips-prf], [s charon nm cmd])
ADD_PLUGIN([gmp], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([gmp], [s charon pki scripts manager medsrv attest nm cmd aikgen fuzz])
ADD_PLUGIN([curve25519], [s charon pki scripts nm cmd])
ADD_PLUGIN([agent], [s charon nm cmd])
ADD_PLUGIN([keychain], [s charon cmd])
@ -1522,26 +1588,25 @@ ADD_PLUGIN([kdf], [s charon pki scripts nm cmd])
ADD_PLUGIN([ctr], [s charon scripts nm cmd])
ADD_PLUGIN([ccm], [s charon scripts nm cmd])
ADD_PLUGIN([gcm], [s charon scripts nm cmd])
ADD_PLUGIN([ntru], [s charon scripts nm cmd])
ADD_PLUGIN([ml], [s charon scripts nm cmd])
ADD_PLUGIN([drbg], [s charon pki scripts nm cmd])
ADD_PLUGIN([newhope], [s charon scripts nm cmd])
ADD_PLUGIN([bliss], [s charon pki scripts nm cmd])
ADD_PLUGIN([curl], [s charon scepclient pki scripts nm cmd])
ADD_PLUGIN([files], [s charon scepclient pki scripts nm cmd])
ADD_PLUGIN([curl], [s charon pki scripts nm cmd])
ADD_PLUGIN([files], [s charon pki scripts nm cmd])
ADD_PLUGIN([winhttp], [s charon pki scripts])
ADD_PLUGIN([soup], [s charon pki scripts nm cmd])
ADD_PLUGIN([mysql], [s charon pool manager medsrv attest])
ADD_PLUGIN([sqlite], [s charon pool manager medsrv attest])
ADD_PLUGIN([mysql], [s charon pki pool manager medsrv attest])
ADD_PLUGIN([sqlite], [s charon pki pool manager medsrv attest])
ADD_PLUGIN([openxpki], [s pki])
ADD_PLUGIN([attr], [c charon])
ADD_PLUGIN([attr-sql], [c charon])
ADD_PLUGIN([load-tester], [c charon])
ADD_PLUGIN([kernel-libipsec], [c charon cmd])
ADD_PLUGIN([kernel-wfp], [c charon])
ADD_PLUGIN([kernel-iph], [c charon])
ADD_PLUGIN([kernel-pfkey], [c charon starter nm cmd])
ADD_PLUGIN([kernel-pfroute], [c charon starter nm cmd])
ADD_PLUGIN([kernel-netlink], [c charon starter nm cmd])
ADD_PLUGIN([selinux], [c charon starter nm cmd])
ADD_PLUGIN([kernel-pfkey], [c charon nm cmd])
ADD_PLUGIN([kernel-pfroute], [c charon nm cmd])
ADD_PLUGIN([kernel-netlink], [c charon nm cmd])
ADD_PLUGIN([selinux], [c charon nm cmd])
ADD_PLUGIN([resolve], [c charon cmd])
ADD_PLUGIN([save-keys], [c])
ADD_PLUGIN([socket-default], [c charon nm cmd])
@ -1605,16 +1670,13 @@ ADD_PLUGIN([led], [c charon])
ADD_PLUGIN([duplicheck], [c charon])
ADD_PLUGIN([coupling], [c charon])
ADD_PLUGIN([radattr], [c charon])
ADD_PLUGIN([uci], [c charon])
ADD_PLUGIN([addrblock], [c charon])
ADD_PLUGIN([unity], [c charon])
ADD_PLUGIN([counters], [c charon])
AC_SUBST(charon_plugins)
AC_SUBST(starter_plugins)
AC_SUBST(pool_plugins)
AC_SUBST(attest_plugins)
AC_SUBST(scepclient_plugins)
AC_SUBST(pki_plugins)
AC_SUBST(scripts_plugins)
AC_SUBST(fuzz_plugins)
@ -1668,6 +1730,7 @@ AM_CONDITIONAL(USE_PKCS1, test x$pkcs1 = xtrue)
AM_CONDITIONAL(USE_PKCS7, test x$pkcs7 = xtrue)
AM_CONDITIONAL(USE_PKCS8, test x$pkcs8 = xtrue)
AM_CONDITIONAL(USE_PKCS12, test x$pkcs12 = xtrue)
AM_CONDITIONAL(USE_OPENXPKI, test x$openxpki = xtrue)
AM_CONDITIONAL(USE_PGP, test x$pgp = xtrue)
AM_CONDITIONAL(USE_DNSKEY, test x$dnskey = xtrue)
AM_CONDITIONAL(USE_SSHKEY, test x$sshkey = xtrue)
@ -1692,10 +1755,8 @@ AM_CONDITIONAL(USE_CTR, test x$ctr = xtrue)
AM_CONDITIONAL(USE_CCM, test x$ccm = xtrue)
AM_CONDITIONAL(USE_GCM, test x$gcm = xtrue)
AM_CONDITIONAL(USE_AF_ALG, test x$af_alg = xtrue)
AM_CONDITIONAL(USE_NTRU, test x$ntru = xtrue)
AM_CONDITIONAL(USE_NEWHOPE, test x$newhope = xtrue)
AM_CONDITIONAL(USE_BLISS, test x$bliss = xtrue)
AM_CONDITIONAL(USE_DRBG, test x$drbg = xtrue)
AM_CONDITIONAL(USE_ML, test x$ml = xtrue)
# charon plugins
# ----------------
@ -1703,7 +1764,6 @@ AM_CONDITIONAL(USE_STROKE, test x$stroke = xtrue)
AM_CONDITIONAL(USE_VICI, test x$vici = xtrue)
AM_CONDITIONAL(USE_MEDSRV, test x$medsrv = xtrue)
AM_CONDITIONAL(USE_MEDCLI, test x$medcli = xtrue)
AM_CONDITIONAL(USE_UCI, test x$uci = xtrue)
AM_CONDITIONAL(USE_OSX_ATTR, test x$osx_attr = xtrue)
AM_CONDITIONAL(USE_P_CSCF, test x$p_cscf = xtrue)
AM_CONDITIONAL(USE_ANDROID_DNS, test x$android_dns = xtrue)
@ -1790,6 +1850,7 @@ AM_CONDITIONAL(USE_ATTR, test x$attr = xtrue)
AM_CONDITIONAL(USE_ATTR_SQL, test x$attr_sql = xtrue)
AM_CONDITIONAL(USE_COUNTERS, test x$counters = xtrue)
AM_CONDITIONAL(USE_SELINUX, test x$selinux = xtrue)
AM_CONDITIONAL(USE_PF_HANDLER, test x$dhcp = xtrue -o x$farp = xtrue)
# other options
# ---------------
@ -1807,20 +1868,18 @@ AM_CONDITIONAL(USE_ADNS, test x$adns = xtrue)
AM_CONDITIONAL(USE_CHARON, test x$charon = xtrue)
AM_CONDITIONAL(USE_NM, test x$nm = xtrue)
AM_CONDITIONAL(USE_PKI, test x$pki = xtrue)
AM_CONDITIONAL(USE_SCEPCLIENT, test x$scepclient = xtrue)
AM_CONDITIONAL(USE_SCRIPTS, test x$scripts = xtrue)
AM_CONDITIONAL(USE_FUZZING, test x$fuzzing = xtrue)
AM_CONDITIONAL(USE_CONFTEST, test x$conftest = xtrue)
AM_CONDITIONAL(USE_LIBSTRONGSWAN, test x$charon = xtrue -o x$pki = xtrue -o x$scepclient = xtrue -o x$conftest = xtrue -o x$fast = xtrue -o x$imcv = xtrue -o x$nm = xtrue -o x$tkm = xtrue -o x$cmd = xtrue -o x$tls = xtrue -o x$tnc_tnccs = xtrue -o x$aikgen = xtrue -o x$svc = xtrue -o x$systemd = xtrue)
AM_CONDITIONAL(USE_LIBSTRONGSWAN, test x$charon = xtrue -o x$pki = xtrue -o x$conftest = xtrue -o x$fast = xtrue -o x$imcv = xtrue -o x$nm = xtrue -o x$tkm = xtrue -o x$cmd = xtrue -o x$tls = xtrue -o x$tnc_tnccs = xtrue -o x$aikgen = xtrue -o x$svc = xtrue -o x$systemd = xtrue)
AM_CONDITIONAL(USE_LIBCHARON, test x$charon = xtrue -o x$conftest = xtrue -o x$nm = xtrue -o x$tkm = xtrue -o x$cmd = xtrue -o x$svc = xtrue -o x$systemd = xtrue)
AM_CONDITIONAL(USE_LIBIPSEC, test x$libipsec = xtrue)
AM_CONDITIONAL(USE_LIBNTTFFT, test x$bliss = xtrue -o x$newhope = xtrue)
AM_CONDITIONAL(USE_LIBTNCIF, test x$tnc_tnccs = xtrue -o x$imcv = xtrue)
AM_CONDITIONAL(USE_LIBTNCCS, test x$tnc_tnccs = xtrue)
AM_CONDITIONAL(USE_LIBPTTLS, test x$tnc_tnccs = xtrue)
AM_CONDITIONAL(USE_LIBTPMTSS, test x$tss_trousers = xtrue -o x$tss_tss2 = xtrue -o x$tpm = xtrue -o x$aikgen = xtrue -o x$imcv = xtrue)
AM_CONDITIONAL(USE_FILE_CONFIG, test x$stroke = xtrue)
AM_CONDITIONAL(USE_IPSEC_SCRIPT, test x$stroke = xtrue -o x$scepclient = xtrue -o x$conftest = xtrue)
AM_CONDITIONAL(USE_IPSEC_SCRIPT, test x$stroke = xtrue -o x$conftest = xtrue)
AM_CONDITIONAL(USE_LIBCAP, test x$capabilities = xlibcap)
AM_CONDITIONAL(USE_VSTR, test x$printf_hooks = xvstr)
AM_CONDITIONAL(USE_BUILTIN_PRINTF, test x$printf_hooks = xbuiltin)
@ -1842,8 +1901,10 @@ AM_CONDITIONAL(USE_SWANCTL, test x$swanctl = xtrue)
AM_CONDITIONAL(USE_SVC, test x$svc = xtrue)
AM_CONDITIONAL(USE_SYSTEMD, test x$systemd = xtrue)
AM_CONDITIONAL(USE_LEGACY_SYSTEMD, test -n "$systemdsystemunitdir" -a "x$systemdsystemunitdir" != xno)
AM_CONDITIONAL(USE_CERT_ENROLL, test x$cert_enroll = xtrue)
AM_CONDITIONAL(USE_CERT_ENROLL_TIMER, test x$cert_enroll_timer = xtrue)
AM_CONDITIONAL(USE_RUBY_GEMS, test x$ruby_gems = xtrue)
AM_CONDITIONAL(USE_PYTHON_EGGS, test x$python_eggs = xtrue)
AM_CONDITIONAL(USE_PYTHON_WHEELS, test x$python_wheels = xtrue)
AM_CONDITIONAL(USE_PERL_CPAN, test x$perl_cpan = xtrue)
AM_CONDITIONAL(USE_TOX, test "x$TOX" != x)
AM_CONDITIONAL(USE_PY_TEST, test "x$PY_TEST" != x -a "x$TOX" = x)
@ -1888,15 +1949,16 @@ strongswan_options=
AM_COND_IF([USE_AIKGEN], [strongswan_options=${strongswan_options}" aikgen"])
AM_COND_IF([USE_ATTR_SQL], [strongswan_options=${strongswan_options}" pool"])
AM_COND_IF([USE_CHARON], [strongswan_options=${strongswan_options}" charon charon-logging"])
AM_COND_IF([USE_CHARON], [strongswan_options=${strongswan_options}" charon charon-logging iptfs"])
AM_COND_IF([USE_FILE_CONFIG], [strongswan_options=${strongswan_options}" starter"])
AM_COND_IF([USE_IMV_ATTESTATION], [strongswan_options=${strongswan_options}" attest"])
AM_COND_IF([USE_IMCV], [strongswan_options=${strongswan_options}" imcv"])
AM_COND_IF([USE_IMCV], [strongswan_options=${strongswan_options}" imcv imv_policy_manager"])
AM_COND_IF([USE_IMC_SWIMA], [strongswan_options=${strongswan_options}" sw-collector"])
AM_COND_IF([USE_IMV_SWIMA], [strongswan_options=${strongswan_options}" sec-updater"])
AM_COND_IF([USE_LIBTNCCS], [strongswan_options=${strongswan_options}" tnc"])
AM_COND_IF([USE_MANAGER], [strongswan_options=${strongswan_options}" manager"])
AM_COND_IF([USE_MEDSRV], [strongswan_options=${strongswan_options}" medsrv"])
AM_COND_IF([USE_SCEPCLIENT], [strongswan_options=${strongswan_options}" scepclient"])
AM_COND_IF([USE_NM], [strongswan_options=${strongswan_options}" charon-nm"])
AM_COND_IF([USE_PKI], [strongswan_options=${strongswan_options}" pki"])
AM_COND_IF([USE_SWANCTL], [strongswan_options=${strongswan_options}" swanctl"])
AM_COND_IF([USE_SYSTEMD], [strongswan_options=${strongswan_options}" charon-systemd"])
@ -1918,8 +1980,6 @@ AC_CONFIG_FILES([
src/Makefile
src/include/Makefile
src/libstrongswan/Makefile
src/libstrongswan/math/libnttfft/Makefile
src/libstrongswan/math/libnttfft/tests/Makefile
src/libstrongswan/plugins/aes/Makefile
src/libstrongswan/plugins/cmac/Makefile
src/libstrongswan/plugins/des/Makefile
@ -1950,6 +2010,7 @@ AC_CONFIG_FILES([
src/libstrongswan/plugins/pkcs7/Makefile
src/libstrongswan/plugins/pkcs8/Makefile
src/libstrongswan/plugins/pkcs12/Makefile
src/libstrongswan/plugins/openxpki/Makefile
src/libstrongswan/plugins/pgp/Makefile
src/libstrongswan/plugins/dnskey/Makefile
src/libstrongswan/plugins/sshkey/Makefile
@ -1976,11 +2037,7 @@ AC_CONFIG_FILES([
src/libstrongswan/plugins/gcm/Makefile
src/libstrongswan/plugins/af_alg/Makefile
src/libstrongswan/plugins/drbg/Makefile
src/libstrongswan/plugins/ntru/Makefile
src/libstrongswan/plugins/bliss/Makefile
src/libstrongswan/plugins/bliss/tests/Makefile
src/libstrongswan/plugins/newhope/Makefile
src/libstrongswan/plugins/newhope/tests/Makefile
src/libstrongswan/plugins/ml/Makefile
src/libstrongswan/plugins/test_vectors/Makefile
src/libstrongswan/tests/Makefile
src/libipsec/Makefile
@ -2061,7 +2118,6 @@ AC_CONFIG_FILES([
src/libcharon/plugins/medcli/Makefile
src/libcharon/plugins/addrblock/Makefile
src/libcharon/plugins/unity/Makefile
src/libcharon/plugins/uci/Makefile
src/libcharon/plugins/ha/Makefile
src/libcharon/plugins/kernel_netlink/Makefile
src/libcharon/plugins/kernel_pfkey/Makefile
@ -2103,7 +2159,6 @@ AC_CONFIG_FILES([
src/starter/Makefile
src/starter/tests/Makefile
src/_updown/Makefile
src/scepclient/Makefile
src/aikgen/Makefile
src/tpm_extendpcr/Makefile
src/pki/Makefile
@ -2118,6 +2173,7 @@ AC_CONFIG_FILES([
src/sw-collector/Makefile
src/sec-updater/Makefile
src/swanctl/Makefile
src/cert-enroll/Makefile
src/xfrmi/Makefile
scripts/Makefile
testing/Makefile
@ -2136,14 +2192,19 @@ AC_CONFIG_FILES([
src/pki/man/pki.1
src/pki/man/pki---acert.1
src/pki/man/pki---dn.1
src/pki/man/pki---est.1
src/pki/man/pki---estca.1
src/pki/man/pki---gen.1
src/pki/man/pki---issue.1
src/pki/man/pki---keyid.1
src/pki/man/pki---ocsp.1
src/pki/man/pki---pkcs12.1
src/pki/man/pki---pkcs7.1
src/pki/man/pki---print.1
src/pki/man/pki---pub.1
src/pki/man/pki---req.1
src/pki/man/pki---scep.1
src/pki/man/pki---scepca.1
src/pki/man/pki---self.1
src/pki/man/pki---signcrl.1
src/pki/man/pki---verify.1
@ -2153,6 +2214,7 @@ AC_CONFIG_FILES([
src/pt-tls-client/pt-tls-client.1
src/sw-collector/sw-collector.8
src/sec-updater/sec-updater.8
src/cert-enroll/cert-enroll.8
])
AC_OUTPUT

View File

@ -1,505 +0,0 @@
Network Working Group Y. Sheffer
Internet-Draft Check Point
Intended status: Informational July 6, 2008
Expires: January 7, 2009
Using EAP-GTC for Simple User Authentication in IKEv2
draft-sheffer-ikev2-gtc-00.txt
Status of this Memo
By submitting this Internet-Draft, each author represents that any
applicable patent or other IPR claims of which he or she is aware
have been or will be disclosed, and any of which he or she becomes
aware will be disclosed, in accordance with Section 6 of BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that
other groups may also distribute working documents as Internet-
Drafts.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt.
The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html.
This Internet-Draft will expire on January 7, 2009.
Abstract
Despite many years of effort, simple username-password authentication
is still prevalent. In many cases a password is the only credential
available to the end user. IKEv2 uses EAP as a sub-protocol for user
authentication. This provides a well-specified and extensible
architecture. To this day EAP does not provide a simple password-
based authentication method. The only existing password
authentication methods either require the peer to know the password
in advance (EAP-MD5), or are needlessly complex when used within
IKEv2 (e.g. PEAP). This document codifies the common practice of
using EAP-GTC for this type of authentication, with the goal of
achieving maximum interoperability. The various security issues are
extensively analyzed.
Sheffer Expires January 7, 2009 [Page 1]
Internet-Draft EAP-GTC in IKEv2 July 2008
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3. Alternatives to EAP-GTC in IKEv2 . . . . . . . . . . . . . . . 4
3.1. Non-password credentials . . . . . . . . . . . . . . . . . 4
3.2. Using the IKE preshared secret . . . . . . . . . . . . . . 4
3.3. EAP-MD5 , EAP-MSCHAPv2 and mutual authentication
schemes . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4. Using EAP-GTC in IKE: Details . . . . . . . . . . . . . . . . . 5
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 6
6. Security Considerations . . . . . . . . . . . . . . . . . . . . 6
6.1. Key generation and MITM protection . . . . . . . . . . . . 6
6.2. Protection of credentials between the IKE gateway and
the AAA server . . . . . . . . . . . . . . . . . . . . . . 6
6.3. Server authentication . . . . . . . . . . . . . . . . . . . 6
7. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . 7
8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 7
8.1. Normative References . . . . . . . . . . . . . . . . . . . 7
8.2. Informative References . . . . . . . . . . . . . . . . . . 7
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . . 8
A.1. -00 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 8
Intellectual Property and Copyright Statements . . . . . . . . . . 9
Sheffer Expires January 7, 2009 [Page 2]
Internet-Draft EAP-GTC in IKEv2 July 2008
1. Introduction
"Oh dear! It's possible that we have added EAP to IKE to support a
case that EAP can't support." -- C. Kaufman.
Despite many years of effort, simple username-password authentication
is still prevalent. In many cases a password is the only credential
available to the end user.
IKEv2 [RFC4306] uses the Extensible Authentication Protocol (EAP) as
a sub-protocol for user authentication. This provides a well-
specified and extensible architecture and enables useful capabilities
like SIM authentication. Unfortunately, for a number of reasons EAP
still does not provide a simple password-based authentication method.
The only existing password authentication methods either require the
peer to know the password in advance (EAP-MD5), or are needlessly
complex when used within IKEv2 (e.g. PEAP).
Technically, the IKE preshared secret authentication mode can be used
for password authentication. In fact even the IKEv2 RFC winks at
this practice. But this use jeopardizes the protocol's security and
should clearly be avoided (more details below).
EAP is used in IKEv2 at a stage when the remote access gateway has
already been authenticated. At this point the user has a high enough
level of trust to send his or her password to the gateway. Such an
exchange is enabled by the EAP Generic Token Card (GTC) method, which
is a simple text transport between the two EAP peers. To quote
[RFC3748]:
The EAP GTC method is intended for use with the Token Cards
supporting challenge/response authentication and MUST NOT be used
to provide support for cleartext passwords in the absence of a
protected tunnel with server authentication.
IKEv2 does indeed provide "a protected tunnel with server
authentication". The current document updates [RFC3748] by making an
exception and allowing the use of GTC to carry secret credentials, in
this specific situation. Section 6 further elaborates on the
security properties of this solution.
Other protocols provide a similar protected tunnel, for example TLS-
EAP, described in [I-D.nir-tls-eap]. These protocols however are out
of scope for this document.
Sheffer Expires January 7, 2009 [Page 3]
Internet-Draft EAP-GTC in IKEv2 July 2008
2. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119].
3. Alternatives to EAP-GTC in IKEv2
This section presents a few of the alternatives to EAP-GTC, and
explains why they are either insecure or impractical given today's
common identity management infrastructure.
3.1. Non-password credentials
Certificate-based authentication, especially when combined with
hardware protection (e.g. a hardware token), can be deployed in a
more secure manner than the form of password authentication which we
discuss. However, due to a host of issues to do with cost,
inconvenience and reliability this solution has not gained wide
market acceptance over the last 10 years.
3.2. Using the IKE preshared secret
Sec. 2.15 of RFC 4306 points out that the generation of the IKE
preshared secret from a weak password is insecure. Such use is
vulnerable to off line password guessing by an active attacker. All
the attacker needs to do is respond correctly to the first IKE_INIT
message, and then record the third IKE message. This is then
followed by a dictionary attack to obtain the password.
3.3. EAP-MD5 , EAP-MSCHAPv2 and mutual authentication schemes
Challenge-response schemes, like EAP-MD5 and EAP-MSCHAPv2, have a
clear security advantage over sending the plaintext password to the
gateway. Password-based mutual authentication schemes like SRP have
a further advantage in that the gateway's authentication is much
stronger than when using certificates alone, since the AAA server
proves its knowledge of a per-client credential, and the gateway
proves that it has been authorized by the AAA server for that
particular client.
Unfortunately all of these methods also suffer from a major drawback:
the gateway must have a priori access to the plaintext password.
While many RADIUS servers may indeed have such access, other very
common deployments do not provide it. One typical example is when
the gateway directly accesses an LDAP directory (or a Microsoft
Active Directory) to authenticate the user. The usual way to do that
Sheffer Expires January 7, 2009 [Page 4]
Internet-Draft EAP-GTC in IKEv2 July 2008
is by issuing an LDAP Bind operation into the directory, using the
just-received plaintext password. Often in this case it is the IKE
gateway that terminates the EAP protocol, and it needs a way to
obtain the raw password.
An additional issue with mutual authentication schemes is their heavy
IP encumbrance, which has resulted in a scarcity of standards using
them and a low rate of market adoption.
4. Using EAP-GTC in IKE: Details
EAP-GTC is specified in [RFC3748], Sec. 5.6. This section is non-
normative, and is merely an interpretation of this specification in
the context of IKEv2.
Simple authentication requires a non secret identity ("user name")
and a secret credential ("password"). Both of these are arbitrary
Unicode strings, although implementations may impose length
constraints.
In the case of EAP-GTC, the user name is conveyed in the IKE IDi
payload. According to [RFC4718], Sec. 3.4, the user name can be
encoded in one of two ways: as a simple user name, in which case the
ID_KEY_ID identification type is used; or as a combination user name
plus realm, in which case the format is a NAI [RFC4282] and the
identification type is ID_RFC822_ADDR. In either case, the user name
is a Unicode string encoded as UTF-8. Using the EAP Identity payload
is redundant, and if it is used, it should be identical to the IDi
payload.
EAP-GTC consists of a simple 2-message exchange. The contents of the
Type-Data field in the Request should not be interpreted in any way,
and should be displayed to the user. This field contains a Unicode
string, encoded as UTF-8.
The password is sent in the EAP Response. The Type-Data field of the
Response is also a Unicode string encoded as UTF-8. Note that none
of the IDi payload, the EAP Request or the EAP Response is null-
terminated.
If either or both the user name and the password are non-ASCII, they
should be normalized by the IKE client before the IKE/EAP message is
constructed. The normalization method is SASLprep, [RFC4013].
Sheffer Expires January 7, 2009 [Page 5]
Internet-Draft EAP-GTC in IKEv2 July 2008
5. IANA Considerations
This document does not require any action by IANA.
6. Security Considerations
6.1. Key generation and MITM protection
Modern EAP methods generate a key shared between the two protocol
peers. GTC does not (and cannot) generate such a key. RFC 4306
mandates that:
EAP methods that do not establish a shared key SHOULD NOT be used,
as they are subject to a number of man-in-the-middle attacks
[EAPMITM] if these EAP methods are used in other protocols that do
not use a server-authenticated tunnel.
However GTC must never be used in such a situation, since the client
would be sending its credentials openly to an unauthenticated server.
When using GTC with IKEv2, the implementation (or local
administrators) MUST ensure that the same credentials are never used
in such a manner.
6.2. Protection of credentials between the IKE gateway and the AAA
server
In the proposed solution, the raw credentials are sent from the IKE
gateway to a AAA server, typically a RADIUS server. These
credentials and the associated messaging MUST be strongly protected.
Some of the existing options include:
o An IPsec tunnel between the gateway and the AAA server.
o RADIUS over TCP with TLS, [I-D.winter-radsec].
o RADIUS over UDP with DTLS, [I-D.dekok-radext-dtls] (expired).
The legacy RADIUS security mechanism (Sec. 5.2 of [RFC2865]) is
considered weak and SHOULD NOT be used when better alternatives are
available.
6.3. Server authentication
The client may only send its cleartext credentials after it has
positively authenticated the server. This authentication is
specified, albeit rather vaguely, in [RFC4306] and is out of scope of
the current document. Unauthenticated (BTNS) derivatives of IKE MUST
NOT be used with EAP-GTC.
Sheffer Expires January 7, 2009 [Page 6]
Internet-Draft EAP-GTC in IKEv2 July 2008
7. Acknowledgments
I would like to thank Yoav Nir and Charlie Kaufman for their helpful
comments.
8. References
8.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC3748] Aboba, B., Blunk, L., Vollbrecht, J., Carlson, J., and H.
Levkowetz, "Extensible Authentication Protocol (EAP)",
RFC 3748, June 2004.
[RFC4013] Zeilenga, K., "SASLprep: Stringprep Profile for User Names
and Passwords", RFC 4013, February 2005.
[RFC4306] Kaufman, C., "Internet Key Exchange (IKEv2) Protocol",
RFC 4306, December 2005.
8.2. Informative References
[EAPMITM] Asokan, N., Niemi, V., and K. Nyberg, "Man-in-the-Middle
in Tunneled Authentication Protocols", November 2002,
<http://eprint.iacr.org/2002/163>.
[I-D.dekok-radext-dtls]
DeKok, A., "DTLS as a Transport Layer for RADIUS",
draft-dekok-radext-dtls-00 (work in progress),
February 2007.
[I-D.nir-tls-eap]
Nir, Y., Tschofenig, H., and P. Gutmann, "TLS using EAP
Authentication", draft-nir-tls-eap-03 (work in progress),
April 2008.
[I-D.winter-radsec]
Winter, S., McCauley, M., and S. Venaas, "RadSec Version 2
- A Secure and Reliable Transport for the RADIUS
Protocol", draft-winter-radsec-01 (work in progress),
February 2008.
[RFC2865] Rigney, C., Willens, S., Rubens, A., and W. Simpson,
"Remote Authentication Dial In User Service (RADIUS)",
RFC 2865, June 2000.
Sheffer Expires January 7, 2009 [Page 7]
Internet-Draft EAP-GTC in IKEv2 July 2008
[RFC4282] Aboba, B., Beadles, M., Arkko, J., and P. Eronen, "The
Network Access Identifier", RFC 4282, December 2005.
[RFC4718] Eronen, P. and P. Hoffman, "IKEv2 Clarifications and
Implementation Guidelines", RFC 4718, October 2006.
Appendix A. Change Log
A.1. -00
Initial version.
Author's Address
Yaron Sheffer
Check Point Software Technologies Ltd.
5 Hasolelim St.
Tel Aviv 67897
Israel
Email: yaronf@checkpoint.com
Sheffer Expires January 7, 2009 [Page 8]
Internet-Draft EAP-GTC in IKEv2 July 2008
Full Copyright Statement
Copyright (C) The IETF Trust (2008).
This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property
The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information
on the procedures with respect to rights in RFC documents can be
found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at
ietf-ipr@ietf.org.
Sheffer Expires January 7, 2009 [Page 9]

File diff suppressed because it is too large Load Diff

View File

@ -1,732 +0,0 @@
Network Working Group W. Simpson
Request for Comments: 1994 DayDreamer
Obsoletes: 1334 August 1996
Category: Standards Track
PPP Challenge Handshake Authentication Protocol (CHAP)
Status of this Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Abstract
The Point-to-Point Protocol (PPP) [1] provides a standard method for
transporting multi-protocol datagrams over point-to-point links.
PPP also defines an extensible Link Control Protocol, which allows
negotiation of an Authentication Protocol for authenticating its peer
before allowing Network Layer protocols to transmit over the link.
This document defines a method for Authentication using PPP, which
uses a random Challenge, with a cryptographically hashed Response
which depends upon the Challenge and a secret key.
Table of Contents
1. Introduction .......................................... 1
1.1 Specification of Requirements ................... 1
1.2 Terminology ..................................... 2
2. Challenge-Handshake Authentication Protocol ........... 2
2.1 Advantages ...................................... 3
2.2 Disadvantages ................................... 3
2.3 Design Requirements ............................. 4
3. Configuration Option Format ........................... 5
4. Packet Format ......................................... 6
4.1 Challenge and Response .......................... 7
4.2 Success and Failure ............................. 9
SECURITY CONSIDERATIONS ...................................... 10
ACKNOWLEDGEMENTS ............................................. 11
REFERENCES ................................................... 12
CONTACTS ..................................................... 12
Simpson [Page i]
RFC 1994 PPP CHAP August 1996
1. Introduction
In order to establish communications over a point-to-point link, each
end of the PPP link must first send LCP packets to configure the data
link during Link Establishment phase. After the link has been
established, PPP provides for an optional Authentication phase before
proceeding to the Network-Layer Protocol phase.
By default, authentication is not mandatory. If authentication of
the link is desired, an implementation MUST specify the
Authentication-Protocol Configuration Option during Link
Establishment phase.
These authentication protocols are intended for use primarily by
hosts and routers that connect to a PPP network server via switched
circuits or dial-up lines, but might be applied to dedicated links as
well. The server can use the identification of the connecting host
or router in the selection of options for network layer negotiations.
This document defines a PPP authentication protocol. The Link
Establishment and Authentication phases, and the Authentication-
Protocol Configuration Option, are defined in The Point-to-Point
Protocol (PPP) [1].
1.1. Specification of Requirements
In this document, several words are used to signify the requirements
of the specification. These words are often capitalized.
MUST This word, or the adjective "required", means that the
definition is an absolute requirement of the specification.
MUST NOT This phrase means that the definition is an absolute
prohibition of the specification.
SHOULD This word, or the adjective "recommended", means that there
may exist valid reasons in particular circumstances to
ignore this item, but the full implications must be
understood and carefully weighed before choosing a
different course.
MAY This word, or the adjective "optional", means that this
item is one of an allowed set of alternatives. An
implementation which does not include this option MUST be
prepared to interoperate with another implementation which
does include the option.
Simpson [Page 1]
RFC 1994 PPP CHAP August 1996
1.2. Terminology
This document frequently uses the following terms:
authenticator
The end of the link requiring the authentication. The
authenticator specifies the authentication protocol to be
used in the Configure-Request during Link Establishment
phase.
peer The other end of the point-to-point link; the end which is
being authenticated by the authenticator.
silently discard
This means the implementation discards the packet without
further processing. The implementation SHOULD provide the
capability of logging the error, including the contents of
the silently discarded packet, and SHOULD record the event
in a statistics counter.
2. Challenge-Handshake Authentication Protocol
The Challenge-Handshake Authentication Protocol (CHAP) is used to
periodically verify the identity of the peer using a 3-way handshake.
This is done upon initial link establishment, and MAY be repeated
anytime after the link has been established.
1. After the Link Establishment phase is complete, the
authenticator sends a "challenge" message to the peer.
2. The peer responds with a value calculated using a "one-way
hash" function.
3. The authenticator checks the response against its own
calculation of the expected hash value. If the values match,
the authentication is acknowledged; otherwise the connection
SHOULD be terminated.
4. At random intervals, the authenticator sends a new challenge to
the peer, and repeats steps 1 to 3.
Simpson [Page 2]
RFC 1994 PPP CHAP August 1996
2.1. Advantages
CHAP provides protection against playback attack by the peer through
the use of an incrementally changing identifier and a variable
challenge value. The use of repeated challenges is intended to limit
the time of exposure to any single attack. The authenticator is in
control of the frequency and timing of the challenges.
This authentication method depends upon a "secret" known only to the
authenticator and that peer. The secret is not sent over the link.
Although the authentication is only one-way, by negotiating CHAP in
both directions the same secret set may easily be used for mutual
authentication.
Since CHAP may be used to authenticate many different systems, name
fields may be used as an index to locate the proper secret in a large
table of secrets. This also makes it possible to support more than
one name/secret pair per system, and to change the secret in use at
any time during the session.
2.2. Disadvantages
CHAP requires that the secret be available in plaintext form.
Irreversably encrypted password databases commonly available cannot
be used.
It is not as useful for large installations, since every possible
secret is maintained at both ends of the link.
Implementation Note: To avoid sending the secret over other links
in the network, it is recommended that the challenge and response
values be examined at a central server, rather than each network
access server. Otherwise, the secret SHOULD be sent to such
servers in a reversably encrypted form. Either case requires a
trusted relationship, which is outside the scope of this
specification.
Simpson [Page 3]
RFC 1994 PPP CHAP August 1996
2.3. Design Requirements
The CHAP algorithm requires that the length of the secret MUST be at
least 1 octet. The secret SHOULD be at least as large and
unguessable as a well-chosen password. It is preferred that the
secret be at least the length of the hash value for the hashing
algorithm chosen (16 octets for MD5). This is to ensure a
sufficiently large range for the secret to provide protection against
exhaustive search attacks.
The one-way hash algorithm is chosen such that it is computationally
infeasible to determine the secret from the known challenge and
response values.
Each challenge value SHOULD be unique, since repetition of a
challenge value in conjunction with the same secret would permit an
attacker to reply with a previously intercepted response. Since it
is expected that the same secret MAY be used to authenticate with
servers in disparate geographic regions, the challenge SHOULD exhibit
global and temporal uniqueness.
Each challenge value SHOULD also be unpredictable, least an attacker
trick a peer into responding to a predicted future challenge, and
then use the response to masquerade as that peer to an authenticator.
Although protocols such as CHAP are incapable of protecting against
realtime active wiretapping attacks, generation of unique
unpredictable challenges can protect against a wide range of active
attacks.
A discussion of sources of uniqueness and probability of divergence
is included in the Magic-Number Configuration Option [1].
Simpson [Page 4]
RFC 1994 PPP CHAP August 1996
3. Configuration Option Format
A summary of the Authentication-Protocol Configuration Option format
to negotiate the Challenge-Handshake Authentication Protocol is shown
below. The fields are transmitted from left to right.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length | Authentication-Protocol |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Algorithm |
+-+-+-+-+-+-+-+-+
Type
3
Length
5
Authentication-Protocol
c223 (hex) for Challenge-Handshake Authentication Protocol.
Algorithm
The Algorithm field is one octet and indicates the authentication
method to be used. Up-to-date values are specified in the most
recent "Assigned Numbers" [2]. One value is required to be
implemented:
5 CHAP with MD5 [3]
Simpson [Page 5]
RFC 1994 PPP CHAP August 1996
4. Packet Format
Exactly one Challenge-Handshake Authentication Protocol packet is
encapsulated in the Information field of a PPP Data Link Layer frame
where the protocol field indicates type hex c223 (Challenge-Handshake
Authentication Protocol). A summary of the CHAP packet format is
shown below. The fields are transmitted from left to right.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Code | Identifier | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data ...
+-+-+-+-+
Code
The Code field is one octet and identifies the type of CHAP
packet. CHAP Codes are assigned as follows:
1 Challenge
2 Response
3 Success
4 Failure
Identifier
The Identifier field is one octet and aids in matching challenges,
responses and replies.
Length
The Length field is two octets and indicates the length of the
CHAP packet including the Code, Identifier, Length and Data
fields. Octets outside the range of the Length field should be
treated as Data Link Layer padding and should be ignored on
reception.
Data
The Data field is zero or more octets. The format of the Data
field is determined by the Code field.
Simpson [Page 6]
RFC 1994 PPP CHAP August 1996
4.1. Challenge and Response
Description
The Challenge packet is used to begin the Challenge-Handshake
Authentication Protocol. The authenticator MUST transmit a CHAP
packet with the Code field set to 1 (Challenge). Additional
Challenge packets MUST be sent until a valid Response packet is
received, or an optional retry counter expires.
A Challenge packet MAY also be transmitted at any time during the
Network-Layer Protocol phase to ensure that the connection has not
been altered.
The peer SHOULD expect Challenge packets during the Authentication
phase and the Network-Layer Protocol phase. Whenever a Challenge
packet is received, the peer MUST transmit a CHAP packet with the
Code field set to 2 (Response).
Whenever a Response packet is received, the authenticator compares
the Response Value with its own calculation of the expected value.
Based on this comparison, the authenticator MUST send a Success or
Failure packet (described below).
Implementation Notes: Because the Success might be lost, the
authenticator MUST allow repeated Response packets during the
Network-Layer Protocol phase after completing the
Authentication phase. To prevent discovery of alternative
Names and Secrets, any Response packets received having the
current Challenge Identifier MUST return the same reply Code
previously returned for that specific Challenge (the message
portion MAY be different). Any Response packets received
during any other phase MUST be silently discarded.
When the Failure is lost, and the authenticator terminates the
link, the LCP Terminate-Request and Terminate-Ack provide an
alternative indication that authentication failed.
Simpson [Page 7]
RFC 1994 PPP CHAP August 1996
A summary of the Challenge and Response packet format is shown below.
The fields are transmitted from left to right.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Code | Identifier | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Value-Size | Value ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Name ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Code
1 for Challenge;
2 for Response.
Identifier
The Identifier field is one octet. The Identifier field MUST be
changed each time a Challenge is sent.
The Response Identifier MUST be copied from the Identifier field
of the Challenge which caused the Response.
Value-Size
This field is one octet and indicates the length of the Value
field.
Value
The Value field is one or more octets. The most significant octet
is transmitted first.
The Challenge Value is a variable stream of octets. The
importance of the uniqueness of the Challenge Value and its
relationship to the secret is described above. The Challenge
Value MUST be changed each time a Challenge is sent. The length
of the Challenge Value depends upon the method used to generate
the octets, and is independent of the hash algorithm used.
The Response Value is the one-way hash calculated over a stream of
octets consisting of the Identifier, followed by (concatenated
with) the "secret", followed by (concatenated with) the Challenge
Value. The length of the Response Value depends upon the hash
algorithm used (16 octets for MD5).
Simpson [Page 8]
RFC 1994 PPP CHAP August 1996
Name
The Name field is one or more octets representing the
identification of the system transmitting the packet. There are
no limitations on the content of this field. For example, it MAY
contain ASCII character strings or globally unique identifiers in
ASN.1 syntax. The Name should not be NUL or CR/LF terminated.
The size is determined from the Length field.
4.2. Success and Failure
Description
If the Value received in a Response is equal to the expected
value, then the implementation MUST transmit a CHAP packet with
the Code field set to 3 (Success).
If the Value received in a Response is not equal to the expected
value, then the implementation MUST transmit a CHAP packet with
the Code field set to 4 (Failure), and SHOULD take action to
terminate the link.
A summary of the Success and Failure packet format is shown below.
The fields are transmitted from left to right.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Code | Identifier | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Message ...
+-+-+-+-+-+-+-+-+-+-+-+-+-
Code
3 for Success;
4 for Failure.
Identifier
The Identifier field is one octet and aids in matching requests
and replies. The Identifier field MUST be copied from the
Identifier field of the Response which caused this reply.
Simpson [Page 9]
RFC 1994 PPP CHAP August 1996
Message
The Message field is zero or more octets, and its contents are
implementation dependent. It is intended to be human readable,
and MUST NOT affect operation of the protocol. It is recommended
that the message contain displayable ASCII characters 32 through
126 decimal. Mechanisms for extension to other character sets are
the topic of future research. The size is determined from the
Length field.
Security Considerations
Security issues are the primary topic of this RFC.
The interaction of the authentication protocols within PPP are highly
implementation dependent. This is indicated by the use of SHOULD
throughout the document.
For example, upon failure of authentication, some implementations do
not terminate the link. Instead, the implementation limits the kind
of traffic in the Network-Layer Protocols to a filtered subset, which
in turn allows the user opportunity to update secrets or send mail to
the network administrator indicating a problem.
There is no provision for re-tries of failed authentication.
However, the LCP state machine can renegotiate the authentication
protocol at any time, thus allowing a new attempt. It is recommended
that any counters used for authentication failure not be reset until
after successful authentication, or subsequent termination of the
failed link.
There is no requirement that authentication be full duplex or that
the same protocol be used in both directions. It is perfectly
acceptable for different protocols to be used in each direction.
This will, of course, depend on the specific protocols negotiated.
The secret SHOULD NOT be the same in both directions. This allows an
attacker to replay the peer's challenge, accept the computed
response, and use that response to authenticate.
In practice, within or associated with each PPP server, there is a
database which associates "user" names with authentication
information ("secrets"). It is not anticipated that a particular
named user would be authenticated by multiple methods. This would
make the user vulnerable to attacks which negotiate the least secure
method from among a set (such as PAP rather than CHAP). If the same
Simpson [Page 10]
RFC 1994 PPP CHAP August 1996
secret was used, PAP would reveal the secret to be used later with
CHAP.
Instead, for each user name there should be an indication of exactly
one method used to authenticate that user name. If a user needs to
make use of different authentication methods under different
circumstances, then distinct user names SHOULD be employed, each of
which identifies exactly one authentication method.
Passwords and other secrets should be stored at the respective ends
such that access to them is as limited as possible. Ideally, the
secrets should only be accessible to the process requiring access in
order to perform the authentication.
The secrets should be distributed with a mechanism that limits the
number of entities that handle (and thus gain knowledge of) the
secret. Ideally, no unauthorized person should ever gain knowledge
of the secrets. Such a mechanism is outside the scope of this
specification.
Acknowledgements
David Kaufman, Frank Heinrich, and Karl Auerbach used a challenge
handshake at SDC when designing one of the protocols for a "secure"
network in the mid-1970s. Tom Bearson built a prototype Sytek
product ("Poloneous"?) on the challenge-response notion in the 1982-
83 timeframe. Another variant is documented in the various IBM SNA
manuals. Yet another variant was implemented by Karl Auerbach in the
Telebit NetBlazer circa 1991.
Kim Toms and Barney Wolff provided useful critiques of earlier
versions of this document.
Special thanks to Dave Balenson, Steve Crocker, James Galvin, and
Steve Kent, for their extensive explanations and suggestions. Now,
if only we could get them to agree with each other.
Simpson [Page 11]
RFC 1994 PPP CHAP August 1996
References
[1] Simpson, W., Editor, "The Point-to-Point Protocol (PPP)", STD
51, RFC 1661, DayDreamer, July 1994.
[2] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, RFC
1700, USC/Information Sciences Institute, October 1994.
[3] Rivest, R., and S. Dusse, "The MD5 Message-Digest Algorithm",
MIT Laboratory for Computer Science and RSA Data Security,
Inc., RFC 1321, April 1992.
Contacts
Comments should be submitted to the ietf-ppp@merit.edu mailing list.
This document was reviewed by the Point-to-Point Protocol Working
Group of the Internet Engineering Task Force (IETF). The working
group can be contacted via the current chair:
Karl Fox
Ascend Communications
3518 Riverside Drive, Suite 101
Columbus, Ohio 43221
karl@MorningStar.com
karl@Ascend.com
Questions about this memo can also be directed to:
William Allen Simpson
DayDreamer
Computer Systems Consulting Services
1384 Fontaine
Madison Heights, Michigan 48071
wsimpson@UMich.edu
wsimpson@GreenDragon.com (preferred)
Simpson [Page 12]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,339 +0,0 @@
Network Working Group J. Schiller
Request for Comments: 4307 Massachusetts Institute of Technology
Category: Standards Track December 2005
Cryptographic Algorithms for Use in the
Internet Key Exchange Version 2 (IKEv2)
Status of This Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The Internet Society (2005).
Abstract
The IPsec series of protocols makes use of various cryptographic
algorithms in order to provide security services. The Internet Key
Exchange (IKE (RFC 2409) and IKEv2) provide a mechanism to negotiate
which algorithms should be used in any given association. However,
to ensure interoperability between disparate implementations, it is
necessary to specify a set of mandatory-to-implement algorithms to
ensure that there is at least one algorithm that all implementations
will have available. This document defines the current set of
algorithms that are mandatory to implement as part of IKEv2, as well
as algorithms that should be implemented because they may be promoted
to mandatory at some future time.
1. Introduction
The Internet Key Exchange protocol provides for the negotiation of
cryptographic algorithms between both endpoints of a cryptographic
association. Different implementations of IPsec and IKE may provide
different algorithms. However, the IETF desires that all
implementations should have some way to interoperate. In particular,
this requires that IKE define a set of mandatory-to-implement
algorithms because IKE itself uses such algorithms as part of its own
negotiations. This requires that some set of algorithms be specified
as "mandatory-to-implement" for IKE.
Schiller Standards Track [Page 1]
RFC 4307 IKEv2 Cryptographic Algorithms December 2005
The nature of cryptography is that new algorithms surface
continuously and existing algorithms are continuously attacked. An
algorithm believed to be strong today may be demonstrated to be weak
tomorrow. Given this, the choice of mandatory-to-implement algorithm
should be conservative so as to minimize the likelihood of it being
compromised quickly. Thought should also be given to performance
considerations as many uses of IPsec will be in environments where
performance is a concern.
Finally, we need to recognize that the mandatory-to-implement
algorithm(s) may need to change over time to adapt to the changing
world. For this reason, the selection of mandatory-to-implement
algorithms was removed from the main IKEv2 specification and placed
in this document. As the choice of algorithm changes, only this
document should need to be updated.
Ideally, the mandatory-to-implement algorithm of tomorrow should
already be available in most implementations of IPsec by the time it
is made mandatory. To facilitate this, we will attempt to identify
those algorithms (that are known today) in this document. There is
no guarantee that the algorithms we believe today may be mandatory in
the future will in fact become so. All algorithms known today are
subject to cryptographic attack and may be broken in the future.
2. Requirements Terminology
Keywords "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT", and
"MAY" that appear in this document are to be interpreted as described
in [RFC2119].
We define some additional terms here:
SHOULD+ This term means the same as SHOULD. However, it is likely
that an algorithm marked as SHOULD+ will be promoted at
some future time to be a MUST.
SHOULD- This term means the same as SHOULD. However, an algorithm
marked as SHOULD- may be deprecated to a MAY in a future
version of this document.
MUST- This term means the same as MUST. However, we expect at
some point that this algorithm will no longer be a MUST in
a future document. Although its status will be determined
at a later time, it is reasonable to expect that if a
future revision of a document alters the status of a MUST-
algorithm, it will remain at least a SHOULD or a SHOULD-.
Schiller Standards Track [Page 2]
RFC 4307 IKEv2 Cryptographic Algorithms December 2005
3. Algorithm Selection
3.1. IKEv2 Algorithm Selection
3.1.1. Encrypted Payload Algorithms
The IKEv2 Encrypted Payload requires both a confidentiality algorithm
and an integrity algorithm. For confidentiality, implementations
MUST- implement 3DES-CBC and SHOULD+ implement AES-128-CBC. For
integrity, HMAC-SHA1 MUST be implemented.
3.1.2. Diffie-Hellman Groups
There are several Modular Exponential (MODP) groups that are defined
for use in IKEv2. They are defined in both the [IKEv2] base document
and in the MODP extensions document. They are identified by group
number. Any groups not listed here are considered as "MAY be
implemented".
Group Number Bit Length Status Defined
2 1024 MODP Group MUST- [RFC2409]
14 2048 MODP Group SHOULD+ [RFC3526]
3.1.3. IKEv2 Transform Type 1 Algorithms
IKEv2 defines several possible algorithms for Transfer Type 1
(encryption). These are defined below with their implementation
status.
Name Number Defined In Status
RESERVED 0
ENCR_3DES 3 [RFC2451] MUST-
ENCR_NULL 11 [RFC2410] MAY
ENCR_AES_CBC 12 [AES-CBC] SHOULD+
ENCR_AES_CTR 13 [AES-CTR] SHOULD
3.1.4. IKEv2 Transform Type 2 Algorithms
Transfer Type 2 Algorithms are pseudo-random functions used to
generate random values when needed.
Name Number Defined In Status
RESERVED 0
PRF_HMAC_MD5 1 [RFC2104] MAY
PRF_HMAC_SHA1 2 [RFC2104] MUST
PRF_AES128_CBC 4 [AESPRF] SHOULD+
Schiller Standards Track [Page 3]
RFC 4307 IKEv2 Cryptographic Algorithms December 2005
3.1.5. IKEv2 Transform Type 3 Algorithms
Transfer Type 3 Algorithms are Integrity algorithms used to protect
data against tampering.
Name Number Defined In Status
NONE 0
AUTH_HMAC_MD5_96 1 [RFC2403] MAY
AUTH_HMAC_SHA1_96 2 [RFC2404] MUST
AUTH_AES_XCBC_96 5 [AES-MAC] SHOULD+
4. Security Considerations
The security of cryptographic-based systems depends on both the
strength of the cryptographic algorithms chosen and the strength of
the keys used with those algorithms. The security also depends on
the engineering of the protocol used by the system to ensure that
there are no non-cryptographic ways to bypass the security of the
overall system.
This document concerns itself with the selection of cryptographic
algorithms for the use of IKEv2, specifically with the selection of
"mandatory-to-implement" algorithms. The algorithms identified in
this document as "MUST implement" or "SHOULD implement" are not known
to be broken at the current time, and cryptographic research so far
leads us to believe that they will likely remain secure into the
foreseeable future. However, this isn't necessarily forever. We
would therefore expect that new revisions of this document will be
issued from time to time that reflect the current best practice in
this area.
5. Normative References
[RFC2409] Harkins, D. and D. Carrel, "The Internet Key Exchange
(IKE)", RFC 2409, November 1998.
[IKEv2] Kaufman, C., Ed., "Internet Key Exchange (IKEv2)
Protocol", RFC 4306, December 2005.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC3526] Kivinen, T. and M. Kojo, "More Modular Exponential
(MODP) Diffie-Hellman groups for Internet Key Exchange
(IKE)", RFC 3526, May 2003.
[RFC2451] Pereira, R. and R. Adams, "The ESP CBC-Mode Cipher
Algorithms", RFC 2451, November 1998.
Schiller Standards Track [Page 4]
RFC 4307 IKEv2 Cryptographic Algorithms December 2005
[RFC2410] Glenn, R. and S. Kent, "The NULL Encryption Algorithm
and Its Use With IPsec", RFC 2410, November 1998.
[AES-CBC] Frankel, S., Glenn, R., and S. Kelly, "The AES-CBC
Cipher Algorithm and Its Use with IPsec", RFC 3602,
September 2003.
[AES-CTR] Housley, R., "Using Advanced Encryption Standard (AES)
Counter Mode With IPsec Encapsulating Security Payload
(ESP)", RFC 3686, January 2004.
[RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC:
Keyed-Hashing for Message Authentication", RFC 2104,
February 1997.
[AESPRF] Hoffman, P., "The AES-XCBC-PRF-128 Algorithm for the
Internet Key Exchange Protocol (IKE)", RFC 3664, January
2004.
[RFC2403] Madson, C. and R. Glenn, "The Use of HMAC-MD5-96 within
ESP and AH", RFC 2403, November 1998.
[RFC2404] Madson, C. and R. Glenn, "The Use of HMAC-SHA-1-96
within ESP and AH", RFC 2404, November 1998.
[AES-MAC] Frankel, S. and H. Herbert, "The AES-XCBC-MAC-96
Algorithm and Its Use With IPsec", RFC 3566, September
2003.
Author's Address
Jeffrey I. Schiller
Massachusetts Institute of Technology
Room W92-190
77 Massachusetts Avenue
Cambridge, MA 02139-4307
USA
Phone: +1 (617) 253-0161
EMail: jis@mit.edu
Schiller Standards Track [Page 5]
RFC 4307 IKEv2 Cryptographic Algorithms December 2005
Full Copyright Statement
Copyright (C) The Internet Society (2005).
This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property
The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information
on the procedures with respect to rights in RFC documents can be
found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at ietf-
ipr@ietf.org.
Acknowledgement
Funding for the RFC Editor function is currently provided by the
Internet Society.
Schiller Standards Track [Page 6]

View File

@ -1,283 +0,0 @@
Network Working Group Y. Nir
Request for Comments: 4478 Check Point
Category: Experimental April 2006
Repeated Authentication in Internet Key Exchange (IKEv2) Protocol
Status of This Memo
This memo defines an Experimental Protocol for the Internet
community. It does not specify an Internet standard of any kind.
Discussion and suggestions for improvement are requested.
Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The Internet Society (2006).
Abstract
This document extends the Internet Key Exchange (IKEv2) Protocol
document [IKEv2]. With some IPsec peers, particularly in the remote
access scenario, it is desirable to repeat the mutual authentication
periodically. The purpose of this is to limit the time that security
associations (SAs) can be used by a third party who has gained
control of the IPsec peer. This document describes a mechanism to
perform this function.
1. Introduction
In several cases, such as the remote access scenario, policy dictates
that the mutual authentication needs to be repeated periodically.
Repeated authentication can usually be achieved by simply repeating
the Initial exchange by whichever side has a stricter policy.
However, in the remote access scenario it is usually up to a human
user to supply the authentication credentials, and often Extensible
Authentication Protocol (EAP) is used for authentication, which makes
it unreasonable or impossible for the remote access gateway to
initiate the IKEv2 exchange.
This document describes a new notification that the original
Responder can send to the original Initiator with the number of
seconds before the authentication needs to be repeated. The
Initiator SHOULD repeat the Initial exchange before that time is
expired. If the Initiator fails to do so, the Responder may close
all Security Associations.
Nir Experimental [Page 1]
RFC 4478 Repeated Authentication in IKEv2 April 2006
Repeated authentication is not the same as IKE SA rekeying, and need
not be tied to it. The key words "MUST", "MUST NOT", "SHOULD",
"SHOULD NOT", and "MAY" in this document are to be interpreted as
described in [RFC2119].
2. Authentication Lifetime
The Responder in an IKEv2 negotiation MAY be configured to limit the
time that an IKE SA and the associated IPsec SAs may be used before
the peer is required to repeat the authentication, through a new
Initial Exchange.
The Responder MUST send this information to the Initiator in an
AUTH_LIFETIME notification either in the last message of an IKE_AUTH
exchange, or in an INFORMATIONAL request, which may be sent at any
time.
When sent as part of the IKE SA setup, the AUTH_LIFETIME notification
is used as follows:
Initiator Responder
------------------------------- -----------------------------
HDR, SAi1, KEi, Ni -->
<-- HDR, SAr1, KEr, Nr, [CERTREQ]
HDR, SK {IDi, [CERT,] [CERTREQ,]
[IDr,] AUTH, SAi2, TSi, TSr} -->
<-- HDR, SK {IDr, [CERT,] AUTH,
SAr2, TSi, TSr,
N(AUTH_LIFETIME)}
The separate Informational exchange is formed as follows:
<-- HDR, SK {N(AUTH_LIFETIME)}
HDR SK {} -->
The AUTH_LIFETIME notification is described in Section 3.
The original Responder that sends the AUTH_LIFETIME notification
SHOULD send a DELETE notification soon after the end of the lifetime
period, unless the IKE SA is deleted before the lifetime period
elapses. If the IKE SA is rekeyed, then the time limit applies to
the new SA.
An Initiator that received an AUTH_LIFETIME notification SHOULD
repeat the Initial exchange within the time indicated in the
notification. The time is measured from the time that the original
Initiator receives the notification.
Nir Experimental [Page 2]
RFC 4478 Repeated Authentication in IKEv2 April 2006
A special case is where the notification is sent in an Informational
exchange, and the lifetime is zero. In that case, the original
responder SHOULD allow a reasonable time for the repeated
authentication to occur.
The AUTH_LIFETIME notification MUST be protected and MAY be sent by
the original Responder at any time. If the policy changes, the
original Responder MAY send it again in a new Informational.
The new Initial exchange is not altered. The initiator SHOULD delete
the old IKE SA within a reasonable time of the new Auth exchange.
3. AUTH_LIFETIME Notification
The AUTH_LIFETIME message is a notification payload formatted as
follows:
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! Next Payload !C! RESERVED ! Payload Length !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! Protocol ID ! SPI Size ! Notify Message Type !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! Lifetime !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
o Payload Length is 12.
o Protocol ID (1 octet) MUST be 0.
o SPI size is 0 (SPI is in message header).
o Notify Message type is 16403 by IANA.
o Lifetime is the amount of time (in seconds) left before the
peer should repeat the Initial exchange. A zero value
signifies that the Initial exchange should begin immediately.
It is usually not reasonable to set this value to less than 300
(5 minutes) since that is too cumbersome for a user.
It is also usually not reasonable to set this value to more
than 86400 (1 day) as that would negate the security benefit of
repeating the authentication.
4. Interoperability with Non-Supporting IKEv2 Implementations
IKEv2 implementations that do not support the AUTH_LIFETIME
notification will ignore it and will not repeat the authentication.
In that case the original Responder will send a Delete notification
for the IKE SA in an Informational exchange. Such implementations
may be configured manually to repeat the authentication periodically.
Nir Experimental [Page 3]
RFC 4478 Repeated Authentication in IKEv2 April 2006
Non-supporting Responders are not a problem because they will simply
not send these notifications. In that case, there is no requirement
that the original Initiator re-authenticate.
5. Security Considerations
The AUTH_LIFETIME notification sent by the Responder does not
override any security policy on the Initiator. In particular, the
Initiator may have a different policy regarding re-authentication,
requiring more frequent re-authentication. Such an Initiator can
repeat the authentication earlier then is required by the
notification.
An Initiator MAY set reasonable limits on the amount of time in the
AUTH_LIFETIME notification. For example, an authentication lifetime
of less than 300 seconds from SA initiation may be considered
unreasonable.
6. IANA Considerations
The IANA has assigned a notification payload type for the
AUTH_LIFETIME notifications from the IKEv2 Notify Message Types
registry.
7. Normative References
[IKEv2] Kaufman, C., "Internet Key Exchange (IKEv2) Protocol", RFC
4306, December 2005.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
Author's Address
Yoav Nir
Check Point Software Technologies
EMail: ynir@checkpoint.com
Nir Experimental [Page 4]
RFC 4478 Repeated Authentication in IKEv2 April 2006
Full Copyright Statement
Copyright (C) The Internet Society (2006).
This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property
The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information
on the procedures with respect to rights in RFC documents can be
found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at
ietf-ipr@ietf.org.
Acknowledgement
Funding for the RFC Editor function is provided by the IETF
Administrative Support Activity (IASA).
Nir Experimental [Page 5]

View File

@ -1,787 +0,0 @@
Network Working Group D. McGrew
Request for Comments: 4543 Cisco Systems, Inc.
Category: Standards Track J. Viega
McAfee, Inc.
May 2006
The Use of Galois Message Authentication Code (GMAC) in
IPsec ESP and AH
Status of This Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The Internet Society (2006).
Abstract
This memo describes the use of the Advanced Encryption Standard (AES)
Galois Message Authentication Code (GMAC) as a mechanism to provide
data origin authentication, but not confidentiality, within the IPsec
Encapsulating Security Payload (ESP) and Authentication Header (AH).
GMAC is based on the Galois/Counter Mode (GCM) of operation, and can
be efficiently implemented in hardware for speeds of 10 gigabits per
second and above, and is also well-suited to software
implementations.
McGrew & Viega Standards Track [Page 1]
RFC 4543 GMAC in IPsec ESP and AH May 2006
Table of Contents
1. Introduction ....................................................2
1.1. Conventions Used in This Document ..........................3
2. AES-GMAC ........................................................3
3. The Use of AES-GMAC in ESP ......................................3
3.1. Initialization Vector ......................................4
3.2. Nonce Format ...............................................4
3.3. AAD Construction ...........................................5
3.4. Integrity Check Value (ICV) ................................6
3.5. Differences with AES-GCM-ESP ...............................6
3.6. Packet Expansion ...........................................7
4. The Use of AES-GMAC in AH .......................................7
5. IKE Conventions .................................................8
5.1. Phase 1 Identifier .........................................8
5.2. Phase 2 Identifier .........................................8
5.3. Key Length Attribute .......................................9
5.4. Keying Material and Salt Values ............................9
6. Test Vectors ....................................................9
7. Security Considerations ........................................10
8. Design Rationale ...............................................11
9. IANA Considerations ............................................11
10. Acknowledgements ..............................................11
11. References ....................................................12
11.1. Normative References .....................................12
11.2. Informative References ...................................12
1. Introduction
This document describes the use of AES-GMAC mode (AES-GMAC) as a
mechanism for data origin authentication in ESP [RFC4303] and AH
[RFC4302]. We refer to these methods as ENCR_NULL_AUTH_AES_GMAC and
AUTH_AES_GMAC, respectively. ENCR_NULL_AUTH_AES_GMAC is a companion
to the AES Galois/Counter Mode ESP [RFC4106], which provides
authentication as well as confidentiality. ENCR_NULL_AUTH_AES_GMAC
is intended for cases in which confidentiality is not desired. Like
GCM, GMAC is efficient and secure, and is amenable to high-speed
implementations in hardware. ENCR_NULL_AUTH_AES_GMAC and
AUTH_AES_GMAC are designed so that the incremental cost of
implementation, given an implementation is AES-GCM-ESP, is small.
This document does not cover implementation details of GCM or GMAC.
Those details can be found in [GCM], along with test vectors.
McGrew & Viega Standards Track [Page 2]
RFC 4543 GMAC in IPsec ESP and AH May 2006
1.1. Conventions Used in This Document
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119].
2. AES-GMAC
GMAC is a block cipher mode of operation providing data origin
authentication. It is defined in terms of the GCM authenticated
encryption operation as follows. The GCM authenticated encryption
operation has four inputs: a secret key, an initialization vector
(IV), a plaintext, and an input for additional authenticated data
(AAD). It has two outputs, a ciphertext whose length is identical to
the plaintext and an authentication tag. GMAC is the special case of
GCM in which the plaintext has a length of zero. The (zero-length)
ciphertext output is ignored, of course, so that the only output of
the function is the Authentication Tag. In the following, we
describe how the GMAC IV and AAD are formed from the ESP and AH
fields, and how the ESP and AH packets are formed from the
Authentication Tag.
Below we refer to the AES-GMAC IV input as a nonce, in order to
distinguish it from the IV fields in the packets. The same nonce and
key combination MUST NOT be used more than once, since reusing a
nonce/key combination destroys the security guarantees of AES-GMAC.
Because of this restriction, it can be difficult to use this mode
securely when using statically configured keys. For the sake of good
security, implementations MUST use an automated key management
system, such as the Internet Key Exchange (IKE) (either version two
[RFC4306] or version one [RFC2409]), to ensure that this requirement
is met.
3. The Use of AES-GMAC in ESP
The AES-GMAC algorithm for ESP is defined as an ESP "combined mode"
algorithm (see Section 3.2.3 of [RFC4303]), rather than an ESP
integrity algorithm. It is called ENCR_NULL_AUTH_AES_GMAC to
highlight the fact that it performs no encryption and provides no
confidentiality.
Rationale: ESP makes no provision for integrity transforms to
place an initialization vector within the Payload field; only
encryption transforms are expected to use IVs. Defining GMAC as
an encryption transform avoids this issue, and allows GMAC to
benefit from the same pipelining as does GCM.
McGrew & Viega Standards Track [Page 3]
RFC 4543 GMAC in IPsec ESP and AH May 2006
Like all ESP combined modes, it is registered in IKEv2 as an
encryption transform, or "Type 1" transform. It MUST NOT be used in
conjunction with any other ESP encryption transform (within a
particular ESP encapsulation). If confidentiality is desired, then
GCM ESP [RFC4106] SHOULD be used instead.
3.1. Initialization Vector
With ENCR_NULL_AUTH_AES_GMAC, an explicit Initialization Vector (IV)
is included in the ESP Payload, at the outset of that field. The IV
MUST be eight octets long. For a given key, the IV MUST NOT repeat.
The most natural way to meet this requirement is to set the IV using
a counter, but implementations are free to set the IV field in any
way that guarantees uniqueness, such as a linear feedback shift
register (LFSR). Note that the sender can use any IV generation
method that meets the uniqueness requirement without coordinating
with the receiver.
3.2. Nonce Format
The nonce passed to the AES-GMAC authentication algorithm has the
following layout:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Salt |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Initialization Vector |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 1: Nonce Format
The components of the nonce are as follows:
Salt
The salt field is a four-octet value that is assigned at the
beginning of the security association, and then remains constant
for the life of the security association. The salt SHOULD be
unpredictable (i.e., chosen at random) before it is selected, but
need not be secret. We describe how to set the salt for a
Security Association established via the Internet Key Exchange in
Section 5.4.
Initialization Vector
The IV field is described in Section 3.1.
McGrew & Viega Standards Track [Page 4]
RFC 4543 GMAC in IPsec ESP and AH May 2006
3.3. AAD Construction
Data integrity and data origin authentication are provided for the
SPI, (Extended) Sequence Number, Authenticated Payload, Padding, Pad
Length, and Next Header fields. This is done by including those
fields in the AES-GMAC Additional Authenticated Data (AAD) field.
Two formats of the AAD are defined: one for 32-bit sequence numbers,
and one for 64-bit extended sequence numbers. The format with 32-bit
sequence numbers is shown in Figure 2, and the format with 64-bit
extended sequence numbers is shown in Figure 3.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SPI |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 32-bit Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Authenticated Payload (variable) ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Padding (0-255 bytes) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | Pad Length | Next Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 2: AAD Format with 32-bit Sequence Number
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SPI |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 64-bit Extended Sequence Number |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Authenticated Payload (variable) ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Padding (0-255 bytes) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | Pad Length | Next Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 3: AAD Format with 64-bit Extended Sequence Number
McGrew & Viega Standards Track [Page 5]
RFC 4543 GMAC in IPsec ESP and AH May 2006
The use of 32-bit sequence numbers vs. 64-bit extended sequence
numbers is determined by the security association (SA) management
protocol that is used to create the SA. For IKEv2 [RFC4306] this is
negotiated via Transform Type 5, and the default for ESP is to use
64-bit extended sequence numbers in the absence of negotiation (e.g.,
see Section 2.2.1 of [RFC4303]).
3.4. Integrity Check Value (ICV)
The ICV consists solely of the AES-GMAC Authentication Tag. The
Authentication Tag MUST NOT be truncated, so the length of the ICV is
16 octets.
3.5. Differences with AES-GCM-ESP
In this section, we highlight the differences between this
specification and AES-GCM-ESP [RFC4106]. The essential difference is
that in this document, the AAD consists of the SPI, Sequence Number,
and ESP Payload, and the AES-GCM plaintext is zero-length, while in
AES-GCM-ESP, the AAD consists only of the SPI and Sequence Number,
and the AES-GCM plaintext consists of the ESP Payload. These
differences are illustrated in Figure 4. This figure shows the case
in which the Extended Sequence Number option is not used. When that
option is exercised, the Sequence Number field in the figure would be
replaced with the Extended Sequence Number.
Importantly, ENCR_NULL_AUTH_AES_GMAC is *not* equivalent to AES-GCM-
ESP with encryption "turned off". However, the ICV computations
performed in both cases are similar because of the structure of the
GHASH function [GCM].
McGrew & Viega Standards Track [Page 6]
RFC 4543 GMAC in IPsec ESP and AH May 2006
+-> +-----------------------+ <-+
AES-GCM-ESP | | SPI | |
AAD -------+ +-----------------------+ |
| | Sequence Number | |
+-> +-----------------------+ |
| Authentication | |
| IV | |
+->+-> +-----------------------+ +
AES-GCM-ESP | | | |
Plaintext -+ ~ ESP Payload ~ |
| | | |
| +-----------+-----+-----+ |
| | Padding | PL | NH | |
+----> +-----------+-----+-----+ <-+
|
ENCR_NULL_AUTH_AES_GMAC AAD --+
Figure 4: Differences between ENCR_NULL_AUTH_AES_GMAC and AES-GCM-ESP
3.6. Packet Expansion
The IV adds an additional eight octets to the packet and the ICV adds
an additional 16 octets. These are the only sources of packet
expansion, other than the 10-13 bytes taken up by the ESP SPI,
Sequence Number, Padding, Pad Length, and Next Header fields (if the
minimal amount of padding is used).
4. The Use of AES-GMAC in AH
In AUTH_AES_GMAC, the AH Authentication Data field consists of the IV
and the Authentication Tag, as shown in Figure 5. Unlike the usual
AH case, the Authentication Data field contains both an input to the
authentication algorithm (the IV) and the output of the
authentication algorithm (the tag). No padding is required in the
Authentication Data field, because its length is a multiple of 64
bits.
McGrew & Viega Standards Track [Page 7]
RFC 4543 GMAC in IPsec ESP and AH May 2006
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Initialization Vector (IV) |
| (8 octets) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Integrity Check Value (ICV) (16 octets) |
| |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 5: The AUTH_AES_GMAC Authentication Data Format
The IV is as described in Section 3.1. The Integrity Check Value
(ICV) is as described in Section 3.4.
The GMAC Nonce input is formed as described in Section 3.2. The GMAC
AAD input consists of the authenticated data as defined in Section
3.1 of [RFC4302]. These values are provided as to that algorithm,
along with the secret key, and the resulting authentication tag given
as output is used to form the ICV.
5. IKE Conventions
This section describes the conventions used to generate keying
material and salt values for use with ENCR_NULL_AUTH_AES_GMAC and
AUTH_AES_GMAC using the Internet Key Exchange (IKE) versions one
[RFC2409] and two [RFC4306].
5.1. Phase 1 Identifier
This document does not specify the conventions for using AES-GMAC for
IKE Phase 1 negotiations. For AES-GMAC to be used in this manner, a
separate specification would be needed, and an Encryption Algorithm
Identifier would need to be assigned. Implementations SHOULD use an
IKE Phase 1 cipher that is at least as strong as AES-GMAC. The use
of AES-CBC [RFC3602] with the same AES key size as used by
ENCR_NULL_AUTH_AES_GMAC or AUTH_AES_GMAC is RECOMMENDED.
5.2. Phase 2 Identifier
For IKE Phase 2 negotiations, IANA has assigned identifiers as
described in Section 9.
McGrew & Viega Standards Track [Page 8]
RFC 4543 GMAC in IPsec ESP and AH May 2006
5.3. Key Length Attribute
AES-GMAC can be used with any of the three AES key lengths. The way
that the key length is indicated is different for AH and ESP.
For AH, each key length has its own separate integrity transform
identifier and algorithm name (Section 9). The IKE Key Length
attribute MUST NOT be used with these identifiers. This transform
MUST NOT be used with ESP.
For ESP, there is a single encryption transform identifier (which
represents the combined transform) (Section 9). The IKE Key Length
attribute MUST be used with each use of this identifier to indicate
the key length. The Key Length attribute MUST have a value of 128,
192, or 256.
5.4. Keying Material and Salt Values
IKE makes use of a pseudo-random function (PRF) to derive keying
material. The PRF is used iteratively to derive keying material of
arbitrary size, called KEYMAT. Keying material is extracted from the
output string without regard to boundaries.
The size of the KEYMAT for the ENCR_NULL_AUTH_AES_GMAC and
AUTH_AES_GMAC MUST be four octets longer than is needed for the
associated AES key. The keying material is used as follows:
ENCR_NULL_AUTH_AES_GMAC with a 128-bit key and AUTH_AES_128_GMAC
The KEYMAT requested for each AES-GMAC key is 20 octets. The
first 16 octets are the 128-bit AES key, and the remaining four
octets are used as the salt value in the nonce.
ENCR_NULL_AUTH_AES_GMAC with a 192-bit key and AUTH_AES_192_GMAC
The KEYMAT requested for each AES-GMAC key is 28 octets. The
first 24 octets are the 192-bit AES key, and the remaining four
octets are used as the salt value in the nonce.
ENCR_NULL_AUTH_AES_GMAC with a 256-bit key and AUTH_AES_256_GMAC
The KEYMAT requested for each AES-GMAC key is 36 octets. The
first 32 octets are the 256-bit AES key, and the remaining four
octets are used as the salt value in the nonce.
6. Test Vectors
Appendix B of [GCM] provides test vectors that will assist
implementers with AES-GMAC.
McGrew & Viega Standards Track [Page 9]
RFC 4543 GMAC in IPsec ESP and AH May 2006
7. Security Considerations
Since the authentication coverage is different between AES-GCM-ESP
and this specification (see Figure 4), it is worth pointing out that
both specifications are secure. In ENCR_NULL_AUTH_AES_GMAC, the IV
is not included in either the plaintext or the additional
authenticated data. This does not adversely affect security, because
the IV field only provides an input to the GMAC IV, which is not
required to be authenticated (see [GCM]). In AUTH_AES_GMAC, the IV
is included in the additional authenticated data. This fact has no
adverse effect on security; it follows from the property that GMAC is
secure even against attacks in which the adversary can manipulate
both the IV and the message. Even an adversary with these powerful
capabilities cannot forge an authentication tag for any message
(other than one that was submitted to the chosen-message oracle).
Since such an adversary could easily choose messages that contain the
IVs with which they correspond, there are no security problems with
the inclusion of the IV in the AAD.
GMAC is provably secure against adversaries that can adaptively
choose plaintexts, ICVs and the AAD field, under standard
cryptographic assumptions (roughly, that the output of the underlying
cipher under a randomly chosen key is indistinguishable from a
randomly selected output). Essentially, this means that, if used
within its intended parameters, a break of GMAC implies a break of
the underlying block cipher. The proof of security is available in
[GCMP].
The most important security consideration is that the IV never
repeats for a given key. In part, this is handled by disallowing the
use of AES-GMAC when using statically configured keys, as discussed
in Section 2.
When IKE is used to establish fresh keys between two peer entities,
separate keys are established for the two traffic flows. If a
different mechanism is used to establish fresh keys, one that
establishes only a single key to protect packets, then there is a
high probability that the peers will select the same IV values for
some packets. Thus, to avoid counter block collisions, ESP or AH
implementations that permit use of the same key for protecting
packets with the same peer MUST ensure that the two peers assign
different salt values to the security association (SA).
The other consideration is that, as with any block cipher mode of
operation, the security of all data protected under a given security
association decreases slightly with each message.
McGrew & Viega Standards Track [Page 10]
RFC 4543 GMAC in IPsec ESP and AH May 2006
To protect against this problem, implementations MUST generate a
fresh key before processing 2^64 blocks of data with a given key.
Note that it is impossible to reach this limit when using 32-bit
Sequence Numbers.
Note that, for each message, GMAC calls the block cipher only once.
8. Design Rationale
This specification was designed to be as similar to AES-GCM-ESP
[RFC4106] as possible. We re-use the design and implementation
experience from that specification. We include all three AES key
sizes since AES-GCM-ESP supports all of those sizes, and the larger
key sizes provide future users with more high-security options.
9. IANA Considerations
IANA has assigned the following IKEv2 parameters. For the use of AES
GMAC in AH, the following integrity (type 3) transform identifiers
have been assigned:
"9" for AUTH_AES_128_GMAC
"10" for AUTH_AES_192_GMAC
"11" for AUTH_AES_256_GMAC
For the use of AES-GMAC in ESP, the following encryption (type 1)
transform identifier has been assigned:
"21" for ENCR_NULL_AUTH_AES_GMAC
10. Acknowledgements
Our discussions with Fabio Maino and David Black significantly
improved this specification, and Tero Kivinen provided us with useful
comments. Steve Kent provided guidance on ESP interactions. This
work is closely modeled after AES-GCM, which itself is closely
modeled after Russ Housley's AES-CCM transform [RFC4309].
Additionally, the GCM mode of operation was originally conceived as
an improvement to the CWC mode [CWC] in which Doug Whiting and Yoshi
Kohno participated. We express our thanks to Fabio, David, Tero,
Steve, Russ, Doug, and Yoshi.
McGrew & Viega Standards Track [Page 11]
RFC 4543 GMAC in IPsec ESP and AH May 2006
11. References
11.1. Normative References
[GCM] McGrew, D. and J. Viega, "The Galois/Counter Mode of
Operation (GCM)", Submission to NIST. http://
csrc.nist.gov/CryptoToolkit/modes/proposedmodes/gcm/
gcm-spec.pdf, January 2004.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC3602] Frankel, S., Glenn, R., and S. Kelly, "The AES-CBC Cipher
Algorithm and Its Use with IPsec", RFC 3602, September
2003.
11.2. Informative References
[CWC] Kohno, T., Viega, J., and D. Whiting, "CWC: A high-
performance conventional authenticated encryption mode",
Fast Software Encryption.
http://eprint.iacr.org/2003/106.pdf, February 2004.
[GCMP] McGrew, D. and J. Viega, "The Security and Performance of
the Galois/Counter Mode (GCM)", Proceedings of INDOCRYPT
'04, http://eprint.iacr.org/2004/193, December 2004.
[RFC2409] Harkins, D. and D. Carrel, "The Internet Key Exchange
(IKE)", RFC 2409, November 1998.
[RFC4106] Viega, J. and D. McGrew, "The Use of Galois/Counter Mode
(GCM) in IPsec Encapsulating Security Payload (ESP)", RFC
4106, June 2005.
[RFC4302] Kent, S., "IP Authentication Header", RFC 4302, December
2005.
[RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)", RFC
4303, December 2005.
[RFC4306] Kaufman, C., "Internet Key Exchange (IKEv2) Protocol", RFC
4306, December 2005.
[RFC4309] Housley, R., "Using Advanced Encryption Standard (AES) CCM
Mode with IPsec Encapsulating Security Payload (ESP)", RFC
4309, December 2005.
McGrew & Viega Standards Track [Page 12]
RFC 4543 GMAC in IPsec ESP and AH May 2006
Authors' Addresses
David A. McGrew
Cisco Systems, Inc.
510 McCarthy Blvd.
Milpitas, CA 95035
US
Phone: (408) 525 8651
EMail: mcgrew@cisco.com
URI: http://www.mindspring.com/~dmcgrew/dam.htm
John Viega
McAfee, Inc.
1145 Herndon Parkway, Suite 500
Herndon, VA 20170
EMail: viega@list.org
McGrew & Viega Standards Track [Page 13]
RFC 4543 GMAC in IPsec ESP and AH May 2006
Full Copyright Statement
Copyright (C) The Internet Society (2006).
This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property
The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information
on the procedures with respect to rights in RFC documents can be
found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at
ietf-ipr@ietf.org.
Acknowledgement
Funding for the RFC Editor function is provided by the IETF
Administrative Support Activity (IASA).
McGrew & Viega Standards Track [Page 14]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,619 +0,0 @@
Network Working Group P. Eronen
Request for Comments: 4739 Nokia
Category: Experimental J. Korhonen
TeliaSonera
November 2006
Multiple Authentication Exchanges
in the Internet Key Exchange (IKEv2) Protocol
Status of This Memo
This memo defines an Experimental Protocol for the Internet
community. It does not specify an Internet standard of any kind.
Discussion and suggestions for improvement are requested.
Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The IETF Trust (2006).
Abstract
The Internet Key Exchange (IKEv2) protocol supports several
mechanisms for authenticating the parties, including signatures with
public-key certificates, shared secrets, and Extensible
Authentication Protocol (EAP) methods. Currently, each endpoint uses
only one of these mechanisms to authenticate itself. This document
specifies an extension to IKEv2 that allows the use of multiple
authentication exchanges, using either different mechanisms or the
same mechanism. This extension allows, for instance, performing
certificate-based authentication of the client host followed by an
EAP authentication of the user. When backend authentication servers
are used, they can belong to different administrative domains, such
as the network access provider and the service provider.
Eronen & Korhonen Experimental [Page 1]
RFC 4739 Multiple Auth. Exchanges in IKEv2 November 2006
Table of Contents
1. Introduction ....................................................3
1.1. Usage Scenarios ............................................4
1.2. Terminology ................................................5
2. Solution ........................................................5
2.1. Solution Overview ..........................................5
2.2. Example 1: Multiple EAP Authentications ....................6
2.3. Example 2: Mixed EAP and Certificate Authentications .......7
2.4. Example 3: Multiple Initiator Certificates .................8
2.5. Example 4: Multiple Responder Certificates .................8
3. Payload Formats .................................................9
3.1. MULTIPLE_AUTH_SUPPORTED Notify Payload .....................9
3.2. ANOTHER_AUTH_FOLLOWS Notify Payload ........................9
4. IANA Considerations .............................................9
5. Security Considerations .........................................9
6. Acknowledgments ................................................10
7. References .....................................................10
7.1. Normative References ......................................10
7.2. Informative References ....................................10
Eronen & Korhonen Experimental [Page 2]
RFC 4739 Multiple Auth. Exchanges in IKEv2 November 2006
1. Introduction
IKEv2 [IKEv2] supports several mechanisms for parties involved in the
IKE_SA (IKE security association). These include signatures with
public-key certificates, shared secrets, and Extensible
Authentication Protocol (EAP) methods.
Currently, each endpoint uses only one of these mechanisms to
authenticate itself. However, there are scenarios where making the
authorization decision in IKEv2 (whether to allow access or not)
requires using several of these methods.
For instance, it may be necessary to authenticate both the host
(machine) requesting access, and the user currently using the host.
These two authentications would use two separate sets of credentials
(such as certificates and associated private keys) and might even use
different authentication mechanisms.
To take another example, when an operator is hosting a Virtual
Private Network (VPN) gateway service for a third party, it may be
necessary to authenticate the client to both the operator (for
billing purposes) and the third party's Authentication,
Authorization, and Accounting (AAA) server (for authorizing access to
the third party's internal network).
This document specifies an extension to IKEv2 that allows the use of
multiple authentication exchanges, using either different mechanisms
or the same mechanism. This extension allows, for instance,
performing certificate-based authentication of the client host
followed by an EAP authentication of the user.
Each authentication exchange requiring communication with backend AAA
servers may be directed to different backend AAA servers, located
even in different administrative domains. However, details of the
communication between the IKEv2 gateway and the backend
authentication servers are beyond the scope of this document. In
particular, this document does not specify any changes to existing
AAA protocols, and it does not require the use of any particular AAA
protocol.
In case of several EAP authentications, it is important to notice
that they are not a "sequence" (as described in Section 2.1 of
[EAP]), but separate independent EAP conversations, which are usually
also terminated in different EAP servers. Multiple authentication
methods within a single EAP conversation are still prohibited as
described in Section 2.1 of [EAP]. Using multiple independent EAP
conversations is similar to the separate Network Access Provider
(NAP) and Internet Service Provider (ISP) authentication exchanges
Eronen & Korhonen Experimental [Page 3]
RFC 4739 Multiple Auth. Exchanges in IKEv2 November 2006
planned for [PANA]. The discovery of the appropriate EAP server for
each EAP authentication conversation is based on AAA routing.
1.1. Usage Scenarios
Figure 1 shows an example architecture of an operator-hosted VPN
scenario that could benefit from a two-phase authentication within
the IKEv2 exchange. First, the client authenticates towards the
Network Access Provider (NAP) and gets access to the NAP-hosted VPN
gateway. The first-phase authentication involves the backend AAA
server of the NAP. After the first authentication, the client
initiates the second authentication round that also involves the
Third Party's backend AAA server. If both authentications succeed,
the required IPsec tunnels are set up and the client can access
protected networks behind the Third Party.
Client *Network Access Provider*
+---------+ +---------+ +-----+
| | | NAP's | | NAP |
|Protected| IPsec SAs | Tunnel | AAA Protocol | AAA |
|Endpoint |<------------------>|Endpoint |<------------>|Serv/|
| | | | |Proxy|
+---------+ +---------+ +-----+
^ ^
IPsec or / AAA |
Leased Line / Protocol |
/ |
v |
+---------+ *Third Party* v
|3rd Party| +-----+
Protected | Tunnel | | 3rd |
Subnet <----|Endpoint | |Party|
| | | AAA |
+---------+ +-----+
Figure 1: Two-phase authentication used to gain access to
the Third Party network via Network Access Provider. AAA
traffic goes through NAP's AAA server.
The NAP's AAA server can be used to proxy the AAA traffic to the
Third Party's backend AAA server. Alternatively, the AAA traffic
from the NAP's tunnel endpoint could go directly to the Third Party's
backend AAA servers. However, this is more or less an AAA routing
issue.
Eronen & Korhonen Experimental [Page 4]
RFC 4739 Multiple Auth. Exchanges in IKEv2 November 2006
1.2. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [KEYWORDS].
The terms and abbreviations "authenticator", "backend authentication
server", "EAP server", and "peer" in this document are to be
interpreted as described in [EAP].
When messages containing IKEv2 payloads are described, optional
payloads are shown in brackets (for instance, "[FOO]"), and a plus
sign indicates that a payload can be repeated one or more times (for
instance, "FOO+").
2. Solution
2.1. Solution Overview
The peers announce support for this IKEv2 extension by including a
MULTIPLE_AUTH_SUPPORTED notification in the IKE_SA_INIT response
(responder) and the first IKE_AUTH request (initiator).
If both peers support this extension, either of them can announce
that it wishes to have a second authentication by including an
ANOTHER_AUTH_FOLLOWS notification in any IKE_AUTH message that
contains an AUTH payload. This indicates that the peer sending the
ANOTHER_AUTH_FOLLOWS wishes to authenticate another set of
credentials to the other peer. The next IKE_AUTH message sent by
this peer will contain a second identity payload (IDi or IDr) and
starts another authentication exchange. The IKE_AUTH phase is
considered successful only if all the individual authentication
exchanges complete successfully.
It is assumed that both peers know what credentials they want to
present; there is no negotiation about, for instance, what type of
authentication is to be done. As in IKEv2, EAP-based authentication
is always requested by the initiator (by omitting the AUTH payload).
The AUTH payloads are calculated as specified in [IKEv2] Sections
2.15 and 2.16, where IDi' refers to the latest IDi payload sent by
the initiator, and IDr' refers to the latest IDr payload sent by the
responder. If EAP methods that do not generate shared keys are used,
it is possible that several AUTH payloads with identical contents are
sent. When such EAP methods are used, the purpose of the AUTH
payload is simply to delimit the authentication exchanges, and ensure
that the IKE_SA_INIT request/response messages were not modified.
Eronen & Korhonen Experimental [Page 5]
RFC 4739 Multiple Auth. Exchanges in IKEv2 November 2006
2.2. Example 1: Multiple EAP Authentications
This example shows certificate-based authentication of the responder
followed by an EAP authentication exchange (messages 1-10). When the
first EAP exchange is ending (the initiator is sending its AUTH
payload), the initiator announces that it wishes to have a second
authentication exchange by including an ANOTHER_AUTH_FOLLOWS
notification (message 9).
After this, a second authentication exchange begins. The initiator
sends a new IDi payload but no AUTH payload (message 11), indicating
that EAP will be used. After that, another EAP authentication
exchange follows (messages 12-18).
Initiator Responder
----------- -----------
1. HDR, SA, KE, Ni -->
<-- 2. HDR, SA, KE, Nr, [CERTREQ],
N(MULTIPLE_AUTH_SUPPORTED)
3. HDR, SK { IDi, [CERTREQ+], [IDr],
SA, TSi, TSr, N(MULTIPLE_AUTH_SUPPORTED) } -->
<-- 4. HDR, SK { IDr, [CERT+], AUTH,
EAP(Request) }
5. HDR, SK { EAP(Response) } -->
<-- 6. HDR, SK { EAP(Request) }
7. HDR, SK { EAP(Response) } -->
<-- 8. HDR, SK { EAP(Success) }
9. HDR, SK { AUTH,
N(ANOTHER_AUTH_FOLLOWS) } -->
<-- 10. HDR, SK { AUTH }
11. HDR, SK { IDi } -->
<-- 12. HDR, SK { EAP(Request) }
13. HDR, SK { EAP(Response) } -->
<-- 14. HDR, SK { EAP(Request) }
15. HDR, SK { EAP(Response) } -->
<-- 16. HDR, SK { EAP(Success) }
17. HDR, SK { AUTH } -->
<-- 18. HDR, SK { AUTH, SA, TSi, TSr }
Example 1: Certificate-based authentication of the
responder, followed by two EAP authentication exchanges.
Eronen & Korhonen Experimental [Page 6]
RFC 4739 Multiple Auth. Exchanges in IKEv2 November 2006
2.3. Example 2: Mixed EAP and Certificate Authentications
Another example is shown below: here both the initiator and the
responder are first authenticated using certificates (or shared
secrets); this is followed by an EAP authentication exchange.
Initiator Responder
----------- -----------
1. HDR, SA, KE, Ni -->
<-- 2. HDR, SA, KE, Nr, [CERTREQ],
N(MULTIPLE_AUTH_SUPPORTED)
3. HDR, SK { IDi, [CERT+], [CERTREQ+], [IDr], AUTH,
SA, TSi, TSr, N(MULTIPLE_AUTH_SUPPORTED),
N(ANOTHER_AUTH_FOLLOWS) } -->
<-- 4. HDR, SK { IDr, [CERT+], AUTH }
5. HDR, SK { IDi } -->
<-- 6. HDR, SK { EAP(Request) }
7. HDR, SK { EAP(Response) } -->
<-- 8. HDR, SK { EAP(Request) }
9. HDR, SK { EAP(Response) } -->
<-- 10. HDR, SK { EAP(Success) }
11. HDR, SK { AUTH } -->
<-- 12. HDR, SK { AUTH, SA, TSi, TSr }
Example 2: Certificate-based (or shared-secret-based)
authentication of the initiator and the responder,
followed by an EAP authentication exchange.
Eronen & Korhonen Experimental [Page 7]
RFC 4739 Multiple Auth. Exchanges in IKEv2 November 2006
2.4. Example 3: Multiple Initiator Certificates
This example shows yet another possibility: the initiator has two
different certificates (and associated private keys), and
authenticates both of them to the responder.
Initiator Responder
----------- -----------
1. HDR, SA, KE, Ni -->
<-- 2. HDR, SA, KE, Nr, [CERTREQ],
N(MULTIPLE_AUTH_SUPPORTED)
3. HDR, SK { IDi, [CERT+], [CERTREQ+], [IDr], AUTH,
SA, TSi, TSr, N(MULTIPLE_AUTH_SUPPORTED),
N(ANOTHER_AUTH_FOLLOWS) } -->
<-- 4. HDR, SK { IDr, [CERT+], AUTH }
5. HDR, SK { IDi, [CERT+], AUTH } -->
<-- 6. HDR, SK { SA, TSi, TSr }
Example 3: Two certificate-based authentications of the
initiator, and one certificate-based authentication
of the responder.
2.5. Example 4: Multiple Responder Certificates
This example shows yet another possibility: the responder has two
different certificates (and associated private keys), and
authenticates both of them to the initiator.
Initiator Responder
----------- -----------
1. HDR, SA, KE, Ni -->
<-- 2. HDR, SA, KE, Nr, [CERTREQ],
N(MULTIPLE_AUTH_SUPPORTED)
3. HDR, SK { IDi, [CERT+], [CERTREQ+], [IDr], AUTH,
SA, TSi, TSr, N(MULTIPLE_AUTH_SUPPORTED) } -->
<-- 4. HDR, SK { IDr, [CERT+], AUTH,
N(ANOTHER_AUTH_FOLLOWS) }
5. HDR, SK { } -->
<-- 6. HDR, SK { IDr, [CERT+], AUTH,
SA, TSi, TSr }
Example 4: Two certificate-based authentications of the
responder, and one certificate-based authentication
of the initiator.
Eronen & Korhonen Experimental [Page 8]
RFC 4739 Multiple Auth. Exchanges in IKEv2 November 2006
3. Payload Formats
3.1. MULTIPLE_AUTH_SUPPORTED Notify Payload
The MULTIPLE_AUTH_SUPPORTED notification is included in the
IKE_SA_INIT response or the first IKE_AUTH request to indicate that
the peer supports this specification. The Notify Message Type is
MULTIPLE_AUTH_SUPPORTED (16404). The Protocol ID and SPI Size fields
MUST be set to zero, and there is no data associated with this Notify
type.
3.2. ANOTHER_AUTH_FOLLOWS Notify Payload
The ANOTHER_AUTH_FOLLOWS notification payload is included in an
IKE_AUTH message containing an AUTH payload to indicate that the peer
wants to continue with another authentication exchange. The Notify
Message Type is ANOTHER_AUTH_FOLLOWS (16405). The Protocol ID and
SPI Size fields MUST be set to zero, and there is no data associated
with this Notify type.
4. IANA Considerations
This document defines two new IKEv2 notifications,
MULTIPLE_AUTH_SUPPORTED and ANOTHER_AUTH_FOLLOWS, whose values are
allocated from the "IKEv2 Notify Message Types" namespace defined in
[IKEv2].
This document does not define any new namespaces to be managed by
IANA.
5. Security Considerations
Security considerations for IKEv2 are discussed in [IKEv2]. The
reader is encouraged to pay special attention to considerations
relating to the use of EAP methods that do not generate shared keys.
However, the use of multiple authentication exchanges results in at
least one new security consideration.
In normal IKEv2, the responder authenticates the initiator before
revealing its identity (except when EAP is used). When multiple
authentication exchanges are used to authenticate the initiator, the
responder has to reveal its identity before all of the initiator
authentication exchanges have been completed.
Eronen & Korhonen Experimental [Page 9]
RFC 4739 Multiple Auth. Exchanges in IKEv2 November 2006
6. Acknowledgments
The authors would like to thank Bernard Aboba, Jari Arkko, Spencer
Dawkins, Lakshminath Dondeti, Henry Haverinen, Russ Housley, Mika
Joutsenvirta, Charlie Kaufman, Tero Kivinen, Yoav Nir, Magnus
Nystrom, Mohan Parthasarathy, and Juha Savolainen for their valuable
comments.
7. References
7.1. Normative References
[IKEv2] Kaufman, C., "Internet Key Exchange (IKEv2) Protocol",
RFC 4306, December 2005.
[KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", RFC 2119, March 1997.
7.2. Informative References
[EAP] Aboba, B., Blunk, L., Vollbrecht, J., Carlson, J., and H.
Levkowetz, "Extensible Authentication Protocol (EAP)",
RFC 3748, June 2004.
[PANA] Yegin, A., Ohba, Y., Penno, R., Tsirtsis, G., and C.
Wang, "Protocol for Carrying Authentication for Network
Access (PANA) Requirements", RFC 4058, May 2005.
Authors' Addresses
Pasi Eronen
Nokia Research Center
P.O. Box 407
FIN-00045 Nokia Group
Finland
EMail: pasi.eronen@nokia.com
Jouni Korhonen
TeliaSonera
P.O. Box 970
FIN-00051 Sonera
Finland
EMail: jouni.korhonen@teliasonera.com
Eronen & Korhonen Experimental [Page 10]
RFC 4739 Multiple Auth. Exchanges in IKEv2 November 2006
Full Copyright Statement
Copyright (C) The IETF Trust (2006).
This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST,
AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT
THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY
IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE.
Intellectual Property
The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information
on the procedures with respect to rights in RFC documents can be
found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at
ietf-ipr@ietf.org.
Acknowledgement
Funding for the RFC Editor function is currently provided by the
Internet Society.
Eronen & Korhonen Experimental [Page 11]

View File

@ -1,619 +0,0 @@
Network Working Group M. Myers
Request for Comments: 4806 TraceRoute Security LLC
Category: Standards Track H. Tschofenig
Siemens Networks GmbH & Co KG
February 2007
Online Certificate Status Protocol (OCSP) Extensions to IKEv2
Status of This Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The IETF Trust (2006).
Abstract
While the Internet Key Exchange Protocol version 2 (IKEv2) supports
public key based authentication, the corresponding use of in-band
Certificate Revocation Lists (CRL) is problematic due to unbounded
CRL size. The size of an Online Certificate Status Protocol (OCSP)
response is however well-bounded and small. This document defines
the "OCSP Content" extension to IKEv2. A CERTREQ payload with "OCSP
Content" identifies zero or more trusted OCSP responders and is a
request for inclusion of an OCSP response in the IKEv2 handshake. A
cooperative recipient of such a request responds with a CERT payload
containing the appropriate OCSP response. This content is
recognizable via the same "OCSP Content" identifier.
When certificates are used with IKEv2, the communicating peers need a
mechanism to determine the revocation status of the peer's
certificate. OCSP is one such mechanism. This document applies when
OCSP is desired and security policy prevents one of the IKEv2 peers
from accessing the relevant OCSP responder directly. Firewalls are
often deployed in a manner that prevents such access by IKEv2 peers
outside of an enterprise network.
Myers & Tschofenig Standards Track [Page 1]
RFC 4806 OCSP Extensions to IKEv2 February 2007
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Extension Definition . . . . . . . . . . . . . . . . . . . . . 4
3.1. OCSP Request . . . . . . . . . . . . . . . . . . . . . . . 4
3.2. OCSP Response . . . . . . . . . . . . . . . . . . . . . . 5
4. Extension Requirements . . . . . . . . . . . . . . . . . . . . 5
4.1. Request for OCSP Support . . . . . . . . . . . . . . . . . 5
4.2. Response to OCSP Support . . . . . . . . . . . . . . . . . 6
5. Examples and Discussion . . . . . . . . . . . . . . . . . . . 6
5.1. Peer to Peer . . . . . . . . . . . . . . . . . . . . . . . 6
5.2. Extended Authentication Protocol (EAP) . . . . . . . . . . 7
6. Security Considerations . . . . . . . . . . . . . . . . . . . 8
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9
8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 9
9. Normative References . . . . . . . . . . . . . . . . . . . . . 9
1. Introduction
Version 2 of the Internet Key Exchange (IKE) protocol [IKEv2]
supports a range of authentication mechanisms, including the use of
public key based authentication. Confirmation of certificate
reliability is essential in order to achieve the security assurances
public key cryptography provides. One fundamental element of such
confirmation is reference to certificate revocation status (see
[RFC3280] for additional detail).
The traditional means of determining certificate revocation status is
through the use of Certificate Revocation Lists (CRLs). IKEv2 allows
CRLs to be exchanged in-band via the CERT payload.
However, CRLs can grow unbounded in size. Many real-world examples
exist to demonstrate the impracticality of including a multi-megabyte
file in an IKE exchange. This constraint is particularly acute in
bandwidth-limited environments (e.g., mobile communications). The
net effect is exclusion of in-band CRLs in favor of out-of-band (OOB)
acquisition of these data, should they even be used at all.
Reliance on OOB methods can be further complicated if access to
revocation data requires use of IPsec (and therefore IKE) to
establish secure and authorized access to the CRLs of an IKE
participant. Such network access deadlock further contributes to a
reduced reliance on the status of certificate revocations in favor of
blind trust.
Myers & Tschofenig Standards Track [Page 2]
RFC 4806 OCSP Extensions to IKEv2 February 2007
OCSP [RFC2560] offers a useful alternative. The size of an OCSP
response is bounded and small and therefore suitable for in-band
IKEv2 signaling of a certificate's revocation status.
This document defines an extension to IKEv2 that enables the use of
OCSP for in-band signaling of certificate revocation status. A new
content encoding is defined for use in the CERTREQ and CERT payloads.
A CERTREQ payload with "OCSP Content" identifies zero or more trusted
OCSP responders and is a request for inclusion of an OCSP response in
the IKEv2 handshake. A cooperative recipient of such a request
responds with a CERT payload containing the appropriate OCSP
response. This content is recognizable via the same "OCSP Content"
identifier.
2. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119].
This document defines the following terms:
OCSP request:
An OCSP request refers to the CERTREQ payload that contains a new
content encoding, referred to as OCSP Content, that conforms to
the definition and behavior specified in Section 3.1.
OCSP response:
An OCSP response refers to the CERT payload that contains a new
content encoding, referred to as OCSP Content, that conforms to
the definition and behavior specified in Section 3.2.
OCSP responder:
The term OCSP responder refers to the entity that accepts requests
from an OCSP client and returns responses as defined in [RFC2560].
Note that the OCSP responder does not refer to the party that
sends the CERT message.
Myers & Tschofenig Standards Track [Page 3]
RFC 4806 OCSP Extensions to IKEv2 February 2007
3. Extension Definition
With reference to Section 3.6 of [IKEv2], the values for the Cert
Encoding field of the CERT payload are extended as follows (see also
the IANA Considerations section of this document):
Certificate Encoding Value
-------------------- -----
OCSP Content 14
3.1. OCSP Request
A value of OCSP Content (14) in the Cert Encoding field of a CERTREQ
Payload indicates the presence of zero or more OCSP responder
certificate hashes in the Certificate Authority field of the CERTREQ
payload. Section 2.2 of [RFC2560] defines responses, which belong to
one of the following three groups:
(a) the CA who issued the certificate
(b) a Trusted Responder whose public key is trusted by the requester
(c) a CA Designated Responder (Authorized Responder) who holds a
specially marked certificate issued directly by the CA,
indicating that the responder may issue OCSP responses for that
CA
In case of (a), the use of hashes in the CERTREQ message is not
needed since the OCSP response is signed by the CA who issued the
certificate. In case of (c), the OCSP response is signed by the CA
Designated Responder whereby the sender of the CERTREQ message does
not know the public key in advance. The presence of OCSP Content in
a CERTREQ message will identify one or more OCSP responders trusted
by the sender in case of (b).
The presence of OCSP Content (14) in a CERTREQ message:
1. identifies zero or more OCSP responders trusted by the sender;
2. notifies the recipient of sender's support for the OCSP extension
to IKEv2; and
3. notifies the recipient of sender's desire to receive OCSP
confirmation in a subsequent CERT payload.
Myers & Tschofenig Standards Track [Page 4]
RFC 4806 OCSP Extensions to IKEv2 February 2007
3.2. OCSP Response
A value of OCSP Content (14) in the Cert Encoding field of a CERT
Payload indicates the presence of an OCSP response in the Certificate
Data field of the CERT payload.
Correlation between an OCSP response CERT payload and a corresponding
CERT payload carrying a certificate can be achieved by matching the
OCSP response CertID field to the certificate. See [RFC2560] for the
definition of OCSP response content.
4. Extension Requirements
4.1. Request for OCSP Support
Section 3.7 of [IKEv2] allows for the concatenation of trust anchor
hashes as the Certification Authority value of a single CERTREQ
message. There is no means however to indicate which among those
hashes, if present, relates to the certificate of a trusted OCSP
responder.
Therefore, an OCSP request, as defined in Section 3.1 above, is
transmitted separate from any other CERTREQ payloads in an IKEv2
exchange.
Where it is useful to identify more than one trusted OCSP responder,
each such identification SHALL be concatenated in a manner identical
to the method documented in Section 3.7 of [IKEv2] regarding the
assembly of multiple trust anchor hashes.
The Certification Authority value in an OCSP request CERTREQ SHALL be
computed and produced in a manner identical to that of trust anchor
hashes as documented in Section 3.7 of [IKEv2].
Upon receipt of an OCSP response CERT payload corresponding to a
prior OCSP request CERTREQ, the CERTREQ sender SHALL incorporate the
OCSP response into path validation logic defined by [RFC3280].
Note that the lack of an OCSP response CERT payload after sending an
OCSP request CERT payload might be an indication that this OCSP
extension is not supported. As a result, it is recommended that
nodes be configured to require a response only if it is known that
all peers do in fact support this extension. Otherwise, it is
recommended that the nodes be configured to try OCSP and, if there is
no response, attempt to determine certificate revocation status by
some other means.
Myers & Tschofenig Standards Track [Page 5]
RFC 4806 OCSP Extensions to IKEv2 February 2007
4.2. Response to OCSP Support
Upon receipt of an OCSP request CERTREQ payload, the recipient SHOULD
acquire the related OCSP-based assertion and produce and transmit an
OCSP response CERT payload corresponding to the certificate needed to
verify its signature on IKEv2 payloads.
An OCSP response CERT payload is transmitted separate from any other
CERT payload in an IKEv2 exchange.
The means by which an OCSP response may be acquired for production of
an OCSP response CERT payload is out of scope of this document.
The Certificate Data field of an OCSP response CERT payload SHALL
contain a DER-encoded OCSPResponse structure as defined in [RFC2560].
5. Examples and Discussion
This section shows the standard IKEv2 message examples with both
peers, the initiator and the responder, using public key based
authentication, CERTREQ and CERT payloads. The first instance
corresponds to Section 1.2 of [IKEv2], the illustrations of which are
reproduced below for reference.
5.1. Peer to Peer
Application of the IKEv2 extensions defined in this document to the
peer-to-peer exchange defined in Section 1.2 of [IKEv2] is as
follows. Messages are numbered for ease of reference.
Initiator Responder
----------- -----------
(1) HDR, SAi1, KEi, Ni -->
(2) <-- HDR, SAr1, KEr, Nr,
CERTREQ(OCSP Request)
(3) HDR, SK {IDi, CERT(certificate),-->
CERT(OCSP Response),
CERTREQ(OCSP Request),
[IDr,] AUTH, SAi2, TSi, TSr}
(4) <-- HDR, SK {IDr,
CERT(certificate),
CERT(OCSP Response),
AUTH, SAr2, TSi, TSr}
OCSP Extensions to Baseline IKEv2
Myers & Tschofenig Standards Track [Page 6]
RFC 4806 OCSP Extensions to IKEv2 February 2007
In (2), Responder sends an OCSP request CERTREQ payload identifying
zero or more OCSP responders trusted by the Responder. In response,
Initiator sends in (3) both a CERT payload carrying its certificate
and an OCSP response CERT payload covering that certificate. In (3),
Initiator also requests an OCSP response via the OCSP request CERTREQ
payload. In (4), the Responder returns its certificate and a
separate OCSP response CERT payload covering that certificate.
It is important to note that in this scenario, the Responder in (2)
does not yet possess the Initiator's certificate and therefore cannot
form an OCSP request as defined in [RFC2560]. To bypass this
problem, hashes are used as defined in Section 4.1. In such
instances, OCSP Requests are simply index values into these data.
Thus, it is easily inferred that OCSP responses can be produced in
the absence of a corresponding request (provided that OCSP nonces are
not used, see Section 6).
It is also important in extending IKEv2 toward OCSP in this scenario
that the Initiator has certain knowledge that the Responder is
capable of and willing to participate in the extension. Yet the
Responder will only trust one or more OCSP responder signatures.
These factors motivate the definition of OCSP responder hash
extension.
5.2. Extended Authentication Protocol (EAP)
Another scenario of pressing interest is the use of EAP to
accommodate multiple end users seeking enterprise access to an IPsec
gateway. Note that OCSP is used for the certificate status check of
the server side IKEv2 certificate and not for certificates that may
be used within EAP methods (either by the EAP peer or the EAP
server). As with the preceding section, the following illustration
is extracted from [IKEv2]. In the event of a conflict between this
document and [IKEv2] regarding these illustrations, [IKEv2] SHALL
dominate.
Myers & Tschofenig Standards Track [Page 7]
RFC 4806 OCSP Extensions to IKEv2 February 2007
Initiator Responder
----------- -----------
(1) HDR, SAi1, KEi, Ni -->
(2) <-- HDR, SAr1, KEr, Nr
(3) HDR, SK {IDi, -->
CERTREQ(OCSP Request),
[IDr,] AUTH, SAi2, TSi, TSr}
(4) <-- HDR, SK {IDr,
CERT(certificate),
CERT(OCSP Response),
AUTH, EAP}
(5) HDR, SK {EAP} -->
(6) <-- HDR, SK {EAP (success)}
(7) HDR, SK {AUTH} -->
(8) <-- HDR, SK {AUTH, SAr2, TSi,
TSr }
OCSP Extensions to EAP in IKEv2
In the EAP scenario, messages (5) through (8) are not relevant to
this document.
6. Security Considerations
For the reasons noted above, an OCSP request, as defined in Section
3.1, is used in place of an OCSP request syntax to trigger production
and transmission of an OCSP response. OCSP, as defined in [RFC2560],
may contain a nonce request extension to improve security against
replay attacks (see Section 4.4.1 of [RFC2560] for further details).
The OCSP request defined by this document cannot accommodate nonces.
[RFC2560] deals with this aspect by allowing pre-produced responses.
[RFC2560] points to this replay vulnerability and indicates: "The use
of precomputed responses allows replay attacks in which an old (good)
response is replayed prior to its expiration date but after the
certificate has been revoked. Deployments of OCSP should carefully
evaluate the benefit of precomputed responses against the probability
of a replay attack and the costs associated with its successful
execution." Nodes SHOULD make the required freshness of an OCSP
response configurable.
Myers & Tschofenig Standards Track [Page 8]
RFC 4806 OCSP Extensions to IKEv2 February 2007
7. IANA Considerations
This document defines one new field type for use in the IKEv2 Cert
Encoding field of the Certificate Payload format. Official
assignment of the "OCSP Content" extension to the Cert Encoding table
of Section 3.6 of [IKEv2] has been acquired from IANA.
Certificate Encoding Value
-------------------- -----
OCSP Content 14
8. Acknowledgements
The authors would like to thank Russ Housley for his support.
Additionally, we would like to thank Pasi Eronen, Nicolas Williams,
Liqiang (Larry) Zhu, Lakshminath Dondeti, and Paul Hoffman for their
review. Pasi gave us invaluable last-call comments. We would also
like to thank Tom Taylor for his Gen-ART review. Jari Arkko gave us
IESG review comments.
9. Normative References
[IKEv2] Kaufman, C., "Internet Key Exchange (IKEv2) Protocol",
RFC 4306, December 2005.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC2560] Myers, M., Ankney, R., Malpani, A., Galperin, S., and C.
Adams, "X.509 Internet Public Key Infrastructure Online
Certificate Status Protocol - OCSP", RFC 2560, June 1999.
[RFC3280] Housley, R., Polk, W., Ford, W., and D. Solo, "Internet
X.509 Public Key Infrastructure Certificate and
Certificate Revocation List (CRL) Profile", RFC 3280,
April 2002.
Myers & Tschofenig Standards Track [Page 9]
RFC 4806 OCSP Extensions to IKEv2 February 2007
Authors' Addresses
Michael Myers
TraceRoute Security LLC
EMail: mmyers@fastq.com
Hannes Tschofenig
Siemens Networks GmbH & Co KG
Otto-Hahn-Ring 6
Munich, Bavaria 81739
Germany
EMail: Hannes.Tschofenig@siemens.com
URI: http://www.tschofenig.com
Myers & Tschofenig Standards Track [Page 10]
RFC 4806 OCSP Extensions to IKEv2 February 2007
Full Copyright Statement
Copyright (C) The IETF Trust (2007).
This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property
The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information
on the procedures with respect to rights in RFC documents can be
found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at
ietf-ipr@ietf.org.
Acknowledgement
Funding for the RFC Editor function is currently provided by the
Internet Society.
Myers & Tschofenig Standards Track [Page 11]

File diff suppressed because it is too large Load Diff

View File

@ -1,899 +0,0 @@
Internet Engineering Task Force (IETF) P. Eronen
Request for Comments: 5998 Independent
Updates: 5996 H. Tschofenig
Category: Standards Track Nokia Siemens Networks
ISSN: 2070-1721 Y. Sheffer
Independent
September 2010
An Extension for EAP-Only Authentication in IKEv2
Abstract
IKEv2 specifies that Extensible Authentication Protocol (EAP)
authentication must be used together with responder authentication
based on public key signatures. This is necessary with old EAP
methods that provide only unilateral authentication using, e.g., one-
time passwords or token cards.
This document specifies how EAP methods that provide mutual
authentication and key agreement can be used to provide extensible
responder authentication for IKEv2 based on methods other than public
key signatures.
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in Section 2 of RFC 5741.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
http://www.rfc-editor.org/info/rfc5998.
Eronen, et al. Standards Track [Page 1]
RFC 5998 Extension for EAP in IKEv2 September 2010
Copyright Notice
Copyright (c) 2010 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
This document may contain material from IETF Documents or IETF
Contributions published or made publicly available before November
10, 2008. The person(s) controlling the copyright in some of this
material may not have granted the IETF Trust the right to allow
modifications of such material outside the IETF Standards Process.
Without obtaining an adequate license from the person(s) controlling
the copyright in such materials, this document may not be modified
outside the IETF Standards Process, and derivative works of it may
not be created outside the IETF Standards Process, except to format
it for publication as an RFC or to translate it into languages other
than English.
1. Introduction
The Extensible Authentication Protocol (EAP), defined in [RFC3748],
is an authentication framework that supports multiple authentication
mechanisms. Today, EAP has been implemented at end hosts and routers
that connect via switched circuits or dial-up lines using PPP
[RFC1661], IEEE 802 wired switches [IEEE8021X], and IEEE 802.11
wireless access points [IEEE80211i].
One of the advantages of the EAP architecture is its flexibility.
EAP is used to select a specific authentication mechanism, typically
after the authenticator requests more information in order to
determine the specific authentication method to be used. Rather than
requiring the authenticator (e.g., wireless LAN access point) to be
updated to support each new authentication method, EAP permits the
use of a backend authentication server that may implement some or all
authentication methods.
Eronen, et al. Standards Track [Page 2]
RFC 5998 Extension for EAP in IKEv2 September 2010
IKEv2 ([RFC4306] and [RFC5996]) is a component of IPsec used for
performing mutual authentication and establishing and maintaining
Security Associations (SAs) for IPsec ESP and Authentication Header
(AH). In addition to supporting authentication using public key
signatures and shared secrets, IKEv2 also supports EAP
authentication.
IKEv2 provides EAP authentication since it was recognized that public
key signatures and shared secrets are not flexible enough to meet the
requirements of many deployment scenarios. By using EAP, IKEv2 can
leverage existing authentication infrastructure and credential
databases, since EAP allows users to choose a method suitable for
existing credentials, and also makes separation of the IKEv2
responder (VPN gateway) from the EAP authentication endpoint (backend
Authentication, Authorization, and Accounting (AAA) server) easier.
Some older EAP methods are designed for unilateral authentication
only (that is, EAP peer to EAP server). These methods are used in
conjunction with IKEv2 public-key-based authentication of the
responder to the initiator. It is expected that this approach is
especially useful for "road warrior" VPN gateways that use, for
instance, one-time passwords or token cards to authenticate the
clients.
However, most newer EAP methods, such as those typically used with
IEEE 802.11i wireless LANs, provide mutual authentication and key
agreement. Currently, IKEv2 specifies that these EAP methods must
also be used together with responder authentication based on public
key signatures.
In order for the public key signature authentication of the gateway
to be effective, a deployment of Public Key Infrastructure (PKI) is
required, which has to include management of trust anchors on all
supplicants. In many environments, this is not realistic, and the
security of the gateway public key is the same as the security of a
self-signed certificate. Mutually authenticating EAP methods alone
can provide a sufficient level of security in many circumstances, and
in fact, in some deployments, IEEE 802.11i uses EAP without any PKI
for authenticating the Wireless Local Area Network (WLAN) access
points.
This document specifies how EAP methods that offer mutual
authentication and key agreement can be used to provide responder
authentication in IKEv2 completely based on EAP.
Eronen, et al. Standards Track [Page 3]
RFC 5998 Extension for EAP in IKEv2 September 2010
1.1. Terminology
All notation in this protocol extension is taken from [RFC4306].
Numbered messages refer to the IKEv2 message sequence when using EAP.
Thus:
o Message 1 is the request message of IKE_SA_INIT.
o Message 2 is the response message of IKE_SA_INIT.
o Message 3 is the first request of IKE_AUTH.
o Message 4 is the first response of IKE_AUTH.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119].
2. Scenarios
In this section, we describe two scenarios for extensible
authentication within IKEv2. These scenarios are intended to be
illustrative examples rather than specifying how things should be
done.
Figure 1 shows a configuration where the EAP and the IKEv2 endpoints
are co-located. Authenticating the IKEv2 responder using both EAP
and public key signatures is redundant. Offering EAP-based
authentication has the advantage that multiple different
authentication and key exchange protocols are available with EAP with
different security properties (such as strong password-based
protocols, protocols offering user identity confidentiality, and many
more).
+------+-----+ +------------+
O | IKEv2 | | IKEv2 |
/|\ | Initiator |<---////////////////////--->| Responder |
/ \ +------------+ IKEv2 +------------+
User | EAP Peer | Exchange | EAP Server |
+------------+ +------------+
Figure 1: EAP and IKEv2 Endpoints Are Co-Located
Figure 2 shows a typical corporate network access scenario. The
initiator (client) interacts with the responder (VPN gateway) in the
corporate network. The EAP exchange within IKE runs between the
Eronen, et al. Standards Track [Page 4]
RFC 5998 Extension for EAP in IKEv2 September 2010
client and the home AAA server. As a result of a successful EAP
authentication protocol run, session keys are established and sent
from the AAA server to the VPN gateway, and then used to authenticate
the IKEv2 SA with AUTH payloads.
The protocol used between the VPN gateway and AAA server could be,
for instance, Diameter [RFC4072] or RADIUS [RFC3579]. See Section 6
for related security considerations.
+-------------------------------+
| Corporate network |
| |
+-----------+ +--------+ |
| IKEv2 | AAA | Home | |
IKEv2 +////----->+ Responder +<---------->+ AAA | |
Exchange / | (VPN GW) | (RADIUS/ | Server | |
/ +-----------+ Diameter) +--------+ |
/ | carrying EAP |
| | |
| +-------------------------------+
v
+------+-----+
o | IKEv2 |
/|\ | Initiator |
/ \ | VPN client |
User +------------+
Figure 2: Corporate Network Access
3. Solution
IKEv2 specifies that when the EAP method establishes a shared secret
key, that key is used by both the initiator and responder to generate
an AUTH payload (thus authenticating the IKEv2 SA set up by messages
1 and 2).
When used together with public key responder authentication, the
responder is, in effect, authenticated using two different methods:
the public key signature AUTH payload in message 4, and the EAP-based
AUTH payload later.
If the initiator does not wish to use public-key-based responder
authentication, it includes an EAP_ONLY_AUTHENTICATION notification
payload (16417) in message 3. The Protocol ID and Security Parameter
Index (SPI) size fields are set to zero, and there is no additional
data associated with this notification.
Eronen, et al. Standards Track [Page 5]
RFC 5998 Extension for EAP in IKEv2 September 2010
If the responder supports this notification and chooses to use it, it
omits the public-key-based AUTH payload and CERT payloads from
message 4.
If the responder does not support the EAP_ONLY_AUTHENTICATION
notification or does not wish to use it, it ignores the notification
payload, and includes the AUTH payload in message 4. In this case,
the initiator MUST verify that payload and any associated
certificates, as per [RFC4306].
When receiving message 4, the initiator MUST verify that the proposed
EAP method is allowed by this specification, and MUST abort the
protocol immediately otherwise.
Both the initiator and responder MUST verify that the EAP method
actually used provided mutual authentication and established a shared
secret key. The AUTH payloads sent after EAP Success MUST use the
EAP-generated key, and MUST NOT use SK_pi or SK_pr (see Section 2.15
of [RFC5996]).
Eronen, et al. Standards Track [Page 6]
RFC 5998 Extension for EAP in IKEv2 September 2010
An IKEv2 message exchange with this modification is shown below:
Initiator Responder
----------- -----------
HDR, SAi1, KEi, Ni,
[N(NAT_DETECTION_SOURCE_IP),
N(NAT_DETECTION_DESTINATION_IP)] -->
<-- HDR, SAr1, KEr, Nr, [CERTREQ],
[N(NAT_DETECTION_SOURCE_IP),
N(NAT_DETECTION_DESTINATION_IP)]
HDR, SK { IDi, [IDr], SAi2, TSi, TSr,
N(EAP_ONLY_AUTHENTICATION),
[CP(CFG_REQUEST)] } -->
<-- HDR, SK { IDr, EAP(Request) }
HDR, SK { EAP(Response) } -->
<-- HDR, SK { EAP(Request) }
HDR, SK { EAP(Response) } -->
<-- HDR, SK { EAP(Success) }
HDR, SK { AUTH } -->
<-- HDR, SK { AUTH, SAr2, TSi, TSr,
[CP(CFG_REPLY] }
Note: all notation in the above protocol sequence and elsewhere in
this specification is as defined in [RFC4306], and see in particular
Sec. 1.2 of [RFC4306] for payload types.
The NAT detection and Configuration payloads are shown for
informative purposes only; they do not change how EAP authentication
works.
An IKE SA that was set up with this extension can be resumed using
the mechanism described in [RFC5723]. However, session resumption
does not change the authentication method. Therefore, during the
IKE_AUTH exchange of the resumed session, this extension MUST NOT be
sent by the initiator.
Eronen, et al. Standards Track [Page 7]
RFC 5998 Extension for EAP in IKEv2 September 2010
4. Safe EAP Methods
EAP methods to be used with this extension MUST have the following
properties:
1. The method provides mutual authentication of the peers.
2. The method is key-generating.
3. The method is resistant to dictionary attacks.
The authors believe that the following EAP methods are secure when
used with the current extension. The list is not inclusive, and
there are likely other safe methods that have not been listed here.
+-------------------------------+-------------------+---------------+
| Method Name | Allows Channel | Reference |
| | Binding? | |
+-------------------------------+-------------------+---------------+
| EAP-SIM | No | [RFC4186] |
| EAP-AKA | Yes | [RFC4187] |
| EAP-AKA' | Yes | [RFC5448] |
| EAP-GPSK | Yes | [RFC5433] |
| EAP-pwd | No | [RFC5931] |
| EAP-EKE | Yes | [EMU-EAP-EKE] |
| EAP-PAX | Yes | [RFC4746] |
| EAP-SAKE | No | [RFC4763] |
| EAP-SRP | No | [EAP-SRP] |
| EAP-POTP (mutual | Yes | [RFC4793] |
| authentication variant) | | |
| EAP-TLS | No | [RFC5216] |
| EAP-FAST | No | [RFC4851] |
| EAP-TTLS | No | [RFC5281] |
+-------------------------------+-------------------+---------------+
The "Allows channel binding?" column denotes protocols where
protected identity information may be sent between the EAP endpoints.
This third, optional property of the method provides protection
against certain types of attacks (see Section 6.2 for an
explanation), and therefore in some scenarios, methods that allow for
channel binding are to be preferred. It is noted that at the time of
writing, even when such capabilities are provided, they are not fully
specified in an interoperable manner. In particular, no RFC
specifies what identities should be sent under the protection of the
channel binding mechanism, or what policy is to be used to correlate
identities at the different layers.
Eronen, et al. Standards Track [Page 8]
RFC 5998 Extension for EAP in IKEv2 September 2010
5. IANA Considerations
This document defines a new IKEv2 Notification Payload type,
EAP_ONLY_AUTHENTICATION, described in Section 3. This payload has
been assigned the type number 16417 from the "Status Types" range.
6. Security Considerations
Security considerations applicable to all EAP methods are discussed
in [RFC3748]. The EAP Key Management Framework [RFC5247] deals with
issues that arise when EAP is used as a part of a larger system.
6.1. Authentication of IKEv2 SA
It is important to note that the IKEv2 SA is not authenticated by
just running an EAP conversation: the crucial step is the AUTH
payload based on the EAP-generated key. Thus, EAP methods that do
not provide mutual authentication or establish a shared secret key
MUST NOT be used with the modifications presented in this document.
6.2. Authentication with Separated IKEv2 Responder / EAP Server
As described in Section 2, the EAP conversation can terminate either
at the IKEv2 responder or at a backend AAA server.
If the EAP method is terminated at the IKEv2 responder, then no key
transport via the AAA infrastructure is required. Pre-shared secret
and public-key-based authentication offered by IKEv2 is then replaced
by a wider range of authentication and key exchange methods.
However, typically EAP will be used with a backend AAA server. See
[RFC5247] for a more complete discussion of the related security
issues; here we provide only a short summary.
When a backend server is used, there are actually two authentication
exchanges: the EAP method between the client and the AAA server, and
another authentication between the AAA server and IKEv2 gateway. The
AAA server authenticates the client using the selected EAP method,
and they establish a session key. The AAA server then sends this key
to the IKEv2 gateway over a connection authenticated using, e.g.,
IPsec or Transport Layer Security (TLS).
Some EAP methods do not have any concept of pass-through
authenticator (e.g., Network Access Server (NAS) or IKEv2 gateway)
identity, and these two authentications remain quite independent of
each other. That is, after the client has verified the AUTH payload
sent by the IKEv2 gateway, it knows that it is talking to SOME
gateway trusted by the home AAA server, but not which one. The
Eronen, et al. Standards Track [Page 9]
RFC 5998 Extension for EAP in IKEv2 September 2010
situation is somewhat similar if a single cryptographic hardware
accelerator, containing a single private key, would be shared between
multiple IKEv2 gateways (perhaps in some kind of cluster
configuration). In particular, if one of the gateways is
compromised, it can impersonate any of the other gateways towards the
user (until the compromise is discovered and access rights revoked).
In some environments it is not desirable to trust the IKEv2 gateways
this much (also known as the "Lying NAS Problem"). EAP methods that
provide what is called "connection binding" or "channel binding"
transport some identity or identities of the gateway (or WLAN access
point / NAS) inside the EAP method. Then the AAA server can check
that it is indeed sending the key to the gateway expected by the
client. A potential solution is described in [EAP-SERVICE], see also
[EMU-AAAPAY].
In some deployment configurations, AAA proxies may be present between
the IKEv2 gateway and the backend AAA server. These AAA proxies MUST
be trusted for secure operation, and therefore SHOULD be avoided when
possible; see Section 2.3.4 of [RFC4072] and Section 4.3.7 of
[RFC3579] for more discussion.
6.3. Protection of EAP Payloads
Although the EAP payloads are encrypted and integrity protected with
SK_e/SK_a, this does not provide any protection against active
attackers. Until the AUTH payload has been received and verified, a
man-in-the-middle can change the KEi/KEr payloads and eavesdrop or
modify the EAP payloads.
In IEEE 802.11i wireless LANs, the EAP payloads are neither encrypted
nor integrity protected (by the link layer), so EAP methods are
typically designed to take that into account.
In particular, EAP methods that are vulnerable to dictionary attacks
when used in WLANs are still vulnerable (to active attackers) when
run inside IKEv2.
The rules in Section 4 are designed to avoid this potential
vulnerability.
Eronen, et al. Standards Track [Page 10]
RFC 5998 Extension for EAP in IKEv2 September 2010
6.4. Identities and Authenticated Identities
When using this protocol, each of the peers sends two identity
values:
1. An identity contained in the IKE ID payload.
2. An identity transferred within the specific EAP method's
messages.
(IKEv2 omits the EAP Identity request/response pair, see Section 3.16
of [RFC5996].) The first identity value can be used by the recipient
to route AAA messages and/or to select authentication and EAP types.
But it is only the second identity that is directly authenticated by
the EAP method. The reader is referred to Section 2.16 of [RFC5996]
regarding the need to base IPsec policy decisions on the
authenticated identity. In the context of the extension described
here, this guidance on IPsec policy applies both to the
authentication of the client by the gateway and vice versa.
6.5. User Identity Confidentiality
IKEv2 provides confidentiality for the initiator identity against
passive eavesdroppers, but not against active attackers. The
initiator announces its identity first (in message 3), before the
responder has been authenticated. The usage of EAP in IKEv2 does not
change this situation, since the ID payload in message 3 is used
instead of the EAP Identity Request/Response exchange. This is
somewhat unfortunate since when EAP is used with public key
authentication of the responder, it would be possible to provide
active user identity confidentiality for the initiator.
IKEv2 protects the responder's identity even against active attacks.
This property cannot be provided when using EAP. If public key
responder authentication is used in addition to EAP, the responder
reveals its identity before authenticating the initiator. If only
EAP is used (as proposed in this document), the situation depends on
the EAP method used (in some EAP methods, the server reveals its
identity first).
Hence, if active user identity confidentiality for the responder is
required then EAP methods that offer this functionality have to be
used (see [RFC3748], Section 7.3).
Eronen, et al. Standards Track [Page 11]
RFC 5998 Extension for EAP in IKEv2 September 2010
7. Acknowledgments
This document borrows some text from [RFC3748], [RFC4306], and
[RFC4072]. We would also like to thank Hugo Krawczyk for interesting
discussions about this topic, Dan Harkins, and David Harrington for
their comments.
8. References
8.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC3748] Aboba, B., Blunk, L., Vollbrecht, J., Carlson, J., and
H. Levkowetz, "Extensible Authentication Protocol
(EAP)", RFC 3748, June 2004.
[RFC4306] Kaufman, C., "Internet Key Exchange (IKEv2) Protocol",
RFC 4306, December 2005.
[RFC5723] Sheffer, Y. and H. Tschofenig, "Internet Key Exchange
Protocol Version 2 (IKEv2) Session Resumption",
RFC 5723, January 2010.
[RFC5996] Kaufman, C., Hoffman, P., Nir, Y., and P. Eronen,
"Internet Key Exchange Protocol Version 2 (IKEv2)",
RFC 5996, September 2010.
8.2. Informative References
[EAP-SERVICE] Arkko, J. and P. Eronen, "Authenticated Service
Information for the Extensible Authentication Protocol
(EAP)", Work in Progress, October 2005.
[EAP-SRP] Carlson, J., Aboba, B., and H. Haverinen, "EAP SRP-
SHA1 Authentication Protocol", Work in Progress,
July 2001.
[EMU-AAAPAY] Clancy, C., Lior, A., Zorn, G., and K. Hoeper, "EAP
Method Support for Transporting AAA Payloads", Work
in Progress, May 2010.
[EMU-EAP-EKE] Sheffer, Y., Zorn, G., Tschofenig, H., and S. Fluhrer,
"An EAP Authentication Method Based on the EKE
Protocol", Work in Progress, August 2010.
Eronen, et al. Standards Track [Page 12]
RFC 5998 Extension for EAP in IKEv2 September 2010
[IEEE80211i] Institute of Electrical and Electronics Engineers,
"IEEE Standard for Information technology -
Telecommunications and information exchange between
systems - Local and metropolitan area networks -
Specific requirements - Part 11: Wireless Medium
Access Control (MAC) and Physical Layer (PHY)
specifications: Amendment 6: Medium Access Control
(MAC) Security Enhancements", IEEE Standard 802.11i-
2004, July 2004.
[IEEE8021X] Institute of Electrical and Electronics Engineers,
"Local and Metropolitan Area Networks: Port-Based
Network Access Control", IEEE Standard 802.1X-2001,
2001.
[RFC1661] Simpson, W., "The Point-to-Point Protocol (PPP)",
STD 51, RFC 1661, July 1994.
[RFC3579] Aboba, B. and P. Calhoun, "RADIUS (Remote
Authentication Dial In User Service) Support For
Extensible Authentication Protocol (EAP)", RFC 3579,
September 2003.
[RFC4072] Eronen, P., Hiller, T., and G. Zorn, "Diameter
Extensible Authentication Protocol (EAP) Application",
RFC 4072, August 2005.
[RFC4186] Haverinen, H. and J. Salowey, "Extensible
Authentication Protocol Method for Global System for
Mobile Communications (GSM) Subscriber Identity
Modules (EAP-SIM)", RFC 4186, January 2006.
[RFC4187] Arkko, J. and H. Haverinen, "Extensible Authentication
Protocol Method for 3rd Generation Authentication and
Key Agreement (EAP-AKA)", RFC 4187, January 2006.
[RFC4746] Clancy, T. and W. Arbaugh, "Extensible Authentication
Protocol (EAP) Password Authenticated Exchange",
RFC 4746, November 2006.
[RFC4763] Vanderveen, M. and H. Soliman, "Extensible
Authentication Protocol Method for Shared-secret
Authentication and Key Establishment (EAP-SAKE)",
RFC 4763, November 2006.
[RFC4793] Nystroem, M., "The EAP Protected One-Time Password
Protocol (EAP-POTP)", RFC 4793, February 2007.
Eronen, et al. Standards Track [Page 13]
RFC 5998 Extension for EAP in IKEv2 September 2010
[RFC4851] Cam-Winget, N., McGrew, D., Salowey, J., and H. Zhou,
"The Flexible Authentication via Secure Tunneling
Extensible Authentication Protocol Method (EAP-FAST)",
RFC 4851, May 2007.
[RFC5216] Simon, D., Aboba, B., and R. Hurst, "The EAP-TLS
Authentication Protocol", RFC 5216, March 2008.
[RFC5247] Aboba, B., Simon, D., and P. Eronen, "Extensible
Authentication Protocol (EAP) Key Management
Framework", RFC 5247, August 2008.
[RFC5281] Funk, P. and S. Blake-Wilson, "Extensible
Authentication Protocol Tunneled Transport Layer
Security Authenticated Protocol Version 0 (EAP-
TTLSv0)", RFC 5281, August 2008.
[RFC5433] Clancy, T. and H. Tschofenig, "Extensible
Authentication Protocol - Generalized Pre-Shared Key
(EAP-GPSK) Method", RFC 5433, February 2009.
[RFC5448] Arkko, J., Lehtovirta, V., and P. Eronen, "Improved
Extensible Authentication Protocol Method for 3rd
Generation Authentication and Key Agreement (EAP-
AKA')", RFC 5448, May 2009.
[RFC5931] Harkins, D. and G. Zorn, "Extensible Authentication
Protocol (EAP) Authentication Using Only A Password",
RFC 5931, August 2010.
Eronen, et al. Standards Track [Page 14]
RFC 5998 Extension for EAP in IKEv2 September 2010
Appendix A. Alternative Approaches
In this section, we list alternatives that have been considered
during the work on this document. We concluded that the solution
presented in Section 3 seems to fit better into IKEv2.
A.1. Ignore AUTH Payload at the Initiator
With this approach, the initiator simply ignores the AUTH payload in
message 4 (but obviously must check the second AUTH payload later!).
The main advantage of this approach is that no protocol modifications
are required and no signature verification is required. A
significant disadvantage is that the EAP method to be used cannot be
selected to take this behavior into account.
The initiator could signal to the responder (using a notification
payload) that it did not verify the first AUTH payload.
A.2. Unauthenticated Public Keys in AUTH Payload (Message 4)
Another solution approach suggests the use of unauthenticated public
keys in the public key signature AUTH payload (for message 4).
That is, the initiator verifies the signature in the AUTH payload,
but does not verify that the public key indeed belongs to the
intended party (using certificates) -- since it doesn't have a PKI
that would allow this. This could be used with X.509 certificates
(the initiator ignores all other fields of the certificate except the
public key), or "Raw RSA Key" CERT payloads.
This approach has the advantage that initiators that wish to perform
certificate-based responder authentication (in addition to EAP) may
do so, without requiring the responder to handle these cases
separately. A disadvantage here, again, is that the EAP method
selection cannot take into account the incomplete validation of the
responder's certificate.
If using RSA, the overhead of signature verification is quite small,
compared to the g^xy calculation required by the Diffie-Hellman
exchange.
A.3. Using EAP Derived Session Keys for IKEv2
It has been proposed that when using an EAP method that provides
mutual authentication and key agreement, the IKEv2 Diffie-Hellman
exchange could also be omitted. This would mean that the session
keys for IPsec SAs established later would rely only on EAP-provided
keys.
Eronen, et al. Standards Track [Page 15]
RFC 5998 Extension for EAP in IKEv2 September 2010
It seems the only benefit of this approach is saving some computation
time (g^xy calculation). This approach requires designing a
completely new protocol (which would not resemble IKEv2 anymore); we
do not believe that it should be considered. Nevertheless, we
include it for completeness.
Authors' Addresses
Pasi Eronen
Independent
EMail: pe@iki.fi
Hannes Tschofenig
Nokia Siemens Networks
Linnoitustie 6
Espoo 02600
Finland
Phone: +358 (50) 4871445
EMail: Hannes.Tschofenig@gmx.net
URI: http://www.tschofenig.priv.at
Yaron Sheffer
Independent
EMail: yaronf.ietf@gmail.com
Eronen, et al. Standards Track [Page 16]

2
fuzz/.gitignore vendored
View File

@ -1,5 +1,7 @@
fuzz_certs
fuzz_crls
fuzz_ocsp_req
fuzz_ocsp_rsp
fuzz_ids
fuzz_pa_tnc
fuzz_pb_tnc

View File

@ -11,7 +11,7 @@ AM_CPPFLAGS = @CPPFLAGS@ \
fuzz_ldflags = ${libfuzzer} \
$(top_builddir)/src/libstrongswan/.libs/libstrongswan.a \
-Wl,-Bstatic -lgmp -Wl,-Bdynamic \
-Wl,-Bstatic -lcrypto -Wl,-Bdynamic \
@FUZZING_LDFLAGS@
pa_tnc_ldflags = \
@ -25,7 +25,8 @@ pb_tnc_ldflags = \
$(top_builddir)/src/libtncif/.libs/libtncif.a \
$(fuzz_ldflags)
FUZZ_TARGETS=fuzz_certs fuzz_crls fuzz_ids fuzz_pa_tnc fuzz_pb_tnc
FUZZ_TARGETS=fuzz_certs fuzz_crls fuzz_ocsp_req fuzz_ocsp_rsp \
fuzz_ids fuzz_pa_tnc fuzz_pb_tnc
all-local: $(FUZZ_TARGETS)
@ -37,6 +38,12 @@ fuzz_certs: fuzz_certs.c ${libfuzzer}
fuzz_crls: fuzz_crls.c ${libfuzzer}
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
fuzz_ocsp_req: fuzz_ocsp_req.c ${libfuzzer}
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
fuzz_ocsp_rsp: fuzz_ocsp_rsp.c ${libfuzzer}
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
fuzz_ids: fuzz_ids.c ${libfuzzer}
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
@ -53,7 +60,7 @@ libFuzzerLocal_a_LIBADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
check: all
for f in $(FUZZ_TARGETS); do \
corpus=$${f#fuzz_}; \
./$$f $(FUZZING_CORPORA)/$${corpus}/*; \
./$$f $(FUZZING_CORPORA)/$${corpus}/* || exit 1; \
crashes=$(FUZZING_CORPORA)/$${corpus}-crash; \
test ! -d $${crashes} || ./$$f $${crashes}/*; \
test ! -d $${crashes} || ./$$f $${crashes}/* || exit 1; \
done

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2014 Andreas Steffen
* Copyright (C) 2023 Tobias Brunner
*
* Copyright (C) secunet Security Networks AG
*
@ -14,30 +14,28 @@
* for more details.
*/
#include "bliss_huffman_code.h"
#include <library.h>
#include <utils/debug.h>
extern bliss_huffman_code_t bliss_huffman_code_1;
extern bliss_huffman_code_t bliss_huffman_code_3;
extern bliss_huffman_code_t bliss_huffman_code_4;
/**
* See header.
*/
bliss_huffman_code_t* bliss_huffman_code_get_by_id(bliss_param_set_id_t id)
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
{
switch (id)
{
case BLISS_I:
case BLISS_B_I:
return &bliss_huffman_code_1;
case BLISS_III:
case BLISS_B_III:
return &bliss_huffman_code_3;
case BLISS_IV:
case BLISS_B_IV:
return &bliss_huffman_code_4;
default:
return NULL;
}
}
certificate_t *cert;
chunk_t chunk;
dbg_default_set_level(-1);
library_init(NULL, "fuzz_ocsp_req");
plugin_loader_add_plugindirs(PLUGINDIR, PLUGINS);
if (!lib->plugins->load(lib->plugins, PLUGINS))
{
return 1;
}
chunk = chunk_create((u_char*)buf, len);
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_REQUEST,
BUILD_BLOB, chunk, BUILD_END);
DESTROY_IF(cert);
lib->plugins->unload(lib->plugins);
library_deinit();
return 0;
}

41
fuzz/fuzz_ocsp_rsp.c Normal file
View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2023 Tobias Brunner
*
* Copyright (C) secunet Security Networks AG
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <library.h>
#include <utils/debug.h>
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
{
certificate_t *cert;
chunk_t chunk;
dbg_default_set_level(-1);
library_init(NULL, "fuzz_ocsp_rsp");
plugin_loader_add_plugindirs(PLUGINDIR, PLUGINS);
if (!lib->plugins->load(lib->plugins, PLUGINS))
{
return 1;
}
chunk = chunk_create((u_char*)buf, len);
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_RESPONSE,
BUILD_BLOB, chunk, BUILD_END);
DESTROY_IF(cert);
lib->plugins->unload(lib->plugins);
library_deinit();
return 0;
}

View File

@ -2,10 +2,12 @@
SUBDIRS =
if USE_LEGACY_SYSTEMD
if USE_FILE_CONFIG
if USE_CHARON
SUBDIRS += systemd-starter
endif
endif
endif
if USE_SYSTEMD
if USE_SWANCTL

View File

@ -1,6 +1,7 @@
[Unit]
Description=strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf
After=syslog.target network-online.target
Wants=syslog.target network-online.target
[Service]
ExecStart=@SBINDIR@/@IPSEC_SCRIPT@ start --nofork

View File

@ -1,6 +1,7 @@
[Unit]
Description=strongSwan IPsec IKEv1/IKEv2 daemon using swanctl
After=network-online.target
Wants=network-online.target
[Service]
Type=notify

532
m4/macros/host-cpu-c-abi.m4 Normal file
View File

@ -0,0 +1,532 @@
# host-cpu-c-abi.m4
# serial 20
dnl Copyright (C) 2002-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
dnl From Bruno Haible and Sam Steingold.
dnl Sets the HOST_CPU variable to the canonical name of the CPU.
dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its
dnl C language ABI (application binary interface).
dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in
dnl config.h.
dnl
dnl This canonical name can be used to select a particular assembly language
dnl source file that will interoperate with C code on the given host.
dnl
dnl For example:
dnl * 'i386' and 'sparc' are different canonical names, because code for i386
dnl will not run on SPARC CPUs and vice versa. They have different
dnl instruction sets.
dnl * 'sparc' and 'sparc64' are different canonical names, because code for
dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code
dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit
dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit
dnl mode, but not both.
dnl * 'mips' and 'mipsn32' are different canonical names, because they use
dnl different argument passing and return conventions for C functions, and
dnl although the instruction set of 'mips' is a large subset of the
dnl instruction set of 'mipsn32'.
dnl * 'mipsn32' and 'mips64' are different canonical names, because they use
dnl different sizes for the C types like 'int' and 'void *', and although
dnl the instruction sets of 'mipsn32' and 'mips64' are the same.
dnl * The same canonical name is used for different endiannesses. You can
dnl determine the endianness through preprocessor symbols:
dnl - 'arm': test __ARMEL__.
dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL.
dnl - 'powerpc64': test __BIG_ENDIAN__ vs. __LITTLE_ENDIAN__.
dnl * The same name 'i386' is used for CPUs of type i386, i486, i586
dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because
dnl - Instructions that do not exist on all of these CPUs (cmpxchg,
dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your
dnl assembly language source files use such instructions, you will
dnl need to make the distinction.
dnl - Speed of execution of the common instruction set is reasonable across
dnl the entire family of CPUs. If you have assembly language source files
dnl that are optimized for particular CPU types (like GNU gmp has), you
dnl will need to make the distinction.
dnl See <https://en.wikipedia.org/wiki/X86_instruction_listings>.
AC_DEFUN([gl_HOST_CPU_C_ABI],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_C_ASM])
AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi],
[case "$host_cpu" in
changequote(,)dnl
i[34567]86 )
changequote([,])dnl
gl_cv_host_cpu_c_abi=i386
;;
x86_64 )
# On x86_64 systems, the C compiler may be generating code in one of
# these ABIs:
# - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64.
# - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64
# with native Windows (mingw, MSVC).
# - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
# - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if (defined __x86_64__ || defined __amd64__ \
|| defined _M_X64 || defined _M_AMD64)
int ok;
#else
error fail
#endif
]])],
[AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __ILP32__ || defined _ILP32
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=x86_64-x32],
[gl_cv_host_cpu_c_abi=x86_64])],
[gl_cv_host_cpu_c_abi=i386])
;;
changequote(,)dnl
alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
changequote([,])dnl
gl_cv_host_cpu_c_abi=alpha
;;
arm* | aarch64 )
# Assume arm with EABI.
# On arm64 systems, the C compiler may be generating code in one of
# these ABIs:
# - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
# - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
# - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#ifdef __aarch64__
int ok;
#else
error fail
#endif
]])],
[AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __ILP32__ || defined _ILP32
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=arm64-ilp32],
[gl_cv_host_cpu_c_abi=arm64])],
[# Don't distinguish little-endian and big-endian arm, since they
# don't require different machine code for simple operations and
# since the user can distinguish them through the preprocessor
# defines __ARMEL__ vs. __ARMEB__.
# But distinguish arm which passes floating-point arguments and
# return values in integer registers (r0, r1, ...) - this is
# gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which
# passes them in float registers (s0, s1, ...) and double registers
# (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer
# sets the preprocessor defines __ARM_PCS (for the first case) and
# __ARM_PCS_VFP (for the second case), but older GCC does not.
echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c
# Look for a reference to the register d0 in the .s file.
AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1
if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then
gl_cv_host_cpu_c_abi=armhf
else
gl_cv_host_cpu_c_abi=arm
fi
rm -fr conftest*
])
;;
hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
# On hppa, the C compiler may be generating 32-bit code or 64-bit
# code. In the latter case, it defines _LP64 and __LP64__.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#ifdef __LP64__
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=hppa64],
[gl_cv_host_cpu_c_abi=hppa])
;;
ia64* )
# On ia64 on HP-UX, the C compiler may be generating 64-bit code or
# 32-bit code. In the latter case, it defines _ILP32.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#ifdef _ILP32
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=ia64-ilp32],
[gl_cv_host_cpu_c_abi=ia64])
;;
mips* )
# We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
# at 32.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=mips64],
[# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but
# may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32.
# In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but
# may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if (_MIPS_SIM == _ABIN32)
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=mipsn32],
[gl_cv_host_cpu_c_abi=mips])])
;;
powerpc* )
# Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD.
# No need to distinguish them here; the caller may distinguish
# them based on the OS.
# On powerpc64 systems, the C compiler may still be generating
# 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
# be generating 64-bit code.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __powerpc64__ || defined __LP64__
int ok;
#else
error fail
#endif
]])],
[# On powerpc64, there are two ABIs on Linux: The AIX compatible
# one and the ELFv2 one. The latter defines _CALL_ELF=2.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined _CALL_ELF && _CALL_ELF == 2
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=powerpc64-elfv2],
[gl_cv_host_cpu_c_abi=powerpc64])
],
[gl_cv_host_cpu_c_abi=powerpc])
;;
rs6000 )
gl_cv_host_cpu_c_abi=powerpc
;;
riscv32 | riscv64 )
# There are 2 architectures (with variants): rv32* and rv64*.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if __riscv_xlen == 64
int ok;
#else
error fail
#endif
]])],
[cpu=riscv64],
[cpu=riscv32])
# There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
# Size of 'long' and 'void *':
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __LP64__
int ok;
#else
error fail
#endif
]])],
[main_abi=lp64],
[main_abi=ilp32])
# Float ABIs:
# __riscv_float_abi_double:
# 'float' and 'double' are passed in floating-point registers.
# __riscv_float_abi_single:
# 'float' are passed in floating-point registers.
# __riscv_float_abi_soft:
# No values are passed in floating-point registers.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __riscv_float_abi_double
int ok;
#else
error fail
#endif
]])],
[float_abi=d],
[AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __riscv_float_abi_single
int ok;
#else
error fail
#endif
]])],
[float_abi=f],
[float_abi=''])
])
gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}"
;;
s390* )
# On s390x, the C compiler may be generating 64-bit (= s390x) code
# or 31-bit (= s390) code.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __LP64__ || defined __s390x__
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=s390x],
[gl_cv_host_cpu_c_abi=s390])
;;
sparc | sparc64 )
# UltraSPARCs running Linux have `uname -m` = "sparc64", but the
# C compiler still generates 32-bit code.
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[#if defined __sparcv9 || defined __arch64__
int ok;
#else
error fail
#endif
]])],
[gl_cv_host_cpu_c_abi=sparc64],
[gl_cv_host_cpu_c_abi=sparc])
;;
*)
gl_cv_host_cpu_c_abi="$host_cpu"
;;
esac
])
dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same.
HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'`
HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi"
AC_SUBST([HOST_CPU])
AC_SUBST([HOST_CPU_C_ABI])
# This was
# AC_DEFINE_UNQUOTED([__${HOST_CPU}__])
# AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__])
# earlier, but KAI C++ 3.2d doesn't like this.
sed -e 's/-/_/g' >> confdefs.h <<EOF
#ifndef __${HOST_CPU}__
#define __${HOST_CPU}__ 1
#endif
#ifndef __${HOST_CPU_C_ABI}__
#define __${HOST_CPU_C_ABI}__ 1
#endif
EOF
AH_TOP([/* CPU and C ABI indicator */
#ifndef __i386__
#undef __i386__
#endif
#ifndef __x86_64_x32__
#undef __x86_64_x32__
#endif
#ifndef __x86_64__
#undef __x86_64__
#endif
#ifndef __alpha__
#undef __alpha__
#endif
#ifndef __arm__
#undef __arm__
#endif
#ifndef __armhf__
#undef __armhf__
#endif
#ifndef __arm64_ilp32__
#undef __arm64_ilp32__
#endif
#ifndef __arm64__
#undef __arm64__
#endif
#ifndef __hppa__
#undef __hppa__
#endif
#ifndef __hppa64__
#undef __hppa64__
#endif
#ifndef __ia64_ilp32__
#undef __ia64_ilp32__
#endif
#ifndef __ia64__
#undef __ia64__
#endif
#ifndef __loongarch32__
#undef __loongarch32__
#endif
#ifndef __loongarch64__
#undef __loongarch64__
#endif
#ifndef __m68k__
#undef __m68k__
#endif
#ifndef __mips__
#undef __mips__
#endif
#ifndef __mipsn32__
#undef __mipsn32__
#endif
#ifndef __mips64__
#undef __mips64__
#endif
#ifndef __powerpc__
#undef __powerpc__
#endif
#ifndef __powerpc64__
#undef __powerpc64__
#endif
#ifndef __powerpc64_elfv2__
#undef __powerpc64_elfv2__
#endif
#ifndef __riscv32__
#undef __riscv32__
#endif
#ifndef __riscv64__
#undef __riscv64__
#endif
#ifndef __riscv32_ilp32__
#undef __riscv32_ilp32__
#endif
#ifndef __riscv32_ilp32f__
#undef __riscv32_ilp32f__
#endif
#ifndef __riscv32_ilp32d__
#undef __riscv32_ilp32d__
#endif
#ifndef __riscv64_ilp32__
#undef __riscv64_ilp32__
#endif
#ifndef __riscv64_ilp32f__
#undef __riscv64_ilp32f__
#endif
#ifndef __riscv64_ilp32d__
#undef __riscv64_ilp32d__
#endif
#ifndef __riscv64_lp64__
#undef __riscv64_lp64__
#endif
#ifndef __riscv64_lp64f__
#undef __riscv64_lp64f__
#endif
#ifndef __riscv64_lp64d__
#undef __riscv64_lp64d__
#endif
#ifndef __s390__
#undef __s390__
#endif
#ifndef __s390x__
#undef __s390x__
#endif
#ifndef __sh__
#undef __sh__
#endif
#ifndef __sparc__
#undef __sparc__
#endif
#ifndef __sparc64__
#undef __sparc64__
#endif
])
])
dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI
dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit
dnl one.
dnl This is a simplified variant of gl_HOST_CPU_C_ABI.
AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit],
[case "$host_cpu" in
# CPUs that only support a 32-bit ABI.
arc \
| bfin \
| cris* \
| csky \
| epiphany \
| ft32 \
| h8300 \
| m68k \
| microblaze | microblazeel \
| nds32 | nds32le | nds32be \
| nios2 | nios2eb | nios2el \
| or1k* \
| or32 \
| sh | sh[1234] | sh[1234]e[lb] \
| tic6x \
| xtensa* )
gl_cv_host_cpu_c_abi_32bit=yes
;;
# CPUs that only support a 64-bit ABI.
changequote(,)dnl
alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
| mmix )
changequote([,])dnl
gl_cv_host_cpu_c_abi_32bit=no
;;
*)
if test -n "$gl_cv_host_cpu_c_abi"; then
dnl gl_HOST_CPU_C_ABI has already been run. Use its result.
case "$gl_cv_host_cpu_c_abi" in
i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | loongarch32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
gl_cv_host_cpu_c_abi_32bit=yes ;;
x86_64 | alpha | arm64 | aarch64c | hppa64 | ia64 | loongarch64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
gl_cv_host_cpu_c_abi_32bit=no ;;
*)
gl_cv_host_cpu_c_abi_32bit=unknown ;;
esac
else
gl_cv_host_cpu_c_abi_32bit=unknown
fi
if test $gl_cv_host_cpu_c_abi_32bit = unknown; then
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[int test_pointer_size[sizeof (void *) - 5];
]])],
[gl_cv_host_cpu_c_abi_32bit=no],
[gl_cv_host_cpu_c_abi_32bit=yes])
fi
;;
esac
])
HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit"
])

334
m4/macros/lib-prefix.m4 Normal file
View File

@ -0,0 +1,334 @@
# lib-prefix.m4
# serial 23
dnl Copyright (C) 2001-2005, 2008-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
dnl From Bruno Haible.
dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
dnl to access previously installed libraries. The basic assumption is that
dnl a user will want packages to use other packages he previously installed
dnl with the same --prefix option.
dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
dnl libraries, but is otherwise very convenient.
AC_DEFUN([AC_LIB_PREFIX],
[
AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
dnl By default, look in $includedir and $libdir.
use_additional=yes
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
AC_ARG_WITH([lib-prefix],
[[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
--without-lib-prefix don't search for libraries in includedir and libdir]],
[
if test "X$withval" = "Xno"; then
use_additional=no
else
if test "X$withval" = "X"; then
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
else
additional_includedir="$withval/include"
additional_libdir="$withval/$acl_libdirstem"
fi
fi
])
if test $use_additional = yes; then
dnl Potentially add $additional_includedir to $CPPFLAGS.
dnl But don't add it
dnl 1. if it's the standard /usr/include,
dnl 2. if it's already present in $CPPFLAGS,
dnl 3. if it's /usr/local/include and we are using GCC on Linux,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_includedir" != "X/usr/include"; then
haveit=
for x in $CPPFLAGS; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-I$additional_includedir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test "X$additional_includedir" = "X/usr/local/include"; then
if test -n "$GCC"; then
case $host_os in
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
if test -d "$additional_includedir"; then
dnl Really add $additional_includedir to $CPPFLAGS.
CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
fi
fi
fi
fi
dnl Potentially add $additional_libdir to $LDFLAGS.
dnl But don't add it
dnl 1. if it's the standard /usr/lib,
dnl 2. if it's already present in $LDFLAGS,
dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
haveit=
for x in $LDFLAGS; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$additional_libdir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
if test -n "$GCC"; then
case $host_os in
linux*) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
if test -d "$additional_libdir"; then
dnl Really add $additional_libdir to $LDFLAGS.
LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
fi
fi
fi
fi
fi
])
dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
dnl acl_final_exec_prefix, containing the values to which $prefix and
dnl $exec_prefix will expand at the end of the configure script.
AC_DEFUN([AC_LIB_PREPARE_PREFIX],
[
dnl Unfortunately, prefix and exec_prefix get only finally determined
dnl at the end of configure.
if test "X$prefix" = "XNONE"; then
acl_final_prefix="$ac_default_prefix"
else
acl_final_prefix="$prefix"
fi
if test "X$exec_prefix" = "XNONE"; then
acl_final_exec_prefix='${prefix}'
else
acl_final_exec_prefix="$exec_prefix"
fi
acl_saved_prefix="$prefix"
prefix="$acl_final_prefix"
eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
prefix="$acl_saved_prefix"
])
dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
dnl variables prefix and exec_prefix bound to the values they will have
dnl at the end of the configure script.
AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
[
acl_saved_prefix="$prefix"
prefix="$acl_final_prefix"
acl_saved_exec_prefix="$exec_prefix"
exec_prefix="$acl_final_exec_prefix"
$1
exec_prefix="$acl_saved_exec_prefix"
prefix="$acl_saved_prefix"
])
dnl AC_LIB_PREPARE_MULTILIB creates
dnl - a function acl_is_expected_elfclass, that tests whether standard input
dnl; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI,
dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing
dnl the basename of the libdir to try in turn, either "lib" or "lib64" or
dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar.
AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
[
dnl There is no formal standard regarding lib, lib32, and lib64.
dnl On most glibc systems, the current practice is that on a system supporting
dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on
dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go
dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib.
dnl We determine the compiler's default mode by looking at the compiler's
dnl library search path. If at least one of its elements ends in /lib64 or
dnl points to a directory whose absolute pathname ends in /lib64, we use that
dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default,
dnl namely "lib".
dnl On Solaris systems, the current practice is that on a system supporting
dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT])
AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf],
[AC_EGREP_CPP([Extensible Linking Format],
[#if defined __ELF__ || (defined __linux__ && (defined __EDG__ || defined __SUNPRO_C))
Extensible Linking Format
#endif
],
[gl_cv_elf=yes],
[gl_cv_elf=no])
])
if test $gl_cv_elf = yes; then
# Extract the ELF class of a file (5th byte) in decimal.
# Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
if od -A x < /dev/null >/dev/null 2>/dev/null; then
# Use POSIX od.
func_elfclass ()
{
od -A n -t d1 -j 4 -N 1
}
else
# Use BSD hexdump.
func_elfclass ()
{
dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "'
echo
}
fi
# Use 'expr', not 'test', to compare the values of func_elfclass, because on
# Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002,
# not 1 or 2.
changequote(,)dnl
case $HOST_CPU_C_ABI_32BIT in
yes)
# 32-bit ABI.
acl_is_expected_elfclass ()
{
expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null
}
;;
no)
# 64-bit ABI.
acl_is_expected_elfclass ()
{
expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null
}
;;
*)
# Unknown.
acl_is_expected_elfclass ()
{
:
}
;;
esac
changequote([,])dnl
else
acl_is_expected_elfclass ()
{
:
}
fi
dnl Allow the user to override the result by setting acl_cv_libdirstems.
AC_CACHE_CHECK([for the common suffixes of directories in the library search path],
[acl_cv_libdirstems],
[dnl Try 'lib' first, because that's the default for libdir in GNU, see
dnl <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>.
acl_libdirstem=lib
acl_libdirstem2=
acl_libdirstem3=
case "$host_os" in
solaris*)
dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
dnl <https://docs.oracle.com/cd/E19253-01/816-5138/dev-env/index.html>.
dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
dnl symlink is missing, so we set acl_libdirstem2 too.
if test $HOST_CPU_C_ABI_32BIT = no; then
acl_libdirstem2=lib/64
case "$host_cpu" in
sparc*) acl_libdirstem3=lib/sparcv9 ;;
i*86 | x86_64) acl_libdirstem3=lib/amd64 ;;
esac
fi
;;
netbsd*)
dnl On NetBSD/sparc64, there is a 'sparc' subdirectory that contains
dnl 32-bit libraries.
if test $HOST_CPU_C_ABI_32BIT != no; then
case "$host_cpu" in
sparc*) acl_libdirstem2=lib/sparc ;;
esac
fi
;;
*)
dnl If $CC generates code for a 32-bit ABI, the libraries are
dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64.
dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries
dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32.
dnl Find the compiler's search path. However, non-system compilers
dnl sometimes have odd library search paths. But we can't simply invoke
dnl '/usr/bin/gcc -print-search-dirs' because that would not take into
dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS.
searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \
| sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
if test $HOST_CPU_C_ABI_32BIT != no; then
# 32-bit or unknown ABI.
if test -d /usr/lib32; then
acl_libdirstem2=lib32
fi
fi
if test $HOST_CPU_C_ABI_32BIT != yes; then
# 64-bit or unknown ABI.
if test -d /usr/lib64; then
acl_libdirstem3=lib64
fi
fi
if test -n "$searchpath"; then
acl_saved_IFS="${IFS= }"; IFS=":"
for searchdir in $searchpath; do
if test -d "$searchdir"; then
case "$searchdir" in
*/lib32/ | */lib32 ) acl_libdirstem2=lib32 ;;
*/lib64/ | */lib64 ) acl_libdirstem3=lib64 ;;
*/../ | */.. )
# Better ignore directories of this form. They are misleading.
;;
*) searchdir=`cd "$searchdir" && pwd`
case "$searchdir" in
*/lib32 ) acl_libdirstem2=lib32 ;;
*/lib64 ) acl_libdirstem3=lib64 ;;
esac ;;
esac
fi
done
IFS="$acl_saved_IFS"
if test $HOST_CPU_C_ABI_32BIT = yes; then
# 32-bit ABI.
acl_libdirstem3=
fi
if test $HOST_CPU_C_ABI_32BIT = no; then
# 64-bit ABI.
acl_libdirstem2=
fi
fi
;;
esac
test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem"
acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3"
])
dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and
dnl acl_libdirstem3.
changequote(,)dnl
acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'`
acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'`
acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'`
changequote([,])dnl
])

View File

@ -690,7 +690,7 @@ but for the second authentication round (IKEv2 only).
.BR leftcert " = <path>"
the path to the left participant's X.509 certificate. The file can be encoded
either in PEM or DER format. OpenPGP certificates are supported as well.
Both absolute paths or paths relative to \fI/etc/ipsec.d/certs\fP
Both absolute paths or paths relative to \fI@sysconfdir@/ipsec.d/certs\fP
are accepted. By default
.B leftcert
sets
@ -871,7 +871,7 @@ prefix in front of 0x or 0s, the public key is expected to be in either
the RFC 3110 (not the full RR, only RSA key part) or RFC 4253 public key format,
respectively.
Also accepted is the path to a file containing the public key in PEM, DER or SSH
encoding. Both absolute paths or paths relative to \fI/etc/ipsec.d/certs\fP
encoding. Both absolute paths or paths relative to \fI@sysconfdir@/ipsec.d/certs\fP
are accepted.
.TP
.BR leftsendcert " = never | no | " ifasked " | always | yes"
@ -1219,7 +1219,7 @@ of this connection will be used as peer ID.
.SH "CA SECTIONS"
These are optional sections that can be used to assign special
parameters to a Certification Authority (CA). Because the daemons
automatically import CA certificates from \fI/etc/ipsec.d/cacerts\fP,
automatically import CA certificates from \fI@sysconfdir@/ipsec.d/cacerts\fP,
there is no need to explicitly add them with a CA section, unless you
want to assign special parameters (like a CRL) to a CA.
.TP
@ -1235,7 +1235,7 @@ currently can have either the value
.TP
.BR cacert " = <path>"
defines a path to the CA certificate either relative to
\fI/etc/ipsec.d/cacerts\fP or as an absolute path.
\fI@sysconfdir@/ipsec.d/cacerts\fP or as an absolute path.
.br
A value in the form
.B %smartcard[<slot nr>[@<module>]]:<keyid>
@ -1284,7 +1284,7 @@ section are:
.BR cachecrls " = yes | " no
if enabled, certificate revocation lists (CRLs) fetched via HTTP or LDAP will
be cached in
.I /etc/ipsec.d/crls/
.I @sysconfdir@/ipsec.d/crls/
under a unique file name derived from the certification authority's public key.
.TP
.BR charondebug " = <debug list>"
@ -1463,12 +1463,12 @@ time equals zero and, thus, rekeying gets disabled.
.SH FILES
.nf
/etc/ipsec.conf
/etc/ipsec.d/aacerts
/etc/ipsec.d/acerts
/etc/ipsec.d/cacerts
/etc/ipsec.d/certs
/etc/ipsec.d/crls
@sysconfdir@/ipsec.conf
@sysconfdir@/ipsec.d/aacerts
@sysconfdir@/ipsec.d/acerts
@sysconfdir@/ipsec.d/cacerts
@sysconfdir@/ipsec.d/certs
@sysconfdir@/ipsec.d/crls
.SH SEE ALSO
strongswan.conf(5), ipsec.secrets(5), ipsec(8)

View File

@ -15,7 +15,7 @@ Here is an example.
.LP
.RS
.nf
# /etc/ipsec.secrets - strongSwan IPsec secrets file
# @sysconfdir@/ipsec.secrets - strongSwan IPsec secrets file
192.168.0.1 %any : PSK "v+NkxY9LLZvwj4qCC2o/gGrWDF2d21jL"
: RSA moonKey.pem
@ -140,7 +140,7 @@ is interpreted as Base64 encoded binary data.
.TQ
.B : ECDSA <private key file> [ <passphrase> | %prompt ]
For the private key file both absolute paths or paths relative to
\fI/etc/ipsec.d/private\fP are accepted. If the private key file is
\fI@sysconfdir@/ipsec.d/private\fP are accepted. If the private key file is
encrypted, the \fIpassphrase\fP must be defined. Instead of a passphrase
.B %prompt
can be used which then causes the daemon to ask the user for the password
@ -148,7 +148,7 @@ whenever it is required to decrypt the key.
.TP
.B : P12 <PKCS#12 file> [ <passphrase> | %prompt ]
For the PKCS#12 file both absolute paths or paths relative to
\fI/etc/ipsec.d/private\fP are accepted. If the container is
\fI@sysconfdir@/ipsec.d/private\fP are accepted. If the container is
encrypted, the \fIpassphrase\fP must be defined. Instead of a passphrase
.B %prompt
can be used which then causes the daemon to ask the user for the password
@ -182,7 +182,7 @@ can be specified, which causes the daemon to ask the user for the pin code.
.LP
.SH FILES
/etc/ipsec.secrets
@sysconfdir@/ipsec.secrets
.SH SEE ALSO
ipsec.conf(5), strongswan.conf(5), ipsec(8)
.br

1
scripts/.gitignore vendored
View File

@ -17,3 +17,4 @@ thread_analysis
tls_test
timeattack
os_info
nist_kem_kat

View File

@ -7,7 +7,7 @@ AM_CPPFLAGS = \
noinst_PROGRAMS = bin2array bin2sql id2sql key2keyid keyid2sql oid2der \
thread_analysis dh_speed pubkey_speed crypt_burn hash_burn fetch \
dnssec malloc_speed aes-test settings-test timeattack
dnssec malloc_speed aes-test settings-test timeattack nist_kem_kat
if USE_TLS
noinst_PROGRAMS += tls_test
@ -31,6 +31,7 @@ malloc_speed_SOURCES = malloc_speed.c
fetch_SOURCES = fetch.c
dnssec_SOURCES = dnssec.c
timeattack_SOURCES = timeattack.c
nist_kem_kat_SOURCES = nist_kem_kat.c
id2sql_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
key2keyid_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
@ -46,6 +47,7 @@ dnssec_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
aes_test_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
settings_test_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
timeattack_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la $(RTLIB)
nist_kem_kat_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
if USE_IMCV
AM_CPPFLAGS += -I$(top_srcdir)/src/libimcv

View File

@ -1,4 +1,5 @@
/*
* Copyright (C) 2023-2024 Tobias Brunner
* Copyright (C) 2009 Martin Willi
*
* Copyright (C) secunet Security Networks AG
@ -23,34 +24,10 @@
static void usage()
{
printf("usage: dh_speed plugins rounds group1 [group2 [...]]\n");
printf("usage: dh_speed plugins rounds ke1 [ke2 [...]]\n");
exit(1);
}
struct {
char *name;
key_exchange_method_t group;
} groups[] = {
{"modp768", MODP_768_BIT},
{"modp1024", MODP_1024_BIT},
{"modp1024s160", MODP_1024_160},
{"modp1536", MODP_1536_BIT},
{"modp2048", MODP_2048_BIT},
{"modp2048s224", MODP_2048_224},
{"modp2048s256", MODP_2048_256},
{"modp3072", MODP_3072_BIT},
{"modp4096", MODP_4096_BIT},
{"modp6144", MODP_6144_BIT},
{"modp8192", MODP_8192_BIT},
{"ecp256", ECP_256_BIT},
{"ecp384", ECP_384_BIT},
{"ecp521", ECP_521_BIT},
{"ecp192", ECP_192_BIT},
{"ecp224", ECP_224_BIT},
{"curve25519", CURVE_25519},
{"curve448", CURVE_448},
};
static void start_timing(struct timespec *start)
{
clock_gettime(CLOCK_THREAD_CPUTIME_ID, start);
@ -65,61 +42,71 @@ static double end_timing(struct timespec *start)
(end.tv_sec - start->tv_sec) * 1.0;
}
static void run_test(key_exchange_method_t group, int rounds)
static void run_test(key_exchange_method_t method, int rounds)
{
key_exchange_t *l[rounds], *r;
chunk_t chunk, chunks[rounds], lsecrets[rounds], rsecrets[rounds];
key_exchange_t *l[rounds], *r[rounds];
chunk_t lpublic[rounds], rpublic[rounds], lsecret[rounds], rsecret[rounds];
struct timespec timing;
int round;
r = lib->crypto->create_ke(lib->crypto, group);
if (!r)
r[0] = lib->crypto->create_ke(lib->crypto, method);
if (!r[0])
{
printf("skipping %N, not supported\n", key_exchange_method_names,
group);
fprintf(stderr, "skipping %N, not supported\n", key_exchange_method_names,
method);
return;
}
for (round = 1; round < rounds; round++)
{
r[round] = lib->crypto->create_ke(lib->crypto, method);
}
printf("%N:\t", key_exchange_method_names, group);
/* make sure to use the method call order documented in the
* key_exchange_t header file */
printf("%N:\t", key_exchange_method_names, method);
start_timing(&timing);
for (round = 0; round < rounds; round++)
{
l[round] = lib->crypto->create_ke(lib->crypto, group);
assert(l[round]->get_public_key(l[round], &chunks[round]));
l[round] = lib->crypto->create_ke(lib->crypto, method);
assert(l[round]->get_public_key(l[round], &lpublic[round]));
}
printf("A = g^a/s: %8.1f", rounds / end_timing(&timing));
for (round = 0; round < rounds; round++)
{
assert(r->set_public_key(r, chunks[round]));
assert(r->get_shared_secret(r, &rsecrets[round]));
chunk_free(&chunks[round]);
}
assert(r->get_public_key(r, &chunk));
start_timing(&timing);
for (round = 0; round < rounds; round++)
{
assert(l[round]->set_public_key(l[round], chunk));
assert(l[round]->get_shared_secret(l[round], &lsecrets[round]));
assert(r[round]->set_public_key(r[round], lpublic[round]));
assert(r[round]->get_public_key(r[round], &rpublic[round]));
assert(r[round]->get_shared_secret(r[round], &rsecret[round]));
}
printf(" | S = A^b/s: %8.1f", rounds / end_timing(&timing));
start_timing(&timing);
for (round = 0; round < rounds; round++)
{
assert(l[round]->set_public_key(l[round], rpublic[round]));
assert(l[round]->get_shared_secret(l[round], &lsecret[round]));
}
printf(" | S = B^a/s: %8.1f\n", rounds / end_timing(&timing));
chunk_free(&chunk);
for (round = 0; round < rounds; round++)
{
assert(chunk_equals(rsecrets[round], lsecrets[round]));
free(lsecrets[round].ptr);
free(rsecrets[round].ptr);
assert(chunk_equals(rsecret[round], lsecret[round]));
chunk_free(&lsecret[round]);
chunk_free(&rsecret[round]);
chunk_free(&lpublic[round]);
chunk_free(&rpublic[round]);
l[round]->destroy(l[round]);
r[round]->destroy(r[round]);
}
r->destroy(r);
}
int main(int argc, char *argv[])
{
int rounds, i, j;
const proposal_token_t *token;
int rounds, i;
if (argc < 4)
{
@ -134,20 +121,19 @@ int main(int argc, char *argv[])
for (i = 3; i < argc; i++)
{
bool found = FALSE;
token = lib->proposal->get_token(lib->proposal, argv[i]);
if (!token)
{
fprintf(stderr, "KE method '%s' not found\n", argv[i]);
return 1;
}
else if (token->type != KEY_EXCHANGE_METHOD)
{
fprintf(stderr, "'%s' is not a KE method\n", argv[i]);
return 1;
}
for (j = 0; j < countof(groups); j++)
{
if (streq(groups[j].name, argv[i]))
{
run_test(groups[j].group, rounds);
found = TRUE;
}
}
if (!found)
{
printf("group %s not found\n", argv[i]);
}
run_test(token->algorithm, rounds);
}
return 0;
}

View File

@ -24,8 +24,17 @@ modptest "gcrypt"
echo "testing openssl"
modptest "openssl"
$DIR/dh_speed "openssl" 300 ecp192 ecp192 ecp224 ecp256 ecp384 ecp521 | tail -n 5
$DIR/dh_speed "openssl" 300 ecp224bp ecp224bp ecp256bp ecp384bp ecp512bp | tail -n 4
$DIR/dh_speed "openssl" 300 curve25519 curve25519 curve448 | tail -n 2
echo "testing wolfssl"
modptest "wolfssl"
$DIR/dh_speed "wolfssl" 300 ecp224 ecp224 ecp256 ecp384 ecp521 | tail -n 4
$DIR/dh_speed "wolfssl" 300 ecp224bp ecp224bp ecp256bp ecp384bp ecp512bp | tail -n 4
$DIR/dh_speed "wolfssl" 300 curve25519 curve25519 curve448 | tail -n 2
echo "testing botan"
modptest "botan"
$DIR/dh_speed "botan" 300 ecp256 ecp256 ecp384 ecp521 | tail -n 3
$DIR/dh_speed "botan" 300 ecp256bp ecp256bp ecp384bp ecp512bp | tail -n 3
$DIR/dh_speed "botan" 300 curve25519 curve25519 | tail -n 1

View File

@ -5,7 +5,7 @@ TARBALL=$SRCDIR/.tarball-git-version
if test -f $TARBALL; then
V=$(cat $TARBALL)
elif test -d $SRCDIR/.git; then
elif test -e $SRCDIR/.git; then
V=$(git -C $SRCDIR describe --exclude 'android-*' --tags HEAD 2>/dev/null)
fi

189
scripts/nist_kem_kat.c Normal file
View File

@ -0,0 +1,189 @@
/*
* Copyright (C) 2019-2020 Andreas Steffen
*
* Copyright (C) secunet Security Networks AG
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <library.h>
static void usage(FILE *out, char *name)
{
fprintf(out, "Convert NIST KEM KAT file into struct\n");
fprintf(out, "%s [OPTIONS]\n\n", name);
fprintf(out, "Options:\n");
fprintf(out, " -h, --help print this help.\n");
fprintf(out, " -m, --method KEM method.\n");
fprintf(out, " -c, --count number of structs (default 4).\n");
fprintf(out, " -i, --in=FILE request file (default STDIN).\n");
fprintf(out, " -o, --out=FILE response file (default STDOUT).\n");
fprintf(out, "\n");
}
int main(int argc, char *argv[])
{
FILE *in = stdin;
FILE *out = stdout;
char line[90000], *method = "", *pos, *eol, *param, *value;
size_t param_len, value_len;
int count = 4, n;
library_init(NULL, "nist-kem-kat");
atexit(library_deinit);
while (true)
{
struct option long_opts[] = {
{"help", no_argument, NULL, 'h' },
{"method", required_argument, NULL, 'm' },
{"count", required_argument, NULL, 'c' },
{"in", required_argument, NULL, 'i' },
{"out", required_argument, NULL, 'o' },
{0,0,0,0 },
};
switch (getopt_long(argc, argv, "h:m:c:i:o:", long_opts, NULL))
{
case EOF:
break;
case 'h':
usage(stdout, argv[0]);
return 0;
case 'm':
method = optarg;
continue;
case 'c':
count = atoi(optarg);
continue;
case 'i':
in = fopen(optarg, "r");
if (!in)
{
fprintf(stderr, "failed to open '%s': %s\n", optarg,
strerror(errno));
usage(stderr, argv[0]);
return 1;
}
continue;
case 'o':
out = fopen(optarg, "w");
if (!out)
{
fprintf(stderr, "failed to open '%s': %s\n", optarg,
strerror(errno));
usage(stderr, argv[0]);
return 1;
}
continue;
default:
usage(stderr, argv[0]);
return 1;
}
break;
}
while (fgets(line, sizeof(line), in))
{
pos = strchr(line, '=');
if (!pos)
{
continue;
}
/*remove preceding whitespace from value */
value = pos + 1;
eol = strchr(value, '\n');
if (!eol)
{
fprintf(stderr, "eol not found\n");
break;
}
value_len = eol - value;
while (value_len && *value == ' ')
{
value++;
value_len--;
}
/* remove trailing whitespace from param */
param = line;
param_len = pos - line;
while (param_len && *(--pos) == ' ')
{
param_len--;
}
param[param_len] = '\0';
if (streq(param, "sk"))
{
continue;
}
if (streq(param, "count"))
{
if (count == 0)
{
break;
}
fprintf(out, "/** count = %.*s */\n", (int)value_len, value);
fprintf(out, "{\n");
fprintf(out, "\t.method = %s,\n", method);
count--;
}
else
{
fprintf(out, "\t.%s = chunk_from_chars(", param);
n = 0;
while (value_len > 1)
{
if (n > 0)
{
fprintf(out, ",");
if (n % 100 == 0)
{
fprintf(out, " /* %d */\n", n);
}
}
if (n % 10 == 0)
{
fprintf(out, "\n\t\t");
}
fprintf(out, "0x%.2s", value);
value += 2;
value_len -= 2;
n++;
}
fprintf(out, "),\n");
if (streq(param, "ss"))
{
fprintf(out, "},\n");
}
}
}
if (in != stdin)
{
fclose(in);
}
if (out != stdout)
{
fclose(out);
}
return 0;
}

View File

@ -20,12 +20,12 @@
#include <utils/debug.h>
#include <credentials/keys/private_key.h>
void start_timing(struct timespec *start)
static void start_timing(struct timespec *start)
{
clock_gettime(CLOCK_THREAD_CPUTIME_ID, start);
}
double end_timing(struct timespec *start)
static double end_timing(struct timespec *start)
{
struct timespec end;
@ -128,7 +128,7 @@ int main(int argc, char *argv[])
printf("creating signature failed\n");
exit(1);
}
};
}
printf("sign()/s: %8.1f ", rounds / end_timing(&timing));
public = private->get_public_key(private);

View File

@ -4,7 +4,7 @@
build_botan()
{
# same revision used in the build recipe of the testing environment
BOTAN_REV=2.19.1
BOTAN_REV=3.7.1
BOTAN_DIR=$DEPS_BUILD_DIR/botan
if test -d "$BOTAN_DIR"; then
@ -21,15 +21,17 @@ build_botan()
BOTAN_CONFIG="--without-os-features=threads
--disable-modules=locking_allocator"
fi
# disable some larger modules we don't need for the tests
# disable some larger modules we don't need for the tests and deprecated
# ones, except for MD5, which we need for TLS 1.0/1.1
BOTAN_CONFIG="$BOTAN_CONFIG --disable-modules=pkcs11,tls,x509,xmss
--disable-deprecated-features --enable-modules=md5
--prefix=$DEPS_PREFIX"
git clone https://github.com/randombit/botan.git $BOTAN_DIR &&
cd $BOTAN_DIR &&
git checkout -qf $BOTAN_REV &&
python ./configure.py --amalgamation $BOTAN_CONFIG &&
make -j4 libs >/dev/null &&
./configure.py --amalgamation $BOTAN_CONFIG &&
make -j$(nproc) libs >/dev/null &&
sudo make install >/dev/null &&
sudo ldconfig || exit $?
cd -
@ -37,7 +39,7 @@ build_botan()
build_wolfssl()
{
WOLFSSL_REV=v5.3.0-stable
WOLFSSL_REV=v5.8.2-stable
WOLFSSL_DIR=$DEPS_BUILD_DIR/wolfssl
if test -d "$WOLFSSL_DIR"; then
@ -47,21 +49,22 @@ build_wolfssl()
echo "$ build_wolfssl()"
WOLFSSL_CFLAGS="-DWOLFSSL_PUBLIC_MP -DWOLFSSL_DES_ECB -DHAVE_AES_ECB \
-DHAVE_ECC_BRAINPOOL -DWOLFSSL_MIN_AUTH_TAG_SZ=8"
-DHAVE_ECC_BRAINPOOL -DWOLFSSL_MIN_AUTH_TAG_SZ=8 \
-DRSA_MIN_SIZE=1024"
WOLFSSL_CONFIG="--prefix=$DEPS_PREFIX
--disable-crypttests --disable-examples
--enable-aesccm --enable-aesctr --enable-camellia
--enable-aesccm --enable-aesctr --enable-aescfb --enable-camellia
--enable-curve25519 --enable-curve448 --enable-des3
--enable-ecccustcurves --enable-ed25519 --enable-ed448
--enable-keygen --enable-md4 --enable-rsapss --enable-sha3
--enable-shake256"
--enable-keygen --enable-mlkem --with-max-rsa-bits=8192
--enable-md4 --enable-rsapss --enable-sha3 --enable-shake256"
git clone https://github.com/wolfSSL/wolfssl.git $WOLFSSL_DIR &&
cd $WOLFSSL_DIR &&
git checkout -qf $WOLFSSL_REV &&
./autogen.sh &&
./configure C_EXTRA_FLAGS="$WOLFSSL_CFLAGS" $WOLFSSL_CONFIG &&
make -j4 >/dev/null &&
make -j$(nproc) >/dev/null &&
sudo make install >/dev/null &&
sudo ldconfig || exit $?
cd -
@ -69,7 +72,7 @@ build_wolfssl()
build_tss2()
{
TSS2_REV=2.4.3
TSS2_REV=3.2.3
TSS2_PKG=tpm2-tss-$TSS2_REV
TSS2_DIR=$DEPS_BUILD_DIR/$TSS2_PKG
TSS2_SRC=https://github.com/tpm2-software/tpm2-tss/releases/download/$TSS2_REV/$TSS2_PKG.tar.gz
@ -83,7 +86,7 @@ build_tss2()
curl -L $TSS2_SRC | tar xz -C $DEPS_BUILD_DIR &&
cd $TSS2_DIR &&
./configure --prefix=$DEPS_PREFIX --disable-doxygen-doc &&
make -j4 >/dev/null &&
make -j$(nproc) >/dev/null &&
sudo make install >/dev/null &&
sudo ldconfig || exit $?
cd -
@ -91,32 +94,64 @@ build_tss2()
build_openssl()
{
SSL_REV=3.0.2
SSL_PKG=openssl-$SSL_REV
SSL_DIR=$DEPS_BUILD_DIR/$SSL_PKG
SSL_SRC=https://www.openssl.org/source/$SSL_PKG.tar.gz
SSL_REV=openssl-3.6.0
SSL_DIR=$DEPS_BUILD_DIR/openssl
SSL_INS=$DEPS_PREFIX/ssl
SSL_OPT="shared no-tls no-dtls no-ssl3 no-zlib no-comp no-idea no-psk no-srp
no-stdio no-tests enable-rfc3779 enable-ec_nistp_64_gcc_128"
SSL_OPT="-d shared no-dtls no-ssl3 no-zlib no-idea no-psk
no-tests enable-rfc3779 enable-ec_nistp_64_gcc_128"
if test -d "$SSL_DIR"; then
return
fi
# insist on compiling with gcc and debug information as symbols are otherwise not found
if test "$LEAK_DETECTIVE" = "yes"; then
SSL_OPT="$SSL_OPT CC=gcc -d"
# insist on compiling with gcc and debug information as symbols are
# otherwise not found, but we can disable SRP (see below)
SSL_OPT="$SSL_OPT no-srp CC=gcc -d"
elif test "$CC" != "clang"; then
# when using ASan with clang, llvm-symbolizer is used to resolve symbols
# and this tool links libcurl, which in turn requires SRP, so we can
# only disable it when not building with clang
SSL_OPT="$SSL_OPT no-srp"
fi
echo "$ build_openssl()"
curl -L $SSL_SRC | tar xz -C $DEPS_BUILD_DIR &&
git clone https://github.com/openssl/openssl.git --depth 1 -b $SSL_REV $SSL_DIR || exit $?
if [ "$TEST" = "android" ]; then
OPENSSL_SRC=${SSL_DIR} \
NO_DOCKER=1 src/frontends/android/openssl/build.sh || exit $?
else
cd $SSL_DIR &&
./config --prefix=$SSL_INS --openssldir=$SSL_INS --libdir=lib $SSL_OPT &&
make -j4 >/dev/null &&
make -j$(nproc) >/dev/null &&
sudo make install_sw >/dev/null &&
sudo ldconfig || exit $?
cd -
fi
}
build_awslc()
{
LC_REV=1.61.1
LC_PKG=aws-lc-$LC_REV
LC_DIR=$DEPS_BUILD_DIR/$LC_PKG
LC_SRC=https://github.com/aws/aws-lc/archive/refs/tags/v${LC_REV}.tar.gz
LC_BUILD=$LC_DIR/build
LC_INS=$DEPS_PREFIX/ssl
mkdir -p $LC_BUILD
echo "$ build_awslc()"
curl -L $LC_SRC | tar xz -C $DEPS_BUILD_DIR || exit $?
cd $LC_BUILD &&
cmake -GNinja -DCMAKE_INSTALL_PREFIX=$LC_INS .. &&
ninja &&
sudo ninja install || exit $?
cd -
}
use_custom_openssl()
@ -125,10 +160,51 @@ use_custom_openssl()
export LDFLAGS="$LDFLAGS -L$DEPS_PREFIX/ssl/lib"
export LD_LIBRARY_PATH="$DEPS_PREFIX/ssl/lib:$LD_LIBRARY_PATH"
if test "$1" = "build-deps"; then
case "$TEST" in
openssl-awslc)
build_awslc
;;
*)
build_openssl
;;
esac
fi
}
system_uses_openssl3()
{
pkg-config --atleast-version=3.0.0 libcrypto
return $?
}
prepare_system_openssl()
{
# On systems that ship OpenSSL 3 (e.g. Ubuntu 22.04+), we require debug
# symbols to whitelist leaks
if test "$1" = "deps"; then
echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted
deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted
deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted" | \
sudo tee -a /etc/apt/sources.list.d/ddebs.list
sudo apt-get install -qq ubuntu-dbgsym-keyring
if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "24.04" ]; then
DEPS="$DEPS libssl3t64-dbgsym"
else
DEPS="$DEPS libssl3-dbgsym"
fi
fi
if test "$LEAK_DETECTIVE" = "yes"; then
# make sure we can properly whitelist functions with leak detective
DEPS="$DEPS binutils-dev"
CONFIG="$CONFIG --enable-bfd-backtraces"
elif [ "$ID" = "ubuntu" -a "$VERSION_ID" != "24.04" ]; then
# with ASan we have to use the (extremely) slow stack unwind as the
# shipped version of the library is built with -fomit-frame-pointer
export ASAN_OPTIONS=fast_unwind_on_malloc=0
fi
}
: ${SRC_DIR=$PWD}
: ${BUILD_DIR=$PWD}
: ${DEPS_BUILD_DIR=$BUILD_DIR/..}
: ${DEPS_PREFIX=/usr/local}
@ -143,42 +219,49 @@ TARGET=check
DEPS="libgmp-dev"
CFLAGS="-g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -Werror"
CFLAGS="-g -O2"
case "$TEST" in
default)
# should be the default, but lets make sure
CONFIG="--with-printf-hooks=glibc"
if system_uses_openssl3; then
prepare_system_openssl $1
fi
;;
openssl*)
CONFIG="--disable-defaults --enable-pki --enable-openssl --enable-pem"
export TESTS_PLUGINS="test-vectors pem openssl!"
CONFIG="--disable-defaults --enable-pki --enable-openssl --enable-pem --enable-drbg"
export TESTS_PLUGINS="test-vectors openssl! pem drbg"
DEPS="libssl-dev"
if test "$TEST" = "openssl-3"; then
DEPS=""
use_custom_openssl $1
elif test "$TEST" = "openssl-awslc"; then
DEPS="cmake ninja-build golang"
use_custom_openssl $1
elif system_uses_openssl3; then
prepare_system_openssl $1
else
# the kdf plugin is necessary to build against older OpenSSL versions
TESTS_PLUGINS="$TESTS_PLUGINS kdf"
fi
;;
gcrypt)
CONFIG="--disable-defaults --enable-pki --enable-gcrypt --enable-pkcs1 --enable-pkcs8"
export TESTS_PLUGINS="test-vectors pkcs1 pkcs8 gcrypt!"
if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "20.04" ]; then
CONFIG="--disable-defaults --enable-pki --enable-gcrypt --enable-random --enable-pem --enable-pkcs1 --enable-pkcs8 --enable-gcm --enable-hmac --enable-kdf -enable-curve25519 --enable-x509 --enable-constraints"
export TESTS_PLUGINS="test-vectors gcrypt! random pem pkcs1 pkcs8 gcm hmac kdf curve25519 x509 constraints"
DEPS="libgcrypt20-dev"
else
DEPS="libgcrypt11-dev"
fi
;;
botan)
CONFIG="--disable-defaults --enable-pki --enable-botan --enable-pem"
export TESTS_PLUGINS="test-vectors pem botan!"
CONFIG="--disable-defaults --enable-pki --enable-botan --enable-pem --enable-hmac --enable-x509 --enable-constraints --enable-drbg"
export TESTS_PLUGINS="test-vectors botan! pem hmac x509 constraints drbg"
DEPS=""
if test "$1" = "build-deps"; then
build_botan
fi
;;
wolfssl)
CONFIG="--disable-defaults --enable-pki --enable-wolfssl --enable-pem"
export TESTS_PLUGINS="test-vectors pem wolfssl!"
CONFIG="--disable-defaults --enable-pki --enable-wolfssl --enable-pem --enable-pkcs1 --enable-pkcs8 --enable-x509 --enable-constraints --enable-drbg"
export TESTS_PLUGINS="test-vectors wolfssl! pem pkcs1 pkcs8 x509 constraints drbg"
# build with custom options to enable all the features the plugin supports
DEPS=""
if test "$1" = "build-deps"; then
@ -187,42 +270,63 @@ wolfssl)
;;
printf-builtin)
CONFIG="--with-printf-hooks=builtin"
;;
all|coverage|sonarcloud)
if [ "$TEST" = "sonarcloud" ]; then
if [ -z "$SONAR_PROJECT" -o -z "$SONAR_ORGANIZATION" -o -z "$SONAR_TOKEN" ]; then
echo "The SONAR_PROJECT, SONAR_ORGANIZATION and SONAR_TOKEN" \
"environment variables are required to run this test"
exit 1
if system_uses_openssl3; then
prepare_system_openssl $1
fi
;;
all|alpine|codeql|coverage|sonarcloud|no-dbg|no-testable-ke)
if [ "$TEST" = "codeql" ]; then
# don't run tests, only analyze built code
TARGET=
fi
if [ "$TEST" = "no-dbg" ]; then
CFLAGS="$CFLAGS -DDEBUG_LEVEL=-1"
fi
CONFIG="--enable-all --disable-android-dns --disable-android-log
--disable-kernel-pfroute --disable-keychain
--disable-lock-profiler --disable-padlock --disable-fuzzing
--disable-osx-attr --disable-tkm --disable-uci
--disable-osx-attr --disable-tkm
--disable-unwind-backtraces
--disable-svc --disable-dbghelp-backtraces --disable-socket-win
--disable-kernel-wfp --disable-kernel-iph --disable-winhttp
--disable-python-eggs-install"
--disable-kernel-wfp --disable-kernel-iph --disable-winhttp"
# not enabled on the build server
CONFIG="$CONFIG --disable-af-alg"
if test "$TEST" != "coverage"; then
CONFIG="$CONFIG --disable-coverage"
else
# not actually required but configure checks for it
DEPS="$DEPS lcov"
TARGET="coverage"
fi
DEPS="$DEPS libcurl4-gnutls-dev libsoup2.4-dev libunbound-dev libldns-dev
if [ "$TEST" = "no-testable-ke" ]; then
CONFIG="$CONFIG --without-testable-ke"
fi
DEPS="$DEPS libcurl4-gnutls-dev libsoup-3.0-dev libunbound-dev libldns-dev
libmysqlclient-dev libsqlite3-dev clearsilver-dev libfcgi-dev
libldap2-dev libpcsclite-dev libpam0g-dev binutils-dev libnm-dev
libgcrypt20-dev libjson-c-dev python3-pip libtspi-dev libsystemd-dev
libselinux1-dev"
if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "20.04" ]; then
DEPS="$DEPS libiptc-dev"
else
DEPS="$DEPS iptables-dev python3-setuptools"
libgcrypt20-dev libjson-c-dev libtspi-dev libsystemd-dev
libselinux1-dev libiptc-dev ruby-rubygems python3-build tox"
if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "22.04" -a "$1" = "build-deps" ]; then
# python3-build is broken on 22.04 with venv (https://bugs.launchpad.net/ubuntu/+source/python-build/+bug/1992108)
# while installing python3-virtualenv should help, it doesn't. as even
# after uninstalling python3-venv, build prefers the latter
sudo python3 -m pip install --upgrade build
fi
if [ "$TEST" = "alpine" ]; then
# override the whole list for alpine
DEPS="git gmp-dev openldap-dev curl-dev ldns-dev unbound-dev libsoup3-dev
libxml2-dev tpm2-tss-dev tpm2-tss-sys mariadb-dev wolfssl-dev
libgcrypt-dev botan3-dev pcsc-lite-dev networkmanager-dev
linux-pam-dev iptables-dev libselinux-dev binutils-dev libunwind-dev
ruby py3-setuptools py3-build py3-tox"
# musl does not provide backtrace(), so use libunwind
CONFIG="$CONFIG --enable-unwind-backtraces"
# alpine doesn't have systemd
CONFIG="$CONFIG --disable-systemd --disable-cert-enroll-timer"
# no TrouSerS either
CONFIG="$CONFIG --disable-tss-trousers --disable-aikgen"
# and no Clearsilver
CONFIG="$CONFIG --disable-fast --disable-manager --disable-medsrv"
fi
PYDEPS="tox"
if test "$1" = "build-deps"; then
build_botan
build_wolfssl
@ -236,6 +340,7 @@ win*)
--enable-constraints --enable-revocation --enable-pem --enable-pkcs1
--enable-pkcs8 --enable-x509 --enable-pubkey --enable-acert
--enable-eap-tnc --enable-eap-ttls --enable-eap-identity
--enable-eap-radius
--enable-updown --enable-ext-auth --enable-libipsec --enable-pkcs11
--enable-tnccs-20 --enable-imc-attestation --enable-imv-attestation
--enable-imc-os --enable-imv-os --enable-tnc-imv --enable-tnc-imc
@ -245,17 +350,16 @@ win*)
if test "$APPVEYOR" != "True"; then
TARGET=
else
case "$IMG" in
2015|2017)
# old OpenSSL versions don't provide HKDF
CONFIG="$CONFIG --enable-kdf"
;;
esac
CONFIG="$CONFIG --enable-openssl"
CFLAGS="$CFLAGS -I$OPENSSL_DIR/include"
LDFLAGS="-L$OPENSSL_DIR/lib"
case "$IMG" in
2015)
# gcc/ld might be too old to find libeay32 via .lib instead of .dll
LDFLAGS="-L$OPENSSL_DIR"
;;
esac
export LDFLAGS
fi
CFLAGS="$CFLAGS -mno-ms-bitfields"
DEPS="gcc-mingw-w64-base"
@ -273,9 +377,8 @@ win*)
esac
;;
android)
if test "$1" = "deps"; then
git clone git://git.strongswan.org/android-ndk-boringssl.git -b ndk-static \
src/frontends/android/app/src/main/jni/openssl
if test "$1" = "build-deps"; then
build_openssl
fi
TARGET=distdir
;;
@ -285,19 +388,19 @@ macos)
# use the same options as in the Homebrew Formula
CONFIG="--disable-defaults --enable-charon --enable-cmd --enable-constraints
--enable-curl --enable-eap-gtc --enable-eap-identity
--enable-eap-md5 --enable-eap-mschapv2 --enable-farp --enable-ikev1
--enable-ikev2 --enable-kernel-libipsec --enable-kernel-pfkey
--enable-eap-md5 --enable-eap-mschapv2 --enable-eap-peap
--enable-dhcp --enable-farp --enable-ikev1 --enable-ikev2
--enable-kernel-libipsec --enable-kernel-pfkey
--enable-kernel-pfroute --enable-nonce --enable-openssl
--enable-osx-attr --enable-pem --enable-pgp --enable-pkcs1
--enable-pkcs8 --enable-pki --enable-pubkey --enable-revocation
--enable-scepclient --enable-socket-default --enable-sshkey
--enable-pkcs8 --enable-pkcs11 --enable-pki --enable-pubkey
--enable-revocation --enable-socket-default --enable-sshkey
--enable-stroke --enable-swanctl --enable-unity --enable-updown
--enable-x509 --enable-xauth-generic"
DEPS="automake autoconf libtool bison gettext openssl@1.1 curl"
--enable-x509 --enable-xauth-generic --enable-drbg"
DEPS="automake autoconf libtool bison gperf pkgconf openssl@3 curl"
BREW_PREFIX=$(brew --prefix)
export PATH=$BREW_PREFIX/opt/bison/bin:$PATH
export ACLOCAL_PATH=$BREW_PREFIX/opt/gettext/share/aclocal:$ACLOCAL_PATH
for pkg in openssl@1.1 curl
for pkg in openssl@3 curl
do
PKG_CONFIG_PATH=$BREW_PREFIX/opt/$pkg/lib/pkgconfig:$PKG_CONFIG_PATH
CPPFLAGS="-I$BREW_PREFIX/opt/$pkg/include $CPPFLAGS"
@ -324,9 +427,7 @@ freebsd)
--enable-unbound --enable-unity --enable-xauth-eap --enable-xauth-pam
--with-printf-hooks=builtin --enable-attr-sql --enable-sql
--enable-farp"
DEPS="git gmp openldap24-client libxml2 mysql80-client sqlite3 unbound ldns tpm2-tss"
export GPERF=/usr/local/bin/gperf
export LEX=/usr/local/bin/flex
DEPS="git gmp libxml2 mysql80-client sqlite3 unbound ldns tpm2-tss"
;;
fuzzing)
CFLAGS="$CFLAGS -DNO_CHECK_MEMWIPE"
@ -350,14 +451,13 @@ fuzzing)
symbolize=1:handle_segv=1:fast_unwind_on_fatal=0:external_symbolizer_path=/usr/bin/llvm-symbolizer-3.5
fi
;;
nm|nm-no-glib)
nm)
DEPS="gnome-common libsecret-1-dev libgtk-3-dev libnm-dev libnma-dev"
if test "$TEST" = "nm"; then
DEPS="$DEPS libnm-glib-vpn-dev libnm-gtk-dev"
else
CONFIG="$CONFIG --without-libnm-glib"
ORIG_SRC_DIR="$SRC_DIR"
SRC_DIR="$ORIG_SRC_DIR/src/frontends/gnome"
if [ "$ORIG_SRC_DIR" = "$BUILD_DIR" ]; then
BUILD_DIR="$SRC_DIR"
fi
cd src/frontends/gnome
# don't run ./configure with ./autogen.sh
export NOCONFIGURE=1
;;
@ -369,68 +469,6 @@ apidoc)
CONFIG="--disable-defaults"
TARGET=apidoc
;;
lgtm)
if [ -z "$LGTM_PROJECT" -o -z "$LGTM_TOKEN" ]; then
echo "The LGTM_PROJECT and LGTM_TOKEN environment variables" \
"are required to run this test"
exit 0
fi
DEPS="jq"
if test -z "$1"; then
base=$COMMIT_BASE
# after rebases or for new/duplicate branches, the passed base commit
# ID might not be valid
git rev-parse -q --verify $base^{commit}
if [ $? != 0 ]; then
# this will always compare against master, while via base we
# otherwise only contains "new" commits
base=$(git merge-base origin/master ${COMMIT_ID})
fi
base=$(git rev-parse $base)
echo "Starting code review for $COMMIT_ID (base $base) on lgtm.com"
git diff --binary $base > lgtm.patch || exit $?
curl -s -X POST --data-binary @lgtm.patch \
"https://lgtm.com/api/v1.0/codereviews/${LGTM_PROJECT}?base=${base}&external-id=${BUILD_NUMBER}" \
-H 'Content-Type: application/octet-stream' \
-H 'Accept: application/json' \
-H "Authorization: Bearer ${LGTM_TOKEN}" > lgtm.res || exit $?
lgtm_check_url=$(jq -r '."task-result-url"' lgtm.res)
if [ -z "$lgtm_check_url" -o "$lgtm_check_url" = "null" ]; then
cat lgtm.res
exit 1
fi
lgtm_url=$(jq -r '."task-result"."results-url"' lgtm.res)
echo "Progress and full results: ${lgtm_url}"
echo -n "Waiting for completion: "
lgtm_status=pending
while [ "$lgtm_status" = "pending" ]; do
sleep 15
curl -s -X GET "${lgtm_check_url}" \
-H 'Accept: application/json' \
-H "Authorization: Bearer ${LGTM_TOKEN}" > lgtm.res
if [ $? != 0 ]; then
echo -n "-"
continue
fi
echo -n "."
lgtm_status=$(jq -r '.status' lgtm.res)
done
echo ""
if [ "$lgtm_status" != "success" ]; then
lgtm_message=$(jq -r '.["status-message"]' lgtm.res)
echo "Code review failed: ${lgtm_message}"
exit 1
fi
lgtm_new=$(jq -r '.languages[].new' lgtm.res | awk '{t+=$1} END {print t}')
lgtm_fixed=$(jq -r '.languages[].fixed' lgtm.res | awk '{t+=$1} END {print t}')
echo -n "Code review complete: "
printf "%b\n" "\e[1;31m${lgtm_new}\e[0m new alerts, \e[1;32m${lgtm_fixed}\e[0m fixed"
exit $lgtm_new
fi
;;
*)
echo "$0: unknown test $TEST" >&2
exit 1
@ -441,8 +479,12 @@ case "$1" in
deps)
case "$OS_NAME" in
linux)
sudo apt-get update -qq && \
sudo apt-get install -qq bison flex gperf gettext $DEPS
sudo apt-get update -y && \
sudo apt-get install -y automake autoconf libtool pkgconf bison flex gperf $DEPS
;;
alpine)
apk add --no-cache build-base automake autoconf libtool pkgconfig && \
apk add --no-cache bison flex gperf tzdata $DEPS
;;
macos)
brew update && \
@ -450,15 +492,11 @@ deps)
;;
freebsd)
pkg install -y automake autoconf libtool pkgconf && \
pkg install -y bison flex gperf gettext $DEPS
pkg install -y bison flex gperf $DEPS
;;
esac
exit $?
;;
pydeps)
test -z "$PYDEPS" || pip3 -q install --user $PYDEPS
exit $?
;;
build-deps)
exit
;;
@ -473,10 +511,29 @@ CONFIG="$CONFIG
--enable-monolithic=${MONOLITHIC-no}
--enable-leak-detective=${LEAK_DETECTIVE-no}"
echo "$ ./autogen.sh"
./autogen.sh || exit $?
case "$TEST" in
alpine|codeql|coverage|freebsd|fuzzing|sonarcloud|win*)
# don't use AddressSanitizer if it's not available or causes conflicts
CONFIG="$CONFIG --disable-asan"
;;
*)
if [ "$LEAK_DETECTIVE" != "yes" ]; then
CONFIG="$CONFIG --enable-asan"
else
CONFIG="$CONFIG --disable-asan"
fi
;;
esac
cd $SRC_DIR
if [ ! -f ./configure ]; then
echo "$ ./autogen.sh"
./autogen.sh || exit $?
fi
cd $BUILD_DIR
echo "$ CC=$CC CFLAGS=\"$CFLAGS\" ./configure $CONFIG"
CC="$CC" CFLAGS="$CFLAGS" ./configure $CONFIG || exit $?
CC="$CC" CFLAGS="$CFLAGS" $SRC_DIR/configure $CONFIG || exit $?
case "$TEST" in
apidoc)
@ -491,10 +548,10 @@ case "$TEST" in
sonarcloud)
# without target, coverage is currently not supported anyway because
# sonarqube only supports gcov, not lcov
build-wrapper-linux-x86-64 --out-dir bw-output make -j4 || exit $?
build-wrapper-linux-x86-64 --out-dir $BUILD_WRAPPER_OUT_DIR make -j$(nproc) || exit $?
;;
*)
make -j4 $TARGET || exit $?
make -j$(nproc) $TARGET || exit $?
;;
esac
@ -506,30 +563,17 @@ apidoc)
fi
rm make.warnings
;;
sonarcloud)
sonar-scanner \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.projectKey=${SONAR_PROJECT} \
-Dsonar.organization=${SONAR_ORGANIZATION} \
-Dsonar.login=${SONAR_TOKEN} \
-Dsonar.projectVersion=$(git describe --exclude 'android-*')+${BUILD_NUMBER} \
-Dsonar.sources=. \
-Dsonar.cfamily.threads=2 \
-Dsonar.cfamily.cache.enabled=true \
-Dsonar.cfamily.cache.path=$HOME/.sonar-cache \
-Dsonar.cfamily.build-wrapper-output=bw-output || exit $?
rm -r bw-output .scannerwork
;;
android)
rm -r strongswan-*
cd src/frontends/android
cd $SRC_DIR/src/frontends/android
echo "$ ./gradlew build"
NDK_CCACHE=ccache ./gradlew build || exit $?
NDK_CCACHE=ccache ./gradlew build --info || exit $?
;;
*)
;;
esac
cd $SRC_DIR
# ensure there are no unignored build artifacts (or other changes) in the Git repo
unclean="$(git status --porcelain)"
if test -n "$unclean"; then

View File

@ -1,3 +1,5 @@
sonar.sources=.
# exclude these files completely
sonar.exclusions=\
src/manager/templates/static/jquery.js, \
@ -29,14 +31,25 @@ sonar.issue.ignore.allfile.a2.fileRegexp=made by GNU Bison
sonar.issue.ignore.allfile.a3.fileRegexp=produced by gperf
# ignore some rules
sonar.issue.ignore.multicriteria=m1,m2,m3,m4,m5
sonar.issue.ignore.multicriteria.m1.ruleKey=c:SingleDeclarationPerStatement
sonar.issue.ignore.multicriteria=m1,m2,m3,m4,m5,m6,m7
# Multiple variables should not be declared on the same line
sonar.issue.ignore.multicriteria.m1.ruleKey=c:S1659
sonar.issue.ignore.multicriteria.m1.resourceKey=**/*
sonar.issue.ignore.multicriteria.m2.ruleKey=c:FunctionEllipsis
# Functions should not be defined with a variable number of arguments
sonar.issue.ignore.multicriteria.m2.ruleKey=c:S923
sonar.issue.ignore.multicriteria.m2.resourceKey=**/*
# Function names should be used either as a call with a parameter list or with the "&" operator
sonar.issue.ignore.multicriteria.m3.ruleKey=c:S936
sonar.issue.ignore.multicriteria.m3.resourceKey=**/*
# Unused function parameters should be removed
sonar.issue.ignore.multicriteria.m4.ruleKey=c:S1172
sonar.issue.ignore.multicriteria.m4.resourceKey=**/*
# Single line comments should start with "--"
sonar.issue.ignore.multicriteria.m5.ruleKey=plsql:SingleLineCommentsSyntaxCheck
sonar.issue.ignore.multicriteria.m5.resourceKey=**/*
# User-defined types should not be passed as variadic arguments
sonar.issue.ignore.multicriteria.m6.ruleKey=c:S5270
sonar.issue.ignore.multicriteria.m6.resourceKey=**/*
# Loop variables should be declared in the minimal possible scope
sonar.issue.ignore.multicriteria.m7.ruleKey=c:S5955
sonar.issue.ignore.multicriteria.m7.resourceKey=**/*

View File

@ -75,10 +75,6 @@ if USE_UPDOWN
SUBDIRS += _updown
endif
if USE_SCEPCLIENT
SUBDIRS += scepclient
endif
if USE_PKI
SUBDIRS += pki
endif
@ -146,3 +142,7 @@ endif
if USE_LIBTPMTSS
SUBDIRS += tpm_extendpcr
endif
if USE_CERT_ENROLL
SUBDIRS += cert-enroll
endif

5
src/cert-enroll/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
cert-enroll
cert-enroll.8
cert-enroll.service
cert-install-swanctl
cert-install-ipsec

View File

@ -0,0 +1,61 @@
REPLACE_TARGETS = \
cert-enroll \
cert-install-swanctl \
cert-install-ipsec \
cert-enroll.service
$(REPLACE_TARGETS) : Makefile
$(AM_V_GEN) \
sed \
-e "s:@SYSCONFDIR@:$(sysconfdir):" \
-e "s:@SBINDIR@:$(sbindir):" \
-e "s:@BINDIR@:$(bindir):" \
-e "s:@IPSEC_SCRIPT@:$(ipsec_script):" \
$(srcdir)/$@.in > $@
sbin_SCRIPTS = cert-enroll
cert-enroll : cert-enroll.in
cert_enrolldir = $(sysconfdir)/cert-enroll.d
cert_enroll_DATA = cert-enroll.conf
install-data-local:
test -e "$(DESTDIR)$(cert_enrolldir)/cert-install.d" || \
$(INSTALL) -d "$(DESTDIR)$(cert_enrolldir)/cert-install.d" || true
cert_install_availabledir = $(sysconfdir)/cert-enroll.d/cert-install-available
cert_install_available_DATA = \
cert-install-ssl \
cert-install-sssd \
cert-install-ldaputils \
cert-install-cockpit \
cert-install-dirsrv \
cert-install-lighttpd \
cert-install-openxpki \
cert-install-gitea \
cert-install-ipsec \
cert-install-swanctl
cert-install-swanctl : cert-install-swanctl.in
cert-install-ipsec : cert-install-ipsec.in
EXTRA_DIST = \
cert-enroll.conf cert-enroll.in cert-enroll.service.in cert-enroll.timer \
cert-install-cockpit cert-install-dirsrv cert-install-gitea \
cert-install-ipsec.in cert-install-ldaputils cert-install-lighttpd \
cert-install-openxpki cert-install-ssl cert-install-sssd \
cert-install-swanctl.in
man8_MANS = cert-enroll.8
CLEANFILES = cert-enroll cert-install-swanctl cert-install-ipsec
if USE_CERT_ENROLL_TIMER
systemdsystemunit_DATA = cert-enroll.service cert-enroll.timer
cert-enroll.service : cert-enroll.service.in
CLEANFILES += cert-enroll.service
endif

Some files were not shown because too many files have changed in this diff Show More