|
|
|
@ -24,7 +24,7 @@ OPENVPN_CONFIG_FILE=/etc/openvpn/server.conf |
|
|
|
|
|
|
|
|
|
if [ -z $DNS1 ]; then |
|
|
|
|
echo "DNS1 env variable not set, setting as deafault Cloudflare's 1.1.1.1" |
|
|
|
|
$DNS1 = '1.1.1.1' |
|
|
|
|
DNS1='1.1.1.1' |
|
|
|
|
sed -i -e 's/"dhcp-option DNS .*"/"dhcp-option DNS '${DNS1}'"/g' ${OPENVPN_CONFIG_FILE} |
|
|
|
|
else |
|
|
|
|
|
|
|
|
@ -37,7 +37,7 @@ else |
|
|
|
|
|
|
|
|
|
DNS1=$(host pihole | grep -oE "\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b") |
|
|
|
|
|
|
|
|
|
if [ ! -z $DNS1 ]; then |
|
|
|
|
if [ ! -z "$DNS1" ]; then |
|
|
|
|
echo "The DNS1 container address is ${DNS1}" |
|
|
|
|
sed -i -e 's/"dhcp-option DNS .*"/"dhcp-option DNS '${DNS1}'"/g' ${OPENVPN_CONFIG_FILE} |
|
|
|
|
else |
|
|
|
@ -59,7 +59,8 @@ fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get the \"public\" interface from the default route |
|
|
|
|
export NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1) |
|
|
|
|
NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1) |
|
|
|
|
export NIC |
|
|
|
|
|
|
|
|
|
# Add iptable rules |
|
|
|
|
if [[ "$DNS_ONLY" = 'y' ]]; then |
|
|
|
@ -68,7 +69,7 @@ else |
|
|
|
|
add-openvpn-ipv4-rules |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ '$IPV6_SUPPORT' = 'y' ]; then |
|
|
|
|
if [ "$IPV6_SUPPORT" = 'y' ]; then |
|
|
|
|
add-openvpn-ipv6-rules |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|