# 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:
%>
+/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)} \