Commit Graph
19030 Commits
Author SHA1 Message Date
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
Andreas Steffen a215008c11 Version bump to 5.3.3 2015-09-06 15:05:36 +02:00
Andreas Steffen 2b5c543051 testing: added ikev2/alg-chacha20poly1305 scenario 2015-09-01 17:30:15 +02:00
Andreas Steffen 57eb3b2b25 testing: update to Linux 4.2 kernel 2015-09-01 17:29:30 +02:00
Andreas Steffen 01604016f7 Version bump to 5.3.3rc2 2015-09-01 13:16:43 +02:00
Tobias Brunner adb4db475e imv-os: Add some useful usage output to the pacman utility
Fixes #487.
2015-08-31 16:02:11 +02:00
Tobias Brunner 7b20ab0a94 kernel-netlink: Properly set port mask for ICMP type/code if only set on one side
If only one traffic selector had a port (type/code) the other side had
the port mask set to 0, which canceled out the applied type/code.

It also fixes the installation of ICMP type/code on big-endian hosts.

Fixes #1091.
References #595.
2015-08-31 15:30:57 +02:00
Tobias Brunner d34a82dd57 kernel-pfkey: Properly encode ICMP type/code if only set on one side
References #595.
2015-08-31 15:30:51 +02:00
Tobias Brunner e9ea7e6fb7 testing: Updated environment variable documentation in updown scripts 2015-08-31 11:00:05 +02:00
Tobias Brunner 64ee81cecf libimcv: Updated Android.mk file 2015-08-31 10:53:44 +02:00
Tobias Brunner 18e0d66b60 NEWS: Added additional news 2015-08-28 18:10:37 +02:00
Tobias Brunner 00c2c87b06 eap-radius: Fix creation of host_t objects based on Framed-IPv6-Address attributes
Fixes ec490e68ae ("eap-radius: Add support for some basic IPv6-specific RADIUS attributes").
References #1001.
2015-08-28 16:52:57 +02:00
Tobias Brunner 486d7b2671 conf: Add documentation for new osx-attr option 2015-08-28 15:49:58 +02:00
Tobias Brunner 592f31f5af pki: Add new type options to --issue command usage output 2015-08-27 17:55:15 +02:00
Tobias Brunner 6b0bdda010 conf: Fix declaration of default values for imc-hcd options 2015-08-27 17:07:13 +02:00
Tobias Brunner cfd61a963d starter: Remove documentation for starter.load option 2015-08-27 16:42:09 +02:00
Tobias Brunner fbb593092e eap-ttls: Limit maximum length of tunneled EAP packet to EAP-TTLS packet 2015-08-27 15:29:16 +02:00
Tobias Brunner 03024f4ca8 trap-manager: Cleanup local address in error cases 2015-08-27 14:45:11 +02:00
Tobias Brunner 30ac5c331a imv-os: Properly free strings for invalid input in pacman 2015-08-27 14:42:05 +02:00
Tobias Brunner e3e208fb9f ha: Close control FIFO if it is not valid 2015-08-27 14:31:42 +02:00
Tobias Brunner 0709280175 swanctl: Correctly build man page in out-of-tree builds from the repository 2015-08-27 12:46:53 +02:00
Tobias Brunner 7a1fed284c Fixed some typos, courtesy of codespell 2015-08-27 12:06:31 +02:00
Tobias Brunner c605a96d7f Fix some Doxygen issues 2015-08-27 12:03:11 +02:00
Tobias Brunner 0737e936e0 unit-tests: Additional test cases to increase coverage 2015-08-27 11:47:36 +02:00
Tobias Brunner fe2443b01c traffic-selector: Use calc_netbits() in RFC 3779 constructor
This properly detects prefixes encoded as ranges.
2015-08-27 11:47:36 +02:00
Tobias Brunner df62141362 ike: Fix half-open count for initiating SAs when initially checked in 2015-08-27 11:21:01 +02:00
Tobias Brunner 735f929ca7 ike: Only consider number of half-open SAs as responder when deciding whether COOKIEs are sent 2015-08-27 11:18:51 +02:00
Andreas Steffen 5de8703ee0 Version bump to 5.3.3rc1 2015-08-25 15:10:13 +02:00
Andreas Steffen cdb61c3e88 Added some spaces in swanctl.conf 2015-08-25 15:10:13 +02:00
Evan Broder 78ed330099 vici: Handle closed sockets in the Ruby gem
From recvfrom(2) (which UDPSocket#recv backs into):

  The return value will be 0 when the peer has performed an orderly
  shutdown.

(i.e. it will return an empty string)

Previously in this scenario, Vici::Transport#recv_all would spin
forever trying to pull more data off the socket. I'm not entirely
clear what happened that caused strongSwan to shutdown the socket, but
it probably should not cause vici Ruby apps to spin.

Closes strongswan/strongswan#13.
2015-08-24 11:24:05 +02:00
Tobias Brunner ba3298fa8d Merge branch 'starter-kernel-flush'
Removes flushing of the IPsec state in the kernel when starter
terminates.  We can't easily flush only the policies created for
IPsec SAs (and if installpolicies=no is used we don't want to flush
policies anyway).  Also, since existing policies don't cause errors
anymore these aren't really an issue anymore (I think this was one of
the main reasons to flush the state).  This behavior is also specific to
starter, so nothing is flushed when charon is used via systemd/swanctl.
This will also allow us to merge libhydra with libcharon in a future
release.

