Commit Graph

12079 Commits

Author SHA1 Message Date
Tobias Brunner f4a20b74fd resolve: Make sure to clean up if calling resolvconf failed
If running resolvconf fails handle() fails release() is not called, which
might leave an interface file on the system (or depending on which script
called by resolvconf actually failed even the installed DNS server).
2016-06-10 18:39:21 +02:00
Tobias Brunner b52e540f43 kernel-pfroute: Return interface to reach destination from get_nexthop() 2016-06-10 17:52:26 +02:00
Tobias Brunner b98afc0a37 kernel-pfkey: Install routes with OUT policies 2016-06-10 15:25:46 +02:00
Tobias Brunner aea3c1052e kernel-netlink: Install routes with OUT policies
This is the direction we actually need routes in and makes the code
easier to read.
2016-06-10 15:25:09 +02:00
Tobias Brunner 85fed13c18 kernel-pfkey: Don't install routes for drop policies and if protocol/ports are in the selector 2016-06-10 15:25:05 +02:00
Tobias Brunner e7369a9dc5 kernel-netlink: Don't install routes for drop policies and if protocol/ports are in the selector
We don't need them for drop policies and they might even mess with other
routes we install.  Routes for policies with protocol/ports in the
selector will always be too broad and might conflict with other routes
we install.
2016-06-10 14:01:36 +02:00
Tobias Brunner 50798628c5 kernel-pfkey: Also use interface returned by get_nexthop() for IPsec policies
An exception is if the local address is virtual, in which case we want
the route to be via TUN device.
2016-06-10 13:57:27 +02:00
Tobias Brunner d1f8628420 kernel-netlink: Also use interface returned by get_nexthop() for IPsec policies 2016-06-10 13:57:27 +02:00
Tobias Brunner c158331bfc kernel-pfkey: Use interface to next hop for shunt policies 2016-06-10 13:57:27 +02:00
Tobias Brunner 4ba5ea407b kernel-netlink: Use interface to next hop for shunt policies
Using the source address to determine the interface is not correct for
net-to-net shunts between two interfaces on which the host has IP addresses
for each subnet.
2016-06-10 13:57:27 +02:00
Tobias Brunner 66e9165bc6 kernel-netlink: Return outbound interface in get_nexthop() 2016-06-10 13:54:18 +02:00
Tobias Brunner 99a57aa5ee kernel-net: Let get_nexthop() return an optional interface name
The returned name should be the interface over which the destination
address/net is reachable.
2016-06-10 13:54:18 +02:00
Tobias Brunner 436f64d5bc kernel-interface: Always set `vip` if get_address_by_ts() returns successfully 2016-06-10 13:52:30 +02:00
Tobias Brunner ebeaac1f2b kernel-netlink: Let only a single thread work on a specific policy
Other threads are free to add/update/delete other policies.

This tries to prevent race conditions caused by releasing the mutex while
sending messages to the kernel.  For instance, if break-before-make
reauthentication is used and one thread on the responder is delayed in
deleting the policies that another thread is concurrently adding for the
new SA.  This could have resulted in no policies being installed
eventually.

Fixes #1400.
2016-06-10 10:45:35 +02:00
Tobias Brunner 471b907613 kernel-netlink: Add priority and refcount to policy log 2016-06-10 10:34:09 +02:00
Tobias Brunner 25178f4594 kernel-netlink: Consistently print mark in log messages only if set 2016-06-10 10:34:09 +02:00
Tobias Brunner a0178fe26e kernel-netlink: Provide error information for Netlink sockets
#1467.
2016-06-10 10:34:09 +02:00
Tobias Brunner fc21465c66 kernel-netlink: Allow definition of a custom priority calculation function 2016-06-10 10:33:17 +02:00
Tobias Brunner 1ba2b015fa kernel-pfkey: Use ipsec_sa_cfg_equals() 2016-06-08 16:12:52 +02:00
Tobias Brunner 87ed9a5ffb kernel-netlink: Use ipsec_sa_cfg_equals() and compare marks properly 2016-06-08 16:12:52 +02:00
Tobias Brunner 3c12905103 ipsec: Add function to compare two ipsec_sa_cfg_t instances
memeq() is currently used to compare these but if there is padding that
is not initialized the same for two instances the comparison fails.
Using this function ensures the objects are compared correctly.
2016-06-08 16:12:39 +02:00
Tobias Brunner 5005325020 eap-simaka-pseudonym: Properly store mappings
If a pseudonym changed a new entry was added to the table storing
permanent identity objects (that are used as keys in the other table).
However, the old mapping was not removed while replacing the mapping in
the pseudonym table caused the old pseudonym to get destroyed.  This
eventually caused crashes when a new pseudonym had the same hash value as
such a defunct entry and keys had to be compared.

Fixes strongswan/strongswan#46.
2016-06-06 14:27:19 +02:00
Tobias Brunner b2abd01048 child-sa: Use non-static variable to store generated unique mark
If two CHILD_SAs with mark=%unique are created concurrently they could
otherwise end up with either the same mark or different marks in both
directions.
2016-06-06 14:17:11 +02:00
Tobias Brunner e35bb6e946 ike: Don't trigger message hook when fragmenting pre-generated messages
This is the case for the IKE_SA_INIT and the initial IKEv1 messages, which
are pre-generated in tasks as at least parts of it are used to generate
the AUTH payload.  The IKE_SA_INIT message will never be fragmented, but
the IKEv1 messages might be, so we can't just call generate_message().

Fixes #1478.
2016-06-06 14:12:48 +02:00
Thomas Egerer aa6d4a3d54 error-notify: Notify listeners upon IKE retransmit
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-06-06 14:11:02 +02:00
Tobias Brunner bd71ba0ffb task-manager: Add retransmit cleared alert 2016-06-06 14:11:01 +02:00
Thomas Egerer 9da65eaeb9 task-manager: Add retransmit count to retransmit send alert
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-06-06 14:11:01 +02:00
Tobias Brunner 2eb89ee1e3 stroke: Permanently store PINs in credential set
This fixes authentication with tokens that require the PIN for every
signature.

Fixes #1369.
2016-06-06 14:03:23 +02:00
Tobias Brunner 0a72d68ea8 controller: Use separate callbacks to track termination and initiation of SAs
If a local authentication failure occurs in IKEv1 we delete the IKE_SA, which
we don't want the controller to detect as success.

Fixes #1449.
2016-06-06 13:57:58 +02:00
Tobias Brunner 1b4e7fe1e8 ikev1: Queue INFORMATIONAL messages during XAuth
Some peers send an INITIAL_CONTACT notify after they received our XAuth
username.  The XAuth task waiting for the third XAuth message handles
this incorrectly and closes the IKE_SA as no configuration payloads are
contained in the message.  We queue the INFORMATIONAL until the XAuth
exchange is complete to avoid this issue.

