Performing Initial Firewall Configuration

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

In this lab, you will need to perform a few simple firewall configurations. These configurations include replacing all ports with services, adding the eth0 interface to the default zone, creating a firewalld service for flaskapp.py, changing the port of SSH service from 22 to 61613, and reloading firewalld to apply all the rules. By the end of the lab, it is important to not have any port definitions within the firewall configuration and to ensure that everything is defined with a service. The benefit of these services is that they have a name and a description by which you or anybody can know what the port is used for. Otherwise, you may find yourself in a situation where there are many opened ports and not know what the purpose of each port is. In order to be able to replace all ports with service, you first need to create a firewalld service for flaskapp.py. After that, you will need to change the port of SSH service from port 22 to port 61613. Finally, after all changes are made, you need to reload to apply all the rules.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a Firewalld Service for flaskapp: port 65535, Protocol tcp
  1. Open and create the flaskapp.xml file.

  2. Populate the file with a definition of the flaskapp service, port, and protocol.

  3. Save and close the flaskapp.xml file.

  4. Add the flaskapp service.

  5. Reload firewalld.

Edit SSH Firewalld Service and Reconfigure it for Port 61613
  1. Open the ssh.xml file.

  2. Populate the ssh.xml file with a description, and change the port from 22 to 61613.

  3. Save and close the ssh.xml file.

  4. Add SSH service.

  5. Reload firewalld.

Add eth0 Interface to the Default Zone
  1. Add the eth0 interface to the public zone.

  2. Reload firewalld.

Remove All Ports from Firewalld, Add http Firewalld Service, and Reload Firewalld
  1. Remove port 80/protocol tcp.

  2. Remove port 61613/protocol tcp.

  3. Remove port 65535/protocol tcp.

  4. Add http firewalld service.

  5. Reload firewalld.

Additional Resources

The initial SSH Port is 61613, and that is the port you will need to use to connect to the server via SSH!

A firewall is more than just the opening and closing of ports. Yes, that is its essence and core, but imagine a situation where you have fifteen ports open on a server and you decide to list the firewall rules for that zone. Then, all of a sudden, you have a list of fifteen ports and you have no idea what all of them are used for. To avoid confusion, you can create firewalld services, which are basically configuration files that contain ports and protocols.

In this case, we will edit the SSH firewalld service file and change the port from 22 to 61613. We will also remove the port 61613 from the firewalld ruleset and add the SSH firewalld service to it. So, the port will still remain open, but when we list out the rules for that zone, instead of listing out ports, we will list out the names of the services. Furthermore, since a firewalld service does not exist for our custom backend application, we will have to create one from scratch and allow it with firewalld.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!