Sha256: d91e4915e1e2b14bf3f3ec278d00d9769ed4fd8899779a87bd77b2398e5272df

Contents?: true

Size: 514 Bytes

Versions: 1

Compression:

Stored size: 514 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.1 lib/shutter/iptables/jail.rb