Class: Sqreen::Actions::BlockIp
- Extended by:
- IpRangeIndexedActionClass
- Defined in:
- lib/sqreen/actions/block_ip.rb
Overview
Block a list of IP address ranges. Standard “raise” behavior.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #do_run(client_ip) ⇒ Object
- #event_properties(client_ip) ⇒ Object
-
#initialize(id, opts, _params = {}) ⇒ BlockIp
constructor
A new instance of BlockIp.
Methods included from IpRangeIndexedActionClass
Methods inherited from Base
get_type_class, inherited, known_subclasses, known_types, new_index, #run
Constructor Details
#initialize(id, opts, _params = {}) ⇒ BlockIp
Returns a new instance of BlockIp.
18 19 20 21 |
# File 'lib/sqreen/actions/block_ip.rb', line 18 def initialize(id, opts, _params = {}) # no need to store the ranges for this action, the index filter the class super(id, opts) end |
Instance Method Details
#do_run(client_ip) ⇒ Object
23 24 25 26 27 |
# File 'lib/sqreen/actions/block_ip.rb', line 23 def do_run(client_ip) e = Sqreen::AttackBlocked.new("Blocked client's IP #{client_ip} " \ "(action: #{id}). No action is required") { :status => :raise, :exception => e, :skip_rem_cbs => true } end |
#event_properties(client_ip) ⇒ Object
29 30 31 |
# File 'lib/sqreen/actions/block_ip.rb', line 29 def event_properties(client_ip) { 'ip_address' => client_ip } end |