Skip to content

Instantly share code, notes, and snippets.

@biapar
Created January 13, 2016 09:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biapar/02a57a0acd6235e519f6 to your computer and use it in GitHub Desktop.
Save biapar/02a57a0acd6235e519f6 to your computer and use it in GitHub Desktop.
VestaCP firewall custom script
#!/bin/bash
IPT="/sbin/iptables"
# Your DNS servers you use: cat /etc/resolv.conf
DNS_SERVER=$(cat /etc/resolv.conf | grep -v '^#' | grep nameserver | awk '{print $2}')
for ip in $DNS_SERVER
do
echo "Allowing DNS lookups (tcp, udp port 53) to server '$ip'"
$IPT -A OUTPUT -p udp -d $ip --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A INPUT -p udp -s $ip --sport 53 -m state --state ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -p tcp -d $ip --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A INPUT -p tcp -s $ip --sport 53 -m state --state ESTABLISHED -j ACCEPT
done
-cd /usr/local/vesta/data/firewall
-vim custom.sh
-chmod +x $VESTA/data/firewall/custom.sh
Stop/Start your Firewall service from VestaCP
http://www.lowendtalk.com/discussion/44292/solved-server-with-vestacp-and-firewall-enabled-blocks-dns-lookups
http://www.lowendguide.com/3/networking/iptables-and-vestacp-output-rules-to-allow-dns-lookups/
@dbannik
Copy link

dbannik commented May 9, 2019

thank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment