Sha256: a73001e2670c660de6bfac0898186a56adab1156aae0f1ebf72c0634ed758748

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

module Shutter
  module IPTables
    class Jail
      def initialize( iptables = "/sbin/iptables")
        @iptables =  iptables
      end

      def fail2ban_chains
        `/sbin/iptables-save | grep "^: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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shutter-0.0.2 lib/shutter/iptables/jail.rb