Fixes #1434.
2016-06-06 13:52:58 +02:00
Tobias Brunner a366fa365e identification: Compare identity types when comparing ID_FQDN/ID_RFC822_ADDR identities
References #1380.
2016-06-06 13:49:41 +02:00
Tobias Brunner a6289d9323 ikev2: Handle INITIAL_CONTACT notifies also when peer is authenticated with EAP
Fixes #1380.
2016-06-06 13:49:21 +02:00
Tobias Brunner 9aaea4dbfe x509: Properly wrap keyid in authorityKeyIdentifier in attribute certificates
The correct encoding got lost in bdec2e4f52 ("refactored openac and
its attribute certificate factory").

Fixes #1370.
2016-06-06 13:46:11 +02:00
Tobias Brunner 3427e43f4b p-cscf: Remove libhydra reference in Makefile 2016-05-27 18:24:59 +02:00
Martin Willi 294ac097d6 af-alg: Silently skip probing algorithms if AF_ALG is not supported
If the af-alg plugin is enabled, but kernel support is missing, we get
an error line during startup for each probed algorithm. This is way too
verbose, so just skip probing if AF_ALG is unsupported.
2016-05-19 11:13:24 +02:00
Tobias Brunner 09328c5210 vici: Put source distribution in the dist dir in the build directory
This fixes the out-of-tree build.
2016-05-11 14:33:08 +02:00
Tobias Brunner 0ba905cf24 mem-cred: Fix memory leak when replacing existing CRLs
Fixes #1442.
2016-05-11 12:16:36 +02:00
Tobias Brunner 81b9de0126 vici: Add target to build a source package and universal wheel of the Python package 2016-05-11 11:36:51 +02:00
Tobias Brunner fa844a798b vici: Add README.rst to be used as description on PyPI 2016-05-11 11:16:43 +02:00
Tobias Brunner 5d5ecd8e72 vici: Replace dr with dev in version numbers for the Python egg
The versioning scheme used by Python (PEP 440) supports the rcN suffix
but development releases have to be named devN, not drN, which are
not supported and considered legacy versions.
2016-05-10 12:16:13 +02:00
Tobias Brunner 1ff7ff5ac8 vici: Update setup.py 2016-05-10 11:42:29 +02:00
Tobias Brunner 756cd28fb8 vici: Ensure we read exactly the specified amount of bytes from the socket in Python
recv() will return less bytes than specified (as that's the buffer size)
if not as many are ready to be read from the socket.
2016-05-10 11:42:29 +02:00
Andreas Steffen 6a6876390d swanctl: indicate initiator and responder in --list-sas 2016-05-07 17:54:56 +02:00
Tobias Brunner 979f465113 child-sa: Install "outbound" FWD policy with lower priority
This provides a fix if symmetrically overlapping policies are
installed as e.g. the case in the ikev2/ip-two-pools-db scenario:

  carol 10.3.0.1/32 ----- 10.3.0.0/16, 10.4.0.0/16 moon
  alice 10.4.0.1/32 ----- 10.3.0.0/16, 10.4.0.0/16 moon

Among others, the following FWD policies are installed on moon:

  src 10.3.0.1/32 dst 10.4.0.0/16
    ...
    tmpl ...

  src 10.4.0.0/16 dst 10.3.0.1/32
    ...

  src 10.4.0.1/32 dst 10.3.0.0/16
    ...
    tmpl ...

  src 10.3.0.0/16 dst 10.4.0.1/32
    ...

Because the network prefixes are the same for all of these they all have the
same priority.  Due to that it depends on the install order which policy gets
used.  For instance, a packet from 10.3.0.1 to 10.4.0.1 will match the
first as well as the last policy.  However, when handling the inbound
packet we have to use the first one as the packet will otherwise be
dropped due to a template mismatch.  And we can't install templates with
the "outbound" FWD policies as that would prevent using different
IPsec modes or e.g. IPComp on only one of multiple SAs.

Instead we install the "outbound" FWD policies with a lower priority
than the "inbound" FWD policies so the latter are preferred.  But we use
a higher priority than default drop policies would use (in case they'd
be defined with the same subnets).
2016-05-06 20:27:18 +02:00
Tobias Brunner fee991c259 kernel-netlink: Check proper watcher state in parallel mode
After adding the read callback the state is WATCHER_QUEUED and it is
switched to WATCHER_RUNNING only later by an asynchronous job. This means
that a thread that sent a Netlink message shortly after registration
might see the state as WATCHER_QUEUED.  If it then tries to read the
response and the watcher thread is quicker to actually read the message
from the socket, it could block on recv() while still holding the lock.
And the asynchronous job that actually read the message and tries to queue
it will block while trying to acquire the lock, so we'd end up in a deadlock.

This is probably mostly a problem in the unit tests.
2016-05-06 16:00:32 +02:00
Tobias Brunner 9c01e01420 trap-manager: Allow local address to be unspecified
If there is currently no route to reach the other peer we just default
to left=%any.  The local address is only really used to resolve
leftsubnet=%dynamic anyway (and perhaps for MIPv6 proxy transport mode).

Fixes #1375.
2016-05-06 15:56:19 +02:00
Tobias Brunner 3f4cc30b19 kernel-netlink: Order routes by prefix before comparing priority/metric
Metrics are basically defined to order routes with equal prefix, so ordering
routes by metric first makes not much sense as that could prefer totally
unspecific routes over very specific ones.

For instance, the previous code did break installation of routes for
passthrough policies with two routes like these in the main routing table:

  default via 192.168.2.1 dev eth0 proto static
  192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.10 metric 1

Because the default route has no metric set (0) it was used, instead of the
more specific other one, to determine src and next hop when installing a route
for a passthrough policy for 192.168.2.0/24.  Therefore, the installed route
in table 220 did then incorrectly redirect all local traffic to "next hop"
192.168.2.1.

The same issue occurred when determining the source address while
installing trap policies.

Fixes 6b57790270 ("kernel-netlink: Respect kernel routing priorities for IKE routes").
Fixes #1416.
2016-05-06 15:48:45 +02:00
Tobias Brunner 612fe5410b ikev1: Activate DELETE tasks before other tasks in state ESTABLISHED
Fixes #1410.
2016-05-06 15:35:16 +02:00
Tobias Brunner bf3bed1cc4 ikev1: Don't use rekeyed CHILD_SAs for rekey detection
An old (already rekeyed) CHILD_SA would get switched back into CHILD_REKEYING
state.  And we actually want to change the currently installed CHILD_SA to
that state and later CHILD_REKEYED and properly call e.g. child_rekey() and
not do this again with an old CHILD_SA.  Instead let's only check installed
or currently rekeying CHILD_SAs (in case of a rekey collision).  It's also
uncommon that there is a CHILD_SA in state CHILD_REKEYED but none in state
CHILD_INSTALLED or CHILD_REKEYING, which could happen if e.g. a peer deleted
and recreated a CHILD_SA after a rekeying.  But in that case we don't want
to treat the new CHILD_SA as rekeying (e.g. in regards to events on the bus).
2016-05-06 15:31:31 +02:00
Tobias Brunner a01eb5e4da ikev1: Don't call updown hook etc. when deleting redundant CHILD_SAs
Fixes #1421.
2016-05-06 15:27:35 +02:00
Tobias Brunner 2df0d092f0 android: New release after fixing a crash during certificate imports 2016-05-06 12:52:26 +02:00
Tobias Brunner 1130dbc408 android: Avoid IllegalStateException when importing certificates
When certificates are imported via Storage Access Framework we did handle
the selection directly in onActivityResult().  However, at that point the
activity might apparently not yet be resumed.  So committing
FragmentTransactions could result in IllegalStateExceptions due to the
potential state loss.  To avoid that we cache the returned URI and wait
until onPostResume() to make sure the activity's state is fully restored
before showing the confirmation dialog.
2016-05-06 12:51:49 +02:00
Andreas Steffen b9522f9d64 swanctl: Do not display rekey times for shunts 2016-05-05 14:53:22 +02:00
Andreas Steffen b1df631212 vici list-conns sends reauthentication and rekeying time information 2016-05-04 18:13:52 +02:00
Andreas Steffen e88f21cf65 swanctl: --list-conns shows eap_id, xauth_id and aaa_id 2016-05-04 18:13:52 +02:00
Tobias Brunner c962ae2e62 android: New release after reducing number of DH groups in proposal 2016-05-04 12:07:36 +02:00
Tobias Brunner fae18fd201 proposal: Remove some weaker and rarely used DH groups from the default proposal
This fixes an interoperability issue with Windows Server 2012 R2 gateways.
They insist on using modp1024 for IKE, however, Microsoft's IKEv2
implementation seems only to consider the first 15 DH groups in the proposal.
Depending on the loaded plugins modp1024 is now at position 17 or even
later, causing the server to reject the proposal.  By removing some of
the weaker and rarely used DH groups from the default proposal we make
sure modp1024 is among the first 15 DH groups.  The removed groups may
still be used by configuring custom proposals.
2016-05-04 11:33:28 +02:00
Tobias Brunner 2b9bfb6682 android: Use separate label strings for text fields in login dialog
In the profile editor the password is now marked as optional in the
label, which looks a bit strange in the login dialog.
2016-05-03 10:43:27 +02:00
Tobias Brunner 3e21168d96 android: New release after GUI changes/additions 2016-05-02 18:50:44 +02:00
Tobias Brunner e69781b1a2 android: Show selected user identity in profile list
This also readds the colons that were removed from the labels.
2016-05-02 18:39:19 +02:00
Tobias Brunner 67fa05aa59 android: Allow selection of user identity in GUI 2016-05-02 18:39:18 +02:00
Tobias Brunner cdcf754f64 android: Add adapter for user ID selection 2016-05-02 18:39:18 +02:00
Tobias Brunner eb507a5a0d android: Add helper function to TrustedCertificateEntry to get subjectAltNames
Duplicates (e.g. with different types) are filtered.  If necessary we
could later perhaps add a prefix.
2016-05-02 18:39:18 +02:00
Tobias Brunner e7a12cc862 android: Add auto-completion to remote ID and profile name
This makes it easy to explicitly use the server's IP/hostname as remote
identity or use it in the profile name.
2016-05-02 18:39:18 +02:00
Tobias Brunner c5fee22305 android: Make remote identity configurable in the GUI 2016-05-02 18:39:18 +02:00
Tobias Brunner be05310e7a android: Use TextInputLayout in login dialog 2016-05-02 18:39:18 +02:00
Tobias Brunner ea15f20a56 android: Use TextInputLayoutHelper in profile editor
This adds floating labels and helper texts to the form fields. It also
changed/added lots of strings in the editor.
2016-05-02 18:39:17 +02:00
Tobias Brunner 79ba4b285f android: Add TextInputLayout child class that displays a helper text below the text field
Also hides the error message if the text is changed.
2016-05-02 18:39:17 +02:00
Tobias Brunner 5ffd79b39b android: Use proper namespace for custom attribute 2016-05-02 18:39:17 +02:00
Tobias Brunner fd23ed8cf3 android: Move profile name field to the bottom and use server address as hint 2016-05-02 18:39:17 +02:00
Tobias Brunner 4a58ec24fd android: Use configured local identity in auth-cfgs
We still default to the username or subject DN if none is configured.
But we don't check if the local ID is contained in the configured
certificate.
2016-05-02 18:39:17 +02:00
Tobias Brunner 8b3bf4a4f8 android: Use configured remote ID in auth-cfg
If one is explicitly set we don't use loose identity matching and send it as
IDr to the server.

Closes #strongswan/strongswan#29.
Fixes #1268.
2016-05-02 18:38:44 +02:00
Tobias Brunner 9c55644158 android: Pass local and remote identities as settings of a connection 2016-05-02 18:38:15 +02:00
Tobias Brunner 89149dbb5f android: Add fields for local and remote identities to data model 2016-05-02 18:38:15 +02:00
Tobias Brunner 7ab8ec7ad0 android: Avoid races between FragmentManager and state saving
onSaveInstanceState is apparently called after pausing the fragment and after
that committing any FragmentTransactions causes an IllegalStateException.
We could use commitAllowingStateLoss() but that's not really necessary
as we don't need to update when we are not active anyway.  We also don't
update the view directly after registration as this happens
asynchronously, i.e. we might be paused when it finishes.
2016-05-02 18:38:15 +02:00
Tobias Brunner 73a6bec3fc android: Increase the NAT-T keepalive interval to potentially save battery life
In case this doesn't work out we could probably make it configurable.

References #1326.
2016-05-02 18:38:08 +02:00
Tobias Brunner 44c8580ebe android: Show confirmation dialog also when connecting 2016-05-02 18:35:04 +02:00
Tobias Brunner 6e398a81f2 android: Avoid ProgressDialogs in VPN state fragment
Instead we use a ProgressBar directly in the fragment and use the
existing button to cancel the process.
2016-05-02 16:43:15 +02:00
Tobias Brunner 353526601a android: Fix display of remediation instructions with support library
Because the support library creates its own layout manually and uses
different IDs than the list_content layout we can't use the method we
used previously (and which is actually recommended in the docs).
2016-05-02 16:41:50 +02:00
Tobias Brunner 7c5fec3a5a android: Use Fragment class from the support library to avoid deprecation warnings
For instance, onAttach() with an Activitiy as first argument was deprecated
with API level 23.  However, the overload with a Context as first argument
does obviously not get called on older API levels.  Luckily, the classes
provided by the support library handle that for us.
2016-05-02 16:41:50 +02:00
Tobias Brunner 3256fe9ebb android: Update README.ndk 2016-05-02 16:41:50 +02:00
Tobias Brunner 1bd213db79 android: Use relative path for strongSwan sources
This avoids issues with recursion, which could have happened if the
strongswan directory was a symlink.
2016-05-02 16:41:49 +02:00
Tobias Brunner d9c5e6d786 android: Fix handling of redirects during IKE_AUTH 2016-05-02 16:41:25 +02:00
Tobias Brunner 90172b66c4 android: Fix color of lists and buttons on older platforms
This adds a workaround for an issue on older platforms where the list is
not properly styled with colorAccent.  Similarly applies to borderless buttons.
2016-04-27 14:24:27 +02:00
Tobias Brunner 2a68938b2e android: Use Activity as context for VpnProfileAdapter to fix theme
When using the application context theme customizations wouldn't get
applied for some reason.
2016-04-27 14:24:27 +02:00
Tobias Brunner 19e22af199 android: Use "server" instead of "gateway" in profile editor
The term "gateway" is unfamiliar for most new users (or they confuse it
with the default gateway of their network) but they usually know that
they want to connect to a "server".
2016-04-27 14:24:27 +02:00
Tobias Brunner 61ac729662 android: Define a new color scheme
This mainly changes the color of the appbar (colorPrimary), the color
of the status bar (colorPrimaryDark) is black like the default.
The accent color (colorAccent) used for controls like buttons and check
boxes is a slightly toned down version of the default.
2016-04-27 14:24:27 +02:00
Tobias Brunner 8e71dd9e82 android: Get a warning on use of deprecated features 2016-04-27 14:24:27 +02:00
Tobias Brunner 4c5f4a3d2a android: Replace use of deprecate getColor() method overload 2016-04-27 14:24:26 +02:00
Tobias Brunner 48123633cc android: Make font in log view monospace again on Android 5+ 2016-04-27 14:24:26 +02:00
Tobias Brunner de2fbd0e3f android: Avoid deprecated tabs in the ActionBar in TrustedCertificatesActivity
Instead we use TabLayout and ViewPager from the support libraries.
2016-04-27 14:24:26 +02:00
Tobias Brunner b9f79bc431 android: Automatically reload certificates if manager is reset
No need to manually reset the fragments anymore.
2016-04-27 14:24:26 +02:00
Tobias Brunner 01bade451f android: Make TrustedCertificateManager an Observable
Observers are notified when the manager is reset (and initially when the
certificates are first loaded).
2016-04-27 14:24:26 +02:00
Tobias Brunner 77c1c28d74 android: Switch to AppCompat/Material theme for dialogs
There is no AppCompatProgressDialog class as the use of ProgressDialog
is discouraged (instead progress bars should be placed in the layout directly).
To display the current ProgressDialog instances correctly on systems < 21 we
modify the window background color.
2016-04-27 14:24:25 +02:00
Tobias Brunner 6b31828269 android: Switch to AppCompat/Material theme and use custom Toolbar as AppBar
Also includes some whitespace/formatting changes due to the switch to
Android Studio.
2016-04-27 14:24:25 +02:00
Tobias Brunner 9dd6d1e6db android: Ignore build/ in project directory 2016-04-27 14:24:25 +02:00
Tobias Brunner 10d0de0c9a android: Update platform tools and pull in support libs
We'll have to change some stuff that Google deprecated (e.g. the tabs in
the ActionBar) and that requires changing the theme at least in activities.
Since that would look a bit inconsistent we'll change it globally and
use parts of the support library.
2016-04-27 14:24:25 +02:00
Tobias Brunner 9ab746cb0f android: Update Android Gradle plugin and wrapper 2016-04-27 14:24:25 +02:00
Andreas Steffen ef84ad0e11 Updated products in IMV database 2016-04-26 17:15:37 +02:00
Andreas Steffen afcd466192 swanctl: list EAP type in --list-conns 2016-04-26 17:15:37 +02:00
Yannick Cann 49fa6ebf1c identification: Add support for dmdName RDN (2.5.4.54)
It's listed in RFC 2256 but was later removed with RFC 4519, but there
are still some certs that use it.

Closes strongswan/strongswan#43.
2016-04-25 17:06:04 +02:00
Andreas Steffen c87f428836 leak-detective: added _IO_file_doallocate to whitelist 2016-04-24 23:34:44 +02:00
Andreas Steffen 4e3234afb4 swanctl: log errors to stderr 2016-04-24 23:33:23 +02:00
Tobias Brunner 61587aa6fc pool: Use correct name to remove index for CHILD_SA TS in SQLite script
Fixes #1415.
2016-04-18 10:08:44 +02:00
Tobias Brunner 254726b59e kernel-pfkey: Add support for manual priorities
Also orders policies with equals priorities by their automatic priority.
2016-04-15 10:39:01 +02:00
Tobias Brunner 4e59618382 kernel-pfkey: Update priority calculation formula to the new one in kernel-netlink
Since the selectors are not exactly the same (no port masks, no interface)
some small tweaks have been applied.
2016-04-15 10:39:00 +02:00
Tobias Brunner 869f4e90b1 kernel-netlink: Order policies with equal priorities by their automatic priority
This allows using manual priorities for traps, which have a lower
base priority than the resulting IPsec policies.  This could otherwise
be problematic if, for example, swanctl --install/uninstall is used while
an SA is established combined with e.g. IPComp, where the trap policy does
not look the same as the IPsec policy (which is now otherwise often the case
as the reqids stay the same).

It also orders policies by selector size if manual priorities are configured
and narrowing occurs.
2016-04-15 10:39:00 +02:00
Tobias Brunner 689bb34958 curl: Add TLS support if libcurl is built against BoringSSL
We don't have to rely on the openssl plugin and its threading
initialization as BoringSSL is thread-safe out of the box.
2016-04-15 10:32:53 +02:00
Tobias Brunner 47a46be597 openssl: BoringSSL does not support configuration
The other initialization functions are still defined but many are
apparently no-ops (this is also true for the threading initialization).
2016-04-15 10:32:53 +02:00
Tobias Brunner c8a219a28d openssl: The member storing the DH exponent length has been renamed in BoringSSL 2016-04-15 10:32:53 +02:00
Tobias Brunner 77df573a95 openssl: Use proper EVP macro to determine size of a hash 2016-04-15 10:32:52 +02:00
Tobias Brunner cb65e95d4a android: OPENSSL_NO_ENGINE is now properly defined in the headers 2016-04-15 10:32:36 +02:00
Tobias Brunner de9b3491ad curl: Handle LibreSSL like OpenSSL in regards to multi-threading
LibreSSL is API compatible so our openssl plugin does not need any
changes and it works fine with the curl plugin.
2016-04-15 10:31:19 +02:00
Tobias Brunner 960632ffb0 thread: Don't hold mutex when calling cleanup handlers while terminating
This could interfere with cleanup handlers that try to acquire
mutexes while other threads holding these try to e.g. cancel the threads.

As cleanup handlers are only queued by the threads themselves we don't need
any synchronization to access the list.

Fixes #1401.
2016-04-13 13:55:20 +02:00
Andreas Steffen d3af3b799f Extended IPsec kernel policy scheme
The kernel policy now considers src and dst port masks as well as
restictions to a given network interface. The base priority is
100'000 for passthrough shunts, 200'000 for IPsec policies,
300'000 for IPsec policy traps and 400'000 for fallback drop shunts.
The values 1..30'000 can be used for manually set priorities.
2016-04-09 16:51:02 +02:00
Andreas Steffen e9704e90cf Include manual policy priorities and restriction to interfaces in vici list-conn command 2016-04-09 16:51:02 +02:00
Andreas Steffen c26e4330e7 Implemented IPsec policies restricted to given network interface 2016-04-09 16:51:02 +02:00
Andreas Steffen 7f57c4f9fb Support manually-set IPsec policy priorities 2016-04-09 16:51:01 +02:00
Tobias Brunner 2ba5dadb12 peer-cfg: Use struct to pass data to constructor 2016-04-09 16:51:01 +02:00
Tobias Brunner 8a00a8452d child-cfg: Use struct to pass data to constructor 2016-04-09 16:51:01 +02:00
Tobias Brunner fd8f1194f3 kernel-pfkey: Prefer policies with reqid over those without 2016-04-09 16:51:01 +02:00
Tobias Brunner 0ff8ce9452 kernel-pfkey: Only install templates for regular IPsec policies with reqid 2016-04-09 16:51:01 +02:00
Tobias Brunner 23f25f9647 shunt-manager: Install "outbound" FWD policy
If there is a default drop policy forwarded traffic might otherwise not
be allowed by a specific passthrough policy (while local traffic is
allowed).
2016-04-09 16:51:00 +02:00
Tobias Brunner 83312ee5e4 kernel-netlink: Prefer policies with reqid over those without
This allows two CHILD_SAs with reversed subnets to install two FWD
policies each.  Since the outbound policy won't have a reqid set we will
end up with the two inbound FWD policies installed in the kernel, with
the correct templates to allow decrypted traffic.
2016-04-09 16:51:00 +02:00
Tobias Brunner f7e9e6a3fd kernel-netlink: Only associate templates with inbound FWD policies
We can't set a template on the outbound FWD policy (or we'd have to make
it optional).  Because if the traffic does not come from another (matching)
IPsec tunnel it would get dropped due to the template mismatch.
2016-04-09 16:51:00 +02:00
Tobias Brunner 9c12635252 child-sa: Install "outbound" FWD policy
If there is a DROP shunt that matches outbound forwarded traffic it
would get dropped as the FWD policy we install only matches decrypted
inbound traffic.  That's because the Linux kernel first checks the FWD
policies before looking up the OUT policy and SA to encrypt the packets.
2016-04-09 16:51:00 +02:00
Tobias Brunner c4387e991a kernel-netlink: Associate routes with IN policies instead of FWD policies
This allows us to install more than one FWD policy.  We already do this
in the kernel-pfkey plugin (there the original reason was that not all
kernels support FWD policies).
2016-04-09 16:50:59 +02:00
Tobias Brunner 89da06ace9 kernel: Use structs to pass information to the kernel-ipsec interface 2016-04-09 16:50:59 +02:00
Tobias Brunner 7316a13bd1 pkcs11: Skip zero-padding of r and s when preparing EC signature
They are zero padded to fill the buffer.

