systems:media_server:secure_the_server:setup_a_firewall
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
systems:media_server:secure_the_server:setup_a_firewall [2025/05/31 11:28] – peter | systems:media_server:secure_the_server:setup_a_firewall [2025/05/31 11:34] (current) – peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Systems - Media Server - Secure the Server - Setup a Firewall ====== | ====== Systems - Media Server - Secure the Server - Setup a Firewall ====== | ||
+ | |||
+ | ====== Create a firewall-reset script ====== | ||
+ | |||
+ | <file bash / | ||
+ | #!/bin/bash | ||
+ | # | ||
+ | # Resets all firewall rules | ||
+ | |||
+ | echo " | ||
+ | |||
+ | # | ||
+ | # Modify the following settings as required: | ||
+ | # | ||
+ | |||
+ | IPTABLES=/ | ||
+ | |||
+ | # | ||
+ | # Reset the default policies in the filter table. | ||
+ | # | ||
+ | |||
+ | $IPTABLES -P INPUT ACCEPT | ||
+ | $IPTABLES -P FORWARD ACCEPT | ||
+ | $IPTABLES -P OUTPUT ACCEPT | ||
+ | |||
+ | # | ||
+ | # Reset the default policies in the nat table. | ||
+ | # | ||
+ | |||
+ | $IPTABLES -t nat -P PREROUTING ACCEPT | ||
+ | $IPTABLES -t nat -P POSTROUTING ACCEPT | ||
+ | $IPTABLES -t nat -P OUTPUT ACCEPT | ||
+ | |||
+ | # | ||
+ | # Reset the default policies in the mangle table. | ||
+ | # | ||
+ | |||
+ | $IPTABLES -t mangle -P PREROUTING ACCEPT | ||
+ | $IPTABLES -t mangle -P POSTROUTING ACCEPT | ||
+ | $IPTABLES -t mangle -P INPUT ACCEPT | ||
+ | $IPTABLES -t mangle -P OUTPUT ACCEPT | ||
+ | $IPTABLES -t mangle -P FORWARD ACCEPT | ||
+ | |||
+ | # | ||
+ | # Flush all the rules in the filter, nat and mangle tables. | ||
+ | # | ||
+ | |||
+ | $IPTABLES -F | ||
+ | $IPTABLES -t nat -F | ||
+ | $IPTABLES -t mangle -F | ||
+ | |||
+ | # | ||
+ | # Erase all chains that are not default in filter, nat and mangle tables. | ||
+ | # | ||
+ | |||
+ | $IPTABLES -X | ||
+ | $IPTABLES -t nat -X | ||
+ | $IPTABLES -t mangle -X | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** This resets all firewall rules. | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== Create a firewall-reset script ====== | ||
+ | |||
+ | <file bash / | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
===== Create a systemd service unit file for the firewall ===== | ===== Create a systemd service unit file for the firewall ===== |
systems/media_server/secure_the_server/setup_a_firewall.txt · Last modified: 2025/05/31 11:34 by peter