{"id":786,"date":"2016-09-21T23:42:32","date_gmt":"2016-09-22T04:42:32","guid":{"rendered":"http:\/\/tiemensfamily.com\/TimOnCS\/?p=786"},"modified":"2016-09-21T23:42:32","modified_gmt":"2016-09-22T04:42:32","slug":"iptables-flush-and-ssh","status":"publish","type":"post","link":"https:\/\/tiemensfamily.com\/timoncs\/2016\/09\/21\/iptables-flush-and-ssh\/","title":{"rendered":"iptables flush and ssh"},"content":{"rendered":"<p>Fun lesson from today:  don&#8217;t blindly clear\/flush your iptables.<\/p>\n<p>If you are remotely managing a system, then make sure you run this:<br \/>\n<code><br \/>\n    sudo iptables -P INPUT ACCEPT<br \/>\n    sudo iptables -P FORWARD ACCEPT<br \/>\n    sudo iptables -P OUTPUT ACCEPT<br \/>\n<\/code><\/p>\n<p>before you run this:<br \/>\n<code><br \/>\n    sudo iptables -F<br \/>\n<\/code><\/p>\n<p>It turns out there are people who will write default block (&#8220;policy DROP&#8221;) style rules (instead of the using a default &#8220;policy ACCEPT&#8221; and ending with REJECTs\/DROPs at the end that match everything).  If the default policy is not ACCEPT, then clearing the rules will immediately remove your ssh access to the machine. <\/p>\n<p>The lack of a default &#8220;policy REJECT&#8221; is one reason you will see more &#8220;policy ACCEPT&#8221; &#8211; because then, at the end, you can choose between REJECT or DROP.  If you write your rules &#8220;in the other direction&#8221;, you loose the flexibility to choose &#8211; you must DROP.  There are numerous posts on why DROP is not necessarily better than REJECT.  (&#8220;Attackers don&#8217;t really feel any pain with DROP, but your legitimate users sure do&#8221;.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fun lesson from today: don&#8217;t blindly clear\/flush your iptables. If you are remotely managing a system, then make sure you run this: sudo iptables -P INPUT ACCEPT sudo iptables -P FORWARD ACCEPT sudo iptables -P OUTPUT ACCEPT before you run &hellip; <a href=\"https:\/\/tiemensfamily.com\/timoncs\/2016\/09\/21\/iptables-flush-and-ssh\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,8],"tags":[],"_links":{"self":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/786"}],"collection":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/comments?post=786"}],"version-history":[{"count":0,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/786\/revisions"}],"wp:attachment":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/media?parent=786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/categories?post=786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/tags?post=786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}