Compare commits

...
10 Commits
Author SHA1 Message Date
Your Name 58c0dbaa18 add makecert 2023-06-20 09:01:08 +00:00
Your Name 71a83c880f make proxy 2022-05-28 07:32:54 +00:00
monster 9a68bb87bf Update README.md 2021-06-28 13:26:05 +03:00
monster 0e461f6f06 Merge pull request #1 from monster1026/patch-1
Update README.md
2021-03-31 12:17:32 +03:00
monster1026 c529e75700 Update README.md 2021-03-31 12:16:57 +03:00
Your Name d4d60d0616 updating configuration 2021-03-31 09:10:19 +00:00
monster a666013c37 Update README.md 2021-03-31 02:16:14 +03:00
Your Name 21e4cb1390 Merge branch 'master' of github.com:monster1025/openvpn-proxy 2021-03-30 23:14:19 +00:00
Your Name e2aef994e1 updating configuration 2021-03-30 23:14:12 +00:00
monster cd78746980 Update README.md 2021-03-31 01:58:16 +03:00
9 changed files with 61 additions and 14 deletions

No files matched your search

+11 -1
View File
@@ -1,7 +1,17 @@
# openvpn-proxy
This tool can help you with over-private companies vpn servers.
It can authomatically authentificate via 'password+otp pin' schema and provide proxy access to VPN network.
### Configuration
Please specify your username, password and secret token in openvpn/settings/openvpn.env (you can use openvpn.env.sample)
Please specify your username, password and secret token in openvpn/settings/openvpn.env (you can use openvpn.env.sample)
Also you can specify proxy password for authentification, username is 'admin'.
### Definitions
Openvpn configuration file must be named 'client.ovpn' in 'openvpn/settings/conf/' directory.
## Converting Google Auth export to secrets
You can use this project to convert export url to secret key: https://github.com/dim13/otpauth
## Running
Place configuration in env file, add your vpn setting to 'openvpn/settings/conf', rename you vpn config to client.ovpn and run 'docker-compose up -d'
You will get a HTTPS proxy at 3128 port and SOCKS proxy on 1080.
+8 -2
View File
@@ -6,10 +6,16 @@ services:
build: ./openvpn/docker
container_name: openvpn
ports:
- "9080:9080"
- "3128:3128"
- "1080:1080"
env_file: ./openvpn/settings/openvpn.env
devices:
- "/dev/net/tun:/dev/net/tun"
restart: always
volumes:
- ./openvpn/settings/conf:/etc/openvpn
- ./openvpn/settings/conf:/etc/openvpn:ro
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
+2 -3
View File
@@ -1,7 +1,6 @@
daemon
nserver 10.2.67.10
auth none
log
proxy -p9080
proxy -p3128
socks -p1080
+2 -1
View File
@@ -27,9 +27,10 @@ RUN set -ex \
\
&& apk del .build-deps
RUN apk update && apk add python3 curl && pip3 install pyotp
RUN apk update && apk upgrade && apk add python3 curl && pip3 install pyotp
ADD run.sh /run.sh
ADD generate.py /generate.py
ADD nserver.py /nserver.py
ADD 3pr.cfg /3pr.cfg
RUN chmod +x /run.sh
+7 -7
View File
@@ -5,17 +5,17 @@ user = os.getenv('USERNAME')
password = os.getenv('PASSWORD')
secret = os.getenv('SECRET')
if user == "":
if user == None:
print("USERNAME not specified")
os.exit(-1)
os._exit(-1)
if password == "":
if password == None:
print("PASSWORD not specified")
os.exit(-1)
os._exit(-1)
if secret == "":
if secret == None:
print("SECRET not specified")
os.exit(-1)
os._exit(-1)
totp = pyotp.TOTP(secret)
token = totp.now()
@@ -25,4 +25,4 @@ f.write("{}\n".format(user))
f.write('{}{}\n'.format(password, token))
f.close()
print("Generated OTP token for user ({}): {}".format(user,token))
print("Generated OTP token for user ({}): {}".format(user,token))
+24
View File
@@ -0,0 +1,24 @@
import os
import re
nameserver = os.getenv('NAMESERVER')
if nameserver == None:
print("NAMESERVER not specified, skipping proxy configuration")
os._exit(-1)
filename = "/3pr.cfg"
with open(filename, 'r') as file :
filedata = file.read()
if 'nserver' in filedata:
filedata = re.sub(r'nserver .*', 'nserver {}'.format(nameserver), filedata)
else:
filedata = filedata.replace('daemon', 'daemon\nnserver {}'.format(nameserver))
password = os.getenv('PROXY_PASSWORD')
if password != None:
filedata = filedata.replace('auth none', 'auth strong\nusers admin:CL:{}'.format(password))
with open(filename, 'w') as file:
file.write(filedata)
+1
View File
@@ -1,4 +1,5 @@
#!/bin/bash
python3 /nserver.py
3proxy /3pr.cfg
python3 /generate.py
openvpn --config /etc/openvpn/client.ovpn --auth-user-pass /auth.txt
+4
View File
@@ -0,0 +1,4 @@
openssl pkcs12 -in user.pfx -clcerts -nokeys -out user.crt.new && mv user.crt.new user.crt
openssl pkcs12 -in user.pfx -nocerts -out user_pass.key.new && mv user_pass.key.new user_pass.key
openssl rsa -in user_pass.key -out user.key.new && mv user.key.new user.key
rm -f user.crt.new user_pass.key.new user.key.new
+2
View File
@@ -1,3 +1,5 @@
USERNAME=xxxxxxxxx
PASSWORD=xxxxxxxxx
PROXY_PASSWORD=xxxxxxxxx
SECRET=xxxxxxxxx
NAMESERVER=xxxxxxxxx