#
# Cookbook:: irrigate-orchard_base
# Recipe:: hosts_deny
#
# Copyright: The Orchard
#
# This recipe manages /etc/hosts.deny and /etc/hosts.allow
#
# How to cast ACL's described here:
# https://linux.die.net/man/5/hosts.deny

#####                                       #####
#  Emptying hosts.deny if hosts.allow are empty #
####                                         ####
file '/etc/hosts.deny' do
  content ''
  only_if { node['hosts_allow'].empty? }
end

template '/etc/hosts.allow' do
  source 'hosts.allow.erb'
  mode '644'
  owner 'root'
  group 'root'
end

template '/etc/hosts.deny' do
  source 'hosts.deny.erb'
  mode '644'
  owner 'root'
  group 'root'
  not_if { node['hosts_allow'].empty? }
end
