Commit Graph

594 Commits

Author SHA1 Message Date
Tobias Brunner 6294f28bd3 android: Catch exception if numbers are too large for Integer 2016-06-13 16:12:17 +02:00
Tobias Brunner 9827380e6f android: Update Gradle plugin 2016-06-13 10:19:13 +02:00
Tobias Brunner 25b69260fe android: Fix signature of get_nexthop() 2016-06-13 10:18:45 +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
Tobias Brunner c962ae2e62 android: New release after reducing number of DH groups in proposal 2016-05-04 12:07:36 +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
Tobias Brunner cb65e95d4a android: OPENSSL_NO_ENGINE is now properly defined in the headers 2016-04-15 10:32:36 +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 89da06ace9 kernel: Use structs to pass information to the kernel-ipsec interface 2016-04-09 16:50:59 +02:00
Andreas Steffen b12c53ce77 Use standard unsigned integer types 2016-03-24 18:52:48 +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 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 e8140531fc libipsec: Pass the same data to del_policy() as to add_policy()
We already do this for the other kernel interfaces.

Fixes e1e88d5add ("libipsec: Don't attempt deletion of any non-IPsec policies")
2016-02-04 11:02:59 +01:00
Tobias Brunner 88b85e022a sigwaitinfo() may fail with EINTR if interrupted by an unblocked signal not in the set
Fixes #1213.
2015-11-23 11:37:19 +01:00
Tobias Brunner fe48e4ae31 android: Suppress compiler warnings about missing field initializers
Triggered by -Wextra for many INIT usages where we only partially
initialize a struct.
2015-11-13 18:24:45 +01:00
Tobias Brunner 3af7e09271 android: Add some (older) unit tests 2015-11-12 14:12:43 +01:00
Tobias Brunner 9e81f33b55 android: Properly handle shorter types in BufferedByteWriter
In Java all integer types are signed, when a negative integer is casted
to a larger type (e.g. int to long) then due to sign extension the upper
bytes are not 0.  So writing that value to a byte array does not produce
the expected result.  By overloading the putX() methods we make sure to
upcast the values correctly.
2015-11-12 14:12:13 +01:00
Tobias Brunner a50f3037ad android: Migrate to the Gradle build system
This uses a manual way to trigger the NDK build (the default with
on-the-fly Android.mk files does not work for us).
2015-11-12 14:11:37 +01:00
Tobias Brunner a6e0f14fd2 kernel-interface: Pass the same data to del_policy() that was passed to add_policy()
The additional data can be helpful to identify the exact policy to
delete.
2015-11-10 16:42:52 +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 ff0abde9ed controller: Optionally adhere to init limits also when initiating IKE_SAs 2015-08-21 18:21:13 +02:00
Tobias Brunner 1d3e69c6da android: New release fixing roaming on 5+ and adding new advanced options 2015-07-28 13:57:13 +02:00
Tobias Brunner 1e323dc1b7 android: Keep NDK API level at 19
The headers/libraries changed a lot with level 21 so that our app won't
run on devices with Android < 5 when built against it.  We currently
don't need any new native APIs so that should be fine.
2015-07-28 13:27:34 +02:00
Tobias Brunner acc8948fa5 android: Apply split tunneling options when creating TUN device
Android blocks traffic for address families for which no IPs, DNS servers
or routes are installed via VpnService.Builder.  Since Android 5+ (API
level 21) it is possible to explicitly allow such traffic to bypass the VPN.

So for proper split tunneling we note whether we saw a VIP and/or DNS
server of a specific family, and if not, allow traffic of that family
to bypass the VPN using the new API (on older systems there is no change
and such traffic will still be blocked).  Otherwise, we do what we did so
far, that is, simply install the received routes (traffic selectors), all
other traffic will not be directed to the TUN device and use the underlying
network instead.

