X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/e83395675fe4f9b35a1d83e99c50d1ea6fbe79fd..ea85f03e8a99762521be0fc45b6ae44eb030ecb8:/cookbooks/networking/recipes/default.rb diff --git a/cookbooks/networking/recipes/default.rb b/cookbooks/networking/recipes/default.rb index 5cb43e807..1774b637b 100644 --- a/cookbooks/networking/recipes/default.rb +++ b/cookbooks/networking/recipes/default.rb @@ -22,8 +22,13 @@ require "ipaddr" +network_packages = [] + node[:networking][:interfaces].each do |name, interface| - if interface[:role] && role = node[:networking][:roles][interface[:role]] + network_packages |= ["vlan"] if interface[:interface] =~ /\.\d+$/ + network_packages |= ["ifenslave"] if interface[:bond] + + if interface[:role] && (role = node[:networking][:roles][interface[:role]]) if role[interface[:family]] node.set[:networking][:interfaces][name][:prefix] = role[interface[:family]][:prefix] node.set[:networking][:interfaces][name][:gateway] = role[interface[:family]][:gateway] @@ -39,6 +44,8 @@ node[:networking][:interfaces].each do |name, interface| node.set[:networking][:interfaces][name][:network] = IPAddr.new(interface[:address]).mask(prefix) end +package network_packages + template "/etc/network/interfaces" do source "interfaces.erb" owner "root" @@ -124,12 +131,6 @@ end package "shorewall" -service "shorewall" do - action [:enable, :start] - supports :restart => true - status_command "shorewall status" -end - template "/etc/default/shorewall" do source "shorewall-default.erb" owner "root" @@ -189,6 +190,20 @@ template "/etc/shorewall/rules" do notifies :restart, "service[shorewall]" end +service "shorewall" do + action [:enable, :start] + supports :restart => true + status_command "shorewall status" +end + +template "/etc/logrotate.d/shorewall" do + source "logrotate.shorewall.erb" + owner "root" + group "root" + mode 0644 + variables :name => "shorewall" +end + firewall_rule "limit-icmp-echo" do action :accept family :inet @@ -199,15 +214,15 @@ firewall_rule "limit-icmp-echo" do rate_limit "s:1/sec:5" end -%w(ucl ic bm).each do |zone| +%w(ucl ic bm aws).each do |zone| firewall_rule "accept-openvpn-#{zone}" do action :accept family :inet source zone dest "fw" proto "udp" - dest_ports "1194:1196" - source_ports "1194:1196" + dest_ports "1194:1197" + source_ports "1194:1197" end end @@ -229,12 +244,6 @@ end unless node.interfaces(:family => :inet6).empty? package "shorewall6" - service "shorewall6" do - action [:enable, :start] - supports :restart => true - status_command "shorewall6 status" - end - template "/etc/default/shorewall6" do source "shorewall-default.erb" owner "root" @@ -294,6 +303,20 @@ unless node.interfaces(:family => :inet6).empty? notifies :restart, "service[shorewall6]" end + service "shorewall6" do + action [:enable, :start] + supports :restart => true + status_command "shorewall6 status" + end + + template "/etc/logrotate.d/shorewall6" do + source "logrotate.shorewall.erb" + owner "root" + group "root" + mode 0644 + variables :name => "shorewall6" + end + firewall_rule "limit-icmp6-echo" do action :accept family :inet6