Skip to content

Commit

Permalink
fixing whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Julio Gutierrez committed Jul 1, 2021
1 parent 9c338b8 commit d2b8de1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions start_vpn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,6 @@ if [[ -n ${docker6_network} && -n ${NETWORK6} ]]; then
done
fi

if [[ -n ${WHITELIST} ]]; then
for domain in ${WHITELIST//[;,]/ }; do
domain=$(echo "$domain" | sed 's/^.*:\/\///;s/\/.*$//')
echo "[$(date -Iseconds)] Enabling connection to host ${domain}"
sg nordvpn -c "iptables -A OUTPUT -o eth0 -d ${domain} -j ACCEPT"
sg nordvpn -c "ip6tables -A OUTPUT -o eth0 -d ${domain} -j ACCEPT 2>/dev/null"
done
fi

mkdir -p /dev/net
[[ -c /dev/net/tun ]] || mknod -m 0666 /dev/net/tun c 10 200

Expand Down Expand Up @@ -195,6 +186,15 @@ connect() {
connect
[[ -n ${DEBUG} ]] && tail -n 1 -f /var/log/nordvpn/daemon.log &

if [[ -n ${WHITELIST} ]]; then
for domain in ${WHITELIST//[;,]/ }; do
domain=$(echo "$domain" | sed 's/^.*:\/\///;s/\/.*$//')
echo "[$(date -Iseconds)] Enabling connection to host ${domain}"
iptables -A OUTPUT -o eth0 -d "${domain}" -j ACCEPT
ip6tables -A OUTPUT -o eth0 -d "${domain}" -j ACCEPT 2>/dev/null
done
fi

cleanup() {
nordvpn status
nordvpn disconnect
Expand Down

0 comments on commit d2b8de1

Please sign in to comment.