Project

General

Profile

Integration into the Android VPN frontend » History » Version 7

Tobias Brunner, 05.04.2013 14:22

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 7 Tobias Brunner
5 7 Tobias Brunner
bq. *This is not supported anymore! The required plugin for the charon daemon was removed with [[5.0.3]].*
6 4 Tobias Brunner
7 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.
8 1 Tobias Brunner
9 1 Tobias Brunner
The patches should apply cleanly to the Android 2.2 (Froyo) sources.
10 1 Tobias Brunner
11 3 Tobias Brunner
h2. Register charon as Daemon
12 1 Tobias Brunner
13 3 Tobias Brunner
We [[Android|previously]] described how to [[Android|build strongSwan, the Kernel and libvstr for Android]].
14 3 Tobias Brunner
15 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).
16 1 Tobias Brunner
17 1 Tobias Brunner
<pre>
18 1 Tobias Brunner
cd /patch/to/android/source
19 1 Tobias Brunner
cd system/core
20 1 Tobias Brunner
patch -p1 < /path/to/system.core.patch
21 1 Tobias Brunner
cd -
22 1 Tobias Brunner
</pre>
23 1 Tobias Brunner
24 1 Tobias Brunner
h2. Framework
25 1 Tobias Brunner
26 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).
27 1 Tobias Brunner
28 1 Tobias Brunner
<pre>
29 1 Tobias Brunner
cd frameworks/base
30 1 Tobias Brunner
patch -p1 < /path/to/frameworks.base.patch
31 1 Tobias Brunner
cd -
32 1 Tobias Brunner
</pre>
33 1 Tobias Brunner
34 1 Tobias Brunner
h2. Settings (Frontend)
35 1 Tobias Brunner
36 1 Tobias Brunner
And with a final patch (attachment:packages.apps.Settings.patch) the actual frontend in the @packages/apps/Settings@ project is extended.
37 1 Tobias Brunner
38 1 Tobias Brunner
<pre>
39 1 Tobias Brunner
cd packages/apps/Settings
40 1 Tobias Brunner
patch -p1 < /path/to/packages.apps.Settings.patch
41 1 Tobias Brunner
cd -
42 1 Tobias Brunner
</pre>
43 1 Tobias Brunner
44 1 Tobias Brunner
Building the complete source tree completes the integration.
45 2 Tobias Brunner
46 2 Tobias Brunner
h2. Example Gateway Configuration
47 2 Tobias Brunner
48 2 Tobias Brunner
h3. Certificates
49 2 Tobias Brunner
50 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.
51 2 Tobias Brunner
52 2 Tobias Brunner
h3. Configuration
53 2 Tobias Brunner
54 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).
55 2 Tobias Brunner
56 2 Tobias Brunner
[[IpsecConf|ipsec.conf]]
57 2 Tobias Brunner
<pre>
58 2 Tobias Brunner
# ipsec.conf - strongSwan IPsec configuration file
59 2 Tobias Brunner
60 2 Tobias Brunner
conn android
61 2 Tobias Brunner
	leftsubnet=0.0.0.0/0
62 2 Tobias Brunner
	leftcert=vpnCert.pem
63 2 Tobias Brunner
	leftauth=pubkey
64 2 Tobias Brunner
	leftid=@vpn.strongswan.org
65 2 Tobias Brunner
	right=%any
66 2 Tobias Brunner
	rightsourceip=10.0.5.0/24
67 2 Tobias Brunner
	rightauth=eap-mschapv2
68 2 Tobias Brunner
	rightsendcert=never
69 2 Tobias Brunner
	keyexchange=ikev2
70 2 Tobias Brunner
	eap_identity=%any
71 2 Tobias Brunner
	auto=add
72 2 Tobias Brunner
</pre>
73 2 Tobias Brunner
74 2 Tobias Brunner
[[IpsecSecrets|ipsec.secrets]]
75 2 Tobias Brunner
<pre>
76 2 Tobias Brunner
# /etc/ipsec.secrets - strongSwan IPsec secrets file
77 2 Tobias Brunner
78 2 Tobias Brunner
: RSA vpnKey.pem
79 2 Tobias Brunner
80 2 Tobias Brunner
carol : EAP "abcd1234"
81 2 Tobias Brunner
dave  : EAP "fghj5678"
82 2 Tobias Brunner
</pre>
83 2 Tobias Brunner
84 2 Tobias Brunner
[[StrongswanConf|strongswan.conf]]
85 2 Tobias Brunner
<pre>
86 2 Tobias Brunner
# /etc/strongswan.conf - strongSwan configuration file
87 2 Tobias Brunner
88 2 Tobias Brunner
charon {
89 2 Tobias Brunner
	dns1 = 62.2.17.60
90 2 Tobias Brunner
	dns2 = 62.2.24.162
91 2 Tobias Brunner
}
92 2 Tobias Brunner
</pre>