I am looking for a way to disable all ports except SSH and 80 in a dedicated server per SSH. I think this can be done via ufw but it says that ssh connections might be dropped. What should I do?
I am looking for a way to disable all ports except SSH and 80 in a dedicated server per SSH. I think this can be done via ufw but it says that ssh connections might be dropped. What should I do?
With ufw you can declare all your rules at once and restart the service only after you are done.
So I would just block all ports, open port 22 (or whatever port you have ssh listening to) and only then restart ufw.
Maybe you will have to reconnect to your host again, but you wouldn't be left locked out if you do things right.
Here is a nice guide: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-14-04