Commit Graph

12284 Commits

Author SHA1 Message Date
Tobias Brunner bafd851896 mem-cred: Add methods to add/remove shared keys with unique identifiers
Also added is a method to enumerate the unique identifiers.
2017-02-16 19:21:12 +01:00
Tobias Brunner 04180409ad swanctl: Automatically unload removed private keys 2017-02-16 19:21:12 +01:00
Tobias Brunner 2a56acf501 vici: Add commands to enumerate and remove private keys
They are identified by their SHA-1 key identifier.
2017-02-16 19:21:12 +01:00
Tobias Brunner dd5ee9d415 mem-cred: Add method to remove a private key with a specific fingerprint 2017-02-16 19:21:12 +01:00
Tobias Brunner 257f6cb8e7 swanctl: Add possibility to query a specific pool by name 2017-02-16 19:21:12 +01:00
Tobias Brunner d20bf50e04 vici: Update get_pools() in Python and Ruby bindings 2017-02-16 19:21:12 +01:00
Tobias Brunner 71fa1224ec vici: Add option to query a specific pool 2017-02-16 19:21:12 +01:00
Tobias Brunner c2129d1cbe bypass-lan: Don't use interfaces in policies
After an interface disappeared we can't remove the policies correctly as
the name doesn't resolve to the previous index anymore.
And making the policies so specific might not provide that much benefit.

To handle the interfaces on the policies correctly would require some
changes to the child-cfg, kernel-interface etc. so they'd take interface
indices directly so we could target the policies correctly even if an
interface disappeared (or reappeared and got a new index).
2017-02-16 19:20:18 +01:00
Tobias Brunner 2de9bb30fe revocation: More accurately describe the flags to disable OCSP/CRL validation
These options disable validation as such, e.g. even from cached CRLs, not
only the fetching.  Also made the plugin's validate() implementation a
no-op if both options are disabled.
2017-02-15 10:41:38 +01:00
Eyal Birger 067fd2c69c child-sa: Do not install mark on inbound kernel SA
The SA ID (src, dst, proto, spi) is unique on ingress.

As such, explicit inbound marking is not needed to match an SA.

On the other hand, requiring inbound SAs to use marks forces the
installation of a mechanism for marking traffic (e.g. iptables) based
on some criteria.

Defining the criteria becomes complicated, for example when required to
support multiple SAs from the same src, especially when traffic is UDP
encapsulated.

This commit removes the assignment of the child_sa mark_in to the inbound SA.

Policies can be arbitrated by existing means - e.g, via netfilter policy
matching or using VTI interfaces - without the need to classify the flows prior
to state matching.

Since the reqid allocator regards the mark value, there is no risk of matching
the wrong policy.

And as explicit marking was required for route-based VPN to work before this
change, it should not cause regressions in existing setups.

Closes strongswan/strongswan#59.
2017-02-14 18:34:15 +01:00
Thomas Egerer 8a0bbb9355 unit-tests: Allow default test timeout to be configured via compile option
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2017-02-14 10:41:42 +01:00
Tobias Brunner 3ff5de05b3 tkm: Fix get_auth_octets() signature
Fixes: 267c1f7083 ("keymat: Allow keymat to modify signature scheme(s)")
2017-02-13 18:36:01 +01:00
Martin Willi 395500b8c1 kernel-netlink: Use RTA_SRC to specify route source in kernel-based lookups
For table dumps the kernel accepts RTA_PREFSRC to filter the routes, which is
what we do when doing userspace route calculations. For kernel-based route
lookups, however, the RTA_PREFSRC attribute is ignored and we must specify
RTA_SRC for policy based route lookups.
2017-02-13 15:11:20 +01:00
Martin Willi 558691b3b0 kernel-netlink: Use kernel-based route lookup if we do not install routes
For gateways with many connections, installing routes is often disabled,
as we can use a static route configuration to achieve proper routing with
a single rule. If this is the case, there is no need to dump all routes and
do userspace route lookups, as there is no need to exclude routes we installed
ourself.

