Class: Rack::Attack::Fail2Ban
- Inherits:
-
Object
- Object
- Rack::Attack::Fail2Ban
- Includes:
- InstantiableFail2Ban
- Defined in:
- lib/rack/attack_extensions.rb
Constant Summary
Constants included from InstantiableFail2Ban
InstantiableFail2Ban::MANDATORY_OPTIONS
Instance Attribute Summary
Attributes included from InstantiableFail2Ban
#bantime, #limit, #name, #period, #type
Class Method Summary collapse
- .banned_ip_keys ⇒ Object
- .full_key_prefix ⇒ Object
-
.keys ⇒ Object
AKA unprefixed_keys Removes the Rack::Attack.cache.prefix, but not ‘allow2ban’.
- .prefixed_keys ⇒ Object
- .to_h ⇒ Object
Methods included from InstantiableFail2Ban
Methods included from InspectWithOptions
#inspect_with_options, #options
Methods included from PeriodIntrospection
Class Method Details
.banned_ip_keys ⇒ Object
251 252 253 |
# File 'lib/rack/attack_extensions.rb', line 251 def banned_ip_keys keys.grep(/(allow|fail)2ban:ban:/) end |
.full_key_prefix ⇒ Object
255 256 257 |
# File 'lib/rack/attack_extensions.rb', line 255 def full_key_prefix "#{cache.prefix}:#{key_prefix}" end |
.keys ⇒ Object
AKA unprefixed_keys Removes the Rack::Attack.cache.prefix, but not ‘allow2ban’
239 240 241 242 243 |
# File 'lib/rack/attack_extensions.rb', line 239 def keys prefixed_keys.map { |key| Rack::Attack.unprefix_key(key) } end |
.prefixed_keys ⇒ Object
233 234 235 |
# File 'lib/rack/attack_extensions.rb', line 233 def prefixed_keys cache.store.keys.grep(/^#{cache.prefix}:(allow|fail)2ban:/) end |
.to_h ⇒ Object
245 246 247 248 249 |
# File 'lib/rack/attack_extensions.rb', line 245 def to_h keys.each_with_object({}) do |k, h| h[k] = cache.store.read(k) end end |