Fixes #1377.
2016-04-05 16:17:10 +02:00
Tobias Brunner b82b5f6398 chunk: Skip all leading zero bytes in chunk_skip_zero() not just the first 2016-04-04 15:39:42 +02:00
Tobias Brunner 85597f2983 string: Gracefully handle NULL in str*eq() macros 2016-04-04 10:43:46 +02:00
Tobias Brunner 90c8cf6819 byteorder: Explicitly check for htoXeXX macros
Some platforms have XetohXX macros instead of XeXXtoh macros, in which
case we'd redefine the htoXeXX macros.
2016-03-31 19:47:31 +02:00
Cameron McCord be41d5cba2 vici: Fix documentation of some dictionary keys of two request messages
Closes strongswan/strongswan#40.
2016-03-31 11:26:44 +02:00
Tobias Brunner e8bddd64fc proposal: Use standard integer types for static keywords 2016-03-31 09:25:19 +02:00
Tobias Brunner c545688788 utils: Remove nonsensical typedefs for standard uint types 2016-03-31 09:25:11 +02:00
Andreas Steffen aaa4e478b1 Use u_int32_t legacy type in blowfish header file 2016-03-24 20:58:32 +01:00
Andreas Steffen b12c53ce77 Use standard unsigned integer types 2016-03-24 18:52:48 +01:00
Shota Fukumori b210369314 updown: Get value for PLUTO_MARK_{IN,OUT} from CHILD_SA
Or the invoked script will get a broken value when `mark=%unique` is
used in a configuration.

Closes strongswan/strongswan#37.
2016-03-23 14:45:04 +01:00
Tobias Brunner b39be996cc connmark: Explicitly include xt_mark.h for older kernels
Fixes #1365.
2016-03-23 14:40:29 +01:00
Tobias Brunner 2f3879c3fe android: Enable 64-bit ABIs 2016-03-23 14:18:52 +01:00
Tobias Brunner 17e36cd48c android: Enable build against API level 21
While building against this level in general would break our app on
older systems, the NDK will automatically use this level for 64-bit
ABI builds (which are not supported in older levels).  So to build
against 64-bit ABIs we have to support this API level.
2016-03-23 14:18:37 +01:00
Tobias Brunner ab88f22f78 libcharon: Add missing header file to Android.mk
Not really relevant, just to make sure both file lists are the same.
2016-03-23 14:16:32 +01:00
Tobias Brunner 958c0e8e5c ike-sa-manager: Avoid memory leak if IKE_SAs get checked in after flush() was called
A thread might check out a new IKE_SA via checkout_new() or
checkout_by_config() and start initiating it while the daemon is
terminating and the IKE_SA manager is flushed by the main thread.
That SA is not tracked yet so the main thread is not waiting for it and
the other thread is able to check it in and creating an entry after flush()
already terminated causing a memory leak.