If the previous behavior is needed it can easily be replicated with some
external tools (we could also write a simple utility that does this).

Additional checks in the test environment make sure that the daemon
cleans up the state properly.
2015-08-21 18:27:12 +02:00
Tobias Brunner 9086f060d3 testing: Let test scenarios fail if IPsec SAs or policies are not removed
The IKE daemon should delete all installed SAs and policies when
everything works properly, so we fail the test if that's not the case.
2015-08-21 18:27:06 +02:00
Tobias Brunner c91682d1b8 testing: Flush state and policies before every scenario
Similar to conntrack we make sure we are working on a clean slate.
2015-08-21 18:27:06 +02:00
Tobias Brunner d8fdd1018e starter: Don't flush SAs in the kernel
If starter is not used we don't do that either. And this allows us to
move the stuff in libhydra back to libcharon.
2015-08-21 18:27:06 +02:00
Tobias Brunner bd24f87d35 starter: Don't flush policies in the kernel
We can't control which policies we flush, so if policies are installed
and used outside of strongSwan for other protocols we'd flush them too.
And if installpolicies=no is used we probably shouldn't flush policies
either.  Luckily already existing policies are not treated as fatal
errors anymore, so not flushing policies should not be that much of an
issue (in case of a crash in dynamic setups, e.g. with virtual IPs,
policies could be left behind even after restarting the connections and
properly terminating the daemon).
2015-08-21 18:27:05 +02:00
Tobias Brunner 603e3b489b kernel-pfkey: Only flush SAs of types we actually manage 2015-08-21 18:27:05 +02:00
Tobias Brunner 82b5d1c018 kernel-netlink: Only flush SAs of types we actually manage 2015-08-21 18:27:05 +02:00
Tobias Brunner d88cec920c Merge branch 'init-limits'
IKE_SAs that are initiated are now counted towards the half-open IKE_SAs
limit.  Optionally it is possible to enforce limits towards the number of
half-open IKE_SAs and the job load also when initiating SAs.  This is
currently only possible via VICI.
2015-08-21 18:21:24 +02:00
Tobias Brunner 256e666d22 vici: Optionally check limits when initiating connections
If the init-limits parameter is set (disabled by default) init limits
will be checked and might prevent new SAs from getting initiated.
2015-08-21 18:21:13 +02:00