Initial commit

This commit is contained in:
2016-12-17 15:44:44 +01:00
commit 8809349e6d
49 changed files with 828 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
br="br0"
tap="tap0"
eth="enp0s10f0"
br_ip="10.3.5.1"
br_netmask="255.255.0.0"
br_broadcast="10.3.255.255"
# Create the tap adapter
openvpn --mktun --dev $tap
# Create the bridge and add interfaces
brctl addbr $br
brctl addif $br $eth
brctl addif $br $tap
# Configure the bridge
ifconfig $tap 0.0.0.0 promisc up
ifconfig $eth 0.0.0.0 promisc up
ifconfig $br $br_ip netmask $br_netmask broadcast $br_broadcast
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
ifconfig br0 down
brctl delif br0 enp0s10f0
brctl delif br0 tap0
brctl delbr br0
openvpn --rmtun --dev tap0
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
echo logoff ${common_name} ${trusted_ip} $(date) ${bytes_sent} ${bytes_received} >> /opt/openvpn/log/logon.log
echo logoff ${common_name} ${trusted_ip} $(date) ${bytes_sent} ${bytes_received} >> /opt/openvpn/log/${common_name}.log
# ARP Eintrag loeschen
#/sbin/arp -i br0 -d ${ifconfig_pool_remote_ip}
exit 0
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
echo logon ${common_name} ${trusted_ip} $(date) >> /opt/openvpn/log/logon.log
echo logon ${common_name} ${trusted_ip} $(date) >> /opt/openvpn/log/${common_name}.log
# noch einen ARP Eintrag erstellen
#/sbin/arp -i br0 -Ds ${ifconfig_pool_remote_ip} br0 pub
exit 0
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/python
import bcrypt, os, sys
username = os.environ.get('username')
if not username:
sys.exit(1)
password = os.environ.get('password')
if not password:
sys.exit(1)
file = open('/opt/openvpn/users/'+username+'.pwd', 'r')
hashed=file.read().rstrip()
if bcrypt.hashpw(password, hashed) == hashed:
sys.exit(0)
else:
sys.exit(1)
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
if grep "^${username} ${password};$" /opt/openvpn/users/users.txt >/dev/null ; then
exit 0
fi
exit 1
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
DEST="10.3.5.2"
ping -c4 ${DEST} > /dev/null
if [ $? != 0 ]
then
echo "$(date): cannot ping ${DEST}, rebooting now..." >> /opt/openvpn/scripts/reboot-if-ping-fails.log
/sbin/shutdown -r now
fi