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
305 306 307 |
# File 'lib/rack/attack_extensions.rb', line 305 def banned_ip_keys keys.grep(/(allow|fail)2ban:ban:/) end |
.full_key_prefix ⇒ Object
309 310 311 |
# File 'lib/rack/attack_extensions.rb', line 309 def full_key_prefix "#{cache.prefix}:#{key_prefix}" end |
.keys ⇒ Object
AKA unprefixed_keys Removes the Rack::Attack.cache.prefix, but not ‘allow2ban’
293 294 295 296 297 |
# File 'lib/rack/attack_extensions.rb', line 293 def keys prefixed_keys.map { |key| Rack::Attack.unprefix_key(key) } end |
.prefixed_keys ⇒ Object
287 288 289 |
# File 'lib/rack/attack_extensions.rb', line 287 def prefixed_keys Rack::Attack.all_keys.grep(/^#{cache.prefix}:(allow|fail)2ban:/) end |
.to_h ⇒ Object
299 300 301 302 303 |
# File 'lib/rack/attack_extensions.rb', line 299 def to_h keys.each_with_object({}) do |k, h| h[k] = cache.store.read(k) end end |