Previous class
Secure System with SU and SUDO

Firewall Setup

You can use the Uncomplicated Firewall (UFW) to manage your firewall rules in a more user-friendly way.

First Install UFW

sudo apt install ufw

To allow traffic on specific ports with UFW, you can use the allow command followed by the port number.

Here are the steps:

  1. First, allow traffic on the SSH port (7822 in your case): (To avoid your Terminal Disconnecting) 
sudo ufw allow 7822 
  1. Then allow traffic on port 80 (HTTP) and 443 (HTTPS):
sudo ufw allow 80 sudo ufw allow 443 
  1. Enable the firewall:
sudo ufw enable 
  1. You'll be asked to confirm because this might disrupt existing SSH connections. However, since you've already allowed your SSH port (7822), your current session should not be interrupted.
  2. Check the status of UFW:
sudo ufw status 
  1. The output will show you the current rules set up in UFW. You should see that traffic on ports 7822, 80, and 443 is allowed.

Please make sure to replace 7822 with your actual SSH port if it's different. If you have any questions or encounter any issues, feel free to ask.

AlmaLinux Use

sudo dnf install firewalld
  1. Start and enable
  2. firewalld:
sudo systemctl start firewalld
sudo systemctl enable firewalld
  1. Check the status to make sure it's active:
sudo systemctl status firewalld

From here, you can use the

firewall-cmd utility to manage your firewall rules. For example:

  • To list all rules:
  • sudo firewall-cmd --list-all
  • To allow a service (e.g., http):
  • sudo firewall-cmd --add-service=http --permanent followed by
  • sudo firewall-cmd --reload to apply changes.

If you're more comfortable with

ufw, you'd need to find a third-party repository or manually install it. However,

firewalld is a capable tool and is well-integrated with AlmaLinux and similar distributions.

  • Mark as Completed
  • More
Next class
Add File Database
Comments (0)
Login or Join to comment.

IMREAL.LIFE

Close