Commit Graph

17234 Commits

Author SHA1 Message Date
Tobias Brunner a0a03c25f7 Merge branch 'enum-strings'
Adds a compile check the number of enum strings and updates several of
these lists, in particular, the one in the pfkey-kernel plugin, where
strings for several new extensions on FreeBSD were missing.

Fixes #3210.
2019-10-28 18:46:11 +01:00
Tobias Brunner f3d8179b4b kernel-pfkey: Add additional strings for extensions on different platforms
Don't define structs for macOS as we don't need them (that's true for
most of the others too, though) and at least one is defined inside an extra
ifdef.
2019-10-28 14:26:32 +01:00
Tobias Brunner 45c8399d78 Add missing strings to several enum string definitions 2019-10-28 14:26:32 +01:00
Tobias Brunner 8b98482e04 enum: Add compile-time check for missing strings
If strings are missing (e.g. because the last value of a range changed
unknowingly or adding a string was simply forgotten) compilation will
now fail.

This could be problematic if the upper limit is out of our control (e.g.
from a system header like pfkeyv2.h), in which case patches might be
required on certain platforms (enforcing at least, and not exactly, the
required number of strings might also be an option to compile against
older versions of such a header - for internal enums it's obviously
better to enforce an exact match, though).
2019-10-28 14:26:32 +01:00
Tobias Brunner 1bf58f6ad8 kernel-netlink: Support extended table IDs for custom routes
This adds support for installing routes in tables with IDs > 255.
2019-10-25 16:21:22 +02:00
Tobias Brunner 08d0342ca6 vici: List additional information for deleted CHILD_SAs
If a CHILD_SA is terminated, the updown event is triggered after the
CHILD_SA is set to state CHILD_DELETED, so no usage stats or detail
information like SPIs were reported.  However, when an IKEv2 SA is
terminated, the updown event for its children is triggered without
changing the state first, that is, they usually remain in state
INSTALLED and detailed data was reported in the event.  IKEv1
CHILD_SAs are always terminated individually, i.e. with state
change and no extra data so far.

With this change usage stats are also returned for individually deleted
CHILD_SAs as long as the SA has not yet expired.

Fixes #3198.
2019-10-25 16:15:42 +02:00
Tobias Brunner 62e7c68b61 kernel-pfkey: Clear receive buffer before sending request
Many of the messages sent by the kernel, including confirmations to our
requests, are sent as broadcasts to all PF_KEY sockets.  So if an
external tool is used to manage SAs/policies (e.g. unrelated to IPsec)
the receive buffer might be filled, resulting in errors like these:

  error sending to PF_KEY socket: No buffer space available

To avoid this, just clear the buffer before sending any message.

Fixes #3225.
2019-10-25 13:53:06 +02:00
Tobias Brunner a463ef4435 Merge branch 'proposal-flags'
This uses flags for proposal selection and cloning that control
whether DH groups and algorithms from a private range are skipped, and
for selection whether configured or supplied proposals/algorithms are
preferred.
2019-10-24 17:47:45 +02:00
Tobias Brunner ec93acff03 proposal: Remove unused strip_dh() method 2019-10-24 17:43:21 +02:00
Tobias Brunner a2cb2c9cc8 proposal: Add selection flags to clone() method
This avoids having to call strip_dh() in child_cfg_t::get_proposals().
It also inverts the ALLOW_PRIVATE flag (i.e. makes it SKIP_PRIVATE) so
nothing has to be supplied to clone complete proposals.
2019-10-24 17:43:21 +02:00
Tobias Brunner 3187293e3d quick-mode: Promote selected DH group instead of stripping all others
Since only the first DH group is encoded for IKEv1 this should have the
same effect as removing all other groups.
2019-10-24 17:36:37 +02:00
Tobias Brunner c9599d4101 proposal: Extract proposal selection code in ike/child_cfg_t
Also invert the PREFER_CONFIGURED flag (i.e. make it PREFER_SUPPLIED)
so the default, without flags, is what we preferred so far.
2019-10-24 17:36:33 +02:00
Tobias Brunner a406bc60c5 proposal: Handle skipping DH groups directly in select() and matches()
Also renames the flag.
2019-10-24 17:33:57 +02:00
Thomas Egerer f930b732c4 proposal: Use flags to select/match proposals
During proposal selection with ike/child_cfgs a couple of boolean
variables can be set (e.g. private, prefer_self, strip_dh). To simplify
the addition of new parameters, these functions now use a set of flags
instead of indiviual boolean values.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2019-10-24 17:22:53 +02:00
Tobias Brunner 8346db09dd travis: Bump wolfSSL to 4.2.0 2019-10-23 17:50:20 +02:00
Tobias Brunner b3db361727 Merge branch 'ipv6-addrs-mobike'
Address enumeration on Linux now ignores deprecated addresses and
whether temporary or permanent IPv6 addresses are included now depends
on the charon.prefer_temporary_addrs setting.

