Last active
April 21, 2023 11:10
-
-
Save XnipS/8d27c0da3c4887879192acf8411c3788 to your computer and use it in GitHub Desktop.
Command line for openVPN and DNS leak prevention.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#set -x | |
if [ "$EUID" -ne 0 ] | |
then echo "This script requires root." | |
exit | |
fi | |
while true; do | |
echo "==============================" | |
echo "Commands: Start, Stop, Key, DNS_Start, DNS_Stop" | |
read -p ">>> " COMMAND | |
case $COMMAND in | |
Start) | |
echo "Starting VPN..." | |
konsole -e openvpn --config ./ecc_configs/Australia_TCP.ovpn & | |
;; | |
DNS_Start) | |
echo "Starting DNS Blocker..." | |
iptables-legacy -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 10.31.33.8 | |
iptables-legacy -t nat -A OUTPUT -p tcp --dport 53 -j DNAT --to-destination 10.31.33.8 | |
;; | |
DNS_Stop) | |
echo "Stopping DNS Blocker..." | |
iptables-legacy -t nat -D OUTPUT -p udp --dport 53 -j DNAT --to-destination 10.31.33.8 | |
iptables-legacy -t nat -D OUTPUT -p tcp --dport 53 -j DNAT --to-destination 10.31.33.8 | |
;; | |
Stop) | |
echo "Stopping VPN..." | |
killall "openvpn" | |
;; | |
Key) | |
echo "Input new key..." | |
read -p "KEY >>> " KEY | |
echo "Appending new key..." | |
echo $KEY > ./unlock | |
echo "Appended new key..." | |
;; | |
*) | |
echo "Unknown Command." | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment