lib/shutter/iptables/jail.rb in shutter-0.0.1 vs lib/shutter/iptables/jail.rb in shutter-0.0.2

- old
+ new

@@ -1,26 +1,26 @@ module Shutter - module IPTables - class Jail - def initialize( iptables = "/sbin/iptables") - @iptables = iptables - end + module IPTables + class Jail + def initialize( iptables = "/sbin/iptables") + @iptables = iptables + end - def fail2ban_chains - `/sbin/iptables-save | grep "^:fail2ban"` - end + def fail2ban_chains + `/sbin/iptables-save | grep "^:fail2ban"` + end - def fail2ban_rules - `/sbin/iptables-save | grep "^-A fail2ban"` - end + def fail2ban_rules + `/sbin/iptables-save | grep "^-A fail2ban"` + end - def jail_rules - jail = `/sbin/iptables-save | grep "^-A Jail"` - lines = jail.split('\n') - unless lines != [] && lines[-1] == "-A Jail -j RETURN\n" - jail += "-A Jail -j RETURN\n" - end - jail - end - end - end + def jail_rules + jail = `/sbin/iptables-save | grep "^-A Jail"` + lines = jail.split('\n') + unless lines != [] && lines[-1] == "-A Jail -j RETURN\n" + jail += "-A Jail -j RETURN\n" + end + jail + end + end + end end \ No newline at end of file