+ mode "644"
+end
+
+if node[:exim][:dkim_selectors]
+ keys = data_bag_item("exim", "dkim")
+
+ template "/etc/exim4/dkim-domains" do
+ owner "root"
+ source "dkim-domains.erb"
+ group "Debian-exim"
+ mode "644"
+ end
+
+ template "/etc/exim4/dkim-selectors" do
+ owner "root"
+ source "dkim-selectors.erb"
+ group "Debian-exim"
+ mode "644"
+ end
+
+ directory "/etc/exim4/dkim-keys" do
+ owner "root"
+ group "Debian-exim"
+ mode "755"
+ end
+
+ node[:exim][:dkim_selectors].each do |domain, _selector|
+ file "/etc/exim4/dkim-keys/#{domain}" do
+ content keys[domain].join("\n")
+ owner "root"
+ group "Debian-exim"
+ mode "640"
+ end
+ end
+end
+
+template "/etc/default/exim4" do
+ source "default.erb"
+ owner "root"
+ group "root"
+ mode "044"
+ notifies :restart, "service[exim4]"