Commit Graph

13771 Commits

Author SHA1 Message Date
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
Tobias Brunner fd19feefa4 bliss: Remove unnecessary cast to double
Coverity is still not happy when the result of an integer division is
assigned to a double (without e.g. casting the result to an int first to
indicate the intent).  The shift should avoid this issue.
2014-12-23 15:40:01 +01:00
Tobias Brunner 078fe7aae6 bliss: Log type if unsupported 2014-12-23 15:40:01 +01:00
Tobias Brunner a8e82ace8a bliss: Make sure sampler exists after checking for it earlier 2014-12-23 15:40:01 +01:00
Tobias Brunner 027c19b097 pts: Do not override status with SUCCESS if length is invalid 2014-12-23 15:40:01 +01:00
Tobias Brunner 919449a3f1 NEWS: Added info about CVE-2014-9221 2014-12-23 15:40:01 +01:00
Tobias Brunner 691d00f166 ikev2: Only touch the DH object if we have a matching proposal 2014-12-23 15:40:01 +01:00
Tobias Brunner e13ef5c434 crypto: Define MODP_CUSTOM outside of IKE DH range
Before this fix it was possible to crash charon with an IKE_SA_INIT
message containing a KE payload with DH group MODP_CUSTOM(1025).
Defining MODP_CUSTOM outside of the two byte IKE DH identifier range
prevents it from getting negotiated.

Fixes CVE-2014-9221.
2014-12-23 15:40:01 +01:00
Tobias Brunner 6683cf6a5a pki: Document correct output formats for --pkcs12 --export 2014-12-19 16:31:36 +01:00
Tobias Brunner a6c0dec0e5 pki: Properly clean up if output format for --pkcs12 is wrong 2014-12-19 16:30:10 +01:00
Tobias Brunner 8edea13a5a kernel-netlink: Add missing documentation for two options 2014-12-19 15:36:01 +01:00
Martin Willi 55e7a0cafb Merge branch 'osx-app'
Mainline the OS X App providing the graphical user interface for the charon-xpc
privileged helper.
2014-12-18 09:50:50 +01:00
Martin Willi 7f82a8f34b osx: Update the README with App related bits 2014-12-17 16:54:28 +01:00
Martin Willi dacd667c84 osx: Initial import of the Objective-C App graphical user interface 2014-12-17 16:53:45 +01:00
Martin Willi 04337fed02 apple: Redefine some additional clashing Mach types
While they usually are not included in a normal strongSwan build, the XPC
header indirectly defines these Mach types. To build charon-xpc, which uses
both XPC and strongSwan includes, we have to redefine these types.
2014-12-16 17:22:28 +01:00
Martin Willi 6fa203b8d4 kernel-pfroute: If a new interface appears, slightly delay address enumeration
On OS X 10.10, when installing a virtual IP on a tun device, there is a chance
that a RTM_IFANNOUNCE is sent before the IP is ready on that link when calling
getifaddrs(). As we don't get an RTM_NEWADDR event either, that race lets us
miss the virtual IP install event, failing the add_ip() call.
2014-12-16 17:22:28 +01:00
Martin Willi 1c6188a0c2 charon-xpc: Add a work-around to trigger IP address add events after boot 2014-12-16 17:22:27 +01:00