CentOS下安裝iptables,禁止Solr的8983端口外網訪問

大家好,偶然一次在烏雲網上看到一位兄臺提交的漏洞,是淘寶後臺的Solr,竟然外網無需密碼可以直接訪問(簡直碉堡了)。在這裏記錄一下禁止Solr外網訪問的方法,希望對各位博友有所幫助。

1.安裝iptable iptable-service

#先檢查是否安裝了iptables
service iptables status
#安裝iptables
yum install -y iptables
#升級iptables
yum update iptables 
#安裝iptables-services
yum install iptables-services
2.禁用/停止自帶的firewalld服務
#停止firewalld服務
systemctl stop firewalld
#禁用firewalld服務
systemctl mask firewalls
3.solr外網禁止訪問,只允許localhost
iptables -A INPUT -p tcp -s localhost --dport 8983-j ACCEPT sudo iptables -A INPUT -p tcp --dport 8983-j DROP
4.開放80端口外網訪問
nano /etc/sysconfig/iptables
在COMMIT之前新增如下代碼:
-I INPUT -p tcp --dport 80 -j ACCEPT
重啓iptables
sudo service iptables restart
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章