Commit Graph

13987 Commits

Author SHA1 Message Date
Reto Buerki fa4f66cba3 charon-tkm: Make CHILD/ESP SA database public
Make the CHILD/ESP SA database a public member of the global tkm_t
struct.
2015-02-20 13:34:53 +01:00
Martin Willi 94eb09ac35 Merge branch 'reqid-alloc'
With these changes, charon dynamically allocates reqids for CHILD_SAs. This
allows the reuse of reqids for identical policies, and basically allows multiple
CHILD_SAs with the same selectors. As reqids do not uniquely define a CHILD_SA,
a new unique identifier for CHILD_SAs is introduced, and the kernel backends
use a proto/dst/SPI tuple to identify CHILD_SAs.

charon-tkm is not yet updated and expires are actually broken with this merge.
As some significant refactorings are required, this is fixed using a separate
merge.

References #422, #431, #463.
2015-02-20 13:34:52 +01:00
Reto Buerki e63cbb367c charon-tkm: Fix logger entity name in tests.c
Change 'test_runner' to 'test-runner'.
2015-02-20 13:34:52 +01:00
Martin Willi 246c969d8b ike: Consistently log CHILD_SAs with their unique_id instead of their reqid 2015-02-20 13:34:52 +01:00
Reto Buerki 8fce649d9a testing: Assert proper ESA deletion
Extend the tkm/host2host-initiator testcase by asserting proper ESA
deletion after connection shutdown.
2015-02-20 13:34:52 +01:00
Martin Willi fa42367ca1 unity: Reference IKE_SAs by the IKEv1 COOKIEs, improving lookup performance
When handling thousands of IKE_SAs, the unique ID based lookup is rather slow,
as we have no indexing.
2015-02-20 13:34:52 +01:00
Martin Willi db80d0d2da ike-sa-manager: Remove IKE_SA checkout by CHILD_SA reqid 2015-02-20 13:34:51 +01:00
Martin Willi 246dcf8691 migrate-job: Do CHILD_SA reqid lookup locally 2015-02-20 13:34:51 +01:00
Martin Willi b125839a1a kernel-interface: Raise mapping event with a proto/SPI/dst tuple 2015-02-20 13:34:51 +01:00
Martin Willi 85ace154d8 inactivity-job: Schedule job by CHILD_SA unique ID instead of reqid 2015-02-20 13:34:51 +01:00
Reto Buerki 84e391e08e charon-tkm: Fix compilation of ees_callback.c
Update the call to hydra->kernel_interface->expire to make
ees_callback.c compile again. The required destination host argument is
set to NULL for now.
2015-02-20 13:34:51 +01:00
Martin Willi f81a949748 kernel-interface: Raise expires with a proto/SPI/dst tuple instead of reqid 2015-02-20 13:34:50 +01:00
Martin Willi 971a91685d controller: Use the CHILD_SA unique_id to terminate CHILD_SAs 2015-02-20 13:34:50 +01:00
Martin Willi e4a131b1ce swanctl: List CHILD_SA unique ID as the primary identifier, but print reqid, too 2015-02-20 13:34:50 +01:00
Martin Willi 53cf7fa60a stroke: List CHILD_SA unique ID as the primary identifier, but print reqid, too 2015-02-20 13:34:50 +01:00
Martin Willi adc1885bf7 vici: Include the CHILD_SA unique ID in list-sa event 2015-02-20 13:34:50 +01:00
Martin Willi 38227d0e08 ike: Maintain per-IKE_SA CHILD_SAs in the global CHILD_SA manager 2015-02-20 13:34:49 +01:00
Martin Willi e732fb11a9 child-sa-manager: Add a global manager storing CHILD_SA relations
To quickly check out IKE_SAs and find associated CHILD_SAs, the
child_sa_manager stores relations between CHILD_SAs and IKE_SAs. It provides
CHILD_SA specific IKE_SA checkout functions wrapping the ike_sa_manager.
2015-02-20 13:34:49 +01:00
Martin Willi 85b238887d child-sa: Replace reqid based marks by "unique" marks
As we now use the same reqid for multiple CHILD_SAs with the same selectors,
having marks based on the reqid makes not that much sense anymore. Instead we
use unique marks that use a custom identifier. This identifier is reused during
rekeying, keeping the marks constant for any rule relying on it (for example
installed by updown).

This also simplifies handling of reqid allocation, as we do not have to query
the marks that is not yet assigned for an unknown reqid.
2015-02-20 13:34:49 +01:00
Martin Willi 4ec397b894 child-sa: Introduce a unique CHILD_SA identifier
As the reqid is not that unique even among multiple IKE_SAs anymore, we need
an identifier to uniquely identify a specific CHILD_SA instance.
2015-02-20 13:34:49 +01:00
Martin Willi 0da97f5060 child-sa: Delegate reqid allocation to the kernel interface 2015-02-20 13:34:49 +01:00
Martin Willi cc08ce83f0 kernel-interface: Add reqid allocation and release functions
To reassign reqids where appropriate, we explicitly allocate or confirm them
centrally on the kernel-interface.

