X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/9de17ece169e2c0f91c5545b328fc0cc2fc6a0f4..5965ce211517c8fb9aa7805c443c088dd4b83e93:/cookbooks/letsencrypt/recipes/default.rb diff --git a/cookbooks/letsencrypt/recipes/default.rb b/cookbooks/letsencrypt/recipes/default.rb index 05b1c0fa8..3590fc94d 100644 --- a/cookbooks/letsencrypt/recipes/default.rb +++ b/cookbooks/letsencrypt/recipes/default.rb @@ -17,6 +17,7 @@ # limitations under the License. # +include_recipe "accounts" include_recipe "apache" keys = data_bag_item("chef", "keys") @@ -29,31 +30,31 @@ package %w[ directory "/etc/letsencrypt" do owner "letsencrypt" group "letsencrypt" - mode 0o755 + mode "755" end directory "/var/lib/letsencrypt" do owner "letsencrypt" group "letsencrypt" - mode 0o755 + mode "755" end directory "/var/log/letsencrypt" do owner "letsencrypt" group "letsencrypt" - mode 0o700 + mode "700" end directory "/srv/acme.openstreetmap.org" do owner "letsencrypt" group "letsencrypt" - mode 0o755 + mode "755" end directory "/srv/acme.openstreetmap.org/html" do owner "letsencrypt" group "letsencrypt" - mode 0o755 + mode "755" end ssl_certificate "acme.openstreetmap.org" do @@ -69,55 +70,55 @@ end directory "/srv/acme.openstreetmap.org/config" do owner "letsencrypt" group "letsencrypt" - mode 0o755 + mode "755" end directory "/srv/acme.openstreetmap.org/work" do owner "letsencrypt" group "letsencrypt" - mode 0o755 + mode "755" end directory "/srv/acme.openstreetmap.org/logs" do owner "letsencrypt" group "letsencrypt" - mode 0o700 + mode "700" end directory "/srv/acme.openstreetmap.org/.chef" do owner "letsencrypt" group "letsencrypt" - mode 0o2775 + mode "2775" end file "/srv/acme.openstreetmap.org/.chef/client.pem" do content keys["letsencrypt"].join("\n") owner "letsencrypt" group "letsencrypt" - mode 0o660 + mode "660" end cookbook_file "/srv/acme.openstreetmap.org/.chef/knife.rb" do source "knife.rb" owner "letsencrypt" group "letsencrypt" - mode 0o660 + mode "660" end remote_directory "/srv/acme.openstreetmap.org/bin" do source "bin" owner "root" group "root" - mode 0o755 + mode "755" files_owner "root" files_group "root" - files_mode 0o755 + files_mode "755" end directory "/srv/acme.openstreetmap.org/requests" do owner "root" group "root" - mode 0o755 + mode "755" end certificates = search(:node, "letsencrypt:certificates").each_with_object({}) do |n, c| @@ -136,7 +137,7 @@ certificates.each do |name, details| source "request.erb" owner "root" group "letsencrypt" - mode 0o754 + mode "754" variables details end @@ -147,6 +148,7 @@ certificates.each do |name, details| user "letsencrypt" group "letsencrypt" subscribes :run, "template[/srv/acme.openstreetmap.org/requests/#{name}]" + not_if { ENV["TEST_KITCHEN"] } end end @@ -169,13 +171,22 @@ template "/srv/acme.openstreetmap.org/bin/check-certificates" do source "check-certificates.erb" owner "root" group "root" - mode 0o755 + mode "755" variables :certificates => certificates end -template "/etc/cron.d/letsencrypt" do - source "cron.erb" - owner "root" - group "root" - mode 0o644 +cron_d "letencrypt-renew" do + minute "00" + hour "*/12" + user "letsencrypt" + command "/srv/acme.openstreetmap.org/bin/renew" + mailto "admins@openstreetmap.org" +end + +cron_d "letencrypt-check" do + minute "30" + hour "*/12" + user "letsencrypt" + command "/srv/acme.openstreetmap.org/bin/check-certificates" + mailto "admins@openstreetmap.org" end