Fixes #1348.
2016-03-23 14:02:23 +01:00
Thomas Egerer 90a7a68488 ha: Delete cache entry inside the locked mutex
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-03-23 10:34:24 +01:00
Tobias Brunner b31e8c04f2 swanctl: Fix documented directory name for remote pubkeys 2016-03-22 18:11:51 +01:00
Tobias Brunner 0ed9430d10 kernel-netlink: Fix lookup of next hops for destinations with prefix
References #1347.
2016-03-21 12:14:59 +01:00
Tobias Brunner b0c6869967 imc-os: Terminate buffer after fread(3) call to make Coverity happy 2016-03-11 15:23:18 +01:00
Tobias Brunner 8c3bcebaa6 imc-os: Correctly check return value of ftell(2) 2016-03-11 15:23:17 +01:00
Tobias Brunner 755d076fec Fix some Doxygen issues 2016-03-11 12:25:14 +01:00
Tobias Brunner 0fc8b1d03e identification: Make `written` signed to fix error checking when printing ranges 2016-03-11 10:09:02 +01:00
Tobias Brunner 20df9d315c vici: Don't hold write lock while running or undoing start actions
Running or undoing start actions might require enumerating IKE_SAs,
which in turn might have to enumerate peer configs concurrently, which
requires acquiring a read lock.  So if we keep holding the write lock while
enumerating the SAs we provoke a deadlock.

