{"id":646,"date":"2019-02-14T20:47:44","date_gmt":"2019-02-14T17:47:44","guid":{"rendered":"https:\/\/artem.services\/?p=611"},"modified":"2019-02-19T01:28:49","modified_gmt":"2019-02-18T22:28:49","slug":"iptables-d1-81-d0-ba-d1-80-d0-b8-d0-bf-d1-82-d0-bf-d0-b5-d1-80-d0-b2-d0-be-d0-bd-d0-b0-d1-87-d0-b0-d0-bb-d1-8c-d0-bd-d0-be-d0-b9-d0-bd-d0-b0-d1-81-d1-82-d1-80-d0-be-d0-b9-d0-ba-d0-b8","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=646&lang=en","title":{"rendered":"IPTables &#8212; Initial configuration script"},"content":{"rendered":"<p>This script clears all firewall rules, sets standard values for chains, and opens access via <strong>SSH<\/strong>, <strong>HTTP<\/strong> and <strong>HTTPS<\/strong><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n\r\niptables -F\r\niptables -X\r\n\r\niptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\r\niptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP\r\niptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP\r\niptables -A INPUT -m state --state INVALID -j DROP\r\niptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP\r\niptables -A INPUT -i lo -j ACCEPT\r\n\r\niptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT\r\niptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT\r\niptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT\r\n\r\niptables -P OUTPUT ACCEPT\r\niptables -P INPUT DROP\r\niptables -P FORWARD DROP\r\n<\/pre>\n<p><!--more--><\/p>\n<p>After remember to save the firewall rules<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\niptables-save &gt; \/etc\/sysconfig\/iptables.save\r\n<\/pre>\n<p>or<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nservice iptables save\r\n<\/pre>\n<blockquote><p>Saving depends on the distribution you are using.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>This script clears all firewall rules, sets standard values for chains, and opens access via SSH, HTTP and HTTPS<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[341],"tags":[369,371],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/646"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=646"}],"version-history":[{"count":3,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/646\/revisions"}],"predecessor-version":[{"id":649,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/646\/revisions\/649"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}