]> git.openstreetmap.org Git - chef.git/blob - cookbooks/bind/recipes/default.rb
aaba997815cf10e205e28d3e28e4590f1ccfe45f
[chef.git] / cookbooks / bind / recipes / default.rb
1 #
2 # Cookbook:: bind
3 # Recipe:: default
4 #
5 # Copyright:: 2011, OpenStreetMap Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     https://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 include_recipe "networking"
21
22 ipv4_clients = []
23 ipv6_clients = []
24
25 package "bind9"
26
27 service "bind9" do
28   action [:enable, :start]
29   supports :status => true, :restart => true, :reload => true
30 end
31
32 template "/etc/bind/named.conf.local" do
33   source "named.local.erb"
34   owner "root"
35   group "root"
36   mode 0o644
37   notifies :restart, "service[bind9]"
38 end
39
40 template "/etc/bind/named.conf.options" do
41   source "named.options.erb"
42   owner "root"
43   group "root"
44   mode 0o644
45   variables :ipv4_clients => ipv4_clients, :ipv6_clients => ipv6_clients
46   notifies :restart, "service[bind9]"
47 end
48
49 template "/etc/bind/db.10" do
50   source "db.10.erb"
51   owner "root"
52   group "root"
53   mode 0o644
54   notifies :reload, "service[bind9]"
55 end
56
57 firewall_rule "accept-dns-udp" do
58   action :accept
59   source "net"
60   dest "fw"
61   proto "udp"
62   dest_ports "domain"
63   source_ports "-"
64 end
65
66 firewall_rule "accept-dns-tcp" do
67   action :accept
68   source "net"
69   dest "fw"
70   proto "tcp:syn"
71   dest_ports "domain"
72   source_ports "-"
73 end