RHCSA Rapid Track
In this lab, you will configure a basic firewall.
| Resources | |
|---|---|
| Machines: | serverX and desktopX |
Outcomes
After completion of this exercise, your serverX machine
should have a running web server, listening on both the cleartext
port 80/TCP and the SSL encapsulated port
443/TCP. The firewall configuration on
serverX should only allow connections to the SSL
encapsulated port.
The firewall should allow access to sshd and vnc from all hosts.
Reset your
serverXsystem.
On your
serverXsystem, make sure that both the httpd and mod_ssl packages are installed. These packages provide the Apache web server you will protect with a firewall, and the necessary extensions for the web server to serve content over SSL.[student@serverX ~]$sudo yum -y install httpd mod_ssl
On your
serverXsystem, create a new file called/var/www/html/index.html, with the following contents:I am alive
[student@serverX ~]$sudo bash -c "echo 'I am alive' > /var/www/html/index.html"
Start and enable the httpd service on your
serverXsystem.[student@serverX ~]$sudo systemctl start httpd[student@serverX ~]$sudo systemctl enable httpd
On your
serverXsystem, make sure that both the iptables and ip6tables services are masked, and that the firewalld service is enabled and running.[student@serverX ~]$sudo systemctl mask iptables[student@serverX ~]$sudo systemctl mask ip6tables[student@serverX ~]$sudo systemctl status firewalld
On your
serverXsystem, start the firewall-config application. When prompted for thestudentpassword, enterstudent.[student@serverX ~]$firewall-configor
Select → → from the system menu.
From the Configuration dropdown menu, select Permanent to switch to editing the permanent configuration.
Add the
httpsservice to the list of services allowed in thepubliczone.In the Zone list, select public. Since this zone is also the default zone, it is highlighted in bold.
In the Services tab, add a checkmark in front of the
httpsservice.Important: Also add a checkmark in front of the
vnc-serverservice. Failing to do so will lock out your graphical interface when you activate the firewall. If you do accidentally lock yourself out, recover by using ssh -X serverX firewall-config from yourdesktopXmachine.
Activate your firewall configuration by selecting → from the menu.
Verify your work by attempting to view your web server contents from
desktopX.This command should fail:
[student@desktopX ~]$curl -k http://serverX.example.comThis command should succeed:
[student@desktopX ~]$curl -k https://serverX.example.com
Note
If you use firefox to connect to the web server, it will prompt for verification of the host certificate if it successfully gets past the firewall.