updating configuration
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
#SHELL := /bin/bash
|
||||||
|
|
||||||
|
ARGS = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
|
||||||
|
|
||||||
|
update_secrets_sample:
|
||||||
|
@echo "Masking env files..."
|
||||||
|
@find . -name *.env | xargs -I{} cp {} {}.sample
|
||||||
|
@find . -name *.env.sample | xargs -I{} sed -i "s/\=.*/\=xxxxxxxxx/g" {}
|
||||||
|
|
||||||
|
commit: update_secrets_sample
|
||||||
|
git add .
|
||||||
|
git diff-index --quiet HEAD || git commit -m "$(call ARGS,\"updating configuration\")"
|
||||||
|
git push
|
||||||
|
|
||||||
|
%:
|
||||||
|
@:
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
openvpn:
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
|
build: ./openvpn/docker
|
||||||
|
container_name: openvpn
|
||||||
|
ports:
|
||||||
|
- "9080:9080"
|
||||||
|
env_file: ./openvpn/settings/openvpn.env
|
||||||
|
devices:
|
||||||
|
- "/dev/net/tun:/dev/net/tun"
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./openvpn/settings/conf:/etc/openvpn
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
daemon
|
||||||
|
|
||||||
|
nserver 10.2.67.10
|
||||||
|
|
||||||
|
auth none
|
||||||
|
log
|
||||||
|
proxy -p9080
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
FROM ventz/openvpn
|
||||||
|
|
||||||
|
ENV _3PROXY_VERSION 0.8.12
|
||||||
|
ENV _3PROXY_DOWNLOAD_URL https://github.com/z3APA3A/3proxy/archive/0.8.12.tar.gz
|
||||||
|
ENV _3PROXY_DOWNLOAD_SHA1 c669a9af27cf1c4178f73216ee74777d200e03fb
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
\
|
||||||
|
&& apk add --no-cache --virtual .build-deps \
|
||||||
|
gcc \
|
||||||
|
linux-headers \
|
||||||
|
make \
|
||||||
|
musl-dev \
|
||||||
|
tar \
|
||||||
|
openssl \
|
||||||
|
\
|
||||||
|
&& wget -O 3proxy.tar.gz "$_3PROXY_DOWNLOAD_URL" \
|
||||||
|
&& echo "$_3PROXY_DOWNLOAD_SHA1 *3proxy.tar.gz" | sha1sum -c - \
|
||||||
|
&& mkdir -p /usr/src/3proxy \
|
||||||
|
&& tar -xzf 3proxy.tar.gz -C /usr/src/3proxy --strip-components=1 \
|
||||||
|
&& rm 3proxy.tar.gz \
|
||||||
|
\
|
||||||
|
&& make -C /usr/src/3proxy -f Makefile.Linux \
|
||||||
|
&& make -C /usr/src/3proxy -f Makefile.Linux install \
|
||||||
|
\
|
||||||
|
&& rm -r /usr/src/3proxy \
|
||||||
|
\
|
||||||
|
&& apk del .build-deps
|
||||||
|
|
||||||
|
RUN apk update && apk add python3 curl && pip3 install pyotp
|
||||||
|
ADD run.sh /run.sh
|
||||||
|
ADD generate.py /generate.py
|
||||||
|
ADD 3pr.cfg /3pr.cfg
|
||||||
|
RUN chmod +x /run.sh
|
||||||
|
|
||||||
|
ENTRYPOINT "/run.sh"
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import pyotp
|
||||||
|
import os
|
||||||
|
|
||||||
|
user = os.getenv('USERNAME')
|
||||||
|
password = os.getenv('PASSWORD')
|
||||||
|
secret = os.getenv('SECRET')
|
||||||
|
|
||||||
|
if user == "":
|
||||||
|
print("USERNAME not specified")
|
||||||
|
os.exit(-1)
|
||||||
|
|
||||||
|
if password == "":
|
||||||
|
print("PASSWORD not specified")
|
||||||
|
os.exit(-1)
|
||||||
|
|
||||||
|
if secret == "":
|
||||||
|
print("SECRET not specified")
|
||||||
|
os.exit(-1)
|
||||||
|
|
||||||
|
totp = pyotp.TOTP(secret)
|
||||||
|
token = totp.now()
|
||||||
|
|
||||||
|
f = open("/auth.txt", "w")
|
||||||
|
f.write("{}\n".format(user))
|
||||||
|
f.write('{}{}\n'.format(password, token))
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
print("Generated OTP token for user ({}): {}".format(user,token))
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
3proxy /3pr.cfg
|
||||||
|
python3 /generate.py
|
||||||
|
openvpn --config /etc/openvpn/client.ovpn --auth-user-pass /auth.txt
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
USERNAME=xxxxxxxxx
|
||||||
|
PASSWORD=xxxxxxxxx
|
||||||
|
SECRET=xxxxxxxxx
|
||||||
Reference in New Issue
Block a user