Commit Graph

3318 Commits

Author SHA1 Message Date
Tobias Brunner 0d424d2107 redirect-job: Add job to redirect an active IKE_SA 2016-03-04 16:02:59 +01:00
Tobias Brunner 71c7070588 ike-sa: Add redirect() method to actively redirect an IKE_SA 2016-03-04 16:02:59 +01:00
Tobias Brunner 0840385b27 ike-redirect: Add task to redirect active IKE_SAs 2016-03-04 16:02:59 +01:00
Tobias Brunner f5a9025ce9 ike-auth: Handle REDIRECT notifies during IKE_AUTH 2016-03-04 16:02:59 +01:00
Tobias Brunner f20e00fe54 ike-sa: Handle redirect requests for established SAs as reestablishment
We handle this similar to how we do reestablishing IKE_SAs with all CHILD_SAs,
which also includes the one actively queued during IKE_AUTH.

To delete the old SA we use the recently added ike_reauth_complete task.
2016-03-04 16:02:59 +01:00
Tobias Brunner 19233ef980 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).
2016-03-04 16:02:59 +01:00
Tobias Brunner fdc4b82728 ike-config: Do not assign attributes for redirected IKE_SAs 2016-03-04 16:02:59 +01:00
Tobias Brunner b6fcb91762 child-create: Don't create CHILD_SA if the IKE_SA got redirected in IKE_AUTH 2016-03-04 16:02:59 +01:00
Tobias Brunner d68c05d269 ike-sa: Add a condition to mark redirected IKE_SAs 2016-03-04 16:02:58 +01:00
Tobias Brunner 3d074bce00 ike-init: Handle REDIRECTED_FROM similar to REDIRECT_SUPPORTED as server 2016-03-04 16:02:58 +01:00
Tobias Brunner 6cde9875e1 ike-init: Send REDIRECTED_FROM instead of REDIRECT_SUPPORTED if appropriate 2016-03-04 16:02:58 +01:00
Tobias Brunner e4af6e6b7a ike-sa: Keep track of the address of the gateway that redirected us 2016-03-04 16:02:58 +01:00
Tobias Brunner 489d154e63 ikev2: Add option to disable following redirects as client 2016-03-04 16:02:58 +01:00
Tobias Brunner c126ddd048 ikev2: Handle REDIRECT notifies during IKE_SA_INIT 2016-03-04 16:02:58 +01:00
Tobias Brunner dd2b335b79 ike-init: Send REDIRECT notify during IKE_SA_INIT if requested by providers 2016-03-04 16:02:58 +01:00
Tobias Brunner 2beb26b948 redirect-manager: Add helper function to create and parse REDIRECT notify data
The same encoding is also used for the REDIRECT_FROM notifies.
2016-03-04 16:02:58 +01:00
Tobias Brunner fa5cfbdcbf redirect-manager: Verify type of returned gateway ID 2016-03-04 16:02:58 +01:00
Tobias Brunner 10009b2954 ike-init: Send REDIRECT_SUPPORTED as initiator 2016-03-04 16:02:58 +01:00
Tobias Brunner 099c0b12b6 ike-init: Enable redirection extension if client sends REDIRECT_SUPPORTED notify 2016-03-04 16:02:58 +01:00
Tobias Brunner c6aa749c28 ike-sa: Add new extension for IKEv2 redirection (RFC 5685) 2016-03-04 16:02:58 +01:00
Tobias Brunner 32ba44424d daemon: Create global redirect manager instance 2016-03-04 16:02:58 +01:00
Tobias Brunner 4a6e054122 redirect-manager: Add manager for redirect providers 2016-03-04 16:02:58 +01:00
Tobias Brunner dbb3f7f921 redirect-provider: Add interface to redirect clients during initial messages
This will allow e.g. plugins to decide whether a connecting client is
redirected to a different gateway using RFC 5685.
2016-03-04 16:02:57 +01:00
Andreas Steffen ad82c95f0a Set PLUTO port variables to 0 in the case of no port restrictions 2016-03-04 12:52:35 +01:00
Andreas Steffen 0d7202c7c5 Port range support in updown script 2016-03-04 09:52:34 +01:00
Andreas Steffen 6abae81f86 Implemented port ranges in kernel_netlink interface 2016-03-04 09:52:34 +01:00
Tobias Brunner 28649f6d91 libhydra: Remove empty unused library 2016-03-03 17:36:11 +01:00
Tobias Brunner 8394ea2a42 libhydra: Move kernel interface to libcharon
This moves hydra->kernel_interface to charon->kernel.
2016-03-03 17:36:11 +01:00
Tobias Brunner dec9e1957f libhydra: Move all kernel plugins to libcharon 2016-03-03 17:36:11 +01:00
Tobias Brunner 91d80298f9 ikev1: Send and verify IPv6 addresses correctly
According to the mode-config draft there is no prefix sent for
IPv6 addresses in IKEv1.  We still accept 17 bytes long addresses for
backwards compatibility with older strongSwan releases.

Fixes #1304.
2016-03-03 17:32:03 +01:00
Tobias Brunner 2f3c08d268 ikev1: Allow immediate deletion of rekeyed CHILD_SAs
When charon rekeys a CHILD_SA after a soft limit expired, it is only
deleted after the hard limit is reached.  In case of packet/byte limits
this may not be the case for a long time since the packets/bytes are
usually sent using the new SA.  This may result in a very large number of
stale CHILD_SAs and kernel states.  With enough connections configured this
will ultimately exhaust the memory of the system.

This patch adds a strongswan.conf setting that, if enabled, causes the old
CHILD_SA to be deleted by the initiator after a successful rekeying.

Enabling this setting might create problems with implementations that
continue to use rekeyed SAs (e.g. if the DELETE notify is lost).
2016-03-03 17:28:03 +01:00
Tobias Brunner 904f93f655 ikev1: Avoid modifying local auth config when detecting pubkey method
If it was necessary to pass the local certificates we could probably
clone the config (but we don't do that either when later looking for the
key to actually authenticate).
Passing auth adds the same subject cert to the config over and over
again (I guess we could also try to prevent that by searching for
duplicates).
2016-03-03 17:26:14 +01:00
Tobias Brunner 444565325a forecast: Fix alignment when adding rules
Basically the same issue as with the connmark plugin.

Fixes #1212.
2016-03-03 17:20:37 +01:00
Tobias Brunner c4cb652a56 connmark: Fix alignment when adding rules
The structs that make up a message sent to the kernel have all to be
aligned with XT_ALIGN.  That was not necessarily the case when
initializing the complete message as struct.

Fixes #1212.
2016-03-03 17:20:09 +01:00
Tobias Brunner efd7fa7be1 ike: Keep track of send keepalive jobs to avoid scheduling more than one per IKE_SA 2016-03-03 17:15:37 +01:00
Tobias Brunner 34f7d3b7ae ike: Don't send NAT keepalives if we have no path to the other peer
If there is no path to the other peer there is no point in trying to
send a NAT keepalive.

If the condition changes back and forth within the keepalive interval there
is a chance that multiple jobs get queued.
2016-03-03 17:15:37 +01:00
Tobias Brunner 35d0b8b152 vici: Provide ports of local and remote IKE endpoints 2016-03-03 17:13:35 +01:00
Denis Volpato Martins 337cf81aef duplicheck: Include required headers for FreeBSD
Closes strongswan/strongswan#34.
2016-03-03 09:34:03 +01:00
Thomas Egerer 2080c7e1e2 charon: Add custom logger to daemon
This logger can be used to easily register custom logging instances
using __attribute__((constructor)) benefiting from the global reload
mechanism (with reset of log levels).

Note that this is not intended to be used from plugins, which are loaded
after loggers have already been initialized.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-03-01 11:48:52 +01:00
Tobias Brunner fedb16236c vici: Correctly document 'up' key for updown events
Instead of sending 'no' it is omitted when an SA goes down.
2016-03-01 11:05:34 +01:00
Thomas Egerer 7823393926 ikev2: Use config value for sending of vendor IDs
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-03-01 10:52:59 +01:00
Tobias Brunner c674233804 ike-sa-manager: Store a reference to the thread that checked out an IKE_SA
This could be helpful when debugging deadlocks that manifest around
wait_for_entry(), as it helps identifying other involved threads (the
thread object is seen in the thread_main() call in each thread's backtrace).
2016-02-17 11:21:42 +01:00
Andreas Steffen 4d83c5b4a6 Fix of the mutual TNC measurement use case
If the IKEv2 initiator acting as a TNC server receives invalid TNC measurements
from the IKEv2 responder acting as a TNC clienti, the exchange of PB-TNC batches
is continued until the IKEv2 responder acting as a TNC server has also finished
its TNC measurements.

In the past if these measurements in the other direction were correct
the IKEv2 responder acting as EAP server declared the IKEv2 EAP authentication
successful and the IPsec connection was established even though the TNC
measurement verification on the EAP peer side failed.

The fix adds an "allow" group membership on each endpoint if the corresponding
TNC measurements of the peer are successful. By requiring a "allow" group
membership in the IKEv2 connection definition the IPsec connection succeeds
only if the TNC measurements on both sides are valid.
2016-02-16 18:00:27 +01:00
Tobias Brunner 10c5981d3b utils: Add enum name for pseudo log group 'any' 2016-02-05 15:41:39 +01:00
Tobias Brunner e8140531fc libipsec: Pass the same data to del_policy() as to add_policy()
We already do this for the other kernel interfaces.

Fixes e1e88d5add ("libipsec: Don't attempt deletion of any non-IPsec policies")
2016-02-04 11:02:59 +01:00
Thomas Egerer 3d15269af9 ikev2: Add debug message about failed IKE authentication
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-02-02 16:16:49 +01:00
Thomas Egerer beb4a07ea8 ikev1: Log successful authentication with signature scheme
Output is now identical to that of the IKEv2 pubkey authenticator.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-02-01 15:58:53 +01:00
Tobias Brunner b4ae9e81f5 peer-cfg: Set DPD timeout to at least DPD delay
If DPD timeout is set but to a value smaller than the DPD delay the code
in task_manager_v1.c:queue_liveliness_check will run into an integer
underrun.
2016-02-01 15:29:25 +01:00
Tobias Brunner 24ab8530e5 ikev1: Always enable charon.reuse_ikesa
With IKEv1 we have to reuse IKE_SAs as otherwise the responder might
detect the new SA as reauthentication and will "adopt" the CHILD_SAs of
the original IKE_SA, while the initiator will not do so.  This could
cause CHILD_SA rekeying to fail later.

Fixes #1236.
2016-02-01 11:37:41 +01:00
Tobias Brunner db57f5702b load-tester: Register kernel-ipsec implementation as plugin feature
Otherwise, libcharon's dependency on kernel-ipsec can't be satisfied.

This changed with db61c37690 ("kernel-interface: Return bool for
kernel interface registration") as the registration of further
kernel-ipsec implementations now fails and therefore even if other
plugins are loaded the dependency will not be satisfied anymore.

References #953.
2016-02-01 11:22:56 +01:00