Linux系统的服务器要怎么样来设置相关安全配置
UPORTS="53" ##internal server_ip range SERVER_IP="172.18.10.0/24" ##disable forwarding echo 0 > /proc/sys/net/ipv4/ip_forward ##reset default policies iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -t nat -P PREROUTING ACCEPT iptables -t nat -P POSTROUTING ACCEPT iptables -t nat -P OUTPUT ACCEPT ##del all iptables rules iptables -F INPUT iptables -F FORWARD iptables -F OUTPUT ##clean all non-default chains iptables -X iptables -t nat -X ##iptables default rules iptables -P INPUT DROP iptables -P FORWARD DROP iptables -P OUTPUT ACCEPT ##allow ping packets iptables -A INPUT -p ICMP -s 0/0 --icmp-type 0 -j ACCEPT iptables -A INPUT -p ICMP -s 0/0 --icmp-type 3 -j ACCEPT iptables -A INPUT -p ICMP -s 0/0 --icmp-type 5 -j ACCEPT iptables -A INPUT -p ICMP -s 0/0 --icmp-type 8 -j ACCEPT iptables -A INPUT -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT #iptables -A INPUT -p ICMP -s 0/0 --icmp-type 11 -m limit --limit 5/s -j ACCEPT iptables -A FORWARD -p ICMP -j ACCEPT ##enable forwarding iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT ##STATE RELATED for router iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT ##accept internal packets on the internal i/f iptables -A INPUT -s $SERVER_IP -p tcp -j ACCEPT ##open ports on router for server/services ##TCP PORTS for ATP in $TPORTS do iptables -A INPUT ! -s $SERVER_IP -d $SERVER_IP -p tcp --destination-port $ATP -j ACCEPT iptables -A FORWARD -p tcp --destination-port $ATP -j ACCEPT done ##UDP PORTS for AUP in $UPORTS do iptables -A INPUT -p udp --destination-port $AUP -j ACCEPT iptables -A FORWARD -p udp --destination-port $AUP -j ACCEPT done ##bad_packets chain ##drop INVALID packets imm |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |