Sha256: d92f7d0fbc4a0ca1435c75c6df2de24dbc575095339dac1dd4f99f7f5e0b1060

Contents?: true

Size: 565 Bytes

Versions: 5

Compression:

Stored size: 565 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.last =~ /-A Jail -j RETURN/
          jail += "-A Jail -j RETURN\n"
        end
        jail
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shutter-0.0.7 lib/shutter/iptables/jail.rb
shutter-0.0.6 lib/shutter/iptables/jail.rb
shutter-0.0.5 lib/shutter/iptables/jail.rb
shutter-0.0.4 lib/shutter/iptables/jail.rb
shutter-0.0.3 lib/shutter/iptables/jail.rb