Closes #3192.
2019-10-22 14:55:28 +02:00
Tobias Brunner 9f12b8a61c kernel-netlink: Enumerate temporary IPv6 addresses according to config
This way we announce only permanent addresses via MOBIKE by default, and
temporary ones if the option is enabled.
2019-10-22 14:14:44 +02:00
Tobias Brunner 64795cc416 kernel-netlink: Don't enumerate deprecated IPv6 addresses 2019-10-22 14:13:32 +02:00
Tobias Brunner cf98706bb8 utils: Handle NULL consistently if memwipe() is implemented via explicit_bzero()
Our own implementation ignores NULL values, however, explicit_bzero()
can't handle that, as indicated by the `__nonnull ((1))` attribute in the
function's signature in string.h, and causes a segmentation fault.  This
was noticed in one of the unit tests for NewHope.  Since we usually use
memwipe() via chunk_clear(), which already ignores NULL pointers, this
is not that much of an issue in practice.

Fixes: 149d1bbb05 ("memory: Use explicit_bzero() as memwipe() if available")
2019-10-21 13:58:12 +02:00
Tobias Brunner 393e39a1bc travis: Switch to the Ubuntu 18.04 (bionic) image for tests
Do two full build tests on 16.04 (xenial) and the two for OpenSSL 1.0
also run there.  Since 18.04 ships OpenSSL 1.1.1, which conflicts with
our custom built version, we skip that until OpenSSL 3.0 is released.
A workaround is required for an issue with sonarqube on bionic.
2019-10-21 13:58:12 +02:00
Tobias Brunner 768e013790 prf-plus: Fail after counter has wrapped around
The behavior is undefined if this happens (RFC 7296, section 2.13).
Instead of switching to the non-counter mode, or letting the counter
wrap, this makes it clear that the usage was not as intended.
2019-10-21 13:53:11 +02:00
Tobias Brunner c75010080a prf-plus: Fix a potential memory leak if get_bytes() fails 2019-10-21 12:22:22 +02:00
Tobias Brunner 1b96e4a465 drbg-ctr: Remove unused variable 2019-10-21 10:32:59 +02:00
David Garske 29f7017663 wolfssl: Fix for issue with blinding not defined
Closes strongswan/strongswan#156.
2019-10-21 09:56:55 +02:00
Andreas Steffen 4f4e026d3b Version bump to 5.8.2dr1 2019-10-18 16:26:41 +02:00
Andreas Steffen f05e9eebb0 testing: Added drbg plugin where required 2019-10-18 16:24:39 +02:00
Andreas Steffen e36af6fc2f gmp: Use NIST DRBG for RSA key pair generation 2019-10-18 16:24:39 +02:00
Andreas Steffen ea41f759b3 stroke: List drbgs in list_algs 2019-10-18 16:24:39 +02:00
Andreas Steffen c738704ab6 vici: List drbgs in get_algorithms 2019-10-16 16:46:24 +02:00
Andreas Steffen 6d3a743d90 ntru: Replaced ntru_drbg by drbg 2019-10-16 16:46:24 +02:00
Andreas Steffen 737375a2d2 drbg: Implemented NIST SP-800-90A DRBG 2019-10-16 16:46:24 +02:00
Tobias Brunner 2a7937f179 Merge branch 'android-updates'
Makes the local identity configurable and includes a fix for Android 10,
plus a break-before-make reauth issue (not Android specific) and some
deprecation workarounds.
2019-10-15 17:28:25 +02:00
Tobias Brunner 6e12aa68b3 android: New release after making local identity configurable
This also includes a fix for Android 10 and some older fixes for
API level 28 compatibility and a crash on Huawei devices.  The API
used to detect network changes is also replaced on newer Android
versions and an issue with DELETES received during break-before-make
reauthentication is also fixed.
2019-10-15 17:25:42 +02:00
Tobias Brunner 60457e2aef ike-delete: Continue break-before-make reauth if server concurrently deletes SA
There seem to be servers around that, upon receiving a delete from the
client, instead of responding with an empty INFORMATIONAL, send a delete
themselves.
2019-10-15 17:25:37 +02:00
Tobias Brunner 71d143149c android: Replace deprecated CONNECTIVITY_ACTION on newer Android versions
It was deprecated in API level 28, registerNetworkCallback is available
since API level 21, but ConnectivityManager got some updates with 24
(e.g. default network handling) so we start using it then.
2019-10-15 17:07:02 +02:00
Tobias Brunner 1227b43fe4 android: Don't use specific key types to select user certificates
Android 10 will honor the preselection and could, thus, hide some
installed certificates if we only pass "RSA".  The dialog will also only
be shown if there are actually certificates installed (i.e. users will
have to do that manually outside of the app or via profile import).

