Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
autoca
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ai
autoca
Commits
1adf6ab2
Commit
1adf6ab2
authored
Jul 01, 2012
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a PKCS#12 file to the zip archive (for quick configuration of the android client)
parent
ad7158b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletion
+37
-1
autovpn/vpn_app.py
autovpn/vpn_app.py
+37
-1
No files found.
autovpn/vpn_app.py
View file @
1adf6ab2
...
@@ -2,6 +2,9 @@ import datetime
...
@@ -2,6 +2,9 @@ import datetime
import
functools
import
functools
import
logging
import
logging
import
os
import
os
import
shutil
import
subprocess
import
tempfile
import
uuid
import
uuid
import
zipfile
import
zipfile
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
...
@@ -105,6 +108,18 @@ The ZIP file contains a configuration for Tunnelblick. Double-click
...
@@ -105,6 +108,18 @@ The ZIP file contains a configuration for Tunnelblick. Double-click
on it and it will install itself automatically.
on it and it will install itself automatically.
Android
-------
Check out the OpenVPN app at http://code.google.com/p/ics-openvpn/,
to use it:
- Select the PKCS12 format for the credentials and select the
<uuid>.pfx file from the ZIP archive.
- Ensure that LZO compression is disabled.
References
References
----------
----------
...
@@ -118,6 +133,24 @@ Further info:
...
@@ -118,6 +133,24 @@ Further info:
'''
'''
def
to_pkcs12
(
crt_pem
,
key_pem
,
ca_pem
):
"""Pack credentials into a PKCS12-format buffer."""
tmpdir
=
tempfile
.
mkdtemp
()
try
:
for
name
,
content
in
[
(
'crt.pem'
,
crt_pem
),
(
'key.pem'
,
key_pem
),
(
'ca.pem'
,
ca_pem
)]:
with
open
(
os
.
path
.
join
(
tmpdir
,
name
))
as
fd
:
fd
.
write
(
content
)
pipe
=
subprocess
.
Popen
(
[
'openssl'
,
'pkcs12'
,
'-export'
,
'-password'
,
'pass:'
,
'-in'
,
'crt.pem'
,
'-inkey'
,
'key.pem'
,
'-CAfile'
,
'ca.pem'
],
cwd
=
tmpdir
,
stdout
=
subprocess
.
PIPE
)
return
pipe
.
communicate
()[
0
]
finally
:
shutil
.
rmtree
(
tmpdir
)
def
csrf
(
methods
=
(
'POST'
,)):
def
csrf
(
methods
=
(
'POST'
,)):
def
_csrf
(
fn
):
def
_csrf
(
fn
):
@
functools
.
wraps
(
fn
)
@
functools
.
wraps
(
fn
)
...
@@ -214,13 +247,16 @@ def new_cert_dl():
...
@@ -214,13 +247,16 @@ def new_cert_dl():
'vpn_endpoint'
:
current_app
.
config
[
'VPN_ENDPOINT'
],
'vpn_endpoint'
:
current_app
.
config
[
'VPN_ENDPOINT'
],
'vpn_site'
:
current_app
.
config
[
'VPN_SITE_URL'
],
'vpn_site'
:
current_app
.
config
[
'VPN_SITE_URL'
],
'expiry_date'
:
expiry_date
.
strftime
(
'%Y/%m/%d'
)}
'expiry_date'
:
expiry_date
.
strftime
(
'%Y/%m/%d'
)}
ca_pem
=
g
.
ca
.
get_ca
()
crt_pem
=
crypto
.
dump_certificate
(
crypto
.
FILETYPE_PEM
,
cert
)
crt_pem
=
crypto
.
dump_certificate
(
crypto
.
FILETYPE_PEM
,
cert
)
key_pem
=
crypto
.
dump_privatekey
(
crypto
.
FILETYPE_PEM
,
pkey
)
key_pem
=
crypto
.
dump_privatekey
(
crypto
.
FILETYPE_PEM
,
pkey
)
pkcs12
=
to_pkcs12
(
crt_pem
,
key_pem
,
ca_pem
)
manifest
=
[
manifest
=
[
(
'ca.crt'
,
g
.
ca
.
get_ca
()
),
(
'ca.crt'
,
ca_pem
),
(
'crl.pem'
,
g
.
ca
.
get_crl
(
format
=
'pem'
)),
(
'crl.pem'
,
g
.
ca
.
get_crl
(
format
=
'pem'
)),
(
'%s.crt'
%
cn
,
crt_pem
),
(
'%s.crt'
%
cn
,
crt_pem
),
(
'%s.key'
%
cn
,
key_pem
),
(
'%s.key'
%
cn
,
key_pem
),
(
'%s.pfx'
%
cn
,
pkcs12
),
(
'openvpn-%s.conf'
%
cn
,
OPENVPN_CONFIG_TEMPLATE
%
vars
),
(
'openvpn-%s.conf'
%
cn
,
OPENVPN_CONFIG_TEMPLATE
%
vars
),
(
'README.txt'
,
README_TEMPLATE
%
vars
),
(
'README.txt'
,
README_TEMPLATE
%
vars
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment