Answer the question
In order to leave comments, you need to log in
How to close everything via iptables without losing access to the virtual machine?
Good to all, the question is the following, is it necessary to tightly clog everything except certain services on a virtual server?
The following code, if you believe the mans from the Internet, blocks everything that has no rules:
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
Answer the question
In order to leave comments, you need to log in
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP
service iptables save
something like this
iptables-save > file
edit file
cat file | iprables-restore
Well, check that you will be able to reboot the server to reset the settings, if anything. When all the rules are checked, add them to autoload in any way.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question