Tobias Brunner [Thu, 19 Mar 2020 12:39:48 +0000 (13:39 +0100)]
ike: Add an option to trigger a DPD instead of a NAT keepalive
This is useful on Android where the app might not be able to send
keep-alives if the device is asleep for a while. If the NAT mapping
has been deleted in the mean time, the NAT-D payloads allow detecting
this and connectivity can be restored by doing a MOBIKE update or
recreating the SA if the peer already deleted it because the client
wasn't reachable.
Tobias Brunner [Thu, 19 Mar 2020 13:19:22 +0000 (14:19 +0100)]
time: Allow using different clocks
On some systems it might be preferable to use e.g. CLOCK_BOOTTIME
instead of CLOCK_MONOTONIC, which is also not affected by time
adjustments but includes times when the system was suspended.
Tobias Brunner [Wed, 15 Jan 2020 13:12:07 +0000 (14:12 +0100)]
android: Fix app icon on Android versions < 5.0
XML resources are apparently not supported there. Moving the icon to
the mipmap folders should fix that. Aliases are defined for the icons on
Android < 8.0.
Tobias Brunner [Mon, 21 Oct 2019 13:12:05 +0000 (15:12 +0200)]
android: Again change how data source is handled in TileService
Evidently, onClick() may be called either before onStartListening() or
after onStopListening() has been called, which causes a crash when
trying to load a VpnProfile via mDataSource.
This partially reverts 3716af079e21 ("android: Avoid crash related to
TileService on Huawei devices").
Tobias Brunner [Mon, 25 May 2020 12:29:44 +0000 (14:29 +0200)]
travis: Bump tpm2-tss to 2.4.1
Manually built dependencies are now built in a separate step after
packages have been installed as they might depend themselves on some
packages (e.g. tpm2-tss, which now requires libjson-c).
This change allows to customize the previously hard-coded remote traffic
selectors.
This does not actually write the newly added "remote-ts" configuration option
into NetworkManager's configuration file, but will use an existing value.
Exposing the config setting in the GUI could be done later if this is a
desired change.
Use case: remote firewall appliance wrongly accepts the `0.0.0.0/0` TS but
does not actually route external traffic, leaving the user with a partially
working internet connection.
Tobias Brunner [Tue, 19 May 2020 08:07:18 +0000 (10:07 +0200)]
ikev2: Return to the original host if connection fails after redirection
If we fail connecting to the host we got redirected to, we should restart
with the original host where we might get redirected to a different host.
We must not reset this when retrying due to INVALID_KE_PAYLOAD or COOKIE
notifies. Since we keep the initiator SPI in those cases, we use that
flag as indicator.
Since we don't store the original remote_host value, we can't restore
that. So there is a potential conflict with MIPv6.
Tobias Brunner [Mon, 18 May 2020 09:26:08 +0000 (11:26 +0200)]
nm: Use tabs for options/proposals to save screen space
The height of the dialog increased due to the recently added additional
fields for certificate selection and identities. On some screens the
fields to configure custom proposals were not visible anymore.
Together with less spacing on the top level GtkBox this change reduces
the height by about 80 pixels.
Tobias Brunner [Mon, 11 May 2020 07:48:27 +0000 (09:48 +0200)]
nm: Migrate appdata to metainfo
The path '/usr/share/appdata' is deprecated as is the .appdata.xml
extension, files should be in installed in '/usr/share/metainfo' with
a .metainfo.xml extension.
According to the docs, the metainfo path should be well supported even
by older distros like Ubuntu 16.04.
Tobias Brunner [Fri, 8 May 2020 08:33:55 +0000 (10:33 +0200)]
charon-nm: Clear secrets when disconnecting
The need_secrets() method is called before connect() (where we clear the
previous secrets too), so e.g. a password-protected private could be
decrypted with the cached password from earlier but if the password was not
stored with the connection, it would later fail as no password was requested
from the user that could be passed to connect().
nm: Fix password entry for private keys and allow saving it
On newer desktops the auth dialog is called with --external-ui-mode and
it seems that the password flag has to be set, otherwise the password is
not stored temporarily in the profile and passed to charon-nm (not sure
how this works exactly as need_secrets() is called multiple times even
after the password was already entered, only before doing so the last
time is the password available in that callback, but only if the flag
was set). This now also allows storing the password for the private key
with the profile.
ike: Properly support high number of retransmission tries
Due to the exponential backoff a high number of retransmits only
makes sense if retransmit_limit is set. However, even with that there
was a problem.
We first calculated the timeout for the next retransmit and only then
compared that to the configured limit. Depending on the configured
base and timeout the calculation overflowed the range of uint32_t after
a relatively low number of retransmits (with the default values after 23)
causing the timeout to first get lower (on a high level) before constantly
resulting in 0 (with the default settings after 60 retransmits).
Since that's obviously lower than any configured limit, all remaining
retransmits were then sent without any delay, causing a lot of concurrent
messages if the number of retransmits was high.
This change determines the maximum number of retransmits until an
overflow occurs based on the configuration and defaults to UINT32_MAX
if that value is exceeded. Note that since the timeout is in milliseconds
UINT32_MAX equals nearly 50 days.
The calculation in task_manager_total_retransmit_timeout() uses a double
variable and the result is in seconds so the maximum number would be higher
there (with the default settings 1205). However, we want its result to
be based on the actual IKE retransmission behavior.
ike-auth: Add option to use EAP-only authentication without notify
Some peers apparently don't send the notify and still expect to
authenticate with EAP-only authentication. This option allows forcing
the configured use of EAP-only authentication in that scenario.
child-create: Properly handle DH group during migration when reestablishing
If such a task was active while reestablishing it will get queued on the
new IKE_SA. If the DH group is already set, the DH groups won't be
stripped from the proposals and a KE payload will be sent, which is invalid
during IKE_AUTH. We don't want to reset the group if the task is part of a
child-rekey task.
Otherwise, the output is buffered when e.g. piping the output to another
command (or file). And it avoids having to call fflush() in the
interactive mode.
SHA-3 is only automatically enabled on x86/x64. The tests are disabled
because we don't need them and they currently cause a compile warning/error
when built with clang on x64 (sizeof() on a pointer to an array). If the
examples are enabled, another test suite is built, which includes the
disabled crypto tests.
The file is usually opened/created by root, however, if user/group IDs
are configured and the configuration is reloaded, the file will be reopened
as configured user. Like with UNIX sockets we only attempt to change
the user if we have CAP_CHOWN allowing a start as regular user.
We don't have chown() on Windows, so check for it.
Tobias Brunner [Mon, 4 May 2020 07:45:39 +0000 (09:45 +0200)]
pkcs11: Optionally hash data for PKCS#1 v1.5 RSA signatures in software
If cards/libraries don't support signature mechanisms with hashing, we fall
back to do it ourselves in software and pass the PKCS#1 digestInfo ASN.1
structure to sign via CKM_RSA_PKCS mechanism.
Tobias Brunner [Thu, 26 Mar 2020 12:52:47 +0000 (13:52 +0100)]
openssl: Allow squeezing multiple times from SHAKE128/256 XOFs
OpenSSL currently doesn't support squeezing bytes out of an XOF multiple
times. Unfortunately, EVP_DigestFinalXOF() completely resets the context
and later calls not simply fail, they cause a null-pointer dereference in
libcrypto. This fixes the crash at the cost of repeating initializing
the whole state and allocating too much data for subsequent calls.
There is an open issue and PR that might add a function that allows
squeezing more data from an XOF in a future version of OpenSSL.
Thomas Egerer [Wed, 25 Mar 2020 17:01:37 +0000 (18:01 +0100)]
settings: Use strtoul(3) for settings to int conversion
strtol(3) accepts values in the range of [LONG_MIN;LONG_MAX]. Based
on the architecture (32 or 64 bits), these values expand to either
0x8000000000000000/0x7fffffffffffffff for 64-bit builds, or
0x80000000/0x7fffffff for 32-bit builds.
The behavior when retrieving non-default values for charon.spi_min or
charon.spi_max, for example, depends on the architecture of the target
platform. While 0xC000001/0xCFFFFFFE work fine on a 64-bit build, on a
32-bit build, due to the use of strtol(3), an ERANGE causes get_int()
to return the default values.
By using strtoul(3) the default is only returned if the input value
exceeds 32 or 64 bits, based on the platform. Negative values are still
parsed correctly.
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
Tobias Brunner [Tue, 10 Mar 2020 11:49:53 +0000 (12:49 +0100)]
Merge branch 'throw-type-routes'
Implements simpler routes for passthrough policies on Linux, which
basically act as fallbacks on routes in other routing tables. This way
they require less information (e.g. no interface or source IP) and can
be installed earlier and are not affected by updates.
Noel Kuntze [Sun, 9 Feb 2020 13:52:32 +0000 (14:52 +0100)]
kernel-netlink: Implement passthrough type routes and use them on Linux
Enables us to ignore any future kernel features for routes unless
we actually need to consider them for the source IP routes.
Also enables us to actually really skip IPsec processing for those networks
(because even the routes don't touch those packets). It's more what
users expect.
Thomas Egerer [Thu, 12 Sep 2019 14:58:46 +0000 (16:58 +0200)]
ike: Optionally allow private algorithms for IKE/CHILD_SAs
Charon refuses to make use of algorithms IDs from the private space
for unknown peer implementations [1]. If you chose to ignore and violate
that section of the RFC since you *know* your peers *must* support those
private IDs, there's no way to disable that behavior.
With this commit a strongswan.conf option is introduced which allows to
deliberately ignore parts of section 3.12 from the standard.
Tobias Brunner [Wed, 4 Mar 2020 18:26:55 +0000 (19:26 +0100)]
openssl: Don't check signature if issuer doesn't match always
Doing this for the self-signed check also (i.e. if this and issuer are
the same) is particularly useful if the issuer uses a different key type.
Otherwise, we'd try to verify the signature with an incompatible key
that would result in a log message.
Tobias Brunner [Fri, 6 Mar 2020 09:47:34 +0000 (10:47 +0100)]
Merge branch 'ikev1-transform-nr'
With these changes we return the lifetimes of the actually selected
transform back to the client, which is an issue if the peer uses
different lifetimes for different proposals. We now also return the
correct transform and proposal IDs.
Tobias Brunner [Thu, 6 Feb 2020 14:52:06 +0000 (15:52 +0100)]
ikev1: Get and set the lifetimes of the selected proposal/transform
Previously, we simply used the lifetimes of the first
proposal/transform, which is not correct if the initiator uses different
lifetimes in its proposals/transforms.
Tobias Brunner [Thu, 13 Feb 2020 09:48:49 +0000 (10:48 +0100)]
ike: Don't reestablish IKE_SAs for which a deletion is queued
If an IKE_SA is terminated while a task is active, the delete task is
simply queued (unless the deletion is forced). If the active task times
out before any optional timeout associated with the termination hits, the
IKE_SA previously was reestablished without considering the termination
request.
Tobias Brunner [Wed, 19 Feb 2020 16:38:57 +0000 (17:38 +0100)]
Remove obsolete packages directory
These Debian package sources have not been updated for years and are
severely out-of-date. Since the Debian packages are properly
maintained nowadays, we don't have to provide our own package sources
to serve as examples.
Tobias Brunner [Thu, 13 Feb 2020 16:53:17 +0000 (17:53 +0100)]
charon-nm: Use better default directory for D-Bus policy file
Also makes it configurable via configure script. Depending on `$datadir` is
not ideal as package maintainers might set that to a custom value. Depending
on `$datarootdir` might have been better, the default if pkg-config fails is
now based on that.
Tobias Brunner [Fri, 14 Feb 2020 13:47:34 +0000 (14:47 +0100)]
Merge commit 'nm-client-id'
Makes the client's IKE identity configurable in the NM GUI. For PSK
authentication the identity is now configured via that new field
and not the username anymore (old configs still work and are migrated
when edited). The client identity now also defaults to the IP address
if not configured when using EAP/PSK.
Tobias Brunner [Fri, 14 Feb 2020 12:58:50 +0000 (13:58 +0100)]
Merge branch 'nm-reauth'
With these changes, the NM service should be able to handle
reauthentication (and redirection) by switching to the new IKE_SA and
not considering the old SA going down an error.
Tobias Brunner [Fri, 14 Feb 2020 12:51:44 +0000 (13:51 +0100)]
Merge branch 'nm-eap-tls'
Adds support for EAP-TLS to the NM plugin. The certificates/key
source (file, smartcard, agent) can now be selected independently of
the authentication method (i.e. for both certificate and EAP-TLS auth).
Tobias Brunner [Wed, 5 Feb 2020 15:00:10 +0000 (16:00 +0100)]
charon-nm: Add support for EAP-TLS
The code is structured similar to that in the Android client, but two-round
authentication (cert+EAP) is not supported as that might require multiple
secrets ("password" is currently the only secret field used for every
method) and other details are currently missing too (like configurable
client identities).
Tobias Brunner [Fri, 14 Feb 2020 12:29:10 +0000 (13:29 +0100)]
Merge branch 'nm-remote-id'
This adds an optional field to the NM plugin to configure the server
identity, so it can differ from the address or certificate subject,
which are used by default.
Was fixed by making tox depend on newer versions of six so the package
gets installed/updated automatically now when installing tox. There is
also some ongoing work that tries to make virtualenv work with older
versions of six.
Tobias Brunner [Wed, 12 Feb 2020 16:49:14 +0000 (17:49 +0100)]
cirrus: Remove bashisms from test script to make it compatible with /bin/sh
Bash is not installed on the FreeBSD images here and the location would
be different anyway (`/usr/local/bin/bash`, so we'd have to change the
hashbang to e.g. `/usr/bin/env bash`).