Hello,
I added the possibility to create ovpn file for Android, which has all the certificates inline.
Here's the patch:
Code: Select all
--- app.py.orig 2011-08-08 09:19:31.000000000 +0300
+++ app.py 2013-01-17 02:02:57.263543278 +0200
@@ -142,7 +142,7 @@
action="store",
dest="confs",
default="unix",
- help="create config files for [windows|unix|mac|all]")
+ help="create config files for [windows|unix|mac|android|all]")
group_extra.add_option("-e", "--prefix",
action="store",
dest="fprefix",
@@ -1045,10 +1045,14 @@
sectionname = 'mac conf'
print "Generating Mac configuration file"
f=open(self.working + '/' + self.fprefix + fname + '.conf', 'w')
+ elif sname == 'android':
+ sectionname = 'android conf'
+ print "Generating Android configuration file"
+ f=open(self.working + '/' + self.fprefix + fname + '.ovpn', 'w')
elif sname == 'all':
print "Generating all configuration files"
else:
- print "Incorrect OS type specified. Valid options are 'unix', 'windows', 'mac' or 'all'."
+ print "Incorrect OS type specified. Valid options are 'unix', 'windows', 'mac', 'android' or 'all'."
sys.exit()
if sname != 'all':
section=config[sectionname]
@@ -1069,9 +1073,19 @@
f.write(section[var] + '\n')
else:
f.write(section[var] + '\n')
+ if sname == 'android':
+ fp = open ( self.cacertfile, 'r' )
+ f.write('\n' + "<ca>" + '\n' + fp.read() + "</ca>" + '\n')
+ fp.close ()
+ fp = open ( self.working + '/' + self.fprefix + fname + '.crt', 'r' )
+ f.write('\n' + "<cert>" + '\n' + fp.read() + "</cert>" + '\n')
+ fp.close ()
+ fp = open ( self.working + '/' + self.fprefix + fname + '.key', 'r' )
+ f.write('\n' + "<key>" + '\n' + fp.read() + "</key>" + '\n')
+ fp.close ()
f.close()
else:
- os_versions = ["windows", "linux", "mac"]
+ os_versions = ["windows", "linux", "mac", "android"]
for os_type in os_versions:
# soort extensie ipv deze regel <<
if os_type == 'linux':
@@ -1086,6 +1100,10 @@
sectionname = 'mac conf'
print "Generating Mac configuration file"
f=open(self.working + '/' + self.fprefix + fname + '.mac.conf', 'w')
+ elif os_type == 'android':
+ sectionname = 'android conf'
+ print "Generating Android configuration file"
+ f=open(self.working + '/' + self.fprefix + fname + '.android.ovpn', 'w')
section=config[sectionname]
for var in section:
if var == 'ca':
@@ -1097,6 +1115,16 @@
f.write(section[var].replace('clientkeyfile', self.fprefix + fname + '.key') + '\n')
else:
f.write(section[var] + '\n')
+ if os_type == 'android':
+ fp = open ( self.cacertfile, 'r' )
+ f.write('\n' + "<ca>" + '\n' + fp.read() + "</ca>" + '\n')
+ fp.close ()
+ fp = open ( self.working + '/' + self.fprefix + fname + '.crt', 'r' )
+ f.write('\n' + "<cert>" + '\n' + fp.read() + "</cert>" + '\n')
+ fp.close ()
+ fp = open ( self.working + '/' + self.fprefix + fname + '.key', 'r' )
+ f.write('\n' + "<key>" + '\n' + fp.read() + "</key>" + '\n')
+ fp.close ()
f.close()
And here's the diff for stonevpn.conf:
Code: Select all
--- stonevpn.conf.orig 2010-08-04 17:35:39.000000000 +0300
+++ stonevpn.conf 2013-01-17 02:46:36.718509951 +0200
@@ -114,3 +114,29 @@
verb = 'verb 3'
prot = 'proto tcp'
+[android conf]
+# add options to be added to the configuration file here
+daemon = 'daemon'
+dev = 'dev tun'
+ip = 'remote 12.34.56.78'
+# uncomment the next 3 lines to add redundant routers:
+# remote-random
+# resolv-retry 60
+# ip2 = 'remote 23.45.67.89'
+port = 'port 1194'
+#mssfix = 'mssfix 1300'
+client = 'client'
+tlc = 'tls-client'
+# don't touch the next 3 var names:
+#ca = 'ca /Library/openvpn/cacertfile'
+#cert = 'cert /Library/openvpn/clientcertfile'
+#key = 'key /Library/openvpn/clientkeyfile'
+lzo = 'comp-lzo'
+ping = 'ping 15'
+pingrestart = 'ping-restart 45'
+pingtimer = 'ping-timer-rem'
+persisttun = 'persist-tun'
+persistkey = 'persist-key'
+verb = 'verb 3'
+prot = 'proto tcp'
+