我有4台服务器带有“让我们加密HTTPS证书”,应使用certbot续订。它们是由用户ubuntu
创建的,其标志分别为--dns-route53
,--dns-digitalocean
和--dns-digitalocean-credentials
。当我安装certbot时,已创建文件/etc/cron.d/certbot
:
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew
但是,我认为它是从根运行的,这些标志的凭据应为用户ubuntu。我检查了一下,它们不会自动更新(创建的一个没有这些标志的证书除外)。如何配置这些证书以自动续订?
要手动更新它们,我可以从用户sudo certbot renew
运行ubuntu
,然后输入密码。
我认为test -x /usr/bin/certbot -a \! -d /run/systemd/system
命令存在问题,因此我想将此行添加到root crontab中:
27 2-20/12 * * * perl -e 'sleep int(rand(1800))' && certbot -q renew
我发现仅以root身份运行“ certbot -q renew
”是可以的,但是我需要将设置从用户ubuntu
更改为root
。我正在使用S3,AWS S3凭证和Route 53凭证存在问题-服务器使用其中一个而不是另一个。您知道如何配置S3凭据以供S3使用和Route 53凭据以供Route 53使用吗?
我正在寻找如何根据此页面更改AWS_CONFIG_FILE
的方法:
https://certbot-dns-route53.readthedocs.io/en/stable/
但是只能将其更改为certbot而不是S3。
我尝试使用以下脚本:
#!/bin/bash
AWS_CONFIG_FILE=/root/.aws/config
certbot -q renew
但是如果文件/root/.aws/credentials
存在,则无法使用。只有删除此文件,我才能成功运行certbot renew
。但是我需要此文件将文件备份到S3。
/root/.aws/credentials
包含我的S3凭据,/root/.aws/config
包含我的Route 53的凭据。