]> git.openstreetmap.org Git - chef.git/blob - cookbooks/geodns/recipes/default.rb
813ac250cfed8404c00584543ea2d3eb48df1a52
[chef.git] / cookbooks / geodns / recipes / default.rb
1 #
2 # Cookbook:: geodns
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 "geoipupdate"
21
22 package %w[
23   gdnsd
24 ]
25
26 directory "/etc/gdnsd/config.d" do
27   owner "nobody"
28   group "nogroup"
29   mode 0o755
30 end
31
32 template "/etc/gdnsd/config" do
33   source "config.erb"
34   owner "root"
35   group "root"
36   mode 0o644
37   notifies :restart, "service[gdnsd]"
38 end
39
40 template "/etc/gdnsd/zones/geo.openstreetmap.org" do
41   source "geo.erb"
42   owner "root"
43   group "root"
44   mode 0o644
45   notifies :restart, "service[gdnsd]"
46 end
47
48 service "gdnsd" do
49   action [:enable, :start]
50   supports :status => true, :restart => true, :reload => true
51 end
52
53 systemd_service "gdnsd-reload" do
54   description "Reload gdnsd configuration"
55   type "simple"
56   user "root"
57   exec_start "/bin/systemctl reload-or-restart gdnsd"
58   standard_output "null"
59   private_tmp true
60   private_devices true
61   protect_system "full"
62   protect_home true
63   no_new_privileges true
64 end
65
66 systemd_path "gdnsd-reload" do
67   description "Reload gdnsd configuration"
68   path_changed "/etc/gdnsd/config.d"
69 end
70
71 service "gdnsd-reload.path" do
72   action [:enable, :start]
73   subscribes :restart, "systemd_path[gdnsd-reload]"
74 end
75
76 firewall_rule "accept-dns-udp" do
77   action :accept
78   source "net"
79   dest "fw"
80   proto "udp"
81   dest_ports "domain"
82 end
83
84 firewall_rule "accept-dns-tcp" do
85   action :accept
86   source "net"
87   dest "fw"
88   proto "tcp:syn"
89   dest_ports "domain"
90 end