Firewall
UFW
Ubuntu 16.04 servers can use the UFW firewall to make sure only connections to certain services are allowed.application.
Different applications can register their profiles with UFW upon installation. These profiles allow UFW to manage these applications by name, e.g. OpenSSH, the service allowing us to connect to the server, has a profile registered with UFW.
sudo ufw app list
SSH
Allow SSH connections:
sudo ufw allow OpenSSH
Enabling the firewall
sudo ufw enable
Check firewall status
sudo ufw status