Commit Graph

14668 Commits

Author SHA1 Message Date
Tobias Brunner f36b6d49af testing: Adapt tests to retransmission settings and reduce DPD delay/timeout 2015-11-09 15:18:34 +01:00
Tobias Brunner 50a43fbb97 ipsec: Quit script quicker for ipsec stop
It rarely takes 1 second or longer to terminate the daemon.  This
decreases the runtime of the post test step a lot where `ipsec stop`
is called for multiple hosts in each test case (10-15 minutes over all
test cases).
2015-11-09 15:18:34 +01:00
Tobias Brunner 8713e32435 testing: Only send two retransmits after 1 second each to fail negative tests earlier 2015-11-09 15:18:34 +01:00
Tobias Brunner 9a0871ab94 testing: Add a base strongswan.conf file used by all hosts in all scenarios
We will use this to set some defaults (e.g. timeouts to make testing
negative tests quicker).  We don't want these settings to show up in the
configs of the actual scenarios though.
2015-11-09 15:18:34 +01:00
Tobias Brunner bd5084ae25 xauth: Call authorize() hook also when xauth-noauth is used
Fixes #1138.
2015-11-09 14:44:53 +01:00
Tobias Brunner 50e4aeb22f libtnccs: Optionally use RTLD_NOW to load IMC/IMVs with dlopen() 2015-11-09 14:37:08 +01:00
Tobias Brunner 305c4aa82c plugin-loader: Optionally use RTLD_NOW with dlopen()
This can be useful when writing custom plugins as typos or missing
linker flags that result in unresolved symbols in the shared object
could otherwise cause late crashes.  In particular, if such a symbol
is used in a code path that is rarely executed.  During development
and testing using RTLD_NOW instead of RTLD_LAZY will prevent the
plugin from getting loaded and makes the error visible immediately.
2015-11-09 14:37:08 +01:00
Tobias Brunner 7bea8e0f4a windows: Define RTLD_NOW, even if it is not used 2015-11-09 14:37:07 +01:00
Renato Botelho dff2d05bb9 kernel-pfkey: Enable ENCR_AES_CTR when it's available
Obtained-from:	pfSense
Sponsored-by:	Rubicon Communications (Netgate)
Closes strongswan/strongswan#17.
2015-11-09 12:01:18 +01:00
Tobias Brunner 04f22cdabc vici: Add NAT information when listing IKE_SAs
The `nat-local` and `nat-remote` keys contain information on the NAT
status of the local and remote IKE endpoints, respectively.  If a
responder did not detect a NAT but is configured to fake a NAT situation
this is indicated by `nat-fake` (if an initiator fakes a NAT situation
`nat-local` is set).  If any NAT is detected or faked `nat-any` is set.

Closes strongswan/strongswan#16.
2015-11-09 11:55:51 +01:00
Tobias Brunner 4fc0a9d40b Merge branch 'iv-gen-null-encr'
Fixes NULL encryption in libipsec.

Fixes #1174.
2015-11-09 11:16:12 +01:00
Tobias Brunner 17816515d2 testing: Add libipsec/net2net-null scenario 2015-11-09 11:09:48 +01:00
Tobias Brunner f6083d350c iv-gen: Use NULL IV generator for NULL encryption
We don't need an IV for NULL encryption, so we wouldn't technically need
an IV generator.  But some of the code currently relies on an IV
generator to be present.  So we don't have to change that code and
handle IV size == 0 specially we use the new NULL IV generator, which
handles this transparently to the existing code.

