Tobias Brunner [Wed, 10 Feb 2016 11:09:37 +0000 (12:09 +0100)]
vici: Don't hold write lock while running or undoing start actions
Running or undoing start actions might require enumerating IKE_SAs,
which in turn might have to enumerate peer configs concurrently, which
requires acquiring a read lock. So if we keep holding the write lock while
enumerating the SAs we provoke a deadlock.
By preventing other threads from acquiring the write lock while handling
actions, and thus preventing the modification of the configs, we largely
maintain the current synchronous behavior. This way we also don't need to
acquire additional refs for config objects as they won't get modified/removed.
Tobias Brunner [Mon, 7 Mar 2016 15:52:43 +0000 (16:52 +0100)]
connmark: Don't restore CONNMARK for packets that already have a mark set
This allows e.g. modified versions of xl2tpd to set the mark in
situations where two clients are using the same source port behind the
same NAT, which CONNMARK can't restore properly as only one conntrack entry
will exist with the mark set to that of the client that sent the last packet.
Tobias Brunner [Mon, 7 Mar 2016 14:32:02 +0000 (15:32 +0100)]
connmark: Compare the complete rules when deleting them
By settings a matchmask that covers the complete rule we ensure that the
correct rule is deleted (i.e. matches and targets with potentially different
marks are also compared).
Since data after the passed pointer is actually dereferenced when
comparing we definitely have to pass an array that is at least as long as
the ipt_entry.
Andreas Steffen [Tue, 8 Mar 2016 21:27:30 +0000 (22:27 +0100)]
Implemented IPv4/IPv6 subnet and range identities
The IKEv1 IPV4_ADDR_SUBNET, IPV6_ADDR_SUBNET, IPV4_ADDR_RANGE and
IPV6_ADDR_RANGE identities have been fully implemented and can be
used as owners of shared secrets (PSKs).
Tobias Brunner [Thu, 10 Mar 2016 11:00:56 +0000 (12:00 +0100)]
Merge branch 'p-cscf'
This adds the p-cscf plugin that can request P-CSCF server addresses from
an ePDG via IKEv2 (RFC 7651). Addresses of the same families as requested
virtual IPs are requested if enabled in strongswan.conf for a particular
connection. The plugin currently writes received addresses to the log.
Tobias Brunner [Thu, 10 Mar 2016 10:48:12 +0000 (11:48 +0100)]
Merge branch 'mbb-reauth-online-revocation'
With these changes initiators of make-before-break reauthentications
suspend online revocation checks until after the new IKE_SA and all
CHILD_SAs are established. See f1cbacc5d1be for details why that's
necessary.
Tobias Brunner [Tue, 27 Oct 2015 16:34:50 +0000 (17:34 +0100)]
ikev2: Delay online revocation checks during make-before-break reauthentication
We do these checks after the SA is fully established.
When establishing an SA the responder is always able to install the
CHILD_SA created with the IKE_SA before the initiator can do so.
During make-before-break reauthentication this could cause traffic sent
by the responder to get dropped if the installation of the SA on the
initiator is delayed e.g. by OCSP/CRL checks.
In particular, if the OCSP/CRL URIs are reachable via IPsec tunnel (e.g.
with rightsubnet=0.0.0.0/0) the initiator is unable to reach them during
make-before-break reauthentication as it wouldn't be able to decrypt the
response that the responder sends using the new CHILD_SA.
By delaying the revocation checks until the make-before-break
reauthentication is completed we avoid the problems described above.
Since this only affects reauthentication, not the original IKE_SA, and the
delay until the checks are performed is usually not that long this
doesn't impose much of a reduction in the overall security.
Tobias Brunner [Tue, 27 Oct 2015 16:31:43 +0000 (17:31 +0100)]
ikev2: Add task that verifies a peer's certificate
On failure the SA is deleted and reestablished as configured. The task
is activated after the REAUTH_COMPLETE task so a make-before-break reauth
is completed before the new SA might get torn down.
Tobias Brunner [Tue, 27 Oct 2015 16:17:54 +0000 (17:17 +0100)]
credential-manager: Check cache queue when destroying trusted certificate enumerator
We already do this in the trusted public key enumerator (which
internally uses the trusted certificate enumerator) but should do so
also when this enumerator is used directly (since the public key
enumerator has the read lock the additional call will just be skipped
there).
Tobias Brunner [Mon, 8 Feb 2016 16:19:20 +0000 (17:19 +0100)]
charon-systemd: Inherit all settings from the charon section
Our default config files are very charon specific. So to avoid
confusion when only charon-systemd is installed we just default to all
settings defined for charon. Since charon-systemd probably won't be used
together with charon this should not cause conflicts (settings may still
be overridden via the charon-systemd section).
Tobias Brunner [Thu, 3 Mar 2016 17:12:06 +0000 (18:12 +0100)]
library: Add option to register additional namespaces before calling library_init()
Because settings are already accessed in library_init(), calling
add_fallback() externally after calling library_init() is not ideal.
This way namespaces already serve as fallback while library_init() is
executed and they are also in the correct order so that libstrongswan is
always the last root section.
Tobias Brunner [Mon, 1 Feb 2016 17:16:16 +0000 (18:16 +0100)]
auth-cfg: Make IKE signature schemes configurable
This also restores the charon.signature_authentication_constraints
functionality, that is, if no explicit IKE signature schemes are
configured we apply all regular signature constraints as IKE constraints.
Tobias Brunner [Fri, 4 Mar 2016 15:03:07 +0000 (16:03 +0100)]
Merge branch 'ike-redirect'
This adds support for IKEv2 redirection (RFC 5685). There is currently
no default implementation of the redirect_provider_t interface provided.
Plugins may implement the interface to decide if and when to redirect
connecting clients. It is also possible to redirect established IKE_SAs
via VICI/swanctl.
Tobias Brunner [Thu, 21 May 2015 12:56:01 +0000 (14:56 +0200)]
ike-init: Verify REDIRECT notify before processing IKE_SA_INIT message
An attacker could blindly send a message with invalid nonce data (or none
at all) to DoS an initiator if we just destroy the SA. To prevent this we
ignore the message and wait for the one by the correct responder.
ike-sa: Reauthenticate to the same addresses we currently use
If the SA got redirected this would otherwise cause a reauthentication with
the original gateway. Reestablishing the SA to the original gateway, if e.g.
the new gateway is not reachable makes sense though.
ike-auth: Send REDIRECT notify during IKE_AUTH if requested by providers
To prevent the creation of the CHILD_SA we set a condition on the
IKE_SA. We also schedule a delete job in case the client does not
terminate the IKE_SA (which is a SHOULD in RFC 5685).