By preventing other threads from acquiring the write lock while handling
actions, and thus preventing the modification of the configs, we largely
maintain the current synchronous behavior.  This way we also don't need to
acquire additional refs for config objects as they won't get modified/removed.

Fixes #1185.
2016-03-11 08:32:18 +01:00
Andreas Steffen 35babdf43f Initialize ts variable 2016-03-11 08:29:23 +01:00
Tobias Brunner 7d22a75b12 forecast: Compare the complete rules when deleting them
Same as the change in the connmark plugin.

References #1229.
2016-03-10 17:26:38 +01:00
Tobias Brunner c659d369a0 connmark: Don't restore CONNMARK for packets that already have a mark set
This allows e.g. modified versions of xl2tpd to set the mark in
situations where two clients are using the same source port behind the
same NAT, which CONNMARK can't restore properly as only one conntrack entry
will exist with the mark set to that of the client that sent the last packet.

Fixes #1230.
2016-03-10 17:26:26 +01:00
Tobias Brunner 7c9e7eb933 connmark: Compare the complete rules when deleting them
By settings a matchmask that covers the complete rule we ensure that the
correct rule is deleted (i.e. matches and targets with potentially different
marks are also compared).

Since data after the passed pointer is actually dereferenced when
comparing we definitely have to pass an array that is at least as long as
the ipt_entry.

Fixes #1229.
2016-03-10 17:26:09 +01:00
Andreas Steffen 3f1de98678 Support of IP address ranges in traffic selectors 2016-03-10 13:59:37 +01:00
Andreas Steffen 1d86d1d65a Implemented IPv4/IPv6 subnet and range identities
The IKEv1 IPV4_ADDR_SUBNET, IPV6_ADDR_SUBNET, IPV4_ADDR_RANGE and
IPV6_ADDR_RANGE identities have been fully implemented and can be
used as owners of shared secrets (PSKs).
2016-03-10 13:59:37 +01:00
Tobias Brunner 7e854f4d51 attr: Only enumerate attributes matching the IKE version of the current IKE_SA
Numerically configured attributes are currently sent for both versions.
2016-03-10 11:57:39 +01:00
Tobias Brunner 98a3ba8a5a attr: Add p-cscf keyword for P-CSCF server addresses 2016-03-10 11:57:38 +01:00
Tobias Brunner 276acafa2d p-cscf: Make sending requests configurable and disable it by default 2016-03-10 11:57:38 +01:00
Tobias Brunner e8262251e1 p-cscf: Only send requests if virtual IPs of the same family are requested 2016-03-10 11:57:38 +01:00
Tobias Brunner 3d91d013cc p-cscf: Add attribute handler for P-CSCF server addresses 2016-03-10 11:57:38 +01:00
Tobias Brunner 12ac5fac1a p-cscf: Add plugin stub 2016-03-10 11:57:38 +01:00
Tobias Brunner 319b031a8a payloads: Verify P-CSCF configuration attributes like others carrying IP addresses 2016-03-10 11:57:38 +01:00
Tobias Brunner 7798284da1 attributes: Define P-CSCF address attributes described in RFC 7651 2016-03-10 11:57:38 +01:00
Tobias Brunner e41adf5f05 ike-sa: Improve interaction between flush_auth_cfg and delayed revocation checks 2016-03-10 11:07:15 +01:00
Tobias Brunner f1cbacc5d1 ikev2: Delay online revocation checks during make-before-break reauthentication
We do these checks after the SA is fully established.

When establishing an SA the responder is always able to install the
CHILD_SA created with the IKE_SA before the initiator can do so.
During make-before-break reauthentication this could cause traffic sent
by the responder to get dropped if the installation of the SA on the
initiator is delayed e.g. by OCSP/CRL checks.

In particular, if the OCSP/CRL URIs are reachable via IPsec tunnel (e.g.
with rightsubnet=0.0.0.0/0) the initiator is unable to reach them during
make-before-break reauthentication as it wouldn't be able to decrypt the
response that the responder sends using the new CHILD_SA.

By delaying the revocation checks until the make-before-break
reauthentication is completed we avoid the problems described above.
Since this only affects reauthentication, not the original IKE_SA, and the
delay until the checks are performed is usually not that long this
doesn't impose much of a reduction in the overall security.
2016-03-10 11:07:15 +01:00
Tobias Brunner 8ce78e43a4 ikev2: Add task that verifies a peer's certificate
On failure the SA is deleted and reestablished as configured.  The task
is activated after the REAUTH_COMPLETE task so a make-before-break reauth
is completed before the new SA might get torn down.
2016-03-10 11:07:15 +01:00
Tobias Brunner 034a462901 ikev2: Initiate other tasks after a no-op task 2016-03-10 11:07:14 +01:00
Tobias Brunner a05cff1ec0 ikev2: Don't do online revocation checks in pubkey authenticator if requested
We also update the auth config so the constraints are not enforced.
2016-03-10 11:07:14 +01:00
Tobias Brunner e19162a509 ike-sa: Add condition to suspend online certificate revocation checks for an IKE_SA 2016-03-10 11:07:14 +01:00
Tobias Brunner 1b9c1ae018 ike-sa: Add method to verify certificates in completed authentication rounds 2016-03-10 11:07:14 +01:00
Tobias Brunner ef9171ad1e auth-cfg: Add a rule to suspend certificate validation constraints 2016-03-10 11:07:14 +01:00
Tobias Brunner f371effc5d credential-manager: Check cache queue when destroying trusted certificate enumerator
We already do this in the trusted public key enumerator (which
internally uses the trusted certificate enumerator) but should do so
also when this enumerator is used directly (since the public key
enumerator has the read lock the additional call will just be skipped
there).
2016-03-10 11:07:14 +01:00
Tobias Brunner 5452e3d66e credential-manager: Make online revocation checks optional for public key enumerator 2016-03-10 11:07:14 +01:00
Tobias Brunner 2e190dca04 charon-svc: Inherit all settings from the charon section
Same as with charon-systemd.
2016-03-08 10:56:19 +01:00
Tobias Brunner bc4e689db1 charon-systemd: Inherit all settings from the charon section
Our default config files are very charon specific.  So to avoid
confusion when only charon-systemd is installed we just default to all
settings defined for charon.  Since charon-systemd probably won't be used
together with charon this should not cause conflicts (settings may still
be overridden via the charon-systemd section).
2016-03-08 10:56:19 +01:00
Tobias Brunner 5c8dc908d0 library: Add option to register additional namespaces before calling library_init()
Because settings are already accessed in library_init(), calling
add_fallback() externally after calling library_init() is not ideal.
This way namespaces already serve as fallback while library_init() is
executed and they are also in the correct order so that libstrongswan is
always the last root section.
2016-03-08 10:56:19 +01:00
Tobias Brunner 101abed566 vici: Replace child configs atomically
This also leaves unmodified configs as they are.
2016-03-08 10:21:58 +01:00
Tobias Brunner 622c2b2c33 peer-cfg: Add method to atomically replace child configs 2016-03-08 10:21:58 +01:00
Tobias Brunner 8db4f19ad9 ike-cfg: Use new method to compare proposal lists in equals() 2016-03-08 10:21:57 +01:00
Tobias Brunner f6a5e6b6a9 peer-cfg: Use new method to compare linked lists in equals()
This also compares the complete lists not only the first two items.
2016-03-08 10:21:57 +01:00
Tobias Brunner 3af23606bf child-cfg: Add equals() method 2016-03-08 10:21:57 +01:00
Tobias Brunner 348b0ffbc6 linked-list: Add method to compare two lists of objects for equality 2016-03-08 10:21:57 +01:00
Tobias Brunner 229cdf6bc8 vici: Order auth rounds by optional `round` parameter instead of by position in the request 2016-03-08 10:04:55 +01:00
Tobias Brunner fab4c845ec ikev1: Send NAT-D payloads after vendor ID payloads in Aggressive Mode messages
Some implementations might otherwise not recognize the NAT-D payload
type.  Also moves SIG and HASH payloads last in these messages.

