{"id":105,"date":"2013-04-02T15:01:30","date_gmt":"2013-04-02T13:01:30","guid":{"rendered":"http:\/\/www.zagura.ro\/?p=105"},"modified":"2013-04-02T15:05:26","modified_gmt":"2013-04-02T13:05:26","slug":"block-stopforumspam-com-ips-through-iptables","status":"publish","type":"post","link":"https:\/\/www.zagura.com\/blog\/index.php\/2013\/04\/02\/block-stopforumspam-com-ips-through-iptables\/","title":{"rendered":"Block stopforumspam.com IP&#8217;s through iptables"},"content":{"rendered":"<p><strong>WARNING<\/strong>: The following code will <strong>REPLACE<\/strong> your existing firewall rules as it uses iptables-restore in order to add hundreds of individual ip rules into the INPUT chain very fast.<\/p>\n<p><code><br \/>\n#!\/bin\/bash<br \/>\nrm -f \/root\/listed_ip_*<br \/>\nwget -q -c --no-cache http:\/\/www.stopforumspam.com\/downloads\/listed_ip_90.zip -P \/root\/ --output-document=\/root\/listed_ip_90.txt.zip<br \/>\nunzip \/root\/listed_ip_90.txt.zip > \/dev\/null<br \/>\nBLOCKDB=\/root\/listed_ip_90.txt<\/p>\n<p>echo \"*filter\" >\/tmp\/iptables-save<br \/>\necho \":INPUT ACCEPT [0:0]\" >>\/tmp\/iptables-save<br \/>\necho \":FORWARD ACCEPT [0:0]\" >>\/tmp\/iptables-save<br \/>\necho \":OUTPUT ACCEPT [0:0]\" >>\/tmp\/iptables-save<br \/>\nIPS=$(grep -Ev \"^#\" $BLOCKDB)<br \/>\nfor i in $IPS<br \/>\ndo<br \/>\necho \"-A INPUT -s $i\/32 -p tcp -m tcp --dport 80 -j DROP\" >>\/tmp\/iptables-save<br \/>\ndone<br \/>\necho \"COMMIT\" >>\/tmp\/iptables-save<br \/>\ncat \/tmp\/iptables-save | iptables-restore<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WARNING: The following code will REPLACE your existing firewall rules as it uses iptables-restore in order to add hundreds of individual ip rules into the INPUT chain very fast. #!\/bin\/bash rm -f \/root\/listed_ip_* wget -q -c &#8211;no-cache http:\/\/www.stopforumspam.com\/downloads\/listed_ip_90.zip -P \/root\/ &#8211;output-document=\/root\/listed_ip_90.txt.zip unzip \/root\/listed_ip_90.txt.zip > \/dev\/null BLOCKDB=\/root\/listed_ip_90.txt echo &#8220;*filter&#8221; >\/tmp\/iptables-save echo &#8220;:INPUT ACCEPT [0:0]&#8221; >>\/tmp\/iptables-save echo&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,2],"tags":[],"_links":{"self":[{"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/105"}],"collection":[{"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":6,"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":111,"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/105\/revisions\/111"}],"wp:attachment":[{"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}