Just had an issue upgrading to Ubuntu 20.04.2 LTS. # Drop all other inbound - default deny unless explicitly allowed policy A INPUT -m limit -limit 5/min -j LOG -log-prefix "iptables denied: " -log-level 7 A INPUT -p tcp -m state -state NEW -dport 22 -j ACCEPT # The -dport number should be the same port number you set in sshd_config # Allow HTTP and HTTPS connections from anywhere (the normal ports for websites and SSL). # Allow all outbound traffic - you can modify this to only allow certain traffic A INPUT -m state -state ESTABLISHED,RELATED -j ACCEPT ![]() # Accept all established inbound connections # Allow all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0 sbin/iptables-restore < /etc/Īnd give it permission of execution: sudo chmod +x /etc/network/if-pre-up.d/firewallĮxample file for /etc/: *filter ![]() If you want to activate the same rules each time you boot the computer create this file: sudo nano /etc/network/if-pre-up.d/firewall To activate the rules defined in your file you must send them to iptables-restore (you can use another file if you want): sudo iptables-restore < /etc/Īnd you can check that they are activated with: sudo iptables -L Normally your firewall rules are in the config file /etc/
0 Comments
Leave a Reply. |