Doing kernel-based route lookups is not only faster with may routes, but also
can use the full power of Linux policy based routing; something we can hardly
rebuild in userspace when calculating routes.
2017-02-13 15:11:20 +01:00
Martin Willi 72547830fb swanctl: List CHILD_SA marks, if set 2017-02-13 15:11:20 +01:00
Martin Willi 0b4e539cb3 vici: Include the Netfilter marks in listed CHILD_SAs 2017-02-13 15:11:20 +01:00
Martin Willi 22f08609f1 vici: Explicitly set the Python encoding type
When using vici over RPyC and its (awesome) splitbrain, encoding and decoding
strings fails in vici, most likely because of the Monkey-Patch magic splitbrain
uses.

When specifying the implicit UTF-8 as encoding scheme explicitly, Python uses
the correct method to encode/decode the string, making vici useable in
splitbrain contexts.
2017-02-13 15:04:44 +01:00
Tobias Brunner 2f6ec15dff unit-tests: Add test cases for MID sync exchanges 2017-02-08 15:11:00 +01:00
Tobias Brunner cbb6885e9b ikev2: Ignore IKEV2_MESSAGE_ID_SYNC notifies if extension is disabled
If this is the first message by the peer, i.e. we expect MID 0, the
message is not pre-processed in the task manager so we ignore it in the
task.

We also make sure to ignore such messages if the extension is disabled
and the peer already sent us one INFORMATIONAL, e.g. a DPD (we'd otherwise
consider the message with MID 0 as a retransmit).
2017-02-08 15:10:51 +01:00
Tobias Brunner c3d98d298e ikev2: Don't increase expected MID after handling MID sync message
If the responder never sent a message the expected MID is 0.  While
the sent MID (M1) SHOULD be increased beyond the known value, it's
not necessarily the case.
Since M2 - 1 would then equal UINT_MAX setting that MID would get ignored
and while we'd return 0 in the notify we'd actually expect 1 afterwards.
2017-02-08 15:03:26 +01:00
Tobias Brunner fb57904cbf ikev2: Don't cache response to MID sync request 2017-02-08 15:03:25 +01:00
Tobias Brunner 3abc104f7e ikev2: Accept INFORMATIONAL messages with MID 0 if used to sync MIDs
We are very picky to only allow MID 0 for these messages (while we
currently don't support IPSEC_REPLAY_COUNTER_SYNC notifies we accept
them).
2017-02-08 15:03:25 +01:00
Tobias Brunner d6ffa85fea ikev2: Negotiate support for IKE message ID synchronisation during IKE_AUTH 2017-02-08 15:03:25 +01:00
Tobias Brunner 5ab59221d2 ikev2: Add task to handle IKEV2_MESSAGE_ID_SYNC notifies as responder 2017-02-08 15:03:25 +01:00
Tobias Brunner 347c403cf6 ike: Publish getter for the current message ID on IKE_SA 2017-02-08 15:03:25 +01:00
Tobias Brunner 05a2be82c2 ike: Add getter for the current message ID to task manager 2017-02-08 15:03:25 +01:00
Tobias Brunner 21df4cc1ed kernel-pfroute: Implement enumeration of local subnets 2017-02-08 10:38:28 +01:00
Tobias Brunner 0aabfe0780 bypass-lan: Allow ignoring or only considering subnets of specific interfaces
The config can also be reloaded by sending a SIGHUP to charon.
2017-02-08 10:38:28 +01:00
Tobias Brunner 62b58a40da bypass-lan: Configure interface on bypass policy
Currently, only the kernel-netlink plugin supports this, the others will
just ignore it.
2017-02-08 10:38:28 +01:00
Tobias Brunner 2406474158 kernel-netlink: Return interface name in local subnet enumerator 2017-02-08 10:38:28 +01:00
Tobias Brunner 46c21e3cc3 kernel-interface: Add interface name to local subnet enumerator 2017-02-08 10:38:28 +01:00
Tobias Brunner f8a362bfbc bypass-lan: Add plugin that installs bypass policies for locally attached subnets 2017-02-08 10:38:28 +01:00
Tobias Brunner eac584a37d kernel-netlink: Implement enumerator for local subnets 2017-02-08 10:38:28 +01:00
Tobias Brunner 324fc2cb52 kernel-interface: Add method to enumerate locally attached subnets 2017-02-08 10:38:28 +01:00
Tobias Brunner 3c46ce2834 kernel-pfkey: Use the same priority range for trap and regular policies
Same as the change in the kernel-netlink plugin.
2017-02-08 10:36:38 +01:00
Tobias Brunner 0e9d6c4605 kernel-netlink: Use the same priority range for trap and regular policies
While trap and regular policies now often look the same (mainly because
reqids are kept constant) trap policies still need to have a lower priority
than regular policies to handle unroute/route correctly if e.g. IPComp
is used or the mode changes.  But if we use a completely different
priority range that's lower than that of regular policies it is not possible
to install overlapping trap policies.  By differentiating trap from
regular policies via the priority's LSB this issue is avoided while
still maintaining the proper ordering of trap and regular policies.

Fixes #1243.
2017-02-08 10:36:38 +01:00
Tobias Brunner 6606393b8c kernel-netlink: Fix spacing in log message when policy is unchanged 2017-02-08 10:36:37 +01:00
Tobias Brunner aeaab528e8 ikev1: Factor out IV and QM management
This simplifies implementing a custom keymat_v1_t.
2017-02-08 10:33:07 +01:00
Thomas Egerer 267c1f7083 keymat: Allow keymat to modify signature scheme(s)
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2017-02-08 10:32:17 +01:00
James Laird-Wah 094a4d15cf forecast: Mark correct port in UDP NAT-T rule
Closes strongswan/strongswan#62.
2017-02-08 09:54:02 +01:00
Tobias Brunner 2222af2932 android: New release after adding translation for Simplified Chinese 2017-02-07 16:01:25 +01:00
Tobias Brunner ad882e1a43 android: Add translation for Simplified Chinese
Courtesy of Yick Xie.
2017-02-07 15:59:07 +01:00
Tobias Brunner d6c6fb1332 settings: Fix purge if order differs from alphabetical order 2017-02-07 11:00:31 +01:00
Tobias Brunner 865fd804ee eap-dynamic: Publish the get_auth() method of the wrapped EAP method
Fixes #2238.
2017-02-07 10:52:24 +01:00
Tobias Brunner 2f95c55271 ike-auth: Don't send INITIAL_CONTACT if remote ID contains wildcards
Such an identity won't equal an actual peer's identity resulting in
sending an INITIAL_CONTACT notify even if there might be an existing
IKE_SA.
2017-02-06 11:16:53 +01:00
Tobias Brunner 22f13dcecd proposal: Copy SPI and proposal number from correct proposal in select()
If charon.prefer_configured_proposals is disabled select() is called on
the received proposal. This incorrectly set the SPI to 0 as the
configured proposal has no SPI set.

Fixes #2190.
2017-02-06 11:14:31 +01:00
Tobias Brunner b062d3cc44 kernel-netlink: Set NODAD flag for virtual IPv6 addresses
The Optimistic Duplicate Address Detection (DAD) seems to fail in some
cases (`dadfailed` in `ip addr`) rendering the virtual IP address unusable.

Fixes #2183.
2017-02-06 11:10:44 +01:00
Tobias Brunner 7a40162cb7 kernel-netlink: Prefer matching label when selecting IPv6 source addresses
This implements rule 6 of RFC 6724 using the default priority table,
so that e.g. global addresses are preferred over ULAs (which also have
global scope) when the destination is a global address.

Fixes #2138.
2017-02-06 11:06:22 +01:00
Tobias Brunner 965daa1df3 kernel-netlink: Use correct 4 byte alignment for AH with IPv4
By default, the kernel incorrectly uses an 8 byte alignment, which is
mandatory for IPv6 but prohibited for IPv4.  For many algorithms this
doesn't matter but that's not the case for HMAC_SHA2_256_128.
Since 2.6.39 the kernel can be explicitly configured to use a 4 byte
alignment.
2017-01-25 17:51:35 +01:00
Thomas Egerer 8a91729dfe kernel-netlink: Allow change of Netlink socket receive buffer size
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2017-01-25 17:42:38 +01:00