2014-06-04 18:13:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# Run the OpenVPN server normally
|
|
|
|
#
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
mkdir -p /dev/net
|
|
|
|
if [ ! -c /dev/net/tun ]; then
|
|
|
|
mknod /dev/net/tun c 10 200
|
|
|
|
fi
|
|
|
|
|
2014-06-30 06:22:03 +00:00
|
|
|
if [ ! -d "$OPENVPN/ccd" ]; then
|
|
|
|
mkdir -p /etc/openvpn/ccd
|
|
|
|
fi
|
|
|
|
|
2014-06-30 07:10:52 +00:00
|
|
|
# Static subnet
|
|
|
|
iptables -t nat -A POSTROUTING -s 192.168.254.0/24 -o eth0 -j MASQUERADE
|
|
|
|
# Dynamic subnet
|
2014-06-04 18:13:59 +00:00
|
|
|
iptables -t nat -A POSTROUTING -s 192.168.255.0/24 -o eth0 -j MASQUERADE
|
|
|
|
|
2014-07-01 05:56:26 +00:00
|
|
|
conf="$OPENVPN/openvpn.conf"
|
|
|
|
|
|
|
|
# TODO Remove after we stop caring about backwards compatibility
|
|
|
|
[ ! -s "$conf" ] && conf="$OPENVPN/udp1194.conf"
|
|
|
|
|
|
|
|
openvpn --config "$conf"
|