Fixes #1239.
2016-03-07 14:13:12 +01:00
Thomas Egerer d8adcb8ff9 ike-sa-manager: Log a checkin/failure message for every checkout
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-03-07 11:16:52 +01:00
Andreas Steffen 99b794a4cf Display IKE ports with swanctl --list-sas 2016-03-05 18:19:00 +01:00
Tobias Brunner ec9566ae24 ike-sa-manager: Log some additional details like SPIs when checking out SAs 2016-03-04 18:43:27 +01:00
Tobias Brunner 67e28a3afa smp: Correctly return IKE SPIs stored in network order 2016-03-04 18:43:26 +01:00
Tobias Brunner e32504352d vici: Correctly return IKE SPIs stored in network order 2016-03-04 18:43:26 +01:00
Tobias Brunner db00982dad stroke: Correctly print IKE SPIs stored in network order 2016-03-04 18:43:26 +01:00
Tobias Brunner fac9fd7368 byteorder: Simplify htoun64/untoh64 functions 2016-03-04 18:43:26 +01:00
Tobias Brunner 14de79604a byteorder: Always define be64toh/htobe64 macros 2016-03-04 18:43:26 +01:00
Tobias Brunner 130c485be6 swanctl: Document signature scheme constraints 2016-03-04 16:19:54 +01:00
Tobias Brunner 1ecec95dff vici: Add support for pubkey constraints with EAP-TLS
This is a feature currently supported by stroke.
2016-03-04 16:19:54 +01:00
Tobias Brunner 3c23a75120 auth-cfg: Make IKE signature schemes configurable
This also restores the charon.signature_authentication_constraints
functionality, that is, if no explicit IKE signature schemes are
configured we apply all regular signature constraints as IKE constraints.
2016-03-04 16:19:54 +01:00
Tobias Brunner e37e6d6dca ikev2: Always store signature scheme in auth-cfg
As we use a different rule we can always store the scheme.
2016-03-04 16:19:53 +01:00
Thomas Egerer c8a0781334 ikev2: Diversify signature scheme rule
This allows for different signature schemes for IKE authentication and
trustchain verification.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-03-04 16:19:53 +01:00
Tobias Brunner 47701e1178 ike-init: Verify REDIRECT notify before processing IKE_SA_INIT message
An attacker could blindly send a message with invalid nonce data (or none
at all) to DoS an initiator if we just destroy the SA.  To prevent this we
ignore the message and wait for the one by the correct responder.
2016-03-04 16:03:00 +01:00
Tobias Brunner fb7cc16d67 ikev2: Allow tasks to verify request messages before processing them 2016-03-04 16:03:00 +01:00
Tobias Brunner 4b83619310 ikev2: Allow tasks to verify response messages before processing them 2016-03-04 16:03:00 +01:00
Tobias Brunner b4968a952e task: Add optional pre_process() method
This will eventually allow tasks to pre-process and verify received
messages.
2016-03-04 16:03:00 +01:00
Tobias Brunner 9282bc39a7 ike-init: Ignore notifies related to redirects during rekeying
Also don't query redirect providers in this case.
2016-03-04 16:03:00 +01:00
Tobias Brunner c6ebd0332e ike-sa: Add limit for the number of redirects within a defined time period 2016-03-04 16:03:00 +01:00
Tobias Brunner 7505fb8d45 ike-sa: Reauthenticate to the same addresses we currently use
If the SA got redirected this would otherwise cause a reauthentication with
the original gateway.  Reestablishing the SA to the original gateway, if e.g.
the new gateway is not reachable makes sense though.
2016-03-04 16:03:00 +01:00
Tobias Brunner c13eb73719 vici: Don't redirect all SAs if no selectors are given
This avoid confusion and redirecting all SAs can now easily be done
explicitly (e.g. peer_ip=0.0.0.0/0).
2016-03-04 16:03:00 +01:00
Tobias Brunner 27074f3155 vici: Match subnets and ranges against peer IP in redirect command 2016-03-04 16:03:00 +01:00
Tobias Brunner bef4518de7 vici: Match identity with wildcards against remote ID in redirect command 2016-03-04 16:02:59 +01:00
Tobias Brunner e92364db66 swanctl: Add --redirect command 2016-03-04 16:02:59 +01:00
Tobias Brunner 43b46b26ea vici: Add redirect command
This allows redirecting IKE_SAs by multiple different selectors, if none
are given all SAs are redirected.
2016-03-04 16:02:59 +01:00
Tobias Brunner 0d424d2107 redirect-job: Add job to redirect an active IKE_SA 2016-03-04 16:02:59 +01:00
Tobias Brunner 71c7070588 ike-sa: Add redirect() method to actively redirect an IKE_SA 2016-03-04 16:02:59 +01:00
Tobias Brunner 0840385b27 ike-redirect: Add task to redirect active IKE_SAs 2016-03-04 16:02:59 +01:00
Tobias Brunner f5a9025ce9 ike-auth: Handle REDIRECT notifies during IKE_AUTH 2016-03-04 16:02:59 +01:00
Tobias Brunner f20e00fe54 ike-sa: Handle redirect requests for established SAs as reestablishment
We handle this similar to how we do reestablishing IKE_SAs with all CHILD_SAs,
which also includes the one actively queued during IKE_AUTH.

