Skip to content

Instantly share code, notes, and snippets.

@hoangdh
Last active October 11, 2018 09:05
Show Gist options
  • Save hoangdh/aaf7893af7da578dc772342f41120df3 to your computer and use it in GitHub Desktop.
Save hoangdh/aaf7893af7da578dc772342f41120df3 to your computer and use it in GitHub Desktop.
#!/bin/bash
systemctl stop firewalld
systemctl disable firewalld
systemctl stop postfix
systemctl disable postfix
systemctl stop NetworkManager
systemctl disable NetworkManager
yum install -y iptables-services
systemctl start iptables
systemctl enable iptables
iptables -I INPUT -p tcp --dport 53 -j ACCEPT
iptables -I INPUT -p udp --dport 53 -j ACCEPT
iptables -I INPUT -s 118.70.170.88 -p tcp --dport 1010 -j ACCEPT
iptables -I INPUT -s 222.252.19.129 -p tcp --dport 1010 -j ACCEPT
iptables -I INPUT -s 113.160.226.149 -p tcp --dport 1010 -j ACCEPT
iptables -I INPUT -s 103.18.6.0/23 -p tcp --dport 953 -j ACCEPT
iptables -I INPUT -s 103.18.6.0/23 -p udp --dport 953 -j ACCEPT
iptables -I INPUT -s 173.59.104.0/22 -p tcp --dport 953 -j ACCEPT
iptables -I INPUT -s 173.59.104.0/22 -p udp --dport 953 -j ACCEPT
service iptables save
sed -i 's/#Port 22/Port 1010/g' /etc/ssh/sshd_config
systemctl restart sshd
yum install bind bind-utils -y
systemctl enable named
systemctl start named
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment