After setup of Debian 9 to your server installing firewall would be a good idea to secure it. We will use UFW (Uncomplicated firewall).
Firstly, install the ufw
package:
1
sudo apt-get install ufw
Next allow 22 port to be able to connect our server via SSH:
1
sudo ufw allow ssh
With the changes made to UFW, we can now enable it and press y
when promted:
1
sudo ufw enable
And now you check the status status of ufw with:
1
sudo ufw status
And output in the terminal could look like this:
1
2
3
4
5
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
Which means everything was set up correctly.