To delete the old SA we use the recently added ike_reauth_complete task.
2016-03-04 16:02:59 +01:00
Tobias Brunner 19233ef980 ike-auth: Send REDIRECT notify during IKE_AUTH if requested by providers
To prevent the creation of the CHILD_SA we set a condition on the
IKE_SA.  We also schedule a delete job in case the client does not
terminate the IKE_SA (which is a SHOULD in RFC 5685).
2016-03-04 16:02:59 +01:00
Tobias Brunner fdc4b82728 ike-config: Do not assign attributes for redirected IKE_SAs 2016-03-04 16:02:59 +01:00
Tobias Brunner b6fcb91762 child-create: Don't create CHILD_SA if the IKE_SA got redirected in IKE_AUTH 2016-03-04 16:02:59 +01:00
Tobias Brunner d68c05d269 ike-sa: Add a condition to mark redirected IKE_SAs 2016-03-04 16:02:58 +01:00
Tobias Brunner 3d074bce00 ike-init: Handle REDIRECTED_FROM similar to REDIRECT_SUPPORTED as server 2016-03-04 16:02:58 +01:00
Tobias Brunner 6cde9875e1 ike-init: Send REDIRECTED_FROM instead of REDIRECT_SUPPORTED if appropriate 2016-03-04 16:02:58 +01:00
Tobias Brunner e4af6e6b7a ike-sa: Keep track of the address of the gateway that redirected us 2016-03-04 16:02:58 +01:00
Tobias Brunner 489d154e63 ikev2: Add option to disable following redirects as client 2016-03-04 16:02:58 +01:00
Tobias Brunner c126ddd048 ikev2: Handle REDIRECT notifies during IKE_SA_INIT 2016-03-04 16:02:58 +01:00
Tobias Brunner dd2b335b79 ike-init: Send REDIRECT notify during IKE_SA_INIT if requested by providers 2016-03-04 16:02:58 +01:00
Tobias Brunner 2beb26b948 redirect-manager: Add helper function to create and parse REDIRECT notify data
The same encoding is also used for the REDIRECT_FROM notifies.
2016-03-04 16:02:58 +01:00
Tobias Brunner fa5cfbdcbf redirect-manager: Verify type of returned gateway ID 2016-03-04 16:02:58 +01:00
Tobias Brunner 10009b2954 ike-init: Send REDIRECT_SUPPORTED as initiator 2016-03-04 16:02:58 +01:00
Tobias Brunner 099c0b12b6 ike-init: Enable redirection extension if client sends REDIRECT_SUPPORTED notify 2016-03-04 16:02:58 +01:00
Tobias Brunner c6aa749c28 ike-sa: Add new extension for IKEv2 redirection (RFC 5685) 2016-03-04 16:02:58 +01:00
Tobias Brunner 32ba44424d daemon: Create global redirect manager instance 2016-03-04 16:02:58 +01:00
Tobias Brunner 4a6e054122 redirect-manager: Add manager for redirect providers 2016-03-04 16:02:58 +01:00
Tobias Brunner dbb3f7f921 redirect-provider: Add interface to redirect clients during initial messages
This will allow e.g. plugins to decide whether a connecting client is
redirected to a different gateway using RFC 5685.
2016-03-04 16:02:57 +01:00
Andreas Steffen ad82c95f0a Set PLUTO port variables to 0 in the case of no port restrictions 2016-03-04 12:52:35 +01:00
Andreas Steffen 0d7202c7c5 Port range support in updown script 2016-03-04 09:52:34 +01:00
Andreas Steffen 6abae81f86 Implemented port ranges in kernel_netlink interface 2016-03-04 09:52:34 +01:00
Thomas Egerer 8ea4cb3e5d thread: Allow thread ID to be value returned by gettid()
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-03-04 09:12:11 +01:00
Andreas Steffen f00f679af9 Request missing SWID tags in a directed PA-TNC message 2016-03-04 01:04:44 +01:00
Tobias Brunner 28649f6d91 libhydra: Remove empty unused library 2016-03-03 17:36:11 +01:00
Tobias Brunner 8394ea2a42 libhydra: Move kernel interface to libcharon
This moves hydra->kernel_interface to charon->kernel.
2016-03-03 17:36:11 +01:00
Tobias Brunner dec9e1957f libhydra: Move all kernel plugins to libcharon 2016-03-03 17:36:11 +01:00
Tobias Brunner 91d80298f9 ikev1: Send and verify IPv6 addresses correctly
According to the mode-config draft there is no prefix sent for
IPv6 addresses in IKEv1.  We still accept 17 bytes long addresses for
backwards compatibility with older strongSwan releases.

Fixes #1304.
2016-03-03 17:32:03 +01:00
Tobias Brunner 2f3c08d268 ikev1: Allow immediate deletion of rekeyed CHILD_SAs
When charon rekeys a CHILD_SA after a soft limit expired, it is only
deleted after the hard limit is reached.  In case of packet/byte limits
this may not be the case for a long time since the packets/bytes are
usually sent using the new SA.  This may result in a very large number of
stale CHILD_SAs and kernel states.  With enough connections configured this
will ultimately exhaust the memory of the system.

This patch adds a strongswan.conf setting that, if enabled, causes the old
CHILD_SA to be deleted by the initiator after a successful rekeying.

Enabling this setting might create problems with implementations that
continue to use rekeyed SAs (e.g. if the DELETE notify is lost).
2016-03-03 17:28:03 +01:00
Tobias Brunner 904f93f655 ikev1: Avoid modifying local auth config when detecting pubkey method
If it was necessary to pass the local certificates we could probably
clone the config (but we don't do that either when later looking for the
key to actually authenticate).
Passing auth adds the same subject cert to the config over and over
again (I guess we could also try to prevent that by searching for
duplicates).
2016-03-03 17:26:14 +01:00
Tobias Brunner 444565325a forecast: Fix alignment when adding rules
Basically the same issue as with the connmark plugin.

Fixes #1212.
2016-03-03 17:20:37 +01:00
Tobias Brunner c4cb652a56 connmark: Fix alignment when adding rules
The structs that make up a message sent to the kernel have all to be
aligned with XT_ALIGN.  That was not necessarily the case when
initializing the complete message as struct.

Fixes #1212.
2016-03-03 17:20:09 +01:00
Tobias Brunner efd7fa7be1 ike: Keep track of send keepalive jobs to avoid scheduling more than one per IKE_SA 2016-03-03 17:15:37 +01:00
Tobias Brunner 34f7d3b7ae ike: Don't send NAT keepalives if we have no path to the other peer
If there is no path to the other peer there is no point in trying to
send a NAT keepalive.

If the condition changes back and forth within the keepalive interval there
is a chance that multiple jobs get queued.
2016-03-03 17:15:37 +01:00
Tobias Brunner 35d0b8b152 vici: Provide ports of local and remote IKE endpoints 2016-03-03 17:13:35 +01:00