If traffic for a family should be blocked we install a default route via
TUN device even if we received more specific traffic selectors from the
server.  libipsec will use the actual traffic selectors as IPsec policies
and drop any packets it received that don't match them.  We only do this
if we saw any VIPs or DNS servers of a family.  Otherwise the traffic for
that family is blocked anyway.
2015-07-28 13:27:34 +02:00
Tobias Brunner bb40498df3 android: Build against the android-21 target 2015-07-28 13:27:34 +02:00
Tobias Brunner 3ee84fa976 android: Extend GUI so the split tunneling options can be set 2015-07-28 13:27:33 +02:00
Tobias Brunner f3d8da7644 android: Add field for split tunneling config to data model 2015-07-28 13:27:33 +02:00
Tobias Brunner 030bcee1b0 android: Retrigger a roam event if reportedly connected but no source address found
In dual-stack environments the IPv6 connectivity (via autoconfiguration)
might be established before the IPv4 connectivity (via DHCP).  It seems
Android triggers the CONNECTIVITY_ACTION broadcast already when the first
family is fully configured.  At that time we might not be able to find an
IPv4 source address.  And since Android does not trigger the broadcast
again if IPv4 connectivity is established, the connection is broken
afterwards.

So we store the connectivity state and if we are reportedly connected but
still find no source address we trigger a roam event to recheck for an IPv4
address.  This will cause regular rechecks if a device enters an IPv6-only
network, but I guess that's rare (otherwise we could limit the number of
rechecks done between connectivity changes).
2015-07-28 13:27:33 +02:00
Tobias Brunner 41b59a3443 android: Add method to check for connectivity to NetworkManager 2015-07-28 13:27:33 +02:00
Tobias Brunner 5da31733de android: Fix kernel-net implementation on Android 4.3 and earlier
Before fwmarks were used protected sockets were bound to the outbound
interface via SO_BINDTODEVICE.  This does not always seem to work well
together with our connect()/getsockname() trick if the server is covered
by the traffic selectors.  Calling protect() again after disconnecting
the socket seems to help, but if there is no connectivity at all we still
get the virtual IP back (maybe protect() does not bind the socket to any
interface then).
2015-07-28 13:27:33 +02:00
Tobias Brunner 1082372448 android: Add a custom kernel-net implementation to replace kernel-netlink
When roaming from a mobile network to WiFi on Android 5.x the event
received via ConnectivityManager is triggered before the mobile
connection is fully torn down (i.e. before the interface is disabled and
the routes disappear).  So for strongSwan the current path still seems
valid and since no roam event is triggered later the daemon never switches
to WiFi and the connection is broken afterwards.

A possible solution to this is enabling roam events in the kernel-netlink
plugin.  That would trigger an event when the device is finally disconnected
from the mobile network.  However, this could actually take a some time,
during which traffic continues to be sent via mobile network instead of WiFi.
That's because Android now uses multiple routing tables, routing rules and
fwmarks to direct traffic to the appropriate interface/table, but in our
plugin we don't have the information available that would allow us to make
the switch to a different network/routing table earlier (and we actually
prefer the current path if it is still valid).  Additionally, the plugin
produces quite a bit more events than ConnectivityManager (which was one
of the reasons to use the latter in the first place).

This custom kernel-net implementation is now specifically tailored for
Android.  Roam events are still triggered via ConnectivityManager but
the source address is determined via connect()/getsockname() on a VPN
excluded UDP socket, which does use the correct routing table as intended
by Android.  That way the daemon immediately sees a different source IP
when connectivity changes even if the device is connected to multiple
networks concurrently.
2015-07-28 13:27:33 +02:00
Tobias Brunner 69e0215b9d android: Manually load libraries with dlopen() and RTLD_GLOBAL on Android M
This fixes an issue when using the Android M preview.  Bionic's dynamic
linker was changed so that symbols in libraries loaded with RTLD_LOCAL
were not found anymore in dlsym(RTLD_DEFAULT, ...).  This is the case
for libraries loaded with System.loadLibrary(), therefore, the plugin
loader in libstrongswan was not able to resolve any symbols defined in
other libraries loaded later.  While this seems to have been broken
unintentionally for existing apps (fix at [1]), it will again be a
problem whenever we decide to increase targetSdkVersion beyond 22 (or
until that fix makes it into the system/emulator images).

Unfortunately, the dynamic loader in releases prior to Android 4.3 can't
load libandroidbridge without also loading its dependencies.

