This commit is contained in:
simono41 2017-10-01 16:45:01 +02:00
parent ca0735cbcb
commit 646d52bfad
2 changed files with 27 additions and 5 deletions

View file

@ -1,5 +1,7 @@
#!/bin/bash
set -ex
# Secure OpenVPN server installer for Debian, Ubuntu, CentOS and Arch Linux
# https://github.com/Angristan/OpenVPN-install
@ -95,7 +97,7 @@ if [[ "$IP" = "" ]]; then
IP=$(wget -qO- ipv4.icanhazip.com)
fi
# Get Internet network interface with default route
NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
NIC=$(ip -4 route ls | grep default -m 1 | grep -Po '(?<=dev )(\S+)')
if [[ -e /etc/openvpn/server.conf ]]; then
while :
@ -195,7 +197,7 @@ if [[ -e /etc/openvpn/server.conf ]]; then
else # if not SUDO_USER, use /root
homeDir="/root"
fi
rm $homeDir*/.ovpn
rm $homeDir/*.ovpn
echo ""
echo "OpenVPN removed!"
else
@ -836,3 +838,9 @@ verb 3" >> /etc/openvpn/client-template.txt
echo "If you want to add more clients, you simply need to run this script another time!"
fi
exit 0;
# internet-routing
iptables -t nat -F POSTROUTING
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -s 10.8.0.0/24 -j MASQUERADE

View file

@ -1,3 +1,17 @@
openvpn --config ~/linux.ovpn &
sleep 10
ip route add default dev tun0
#!/bin/bash
set -ex
#openvpn --config ~/linux.ovpn &
#sleep 10
#ip route add default dev tun0
echo "systemd start-script wird erzeugt!!!"
echo "Bitte OpenVPN config in die /etc/openvpn/client/client.conf kopieren!!!"
if [ -f /lib/systemd/system/openvpn-client@client.service ]; then
echo "link vorhanden!"
else
ln /lib/systemd/system/openvpn-client@.service /lib/systemd/system/openvpn-client@client.service
fi
systemctl enable openvpn-client@client.service