Move the Gandi DNS certbot hook to kosmos-ejabberd

This commit is contained in:
Greg Karékinian 2020-11-25 16:26:11 +01:00
parent 8b1f90c568
commit 7636f6ed19
3 changed files with 9 additions and 10 deletions

View File

@ -63,14 +63,6 @@ systemctl reload nginx
group "root" group "root"
end end
# gandi_api_data_bag_item = data_bag_item('credentials', 'gandi_api_5apps')
# TODO only write to machines that actually need it (e.g. via role)
# template "/root/gandi_dns_certbot_hook.sh" do
# variables gandi_api_key: gandi_api_data_bag_item["key"]
# mode 0770
# end
# include_recipe 'kosmos-base::systemd_emails' # include_recipe 'kosmos-base::systemd_emails'
# TODO Check the deployed certs expiration dates instead of overwriting supplied systemd services # TODO Check the deployed certs expiration dates instead of overwriting supplied systemd services

View File

@ -54,10 +54,17 @@ file "/etc/letsencrypt/renewal-hooks/post/ejabberd" do
group "root" group "root"
end end
gandi_api_data_bag_item = data_bag_item('credentials', 'gandi_api_5apps')
template "/root/gandi_dns_certbot_hook.sh" do
variables gandi_api_key: gandi_api_data_bag_item["key"]
mode 0770
end
# Generate a Let's Encrypt cert (only if no cert has been generated before). # Generate a Let's Encrypt cert (only if no cert has been generated before).
# The systemd timer will take care of renewing # The systemd timer will take care of renewing
execute "letsencrypt cert for kosmos xmpp" do execute "letsencrypt cert for kosmos xmpp" do
command "/usr/bin/certbot certonly --manual --preferred-challenges dns --manual-public-ip-logging-ok --agree-tos --manual-auth-hook \"/root/gandi_dns_certbot_hook.sh auth\" --manual-cleanup-hook \"/root/gandi_dns_certbot_hook.sh cleanup\" --deploy-hook \"/etc/letsencrypt/renewal-hooks/post/ejabberd\" --email ops@kosmos.org -d kosmos.org -d xmpp.kosmos.org -d chat.kosmos.org -d kosmos.chat -n" command "certbot certonly --manual --preferred-challenges dns --manual-public-ip-logging-ok --agree-tos --manual-auth-hook \"/root/gandi_dns_certbot_hook.sh auth\" --manual-cleanup-hook \"/root/gandi_dns_certbot_hook.sh cleanup\" --deploy-hook \"/etc/letsencrypt/renewal-hooks/post/ejabberd\" --email ops@kosmos.org -d kosmos.org -d xmpp.kosmos.org -d chat.kosmos.org -d kosmos.chat -d uploads.xmpp.kosmos.org -n"
not_if do not_if do
File.exist?("/etc/letsencrypt/live/kosmos.org/fullchain.pem") File.exist?("/etc/letsencrypt/live/kosmos.org/fullchain.pem")
end end
@ -66,7 +73,7 @@ end
# Generate a Let's Encrypt cert (only if no cert has been generated before). # Generate a Let's Encrypt cert (only if no cert has been generated before).
# The systemd timer will take care of renewing # The systemd timer will take care of renewing
execute "letsencrypt cert for 5apps xmpp" do execute "letsencrypt cert for 5apps xmpp" do
command "/usr/bin/certbot certonly --manual --preferred-challenges dns --manual-public-ip-logging-ok --agree-tos --manual-auth-hook \"/root/gandi_dns_certbot_hook.sh auth\" --manual-cleanup-hook \"/root/gandi_dns_certbot_hook.sh cleanup\" --deploy-hook \"/etc/letsencrypt/renewal-hooks/post/ejabberd\" --email ops@5apps.com -d 5apps.com -d muc.5apps.com -d xmpp.5apps.com -n" command "certbot certonly --manual --preferred-challenges dns --manual-public-ip-logging-ok --agree-tos --manual-auth-hook \"/root/gandi_dns_certbot_hook.sh auth\" --manual-cleanup-hook \"/root/gandi_dns_certbot_hook.sh cleanup\" --deploy-hook \"/etc/letsencrypt/renewal-hooks/post/ejabberd\" --email ops@5apps.com -d 5apps.com -d muc.5apps.com -d xmpp.5apps.com -d uploads.xmpp.5apps.com -n"
not_if do not_if do
File.exist?("/etc/letsencrypt/live/5apps.com/fullchain.pem") File.exist?("/etc/letsencrypt/live/5apps.com/fullchain.pem")
end end