Class: Mt::Wall::Model::Policy
- Inherits:
-
Data
- Object
- Data
- Mt::Wall::Model::Policy
- 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
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#chain ⇒ Object
readonly
Returns the value of attribute chain.
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#log ⇒ Object
readonly
Returns the value of attribute log.
-
#log_prefix ⇒ Object
readonly
Returns the value of attribute log_prefix.
Instance Method Summary collapse
-
#action(value) ⇒ Object
readonly
:accept or :drop.
-
#chain(value) ⇒ Object
readonly
:input, :forward or :output.
-
#disabled(value) ⇒ Object
readonly
keep but inactive (disabled=yes).
-
#initialize(chain:, action:, comment: nil, log: false, log_prefix: nil, disabled: false) ⇒ Policy
constructor
A new instance of Policy.
-
#log(value) ⇒ Object
readonly
log packets hitting the default (log=yes).
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
#action ⇒ Object (readonly)
Returns the value of attribute action
20 21 22 |
# File 'lib/mt/wall/model/policy.rb', line 20 def action @action end |
#chain ⇒ Object (readonly)
Returns the value of attribute chain
20 21 22 |
# File 'lib/mt/wall/model/policy.rb', line 20 def chain @chain end |
#comment ⇒ Object (readonly)
Returns the value of attribute 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 |
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled
20 21 22 |
# File 'lib/mt/wall/model/policy.rb', line 20 def disabled @disabled end |
#log ⇒ Object (readonly)
Returns the value of attribute log
20 21 22 |
# File 'lib/mt/wall/model/policy.rb', line 20 def log @log end |
#log_prefix ⇒ Object (readonly)
Returns the value of attribute 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 |