Project

General

Profile

Integration into the Android VPN frontend » History » Version 3

Tobias Brunner, 05.07.2010 11:53

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