This commit is contained in:
2021-09-07 14:50:23 -04:00
commit 37658cfaca
54 changed files with 2918 additions and 0 deletions

36
openpyn_alpine/Dockerfile Normal file
View File

@@ -0,0 +1,36 @@
FROM alpine:latest
ENV OpenVPN-Client 1.0
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories
RUN apk add openvpn unzip wget dante-server sudo expect iputils
RUN apk add --no-cache python3 && \
python3 -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
pip3 install --upgrade pip setuptools && \
if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi
ADD sockd.conf /etc/sockd.conf
ADD sockd.sh /usr/local/bin/
RUN chmod a+x /usr/local/bin/sockd.sh
RUN pip3 install verboselogs
RUN pip3 install --upgrade openpyn
WORKDIR /root
ADD openpyn_init.exp .
RUN expect openpyn_init.exp
ADD run.sh /usr/local/bin/startup.sh
RUN chmod a+x /usr/local/bin/startup.sh
EXPOSE 1080
ENTRYPOINT ["/bin/sh","/usr/local/bin/startup.sh"]

1
openpyn_alpine/README.md Normal file
View File

@@ -0,0 +1 @@
[![Build Status](http://droneci.service.dc1.consul/api/badges/sstent/openpyn_alpine/status.svg)](http://droneci.service.dc1.consul/sstent/openpyn_alpine)

View File

@@ -0,0 +1,2 @@
shapechecker@protonmail.com
0okjU0CN1U4juKqs2OmQ

View File

@@ -0,0 +1,11 @@
#!/usr/bin/expect -f
spawn /usr/bin/openpyn --init
expect "Enter your username for NordVPN"
send "stuart.stent@gmail.com\r"
expect "Enter the password for NordVPN"
send "drRp4mQBVU6awAFOk9lO\r"
expect "\[INFO\] To see usage options type"

7
openpyn_alpine/run.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
if [ -n "$VPNFLAGS" ]; then
/usr/bin/openpyn ${VPNFLAGS} -o "--fast-io --cipher AES-128-GCM --mssfix 1431 --script-security 2 --up /usr/local/bin/sockd.sh"
else
/usr/bin/openpyn nl --max-load 70 --top-servers 10 --tcp --pings 5 -o "--cipher AES-128-GCM --mssfix 1431 --script-security 2 --up /usr/local/bin/sockd.sh"
fi

28
openpyn_alpine/sockd.conf Normal file
View File

@@ -0,0 +1,28 @@
debug: 0
logoutput: stderr
internal: 0.0.0.0 port = 1080
external: tun0
socksmethod: none
clientmethod: none
user.privileged: root
user.unprivileged: nobody
client pass {
from: 192.168.1.0/24 port 1-65535 to: 0.0.0.0/0
#clientmethod: rfc931 # match all idented users that also are in passwordfile
}
client pass {
from: 172.0.0.0/8 port 1-65535 to: 0.0.0.0/0
#clientmethod: rfc931 # match all idented users that also are in passwordfile
}
client pass {
from: 127.0.0.0/8 port 1-65535 to: 0.0.0.0/0
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
protocol: tcp udp
}

9
openpyn_alpine/sockd.sh Normal file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
CFGFILE=/etc/sockd.conf
PIDFILE=/tmp/sockd.pid
WORKERS=10
/etc/openvpn/up.sh
ip route add 192.168.1.0/24 via 172.17.0.1 dev eth0
echo -e "nameserver 192.168.1.1\n$(cat /etc/resolv.conf)" > /etc/resolv.conf
sockd -f $CFGFILE -p $PIDFILE -N $WORKERS &

View File

@@ -0,0 +1,58 @@
#!/bin/bash
# Parses DHCP options from openvpn to update resolv.conf
# To use set as 'up' and 'down' script in your openvpn *.conf:
# up /etc/openvpn/update-resolv-conf
# down /etc/openvpn/update-resolv-conf
#
# Used snippets of resolvconf script by Thomas Hood and Chris Hanson.
# Licensed under the GNU GPL. See /usr/share/common-licenses/GPL.
#
# NordVPN DNS IPs:
#
foreign_option_1='dhcp-option DNS 103.86.99.100'
foreign_option_2='dhcp-option DNS 103.86.96.100'
foreign_option_3='dhcp-option DNS 208.67.222.220' #opendns
#
[ -x /sbin/resolvconf ] || exit 0
[ "$script_type" ] || exit 0
[ "$dev" ] || exit 0
split_into_parts()
{
part1="$1"
part2="$2"
part3="$3"
}
case "$script_type" in
up)
NMSRVRS=""
SRCHS=""
for optionvarname in ${!foreign_option_*} ; do
option="${!optionvarname}"
echo "$option"
split_into_parts $option
if [ "$part1" = "dhcp-option" ] ; then
if [ "$part2" = "DNS" ] ; then
NMSRVRS="${NMSRVRS:+$NMSRVRS }$part3"
elif [ "$part2" = "DOMAIN" ] ; then
SRCHS="${SRCHS:+$SRCHS }$part3"
fi
fi
done
R=""
[ "$SRCHS" ] && R="search $SRCHS
"
for NS in $NMSRVRS ; do
R="${R}nameserver $NS
"
done
echo -n "$R" | /sbin/resolvconf -a "${dev}.openvpn"
/usr/local/bin/sockd.sh
;;
down)
/sbin/resolvconf -d "${dev}.openvpn"
;;
esac