Currently the state is stored in the kernel-interface wrapper for all
backends, but we may add appropriate methods to each backend to implement
a custom reqid allocation logic, if required.
2015-02-20 13:34:49 +01:00
Martin Willi 6d4649573e traffic-selector: Add a hash() method 2015-02-20 13:34:48 +01:00
Martin Willi 5499473c33 child-sa: Sort traffic selectors after adding CHILD_SA policies
Having traffic selectors sorted properly makes comparing them much simpler.
2015-02-20 13:34:48 +01:00
Martin Willi fc978f192f unit-tests: Add an initial set of traffic selector unit tests 2015-02-20 13:34:48 +01:00
Martin Willi 373a147fed traffic-selector: Add a compare function to sort traffic selectors 2015-02-20 13:34:48 +01:00
Martin Willi 698ed656f7 child-sa: Remove the obsolete update logic
The kernel backend uses an inbound parameter these days, where it makes
no sense to pass the update flag. The kernel backend decides itself how
it handles SA installation based on the inbound flag.
2015-02-20 13:34:48 +01:00
Martin Willi d05d85fe65 kernel-interface: Pass full list of traffic selectors to add_sa()
While we can handle the first selector only in BEET mode in kernel-netlink,
passing the full list gives the backend more flexibility how to handle this
information.
2015-02-20 13:34:47 +01:00
Martin Willi fd9417607c libipsec: Remove unused src/dst_ts parameters from ipsec_sa_mgr_t.add_sa() 2015-02-20 13:34:47 +01:00
Martin Willi 6ad787ca54 kernel-pfkey: Don't update during add_sa(), but delete SPI allocation state 2015-02-20 13:34:47 +01:00
Martin Willi 2a1c9e20bd kernel-interface: Remove reqid parameter from get_spi/get_cpi() methods
The reqid is not strictly required, as we set the reqid with the update
call when installing the negotiated SA.

If we don't need a reqid at this stage, we can later allocate the reqid in
the kernel backend once the SA parameters have been fully negotaited. This
allows us to assign the same reqid for the same selectors to avoid conflicts
on backends this is necessary.
2015-02-20 13:34:32 +01:00
Martin Willi 3e779ff555 libipsec: Remove unused reqid parameter from ipsec_sa_mgr_t.get_spi() 2015-02-19 15:42:22 +01:00
Martin Willi 970378c557 libtls: Don't send TLS close notifies in EAP after application succeeds
With the introduction of PT-TLS, we started sending TLS close notifies after
the application layer completes (7bbf7aa9). While this makes sense for TCP based
transports, it is not required in EAP methods. In EAP, handshake completion
can be directly signaled using the outer EAP-SUCCESS message. This also saves
one round-trip in the EAP exchange.

Windows 7/8 does not seem to like TLS close notifies at all in EAP, and either
stalls (EAP-TTLS) or disconnects (PEAP).

Fixes #556.
2015-02-19 11:29:07 +01:00
Thomas Egerer 875f7be5fc ha: Perform child rekeying outside of CHILD_SA enumerator
When rekey_child_sa is called while enumerating the children of an IKE_SA, and
the child to be rekeyed is redundant a QUICK_DELETE task is queued instead of a
QUICK_MODE task. This alters the IKE_SA's list of children (ike_sa_t::child_sas)
invalidating the current element of the child_sa_enumerator. The enumerate
function of linked_list_t will then advance to an element with unpredictable
contents most likely resulting in an segmentation violation. A similar behavior
should be observed when delete_child_sa is called.

This patch creates a list of protocol/spi values while holding the
child_sa_enumerator and performs the rekeying (deletion of redundant) chlidren
after releasing the enumerator.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2015-02-19 10:58:40 +01:00
Tobias Brunner 5cc0b23886 mem-pool: Document reassign_online option 2015-02-12 12:17:48 +01:00
Tobias Brunner aaf9911aeb man: Document IKEv2 fragmentation in ipsec.conf(5) 2015-02-10 18:38:54 +01:00
Tobias Brunner 482810141c configure: Load SQL backends after crypto plugins
If the MySQL client library is linked against OpenSSL the mysql plugin
will cause a segmentation fault when it is unloaded after the openssl
plugin has already been deinitialized.  This is very similar to the issues
with curl (see 44b6a34d43).

Fixes #814.
2015-02-10 16:08:09 +01:00
Martin Willi c6bc167c0b stroke: Double the stroke message string buffer size 2015-02-06 16:44:39 +01:00
Martin Willi eaa964b34e starter: Fail sending stroke message if a string exceeds the buffer size
Instead of silently setting the string value to NULL, we fail completely in
sending the message to notify the user.

Fixes #844.
2015-02-06 16:44:27 +01:00
Martin Willi b851f0a105 x509: Fix public key reference leak if authority key identifier does not match 2015-02-06 13:58:58 +01:00
Martin Willi c8992ea6d2 vici: Fix ruby gem author email 2015-01-22 15:00:45 +01:00
Andreas Steffen ecf605c6e1 trusted_enumerate requires an additional argument 2015-01-21 23:54:53 +01:00
Martin Willi 96df0a0ebd vici: Fix README example encoding element type values, off by one
While we fixed the wrong values in the description with d39e04b5, the example
values are still off by one.

Fixes #828.
2015-01-21 09:31:24 +01:00
Martin Willi 780bf2b8e9 libtls: Check for CHANGE_CIPHER_SPEC type only if upper layer returns NEED_MORE
A type is returned only if upper layers successfully created a record, that is
returns NEED_MORE. If we do not check for the return value, we might check a
previous record or the uninitialized type variable and falsely reset the
sequence number.
2015-01-12 14:18:24 +01:00
Maks Naumov aa71c19e5c starter: Fix mark_out.mask in starter_cmp_conn() 2015-01-12 11:17:12 +01:00
Tobias Brunner 8284e56d5b _updown: Remove obsolete man pages 2015-01-05 13:44:16 +01:00
Andreas Steffen 5028644943 Updated RFC3779 certificates 2014-12-28 12:53:16 +01:00
Andreas Steffen e9878d72db Version bump to 5.2.2 2014-12-23 15:40:02 +01:00
Andreas Steffen ee3b135687 unit-tests: Adapted to coverity fixes 2014-12-23 15:40:01 +01:00
Andreas Steffen 6139c8e524 Fixed bad bit shift and sign extension errors 2014-12-23 15:40:01 +01:00