Commit Graph

11840 Commits

Author SHA1 Message Date
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