%h1 Manually Banned IP Addresses
%table.table.table-striped
%thead
%tr
%th Key
%th Banned IP
- if is_redis?
%th Expires
%th Actions
= render partial: 'rack_attack_admin/banned_ips/banned_ip',
collection: Rack::Attack::BannedIps.keys, as: 'key',
locals: { _:nil,
full_key_prefix: Rack::Attack::BannedIps.full_key_prefix,
}
= form_for @default_banned_ip, url: [rack_attack_admin, :banned_ips] do |f|
%tr
%td Add new:
%td= f.text_field :ip
%td= f.text_field :bantime
%td= f.submit 'Ban', class: 'btn btn-danger'
%h1 Fail2Ban/Allow2Ban Bans
%table.table.table-striped
%thead
%tr
%th Key
%th Banned IP
- if is_redis?
%th Expires
%th Actions
-#
= render partial: 'admin/rack_attack/banned_ips/banned_ip',
collection: @banned_ip_keys, as: 'key',
locals: { _:nil,
full_key_prefix: Rack::Attack::Fail2Ban.full_key_prefix,
}
%h1 Throttle/Fail2Ban Count Keys
%table.table.table-striped.mb-0
%thead
%tr
%th Type:Name
%th Discriminator
%th
Value
\/Limit
%th
Expires
(Time bucket)
%th Actions
- @counters_h.each do |key, value|
%tr
:ruby
parsed = Rack::Attack.parse_key(key)
value = value.to_i
name = Rack::Attack.humanize_key(key).sub(":#{parsed[:discriminator]}", '')
%td
= name
-# if parsed and rule = parsed[:rule]
%code= rule.inspect_with_options
%td= parsed[:discriminator]
- limit = parsed && (rule = parsed[:rule]) && rule.limit.to_i
- over_limit = value >= limit
%td{class: ('over_limit' if over_limit), style: ('color: red' if over_limit)}
= value
- if limit
= "/#{limit}"
%td
-# We can get expires_in from redis or directly from the mached throttle rule
:ruby
interval =
if is_redis?
Rack::Attack.cache.store.ttl("#{Rack::Attack.cache.prefix}:#{key}")
elsif parsed and time_range = parsed[:time_range]
(time_range.end - Time.now)
end
- if interval
in #{ActiveSupport::Duration.build(interval)&.human_str}
- if parsed and time_range = parsed[:time_range]
%small
(#{ time_range.begin.to_s(:time_with_s)}
%span><
\-
#{time_range.end .to_s(:time_with_s)}
\= #{time_range.duration&.human_str})
%td= link_to 'Delete', rack_attack_admin.key_path(key), method: :delete, class: 'btn'
.current_time.mb-2 (Current time: #{Time.now.to_s(:time_with_s)})
%h1 Flags
%table.table.table-striped
%thead
%tr
%th Key
%th Value
%tr
%td cookies[:skip_safelist]
%td= cookies[:skip_safelist]
%h1 Current Request
%table.table.table-striped
%thead
%tr
%th Key
%th Value
- current_request_rack_attack_stats.each do |key, value|
%tr
%td= key
%td= value