Install and configure ufw

  1. Install the ufw package
apt install ufw
  1. Set the default ufw policies
ufw default deny incoming 
ufw default allow outgoing
  1. Allow required traffic

Note

For the purpose of a basic Evilginx setup on a remote server we will allow ssh, dns, and https but add other services as necessary for your setup

ufw allow ssh
ufw allow 53
ufw allow https
  1. Enable the firewall
ufw enable

At this point your server has BASIC protections.