Module: ForemanMaintain::Concerns::Firewall::IptablesMaintenanceMode

Defined in:
lib/foreman_maintain/concerns/firewall/iptables_maintenance_mode.rb

Instance Method Summary collapse

Instance Method Details

#disable_maintenance_modeObject



5
6
7
# File 'lib/foreman_maintain/concerns/firewall/iptables_maintenance_mode.rb', line 5

def disable_maintenance_mode
  remove_chain(custom_chain_name)
end

#enable_maintenance_modeObject



9
10
11
12
# File 'lib/foreman_maintain/concerns/firewall/iptables_maintenance_mode.rb', line 9

def enable_maintenance_mode
  add_chain(custom_chain_name,
    ['-i lo -j ACCEPT', '-p tcp --dport 443 -j REJECT'])
end

#maintenance_mode_status?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/foreman_maintain/concerns/firewall/iptables_maintenance_mode.rb', line 14

def maintenance_mode_status?
  chain_exist?(custom_chain_name)
end

#status_for_maintenance_modeObject



18
19
20
21
22
23
24
# File 'lib/foreman_maintain/concerns/firewall/iptables_maintenance_mode.rb', line 18

def status_for_maintenance_mode
  if maintenance_mode_status?
    ['Iptables chain: present', []]
  else
    ['Iptables chain: absent', []]
  end
end