Please check attached
LAB #4 Deliverables
Provide Screen Shots and a narrative of the following:
Demonstrate two VMs (both can be Ubuntu)
Demonstrate the usage of ufw to control ssh and http permissions from one VM to the LAMP VM
Alter UFW to limit each (show the failed attempt)
Re-enable HTTP connectivity (show the successful attempt)
Understand the usage of ufw
Use Discussion Board and/or do research to successfully complete this lab.
LAB #4 Hands On: Firewalls
UFW – “Uncomplicated Fire Wall”
Already installed as part of Ubuntu, but “off” by default
Easily added to any other Linux flavor
From the Ubuntu instance containing your LAMP stack, let’s install an SSH host, configure UFW, and test using a secondary Ubuntu (or Kali)
For this lab, you will want to make sure you have two VMs running using NAT NETWORK so they can see one another, and can see the Internet, and have different IP addresses.
Start by obtaining your IP addresses using ifconfig or ip command, and using PING to test connectivity between both. (CTRL-C to end)
Linux & UFW (Uncomplicated Firewall)
Check to ensure it is installed and status: sudo ufw status
Let’s review the configuration file: /etc/default/ufw
Now let’s set up and test:
Install open ssh server on your Ubuntu machine: sudo apt-get install openssh-server
Configure UFW to allow traffic on port 22: sudo ufw allow ssh
if you need to reset: sudo ufw reset (you will lose all rule changes)
Deny all:
sudo ufw default deny incoming
sudo ufw enable
Linux and UFW
From a secondary instance of Ubuntu (or Kali), type ssh
Respond to challenge with
Now you’re in.
(Optional) If you wanted to hack the file we created last time:
sudo nano /var/www/test/hw.html
To test, from attack machine, point browser to http://10.0.2.15/HelloWorld.html (using your target IP address of course)
[For the deliverable you only need to show that you can SSH in after configuring the firewall to allow. The file commands listed here are for instruction and are not required for lab.]
Linux and UFW
Let’s turn off the HTTP access from secondary machine
First, test that connecting to your LAMP stack gets you your app
Then, from LAMP machine, sudo ufw deny http
Check status: sudo ufw status verbose
Check connectivity from secondary machine browser
Restore HTTP: sudo ufw allow http
Check connectivity from secondary machine browser
So….?
What did we learn? You should be comfortable finding IP addresses, configuring UFW on and off as it relates to HTTP and SSH, and demonstrating that testing.
Could you answer these questions as a short answer on the final exam?
What risk did we take on by opening port 22?
What would a hacker need to get in?
Could a brute force attack successfully break in?
Additional Info: https://resources.infosecinstitute.com/topic/popular-tools-for-brute-force-attacks/