Tobias Brunner [Tue, 28 Jun 2016 10:22:10 +0000 (12:22 +0200)]
ike1: Flush active queue when queueing a delete of the IKE_SA
By aborting the active task we don't have to wait for potential
retransmits if the other peer does not respond to the current task.
Since IKEv1 has no sequential message IDs and INFORMATIONALs are no real
exchanges this should not be a problem.
Tobias Brunner [Wed, 29 Jun 2016 12:39:06 +0000 (14:39 +0200)]
testing: Remove obsolete openssl-fips recipe
This was only required when we initially started and OpenSSL was built
from sources, which was changed with b97dd59ba841 ("install FIPS-aware
OpenSSL Debian packages").
Tobias Brunner [Tue, 21 Jun 2016 09:12:18 +0000 (11:12 +0200)]
plugin-loader: Allow selective modification of the default plugin list
This change allows selectively modifying the default plugin list by setting
the `load` setting of individual plugins (e.g. to disable them or to change
their priority) without enabling charon.load_modular and having to configure
a section and a load statement for every plugin.
Tobias Brunner [Wed, 29 Jun 2016 09:10:07 +0000 (11:10 +0200)]
Merge branch 'openssl-1.1.0'
This adds support for OpenSSL 1.1.0. Several APIs have changed and it makes
all types opaque, which requires using new getter/setter functions. For older
versions fallbacks are provided.
Tobias Brunner [Mon, 27 Jun 2016 16:04:39 +0000 (18:04 +0200)]
leak-detective: Try to properly free allocations after deinitialization
If a function we whitelist allocates memory while leak detective is enabled
but only frees it after LD has already been disabled, free() will get called
with invalid pointers (not pointing to the actually allocated memory by LD),
which will cause checks in the C library to fail and the program to crash.
This tries to detect such cases and calling free with the correct pointer.
Tobias Brunner [Mon, 27 Jun 2016 15:44:57 +0000 (17:44 +0200)]
openssl: Whitelist OPENSSL_init_crypto() and others in leak detective
Lots of static data is allocated in this function, which isn't freed until
the library is unloaded (we can't call OPENSSL_cleanup() as initialization
would fail when calling it again later). When enabling the leak
detective the test runner eventually crashes as all the data allocated during
initialization has an invalid size when freed after leak detective has been
unloaded.
Tobias Brunner [Mon, 27 Jun 2016 14:56:22 +0000 (16:56 +0200)]
openssl: Update CRL API to OpenSSL 1.1.0
There is currently no way to compare the outer and inner algorithms
encoded in a parsed CRL. X509_CRL_verify() does not seem to check that
either, though (unlike X509_verify()).
Tobias Brunner [Mon, 27 Jun 2016 09:02:36 +0000 (11:02 +0200)]
openssl: Update initialization and cleanup for OpenSSL 1.1.0
We can't call OPENSSL_cleanup() as that would prevent us from
re-initializing the library again (which we use in the Android app, that
loads/unloads plugins).
Andreas Steffen [Sun, 26 Jun 2016 16:40:01 +0000 (18:40 +0200)]
Merge branch 'tpm2'
The libtpmtss library supports both TPM 1.2 and TPM 2.0 Trusted
Platform Modules. Features comprise capability discovery,
listing of PCRs, AIK generation and quote signatures.
Tobias Brunner [Mon, 20 Jun 2016 16:31:13 +0000 (18:31 +0200)]
testing: Start charon before Apache in tnc/tnccs-20-pdp-pt-tls
The change in c423d0e8a124 ("testing: Fix race in tnc/tnccs-20-pdp-pt-tls
scenario") is not really ideal as now the vici plugin might not yet be
ready when `swanctl --load-creds` is called. Perhaps starting charon
before Apache causes enough delay.
Once we switch to charon-systemd this isn't a problem anymore as starting the
unit will block until everything is up and ready. Also, the individual
swanctl calls will be redundant as the default service unit calls --load-all.
But start scripts do run before charon-systemd signals that the daemon is
ready, so using these would work too then.
Tobias Brunner [Mon, 20 Jun 2016 16:18:46 +0000 (18:18 +0200)]
testing: Only load selected plugins in swanctl
The main issue is that the ldap and curl plugins, or rather the libraries
they use, initialize GnuTLS (curl, strangely, even when it is, by its own
account, linked against OpenSSL). Some of these allocations are only freed
once the libraries are unloaded. This means that the leak detective causes
invalid frees when swanctl is terminated and libraries are unloaded after the
leak detective is already deinitialized.
Tobias Brunner [Fri, 17 Jun 2016 16:53:51 +0000 (18:53 +0200)]
Merge branch 'exchange-collisions'
Improves the handling of IKEv2 exchange collisions in several corner
cases. TEMPORARY_FAILURE and CHILD_SA_NOT_FOUND notifies that were defined
with RFC 7296 are now handled and sent as appropriate.
The behavior in these situations is tested with new unit tests.
If a passive rekeying fails due to an INVALID_KE_PAYLOAD we don't want
to consider this task later when resolving collisions. This previously
might have caused the wrong SA to get deleted/installed based on the nonces
in the unsuccessful exchange.
Tobias Brunner [Thu, 2 Jun 2016 13:50:11 +0000 (15:50 +0200)]
ikev2: Add possibility to delay initiation of a queued task
Such a task is not initiated unless a certain time has passed. This
allows delaying certain tasks but avoids problems if we'd do this
via a scheduled job (e.g. if the IKE_SA is rekeyed in the meantime).
If the IKE_SA is rekeyed the delay of such tasks is reset when the
tasks are adopted i.e. they get executed immediately on the new IKE_SA.
Tobias Brunner [Tue, 31 May 2016 12:41:19 +0000 (14:41 +0200)]
ike-rekey: Handle undetected collisions also if delete is delayed
If the peer does not detect the rekey collision and deletes the old
IKE_SA and then receives the colliding rekey request it will respond with
TEMPORARY_FAILURE. That notify may arrive before the DELETE does, in
which case we may just conclude the rekeying initiated by the peer.
Also, since the IKE_SA is destroyed in any case when we receive a delete
there is no point in storing the delete task in collide() as process_i()
in the ike-rekey task will never be called.
Tobias Brunner [Tue, 31 May 2016 10:22:32 +0000 (12:22 +0200)]
ike-rekey: Properly handle situation if the peer did not notice the rekey collision
We conclude the rekeying before deleting the IKE_SA. Waiting for the
potential TEMPORARY_FAILURE notify is no good because if that response
does not reach us the peer will not retransmit it upon our retransmits
of the rekey request if it already deleted the IKE_SA after receiving
our response to the delete.