[1] https://github.com/android/platform_bionic/commit/1913352c6b
2015-07-28 13:27:33 +02:00
Tobias Brunner cda167c8c4 android: Apply configured server port 2015-07-28 13:27:33 +02:00
Tobias Brunner 6c0ec35c53 android: Extend GUI so the server port can be entered 2015-07-28 13:27:33 +02:00
Tobias Brunner 5b11855f26 android: Add field for server port to data model 2015-07-28 13:27:33 +02:00
Tobias Brunner 4d02c49ead android: Apply configured MTU
While it is stored as property of individual profiles it is really a
global setting because we currently don't support more than one
connection.
2015-07-28 13:27:33 +02:00
Tobias Brunner c682205113 android: Extend GUI so the MTU can be entered
This also adds a new area for advanced settings that is only displayed
if the user requests it (or if advanced settings already have been set).

The min. MTU for IPv6 is 1280, anything lower lets the TUN device
creation fail if an IPv6 address has been assigned.  If lower MTUs are
necessary we might be able to catch that later when setting the MTU and
just use at least 1280 if an IPv6 address was assigned, but let's keep
it simple for now.
2015-07-28 13:27:32 +02:00
Tobias Brunner 7e2a6c4a41 android: Add field for MTU to data model 2015-07-28 13:27:32 +02:00
Tobias Brunner 6830cb1c1b android: Set preferred language for remediation instructions 2015-07-28 13:27:32 +02:00
Tobias Brunner 79af70c66e android: Encode connection settings as single Java string argument
This makes adding new configuration settings easier.
2015-07-28 13:27:32 +02:00
Tobias Brunner fd16adb765 android: Add simple utility class to generate settings_t compatible config snippets 2015-07-28 13:27:32 +02:00
Tobias Brunner 41594a7bb7 android: Don't pass null as root view to inflate() 2015-07-28 13:27:31 +02:00
Tobias Brunner 16e9efc092 android: Fix a potential NullPointerException in the IMC state fragment 2015-07-28 13:27:31 +02:00
Tobias Brunner 4dc6275be5 android: EAP-TNC does not require a client certificate
Was incorrectly changed with the refactoring in a64089738d ("android:
Change how features of VPN types are stored and checked").
2015-07-28 13:27:31 +02:00
Tobias Brunner 9d957bacfc android: Enable charon.initiator_only option 2015-07-28 13:27:31 +02:00
Tobias Brunner 5f613590b0 android: Increase the minSdkVersion to 15 and targetSdkVersion to 22
There are no devices anymore that use API level 14 (4.0-4.0.2) and 22 is
the most recent level.
2015-07-28 13:27:31 +02:00
Martin Willi 5fbc709224 osx: Version bump to 5.3.2-1 2015-06-18 10:37:21 +02:00
Martin Willi 88b60c3349 osx: Use CodeSignOnCopy for privileged helper, as suggested by XCode 2015-06-18 10:36:05 +02:00
Martin Willi 0f1d6b34b3 charon-xpc: Use DNS non-append/replace mode in osx-attr plugin 2015-06-18 10:36:04 +02:00
Martin Willi 219821a78a osx: Include eap-gtc plugin in build instructions 2015-03-16 09:27:18 +01:00
Martin Willi 607eebcfcf libipsec: Pass separate inbound/update flags to the IPsec SA manager
Similar to other kernel interfaces, the libipsec backends uses the flag for
different purposes, and therefore should get separate flags.
2015-03-09 18:18:20 +01:00
Martin Willi b9be25ea39 attribute-handler: Pass full IKE_SA to handler backends 2015-02-20 13:34:56 +01:00
Martin Willi 751363275f attributes: Move the configuration attributes framework to libcharon 2015-02-20 13:34:55 +01:00
Martin Willi 246c969d8b ike: Consistently log CHILD_SAs with their unique_id instead of their reqid 2015-02-20 13:34:52 +01:00
Martin Willi db80d0d2da ike-sa-manager: Remove IKE_SA checkout by CHILD_SA reqid 2015-02-20 13:34:51 +01:00
Martin Willi f81a949748 kernel-interface: Raise expires with a proto/SPI/dst tuple instead of reqid 2015-02-20 13:34:50 +01:00