Fixes #3196.
2019-10-15 17:06:36 +02:00
Tobias Brunner a82673346e android: Import local identity for all authentication types 2019-10-15 17:05:56 +02:00
Tobias Brunner 698a18e7a5 android: Allow configuration of client identity for all authentication types
This replaces the drop-down box to select certificate identities with a
text field (in the advanced settings) with auto-completion for SANs
contained in the certificate.

The field is always shown and allows using an IKE identity different from
the username for EAP authentication (e.g. to configure a more complete
identity to select a specific config on the server).

Fixes #3134.
2019-10-15 17:05:56 +02:00
Tobias Brunner df0214baa6 android: Rename adapter for gateway address auto-completion 2019-10-15 12:18:45 +02:00
Tobias Brunner 999287f679 android: No auto-completion required for DNS server text box 2019-10-15 12:18:45 +02:00
Tobias Brunner 2e74fc2197 android: Add helper to read strings from text boxes 2019-10-15 12:18:45 +02:00
Tobias Brunner 54a4a3632d android: Fix deprecation warning related to FragmentPagerAdapter 2019-10-15 12:18:45 +02:00
Tobias Brunner 2ee1c6b106 android: Update AndroidX libraries 2019-10-15 12:18:45 +02:00
Tobias Brunner 57d61730b0 android: Update Gradle plugin 2019-10-15 12:18:45 +02:00
Patryk Duda 121390fb3c kernel-pfkey: Pass ESN flag to kernel if ESN is enabled
This patch adds passing the ESN flag to the kernel if ESN was negotiated
and the appropriate flag is present in the kernel headers, which will
be the case in future FreeBSD releases.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
Closes strongswan/strongswan#155.
2019-10-14 18:03:34 +02:00
Tobias Brunner 9cc24ca39e Use Botan 2.12.1 for tests 2019-10-14 11:43:58 +02:00
Tobias Brunner 0736882678 Use Botan 2.12.0 for tests 2019-10-07 14:31:40 +02:00
Felix Kaiser 7c74ce9190 vici: Use unique names for CHILD_SAs in the child-updown event too
The unique names were introduced for the list-sas command in commit
04c0219e55.  However, the child-updown
event wasn't updated to match.  Even though the documentation suggests
that the section name of the CHILD_SAs are the same in both messages.

The original name is already being returned in the "name" attribute,
so it'll still be available.

Example:

    >>> import vici, json
    >>> s = vici.Session()

    # First, for comparison, the list-sas command:
    >>> print(json.dumps(list(s.list_sas()), sort_keys=True, indent=4, separators=(',', ': ')))
    [
        {
            "vti0": {
                "child-sas": {
                    "vti0-1": {
                        ...

    # A child-updown event before the change:
    >>> for x in s.listen(["child-updown"]): print(json.dumps(x, sort_keys=True, indent=4, separators=(',', ': ')))
    [
        "child-updown",
        {
            "vti0": {
                "child-sas": {
                    "vti0": {   # <-- wrong: inconsistent with list-sas
                        ...

    # A child-updown event after the change:
    >>> s = vici.Session()
    >>> for x in s.listen(["child-updown"]): print(json.dumps(x, sort_keys=True, indent=4, separators=(',', ': ')))
    [
        "child-updown",
        {
            "vti0": {
                "child-sas": {
                    "vti0-1": {  # <-- fixed

Closes strongswan/strongswan#153.
2019-10-04 10:11:18 +02:00
Tobias Brunner d3bd576c46 fuzz: Add fuzzer for identification_t 2019-09-30 10:10:43 +02:00
Tobias Brunner 936d101d99 travis: Bump tpm2-tss to 2.3.1 2019-09-26 11:57:52 +02:00