4.3 Firewall

A firewall is a network security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules/ We will use ufw which should already be installed. If not: sudo apt-get install ufw Check status

$ sudo ufw status
Status: inactive

**It is important to allow 22/tcp as your SSH connection needs it.**

$ sudo ufw allow 22/tcp
$ sudo ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startus

Check status again.

$ sudo ufw status

   
Status: active
To Action From -- ------ ---- 22/tcp ALLOW Anywhere 22/tcp (v6) ALLOW Anywhere (v6)
We are allowing only SSH. First set up some default rules:

sudo ufw default deny incoming
sudo ufw default allow outgoing

Then allow www and Apache Full which will be for our webserver.

sudo ufw allow www
sudo ufw allow 'Apache Full'

I got a message "ERROR: Could not find a profile matching 'Apache Full'". Don't worry,Apache is installed next. Checks status again:

jimmy@vds2:/var/www/moodle$ sudo ufw status

Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere                  
80/tcp                     ALLOW       Anywhere                  
Apache Full                ALLOW       Anywhere                  
22/tcp (v6)                ALLOW       Anywhere (v6)             
80/tcp (v6)                ALLOW       Anywhere (v6)             
Apache Full (v6)           ALLOW       Anywhere (v6)    

No comments:

Post a Comment

Introduction to Linux Command Line

SSH is the way you will connect to your Linux server. You will need to understand the basics of the Linux Command Line.