Sha256: 44eeeb21faa21d656844ea4dece18a05f94b613113346db79777c81fc50a866a

Contents?: true

Size: 965 Bytes

Versions: 29

Compression:

Stored size: 965 Bytes

Contents

# typed: true

# Copyright (c) 2015 Sqreen. All Rights Reserved.
# Please refer to our terms for more information: https://www.sqreen.com/terms.html

require 'sqreen/exception'
require 'sqreen/actions/base'
require 'sqreen/actions/ip_range_indexed_action_class'

module Sqreen
  module Actions
    # Block a list of IP address ranges. Standard "raise" behavior.
    class BlockIp < Base
      extend IpRangeIndexedActionClass

      self.type_name = 'block_ip'

      def initialize(id, opts, _params = {})
        # no need to store the ranges for this action, the index filter the class
        super(id, opts)
      end

      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

      def event_properties(client_ip)
        { 'ip_address' => client_ip }
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
sqreen-1.22.0-java lib/sqreen/actions/block_ip.rb
sqreen-1.22.0 lib/sqreen/actions/block_ip.rb
sqreen-1.21.1-java lib/sqreen/actions/block_ip.rb
sqreen-1.21.1 lib/sqreen/actions/block_ip.rb
sqreen-1.21.0-java lib/sqreen/actions/block_ip.rb
sqreen-1.21.0 lib/sqreen/actions/block_ip.rb
sqreen-1.20.4-java lib/sqreen/actions/block_ip.rb
sqreen-1.20.4 lib/sqreen/actions/block_ip.rb
sqreen-1.21.0.beta3-java lib/sqreen/actions/block_ip.rb
sqreen-1.21.0.beta3 lib/sqreen/actions/block_ip.rb
sqreen-1.20.4.beta1 lib/sqreen/actions/block_ip.rb
sqreen-1.19.4 lib/sqreen/actions/block_ip.rb
sqreen-1.20.3 lib/sqreen/actions/block_ip.rb
sqreen-1.20.2 lib/sqreen/actions/block_ip.rb
sqreen-1.21.0.beta2 lib/sqreen/actions/block_ip.rb
sqreen-1.21.0.beta1 lib/sqreen/actions/block_ip.rb
sqreen-1.20.1-java lib/sqreen/actions/block_ip.rb
sqreen-1.20.1 lib/sqreen/actions/block_ip.rb
sqreen-1.20.0-java lib/sqreen/actions/block_ip.rb
sqreen-1.20.0 lib/sqreen/actions/block_ip.rb