PDF Version Available
This document is also available in PDF format: iptables.pdf
The PDF version includes bookmarks for easy navigation and is optimized for printing.
Accessibility Notice
This document is also available in HTML format at:
Link: https://aholdengouveia.name/LinuxAdmin/labexcercises/iptables.html
The HTML version provides enhanced accessibility features including keyboard navigation, screen reader support, responsive design, dark mode support, and high contrast options.
Ticket
Ticket: ACME-7219
Requested by: Security team
Systems: Both report servers
Background
Acme Corp's two report servers are going into production. Before they do, Security needs firewall rules in place for the services they run. You will be working on the two servers you set up in the Server Setup lab: your Red Hat based server and your second server.
Learning Outcomes
By the end of this lab, you will be able to:
- Configure iptables rules to allow, block, and forward traffic for common services
- Allow or block specific hosts and MAC addresses
- Implement and test a defense that reduces the impact of a DDoS attack
- Prove that firewall rules work, and document every change
Requirements
On both servers, write iptables commands, statements, or scripts to do the following:
- Web server: open the ports the web server needs, and forward port 80 traffic to port 8080.
- MySQL: open the ports MySQL needs.
- SSH: allow incoming and outgoing SSH, and write a second script that denies SSH.
- Hosts: allow or block specific hosts and MAC addresses.
- Telnet and ping: block telnet with one script or command, and block ping with another.
- DDoS: write the specs for how you could reduce the impact of a DDoS attack using iptables. Then implement one protection from your specs on your web server, such as limiting the number of new connections from a single IP address. Test it from your other server by sending more connections than your limit allows, for example with ApacheBench (ab), and show that the extra connections are dropped. Only run this test against your own servers.
Where a requirement leaves room for interpretation, make a reasonable decision and document it as an assumption.
Acceptance Criteria
- Everything must be cited. Every command, statement, and line of code in your scripts and documents must be cited, either with a link to a reference or with a note naming the previous class where you learned it, for example: # Learned in CIS 117 Intro to Linux. In scripts, put the citation in a comment next to the code. Anything without a citation will not count.
- All rules are applied and tested on both servers.
- Every rule is proven to work with a Wireshark screenshot.
- Each command, statement, or script includes an explanation of why you chose it.
- Any assumptions you made are documented.
- The DDoS protection is tested from your other server. You may test with Wireshark, TShark, or another method, but you must explain in detail how you tested it. Your proof must show connections under your limit getting through, and connections over your limit being dropped or refused.
- The DDoS document cites at least 2 sources.
- Every terminal screenshot shows your prompt with your username and hostname, and either the output of date or a note beside the terminal with your name and the term. Hostnames must match your server inventory from the Server Setup lab.
Deliverables
Audience: someone taking care of your servers who hasn't used iptables before. Assume some technical knowledge but not expertise. Screenshots are helpful to go with your descriptions.
Include documents for both servers, clearly labeled with what the document is and which server it's for.
- A text document with your commands, statements, or scripts for each requirement. Include why you chose what you chose, any assumptions you made, and the Wireshark screenshots showing each one works.
- Documentation of the iptables rules on each server. Include a list of the changes you made to the chains, which table you changed, and when each change was made. Include a copy of your original rules and your updated rules at the end.
- A short document with your DDoS specs, the protection you implemented, and how you tested it, including a detailed explanation of your testing method and screenshots of the results. Cite at least 2 sources.
Resources
References, a video, a PowerPoint and some notes are available at my website Link: https://www.aholdengouveia.name/LinuxAdmin/iptables.html
Your servers are command line only, so Wireshark can't run on them directly. You can run Wireshark on your host computer to watch your virtual machines' network traffic, or capture the traffic on a server with TShark or tcpdump, save it to a file, and open that file in Wireshark on your host computer.