For this project you will configure the Uncomplicated Firewall (ufw). This will replace the method of access that was used for SSH in Project 4.
Learning outcomes
- Planning and design.
- VMware guest modifications.
- Modifying application software.
- Security settings using firewalls.
Overview
Like project 4, you will have two partners for your work, but you will still make modifications to your VM. Look at the names of the people surrounding yours in the documentation, wrapping as needed. The person above you will be logging into your Ubuntu VM from their Windows VM but should be denied from the Ubuntu VM.
Remove any previous configuration from Project 4 that restricted access based on IP. You should also disable the requirements of Project 5 for this part,
Again, you will be logging in to the Ubuntu VM of the person below you using your Windows 10 VM. You will be setting up and testing the firewall rule(s) necessary for the person above you.
Additionally,
Ubuntu Firewall
The Ubuntu firewall is very easy to use and write like the English language making it easier to understand. These commands must be run as the root
user or with sudo
.
First, to enable and disable the firewall, use one of:
ufw enable ufw disable
Second, you can check the status at any time with:
ufw status
Now, there is an implicit deny all
that exists after all rules have ben checked. This means that if there is not a rule that can be applied when the firewall is enabled, the access will be denied.
For the sake of the SSH protocol, the simplest approach is to allow from certain IPs access to port 22. The rule
ufw allow from 192.168.2.106 proto tcp to any port 22
allows access from 192.168.2.106 using the TCP protocol to port 22. To delete this rule you could repeat the rule with delete
:
ufw delete allow from 192.168.2.106 proto tcp to any port 22
Or you can use
ufw status numbered
then
ufw delete ##
Where ## represents the rule number to be removed.
NOTE: If at any time, the firewall has been misconfigured and you have lost control, you can run the following from the console:
ufw reset
This will disable the firewall and delete all current rules. Try to save this as a last resort, however. Learning to remove the offending rules is a better overall approach.