Before 3c81cb6fc3 ("aead: Create AEAD using traditional transforms
with an explicit IV generator") iv_gen_rand_t was used for NULL
encryption, which would work too but this way it's clearer.
2015-11-09 11:09:18 +01:00
Tobias Brunner 403acf8614 crypto: Add NULL IV generator
This does not actually allocate an IV and only accepts requests
for size == 0.
2015-11-09 11:08:22 +01:00
Tobias Brunner 32ebb56c5b configure: Load sha1 and random plugins in manager by default
If the openssl plugin is not enabled we need these to generate session
IDs and to authenticate the users.

The md4 plugin is not needed in the manager.

Fixes #1168.
2015-11-09 11:03:47 +01:00
Tobias Brunner 7b95688124 stroke: Make down-nb actually non-blocking
Fixes #1191.
2015-11-09 10:55:46 +01:00
Andreas Steffen f1f7134ecb Version bump to 5.3.4dr2 2015-11-06 16:07:04 +01:00
Andreas Steffen 23a50e66f1 testing: Updated hasher tests 2015-11-06 16:05:44 +01:00
Andreas Steffen a88d958933 Explicitly mention SHA2 algorithm in BLISS OIDs and signature schemes 2015-11-06 14:55:31 +01:00
Andreas Steffen 6590298dad Version bump to 5.3.4dr1 2015-11-04 19:42:17 +01:00
Andreas Steffen 83c1883d0b Use word-aligned XOR in sha3_absorb() 2015-11-03 21:35:09 +01:00
Andreas Steffen a98360a64c testing: BLISS CA uses SHA-3 in its CRL 2015-11-03 21:35:09 +01:00
Andreas Steffen f6fede934b Support BLISS signatures with SHA-3 hash 2015-11-03 21:35:09 +01:00
Andreas Steffen a488584b5f Implemented SHA-3 hash algorithm including test vectors 2015-11-03 21:35:09 +01:00
Andreas Steffen de61e2cef4 Defined SHA-3 hashers 2015-11-03 19:07:15 +01:00
Tobias Brunner 92ef3c2f21 testing: Update tkm to version 0.1.3
Adds XFRM state/policy flush when terminating which caused tests to fail
due to the check added with 9086f060d3 ("testing: Let test scenarios
fail if IPsec SAs or policies are not removed").
2015-10-30 11:19:44 +01:00
Tobias Brunner 1f3a9fdde5 libipsec: Properly support CAMELLIA in CTR mode 2015-10-30 11:04:42 +01:00
Tobias Brunner 0af13d2849 ikev2: Fix size of key material for CAMELLIA-CTR
Like AES in CTR mode it includes a 4 byte nonce.
2015-10-30 11:04:42 +01:00
Tobias Brunner 0e80127691 libipsec: Fix crypter lookup for AES-CTR
Due to the nonce, the ESP key material is four bytes longer than needed for
the actual AES key.  The crypto plugins, however, register their AES-CTR
implementations with the AES key length, so the lookup here failed.

For IKEv2 the key material is allocated after creating a crypter instance
with the negotiated AES key size.  The length of the actual key material is
retrieved via get_key_size(), which adds the four bytes to the AES key length.

Fixes #1124.
2015-10-30 10:54:45 +01:00
Tobias Brunner 72cc029e24 ike-mobike: Send retransmits to the current local and remote addresses
These might have changed by a peer-initiated MOBIKE address update.

Fixes #1125.
2015-10-30 10:51:07 +01:00
Tobias Brunner d7e3433182 Merge branch 'ikev1-cache-informational'
With these changes an INFORMATIONAL message (e.g. with an INITIAL_CONTACT
notify) that arrives while a responder is waiting for the last Aggressive
Mode request gets queued and delivered later.  Previously such messages
caused the IKE_SA to fail as some tasks waiting for the last AM message
fail when trying to handle the INFORMATIONAL message.  Therefore, all
other messages, such as TRANSACTION and QUICK_MODE requests, are now
dropped until AM is complete.  These don't have to be cached as they get
retransmitted by the other peer.

Fixes #1130.
2015-10-30 10:43:40 +01:00
Tobias Brunner 25863fe1c7 ikev1: Handle queued INFORMATIONAL message after receiving the last AM request 2015-10-30 10:30:30 +01:00
Tobias Brunner 1c8dfa30d0 ikev1: Queue INFORMATIONAL request if AM is not complete yet 2015-10-30 10:30:30 +01:00
Tobias Brunner 3805880c8a ikev1: Handle queued TRANSACTION messages only after processing replies 2015-10-30 10:30:07 +01:00
Tobias Brunner 3f56f73159 ikev1: Extract queueing of TRANSACTIONAL requests when MM is not complete yet 2015-10-30 10:27:09 +01:00
Tobias Brunner b0b0c9137d ikev1: Drop TRANSACTION/QUICK_MODE requests until we received the last AM message 2015-10-30 10:27:09 +01:00
Tobias Brunner 0cb8752b85 ikev1: Make maximum number of IKEv1 phase 2 exchanges we keep state about configurable
Fixes #1128.
2015-10-30 10:16:35 +01:00
Tobias Brunner 3195650180 Fix typo in error handling for sigwaitinfo() in charon-systemd and charon-tkm
Fixes 858148092d ("Replace usages of sigwait(3) with sigwaitinfo(2)")
2015-10-29 17:40:31 +01:00
Tobias Brunner 35dbf8af7a random: Properly handle errors when reading from /dev/[u]random
If -1 was returned on the first call to read() `done` got SIZE_MAX
and the function returned TRUE even though no actual random data had
been allocated.

Fixes #1156.
2015-10-29 16:17:17 +01:00
Tobias Brunner 37a22a166b ikev1: Avoid fourth QM message if third QM messages of multiple exchanges are handled delayed
If we haven't received the third QM message for multiple exchanges the
return value of NEED_MORE for passive tasks that are not responsible for
a specific exchange would trigger a fourth empty QM message.

Fixes: 4de361d92c ("ikev1: Fix handling of overlapping Quick Mode exchanges")

References #1076.
2015-10-29 16:03:15 +01:00
Tobias Brunner 758b1caa0e ikev1: Prevent deadlock when checking for duplicate IKEv1 SAs
Previously, the current segment was held while checking for duplicate
SAs, which requires acquiring all segments.  If multiple threads did this
concurrently this resulted in a deadlock as they couldn't acquire the
segments held by the other threads attempting to do the same.  With the
default configuration only one segment is used, which prevents the problem
as only one thread can check in an IKE SA concurrently.

Fixes: a064eaa8a6 ("Handling of initial contact")
2015-10-29 15:59:41 +01:00
Tobias Brunner 858148092d Replace usages of sigwait(3) with sigwaitinfo(2)
This is basically the same call, but it has the advantage of being
supported by FreeBSD's valgrind, which sigwait() is not.

References #1106.
2015-10-29 15:38:37 +01:00
Tobias Brunner c6aa606a65 testing: Actually send an uncompressed packet in the ipv6/rw-compress-ikev2 scenario
The default of 56 bytes already exceeds the threshold of 90 bytes (8 bytes
ICMP + 40 bytes IPv6 = 104 bytes).  By reducing the size we make sure the
packet is not compressed (40 + 8 + 40 = 88).

This also fixes a strange failure of this scenario due to the recently
added post-test `ip xfrm state` check.  The kernel stores a reference to
the used SAs on the inbound skbuffs and since these are garbage collected
it could take a while until all references to an SA disappear and the SA
is finally destroyed.  But while SAs might not get destroyed immediately
when we delete them, they are actually marked as dead and therefore won't
show up in `ip xfrm state`.  However, that's not the case for the tunnel
SAs the kernel attaches to IPComp SAs, which we don't explicitly delete,
and which aren't modified by the kernel until the IPComp SA is destroyed.
So what happened when the last ping unintentionally got compressed is that
the skbuff had a reference to the IPComp SA and therefore the tunnel SA.
This skbuff often was destroyed after the `ip xfrm state` check ran and
because the tunnel SA would still get reported the test case failed.
2015-10-06 15:48:55 +02:00
Tobias Brunner 382f8a334a updown: Add rules to allow IP6IP6 traffic used for uncompressed small packets 2015-09-21 10:12:17 +02:00
Tobias Brunner 08afc33e52 shunt-manager: Resolve %dynamic to %any4/6 before installing policies
left|rightsubnet default to %dynamic, which is basically 0.0.0.0/0 until an
address is assigned to it.  So if only one side was undefined and the other
traffic selector was IPv6 an address family mismatch would occur.

References #595.
2015-09-16 15:01:05 +02:00
Tobias Brunner 65978f08f4 shunt-manager: Don't install policies in case of an address family or IP protocol mismatch
References #595.
2015-09-16 15:00:46 +02:00
Tobias Brunner 5f18e2c371 openssl: Explicitly include openssl/bn.h
If OpenSSL is compiled with OPENSSL_NO_DEPRECATED some of the headers
we include don't include openssl/bn.h anymore.  Therefore, we have to
explicitly include it ourselves where we use BN_* functions.

Fixes #1113.
2015-09-16 11:57:52 +02:00
Tobias Brunner dc486823aa unit-tests: Add a test to verify that there is no partial matching of RDNs 2015-09-09 14:39:26 +02:00
Tobias Brunner 221b0e93ee scepclient: Remove copyright and license from man page 2015-09-09 11:45:17 +02:00
Tobias Brunner e7143fe998 include: Add linux/socket.h
__kernel_sa_family_t is defined and used since Linux 3.1, so on systems
with older kernels (like CentOS 6.7, which still ships a 2.6.32 kernel) the
build with the current UAPI headers fails.  And using the native headers on
such system does not really work either because we use structs, defines, and
enum values from the newer headers in the kernel-netlink plugin.

__kernel_sa_family_t is defined in linux/socket.h so we ship that too (in
particular the simplified UAPI version from Linux 3.7+).

Fixes #1099.
2015-09-07 14:07:46 +02:00