Class: Mt::Wall::Model::Policy

Inherits:
Data
  • Object
show all
Defined in:
lib/mt/wall/model/policy.rb

Overview

A default policy for a firewall chain, e.g. Policy.new(chain: :forward, action: :drop). Defined globally on the Configuration and optionally overridden per Device. Compiles to the trailing default rule of a chain.

RULE-LEVEL ATTRIBUTES (NOT match conditions): ‘log` / `log_prefix` and `disabled` configure the trailing default-policy rule and are excluded from the content-only identity tag (toggling them is an in-place :update).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(chain:, action:, comment: nil, log: false, log_prefix: nil, disabled: false) ⇒ Policy

Returns a new instance of Policy.



21
22
23
# File 'lib/mt/wall/model/policy.rb', line 21

def initialize(chain:, action:, comment: nil, log: false, log_prefix: nil, disabled: false)
  super
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



20
21
22
# File 'lib/mt/wall/model/policy.rb', line 20

def action
  @action
end

#chainObject (readonly)

Returns the value of attribute chain

Returns:

  • (Object)

    the current value of chain



20
21
22
# File 'lib/mt/wall/model/policy.rb', line 20

def chain
  @chain
end

#commentObject (readonly)

Returns the value of attribute comment

Returns:

  • (Object)

    the current value of comment



20
21
22
23
24
# File 'lib/mt/wall/model/policy.rb', line 20

Policy = Data.define(:chain, :action, :comment, :log, :log_prefix, :disabled) do
  def initialize(chain:, action:, comment: nil, log: false, log_prefix: nil, disabled: false)
    super
  end
end

#disabledObject (readonly)

Returns the value of attribute disabled

Returns:

  • (Object)

    the current value of disabled



20
21
22
# File 'lib/mt/wall/model/policy.rb', line 20

def disabled
  @disabled
end

#logObject (readonly)

Returns the value of attribute log

Returns:

  • (Object)

    the current value of log



20
21
22
# File 'lib/mt/wall/model/policy.rb', line 20

def log
  @log
end

#log_prefixObject (readonly)

Returns the value of attribute log_prefix

Returns:

  • (Object)

    the current value of log_prefix



20
21
22
23
24
# File 'lib/mt/wall/model/policy.rb', line 20

Policy = Data.define(:chain, :action, :comment, :log, :log_prefix, :disabled) do
  def initialize(chain:, action:, comment: nil, log: false, log_prefix: nil, disabled: false)
    super
  end
end

Instance Method Details

#action=(value) ⇒ Object (readonly)

:accept or :drop



20
21
22
23
24
# File 'lib/mt/wall/model/policy.rb', line 20

Policy = Data.define(:chain, :action, :comment, :log, :log_prefix, :disabled) do
  def initialize(chain:, action:, comment: nil, log: false, log_prefix: nil, disabled: false)
    super
  end
end

#chain=(value) ⇒ Object (readonly)

:input, :forward or :output



20
21
22
23
24
# File 'lib/mt/wall/model/policy.rb', line 20

Policy = Data.define(:chain, :action, :comment, :log, :log_prefix, :disabled) do
  def initialize(chain:, action:, comment: nil, log: false, log_prefix: nil, disabled: false)
    super
  end
end

#disabled=(value) ⇒ Object (readonly)

keep but inactive (disabled=yes)



20
21
22
23
24
# File 'lib/mt/wall/model/policy.rb', line 20

Policy = Data.define(:chain, :action, :comment, :log, :log_prefix, :disabled) do
  def initialize(chain:, action:, comment: nil, log: false, log_prefix: nil, disabled: false)
    super
  end
end

#log=(value) ⇒ Object (readonly)

log packets hitting the default (log=yes)



20
21
22
23
24
# File 'lib/mt/wall/model/policy.rb', line 20

Policy = Data.define(:chain, :action, :comment, :log, :log_prefix, :disabled) do
  def initialize(chain:, action:, comment: nil, log: false, log_prefix: nil, disabled: false)
    super
  end
end