Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autovpn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
lucha
autovpn
Commits
0e723dc4
Commit
0e723dc4
authored
10 years ago
by
lucha
Browse files
Options
Downloads
Patches
Plain Diff
added android specific configuration
parent
c5dbc384
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
autovpn/vpn_app.py
+42
-10
42 additions, 10 deletions
autovpn/vpn_app.py
with
42 additions
and
10 deletions
autovpn/vpn_app.py
+
42
−
10
View file @
0e723dc4
...
@@ -47,6 +47,31 @@ ns-cert-type server
...
@@ -47,6 +47,31 @@ ns-cert-type server
tls-auth tlsauth.key 1
tls-auth tlsauth.key 1
'''
'''
# Specific config for Android
ANDROID_CONFIG_TEMPLATE
=
'''
client
dev tun
resolv-retry infinite
nobind
persist-key
persist-tun
remote %(vpn_endpoint)s 1194 udp
remote %(vpn_endpoint)s 443 tcp
; SSL configuration.
ns-cert-type server
key-direction 1
crl-verify crl.pem
<tls-auth>
%(tlsauth)s
</tls-aut>
<pkcs12>
%(pkcs12)s
</pkcs12>
'''
TBLK_PLIST_TEMPLATE
=
'''
<?xml version=
"
1.0
"
encoding=
"
UTF-8
"
?>
TBLK_PLIST_TEMPLATE
=
'''
<?xml version=
"
1.0
"
encoding=
"
UTF-8
"
?>
<!DOCTYPE plist PUBLIC
"
-//Apple//DTD PLIST 1.0//EN
"
"
http://www.apple.com/DTDs/PropertyList-1.0.dtd
"
>
<!DOCTYPE plist PUBLIC
"
-//Apple//DTD PLIST 1.0//EN
"
"
http://www.apple.com/DTDs/PropertyList-1.0.dtd
"
>
<plist version=
"
1.0
"
>
<plist version=
"
1.0
"
>
...
@@ -121,10 +146,10 @@ https://play.google.com/store/apps/details?id=de.blinkt.openvpn
...
@@ -121,10 +146,10 @@ https://play.google.com/store/apps/details?id=de.blinkt.openvpn
To use it:
To use it:
-
Select the PKCS12 format for the credentials and select the
-
Copy the files android-%(cn)s.ovpn and crl.pem on your phone/tablet/etc.
<uuid>.pfx file from the ZIP archive.
- Import the condiguration android-%(cn)s.ovpn into the OpenVPN app
- Un-select the option for importing the PKCS12 certificate into Android Keystore
-
Ensure that LZO compression is disabled.
-
If asked for a password, just leave blank
References
References
...
@@ -342,7 +367,12 @@ def new_cert_dl():
...
@@ -342,7 +367,12 @@ def new_cert_dl():
subject
=
current_app
.
config
.
get
(
'
VPN_DEFAULT_SUBJECT_ATTRS
'
,
{}).
copy
()
subject
=
current_app
.
config
.
get
(
'
VPN_DEFAULT_SUBJECT_ATTRS
'
,
{}).
copy
()
subject
[
'
CN
'
]
=
cn
subject
[
'
CN
'
]
=
cn
# generate a new user certificate and pack it into PKCS12 format
pkey
,
cert
=
g
.
ca
.
make_certificate
(
subject
,
days
=
validity
)
pkey
,
cert
=
g
.
ca
.
make_certificate
(
subject
,
days
=
validity
)
crt_pem
=
crypto
.
dump_certificate
(
crypto
.
FILETYPE_PEM
,
cert
)
key_pem
=
crypto
.
dump_privatekey
(
crypto
.
FILETYPE_PEM
,
pkey
)
ca_pem
=
g
.
ca
.
get_ca
()
pkcs12
=
to_pkcs12
(
crt_pem
,
key_pem
,
ca_pem
)
# Create the zipfile in-memory, with all the files the user needs.
# Create the zipfile in-memory, with all the files the user needs.
vars
=
{
'
cn
'
:
cn
,
vars
=
{
'
cn
'
:
cn
,
...
@@ -350,11 +380,10 @@ def new_cert_dl():
...
@@ -350,11 +380,10 @@ def new_cert_dl():
current_app
.
config
[
'
VPN_ENDPOINT
'
].
split
(
'
.
'
)[::
-
1
])
+
'
.
'
+
cn
,
current_app
.
config
[
'
VPN_ENDPOINT
'
].
split
(
'
.
'
)[::
-
1
])
+
'
.
'
+
cn
,
'
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
()
'
tlsauth
'
:
current_app
.
config
[
'
TLS_AUTH_KEY
'
],
crt_pem
=
crypto
.
dump_certificate
(
crypto
.
FILETYPE_PEM
,
cert
)
'
pkcs12
'
:
pkcs12
}
key_pem
=
crypto
.
dump_privatekey
(
crypto
.
FILETYPE_PEM
,
pkey
)
pkcs12
=
to_pkcs12
(
crt_pem
,
key_pem
,
ca_pem
)
manifest
=
[
manifest
=
[
(
'
ca.crt
'
,
ca_pem
),
(
'
ca.crt
'
,
ca_pem
),
(
'
crl.pem
'
,
g
.
ca
.
get_crl
(
format
=
'
pem
'
)),
(
'
crl.pem
'
,
g
.
ca
.
get_crl
(
format
=
'
pem
'
)),
...
@@ -365,6 +394,9 @@ def new_cert_dl():
...
@@ -365,6 +394,9 @@ def new_cert_dl():
(
'
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
),
# Android configuration
(
'
android-%s.ovpn
'
%
cn
,
ANDROID_CONFIG_TEMPLATE
%
vars
),
# Tunnelblick configuration for OSX
# Tunnelblick configuration for OSX
(
'
%s.tblk/Info.plist
'
%
cn
,
TBLK_PLIST_TEMPLATE
%
vars
),
(
'
%s.tblk/Info.plist
'
%
cn
,
TBLK_PLIST_TEMPLATE
%
vars
),
(
'
%s.tblk/config.ovpn
'
%
cn
,
OPENVPN_CONFIG_TEMPLATE
%
vars
),
(
'
%s.tblk/config.ovpn
'
%
cn
,
OPENVPN_CONFIG_TEMPLATE
%
vars
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment