I have an ubuntu server that I access through SSH. I've changed standart port (22) to something else. I want to enable ufw on this machine. However, I'm afraid of the possibility of the following scenario occuring: as soon as I enable ufw, it'll start with default settings blocking connections and kicks me from server, especially since I'm connecting through non-standart port. Will that happen? Should I prepare some configuration first or start ufw right away? SSH is the only way of accessing my server, so loosig this due to firewall would be a disaster.
I also have some applications using some ports for UDP and TCP connections. Will these ports be automatically blocked after I enable ufw? Will I need to add exceptions for them after enabling it?
I've probably found what I wanted, but I need a confirmation from somebody.
I haven't enabled ufw yet, but I've ran some configuration commands.
First I did
sudo ufw ssh
sudo ufw my_new_ssh_port_here
Then I had a look at /lib/ufw/user.rules
This is part of the file:
### RULES ### ### tuple ### allow any 22 0.0.0.0/0 any 0.0.0.0/0 in -A ufw-user-input -p tcp --dport 22 -j ACCEPT -A ufw-user-input -p udp --dport 22 -j ACCEPT ### tuple ### allow any 1111 0.0.0.0/0 any 0.0.0.0/0 in -A ufw-user-input -p tcp --dport 1111 -j ACCEPT -A ufw-user-input -p udp --dport 1111 -j ACCEPT ### END RULES ###
Have I set it up to allow ssh connection through my new port successfully? Is it safe to start now or do I need to configure anything else?
I'm still not sure, because
sudo ufw show raw doesn't seem to show anything helpful and
sudo ufw status verbose still shows Status: inactive only