updating configuration
This commit is contained in:
@@ -13,3 +13,8 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./openvpn/settings/conf:/etc/openvpn
|
- ./openvpn/settings/conf:/etc/openvpn
|
||||||
|
logging:
|
||||||
|
driver: json-file
|
||||||
|
options:
|
||||||
|
max-size: "10m"
|
||||||
|
max-file: "5"
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
daemon
|
daemon
|
||||||
|
|
||||||
nserver 10.2.67.10
|
|
||||||
|
|
||||||
auth none
|
auth none
|
||||||
log
|
log
|
||||||
proxy -p9080
|
proxy -p9080
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ RUN set -ex \
|
|||||||
RUN apk update && apk add python3 curl && pip3 install pyotp
|
RUN apk update && apk add python3 curl && pip3 install pyotp
|
||||||
ADD run.sh /run.sh
|
ADD run.sh /run.sh
|
||||||
ADD generate.py /generate.py
|
ADD generate.py /generate.py
|
||||||
|
ADD nserver.py /nserver.py
|
||||||
ADD 3pr.cfg /3pr.cfg
|
ADD 3pr.cfg /3pr.cfg
|
||||||
RUN chmod +x /run.sh
|
RUN chmod +x /run.sh
|
||||||
|
|
||||||
|
|||||||
@@ -5,17 +5,17 @@ user = os.getenv('USERNAME')
|
|||||||
password = os.getenv('PASSWORD')
|
password = os.getenv('PASSWORD')
|
||||||
secret = os.getenv('SECRET')
|
secret = os.getenv('SECRET')
|
||||||
|
|
||||||
if user == "":
|
if user == None:
|
||||||
print("USERNAME not specified")
|
print("USERNAME not specified")
|
||||||
os.exit(-1)
|
os._exit(-1)
|
||||||
|
|
||||||
if password == "":
|
if password == None:
|
||||||
print("PASSWORD not specified")
|
print("PASSWORD not specified")
|
||||||
os.exit(-1)
|
os._exit(-1)
|
||||||
|
|
||||||
if secret == "":
|
if secret == None:
|
||||||
print("SECRET not specified")
|
print("SECRET not specified")
|
||||||
os.exit(-1)
|
os._exit(-1)
|
||||||
|
|
||||||
totp = pyotp.TOTP(secret)
|
totp = pyotp.TOTP(secret)
|
||||||
token = totp.now()
|
token = totp.now()
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
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))
|
||||||
|
|
||||||
|
with open(filename, 'w') as file:
|
||||||
|
file.write(filedata)
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
python3 /nserver.py
|
||||||
3proxy /3pr.cfg
|
3proxy /3pr.cfg
|
||||||
python3 /generate.py
|
python3 /generate.py
|
||||||
openvpn --config /etc/openvpn/client.ovpn --auth-user-pass /auth.txt
|
openvpn --config /etc/openvpn/client.ovpn --auth-user-pass /auth.txt
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
USERNAME=xxxxxxxxx
|
USERNAME=xxxxxxxxx
|
||||||
PASSWORD=xxxxxxxxx
|
PASSWORD=xxxxxxxxx
|
||||||
SECRET=xxxxxxxxx
|
SECRET=xxxxxxxxx
|
||||||
|
NAMESERVER=xxxxxxxxx
|
||||||
|
|||||||
Reference in New Issue
Block a user