X-Git-Url: https://git.llucax.com/software/pymin.git/blobdiff_plain/0e293d049f3d4dac748a1630b8258ea10b709db2..3a113e91bcbc8e34d9ef66915ccec80e6187332b:/services/firewall/templates/iptables.sh?ds=sidebyside diff --git a/services/firewall/templates/iptables.sh b/services/firewall/templates/iptables.sh index 57dacd5..e384d0e 100644 --- a/services/firewall/templates/iptables.sh +++ b/services/firewall/templates/iptables.sh @@ -4,7 +4,7 @@ # TODO escape shell commands more securely def s(text): - return repr(text.encode('utf-8')) + return repr(unicode(text).encode('utf-8')) def optional(switch, value): if value is not None: @@ -13,8 +13,14 @@ def optional(switch, value): %> +/usr/sbin/iptables -t filter -F + +/usr/sbin/iptables -t filter -P INPUT ACCEPT +/usr/sbin/iptables -t filter -P OUTPUT ACCEPT +/usr/sbin/iptables -t filter -P FORWARD ACCEPT + % for (index, rule) in enumerate(rules): -/sbin/iptables -t filter \ +/usr/sbin/iptables -t filter \ -I ${rule.chain|s} ${index+1|s} \ -j ${rule.target|s} \ ${optional('-s', rule.src)} \