Project

General

Profile

Integration into the Android VPN frontend » History » Version 4

Tobias Brunner, 15.08.2012 14:18
Note about App added

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