To put it in a diagrammatic format, our current C2 configuration is this:
If someone tries to connect to our C2 server, they will be able to detect that our C2 server is running a Meterpreter handler on port 8080/tcp:
To protect our C2 server from outside scanning and recon, let's set the following Uncomplicated Firewall (UFW) ruleset so that only our redirector can connect to our C2. To begin, execute the following UFW commands to add firewall rules for C2:
sudo ufw allow 22
sudo ufw allow 55553
sudo ufw allow from 35.153.183.204 to any port 8080 proto tcp
sudo ufw allow out to 35.153.183.204 port 8080 proto tcp
sudo ufw deny out to any
The given commands needs to be executed and the result is shown in the following screenshot:
In addition, execute the following ufw commands to add firewall rules for redirector as well:
sudo ufw allow 22
sudo ufw...