Project

General

Profile

Integration into the Android VPN frontend » History » Version 6

Tobias Brunner, 05.04.2013 14:19

1 1 Tobias Brunner
h1. Integration into the Android VPN frontend
2 1 Tobias Brunner
3 5 Tobias Brunner
bq. *Important:* This patch is quite outdated. We now provide [[AndroidVPNClient|an App for Android 4 and newer]].
4 6 Tobias Brunner
    *This is not supported anymore! The required plugin for the charon daemon was removed with [[5.0.3]].*
5 4 Tobias Brunner
6 1 Tobias Brunner
To easily setup IKEv2/IPsec VPN connections with EAP-authentication on Android we prepared a set of patches that integrate strongSwan into the default Android VPN frontend.
7 1 Tobias Brunner
8 1 Tobias Brunner
The patches should apply cleanly to the Android 2.2 (Froyo) sources.
9 1 Tobias Brunner
10 3 Tobias Brunner
h2. Register charon as Daemon
11 1 Tobias Brunner
12 3 Tobias Brunner
We [[Android|previously]] described how to [[Android|build strongSwan, the Kernel and libvstr for Android]].
13 3 Tobias Brunner
14 3 Tobias Brunner
To register [[Charon|charon]] as a daemon, the @init.rc@ file of the @system/core@ project has to be patched (attachment:system.core.patch).
15 1 Tobias Brunner
16 1 Tobias Brunner
<pre>
17 1 Tobias Brunner
cd /patch/to/android/source
18 1 Tobias Brunner
cd system/core
19 1 Tobias Brunner
patch -p1 < /path/to/system.core.patch
20 1 Tobias Brunner
cd -
21 1 Tobias Brunner
</pre>
22 1 Tobias Brunner
23 1 Tobias Brunner
h2. Framework
24 1 Tobias Brunner
25 1 Tobias Brunner
The actual VPN types and the Daemon Proxy provided in the @frameworks/base@ project have to be extended by another patch (attachment:frameworks.base.patch).
26 1 Tobias Brunner
27 1 Tobias Brunner
<pre>
28 1 Tobias Brunner
cd frameworks/base
29 1 Tobias Brunner
patch -p1 < /path/to/frameworks.base.patch
30 1 Tobias Brunner
cd -
31 1 Tobias Brunner
</pre>
32 1 Tobias Brunner
33 1 Tobias Brunner
h2. Settings (Frontend)
34 1 Tobias Brunner
35 1 Tobias Brunner
And with a final patch (attachment:packages.apps.Settings.patch) the actual frontend in the @packages/apps/Settings@ project is extended.
36 1 Tobias Brunner
37 1 Tobias Brunner
<pre>
38 1 Tobias Brunner
cd packages/apps/Settings
39 1 Tobias Brunner
patch -p1 < /path/to/packages.apps.Settings.patch
40 1 Tobias Brunner
cd -
41 1 Tobias Brunner
</pre>
42 1 Tobias Brunner
43 1 Tobias Brunner
Building the complete source tree completes the integration.
44 2 Tobias Brunner
45 2 Tobias Brunner
h2. Example Gateway Configuration
46 2 Tobias Brunner
47 2 Tobias Brunner
h3. Certificates
48 2 Tobias Brunner
49 2 Tobias Brunner
A gateway certificate signed by a Certificate Authority (CA) is required and the CA-certificate has to be installed on the Android phone. This can be done easily via the integrated browser. The web server has to provide @application/x-x509-ca-cert@ as MIME-type for the certificate to trigger the installation on the phone.
50 2 Tobias Brunner
51 2 Tobias Brunner
h3. Configuration
52 2 Tobias Brunner
53 2 Tobias Brunner
The following example gateway configuration can be used with the Android client (basically, you can use the same [[Win7EapMultipleConfig|configuration]] as for the [[Windows7|Windows 7]] clients).
54 2 Tobias Brunner
55 2 Tobias Brunner
[[IpsecConf|ipsec.conf]]
56 2 Tobias Brunner
<pre>
57 2 Tobias Brunner
# ipsec.conf - strongSwan IPsec configuration file
58 2 Tobias Brunner
59 2 Tobias Brunner
conn android
60 2 Tobias Brunner
	leftsubnet=0.0.0.0/0
61 2 Tobias Brunner
	leftcert=vpnCert.pem
62 2 Tobias Brunner
	leftauth=pubkey
63 2 Tobias Brunner
	leftid=@vpn.strongswan.org
64 2 Tobias Brunner
	right=%any
65 2 Tobias Brunner
	rightsourceip=10.0.5.0/24
66 2 Tobias Brunner
	rightauth=eap-mschapv2
67 2 Tobias Brunner
	rightsendcert=never
68 2 Tobias Brunner
	keyexchange=ikev2
69 2 Tobias Brunner
	eap_identity=%any
70 2 Tobias Brunner
	auto=add
71 2 Tobias Brunner
</pre>
72 2 Tobias Brunner
73 2 Tobias Brunner
[[IpsecSecrets|ipsec.secrets]]
74 2 Tobias Brunner
<pre>
75 2 Tobias Brunner
# /etc/ipsec.secrets - strongSwan IPsec secrets file
76 2 Tobias Brunner
77 2 Tobias Brunner
: RSA vpnKey.pem
78 2 Tobias Brunner
79 2 Tobias Brunner
carol : EAP "abcd1234"
80 2 Tobias Brunner
dave  : EAP "fghj5678"
81 2 Tobias Brunner
</pre>
82 2 Tobias Brunner
83 2 Tobias Brunner
[[StrongswanConf|strongswan.conf]]
84 2 Tobias Brunner
<pre>
85 2 Tobias Brunner
# /etc/strongswan.conf - strongSwan configuration file
86 2 Tobias Brunner
87 2 Tobias Brunner
charon {
88 2 Tobias Brunner
	dns1 = 62.2.17.60
89 2 Tobias Brunner
	dns2 = 62.2.24.162
90 2 Tobias Brunner
}
91 2 Tobias Brunner
</pre>