systems:media_server:secure_the_server:setup_a_firewall
This is an old revision of the document!
Table of Contents
Systems - Media Server - Secure the Server - Setup a Firewall
Create a systemd service unit file for the firewall
Create a file named /etc/systemd/system/sharewiz-firewall.service:
- /etc/systemd/system/sharewiz-firewall.service
[Unit] Description=Runs the firewall. [Service] [Unit] Description=Runs the firewall. [Service] ExecStart=/sharewiz/firewall/firewall.sh ExecStop=/sharewiz/firewall/firewall-reset.sh Type=oneshot RemainAfterExit=yes [Install] #WantedBy=multi-user.target WantedBy=default.target
NOTE: Ensure that the script that is going to be run is executable.
- ExecStart - this is the script that is run when the service starts.
- ExecStop - this is the script that is run when the service stops.
Reload and enable the firewall.service unit
sudo chmod 644 /etc/systemd/system/sharewiz-firewall.service sudo systemctl daemon-reload sudo systemctl enable sharewiz-firewall.service
NOTE: The systemctl daemon-reload command reloads all unit files, including the new unit file created for the firewall.
Check firewall status
sudo iptables -L INPUT -n
returns:
Chain INPUT (policy DROP) target prot opt source destination ... lots of rules...
NOTE: This should display a lot of rules.
References
systems/media_server/secure_the_server/setup_a_firewall.1748690929.txt.gz · Last modified: 2025/05/31 11:28 by peter