Class: Dcmgr::VNet::Tasks::DropMacSpoofing
- Inherits:
-
Dcmgr::VNet::Task
- Object
- Dcmgr::VNet::Task
- Dcmgr::VNet::Tasks::DropMacSpoofing
- Includes:
- Netfilter
- Defined in:
- lib/dcmgr/vnet/tasks/drop_mac_spoofing.rb
Overview
Disables instances from spoofing another mac address
Instance Attribute Summary collapse
-
#enable_logging ⇒ Object
Returns the value of attribute enable_logging.
-
#log_prefix ⇒ Object
Returns the value of attribute log_prefix.
-
#mac ⇒ Object
Returns the value of attribute mac.
Attributes inherited from Dcmgr::VNet::Task
Instance Method Summary collapse
-
#initialize(mac, enable_logging, log_prefix) ⇒ DropMacSpoofing
constructor
A new instance of DropMacSpoofing.
Constructor Details
#initialize(mac, enable_logging, log_prefix) ⇒ DropMacSpoofing
Returns a new instance of DropMacSpoofing.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dcmgr/vnet/tasks/drop_mac_spoofing.rb', line 14 def initialize(mac,enable_logging,log_prefix) super() self.mac = mac self.enable_logging = enable_logging self.log_prefix = log_prefix # Prevent spoofing to the outside world self.rules << EbtablesRule.new(:filter,:forward,:arp,:outgoing,"--protocol arp --arp-mac-src ! #{self.mac} #{EbtablesRule.log_arp(self.log_prefix) if self.enable_logging} -j DROP") # Prevent spoofing to the host self.rules << EbtablesRule.new(:filter,:input,:arp,:outgoing,"--protocol arp --arp-mac-src ! #{self.mac} #{EbtablesRule.log_arp(self.log_prefix) if self.enable_logging} -j DROP") # Prevent spoofing from the outside world self.rules << EbtablesRule.new(:filter,:forward,:arp,:incoming,"--protocol arp --arp-mac-dst ! #{self.mac} #{EbtablesRule.log_arp(self.log_prefix) if self.enable_logging} -j DROP") # Prevent spoofing from the host self.rules << EbtablesRule.new(:filter,:output,:arp,:incoming,"--protocol arp --arp-mac-dst ! #{self.mac} #{EbtablesRule.log_arp(self.log_prefix) if self.enable_logging} -j DROP") end |
Instance Attribute Details
#enable_logging ⇒ Object
Returns the value of attribute enable_logging.
11 12 13 |
# File 'lib/dcmgr/vnet/tasks/drop_mac_spoofing.rb', line 11 def enable_logging @enable_logging end |
#log_prefix ⇒ Object
Returns the value of attribute log_prefix.
12 13 14 |
# File 'lib/dcmgr/vnet/tasks/drop_mac_spoofing.rb', line 12 def log_prefix @log_prefix end |
#mac ⇒ Object
Returns the value of attribute mac.
10 11 12 |
# File 'lib/dcmgr/vnet/tasks/drop_mac_spoofing.rb', line 10 def mac @mac end |