07-11-2019, 05:29 PM
(07-11-2019, 11:53 AM)Rehan Wrote: I searched the forum and found a tutorial about iptables configurations.I found a guide about its configuration.
https://post4vps.com/thread-2643.html
In that thread i started the steps to secure firewall.Unfortunately on step two when i input the command
My SSH connections lost, i tried reconnecting but failed to connect.Then i restarted the VPS from control panel and re-connected but did not tried running that command again.Code: (Select All)iptables -P OUTPUT ACCEPT
Have you paid attention to the explanation of the commands that was under the commands?
Code: (Select All)
Incoming traffic is blocked by default unless allowed through additional rules. --> Incoming = INPUT --> iptables -P INPUT DROP
Forward traffic is blocked by default unless allowed through additional rules. --> Forward = FORWARD --> iptables -P FORWARD DROP
Outgoing traffic is allowed by default unless blocked through additional rules. --> Outgoing = OUTPUT --> iptables -P OUTPUT ACCEPT
That means you have executed the command when directly connected via SSH. That's a bad idea if you understand what "blocking traffic" means and have read the explanation for the commands.
As soon as you run "iptables -P INPUT DROP" all incoming traffic is instantly dropped. This cuts all connections including SSH instantly. Be careful!
It would have been better if you would have ran these commands through a VNC or emergency console that is provided by the control panel of your VPS or a script that runs all the commands and therefore unlocks traffic to port 22 and etc.
![[Image: zHHqO5Q.png]](https://i.imgur.com/zHHqO5Q.png)