ssl - 通过 DNS 为 Route53 颁发证书时,Certbot 无法找到 AWS 凭证

标签 ssl dns amazon-route53 lets-encrypt certbot

我需要从 LetsEncrypt 获取 AWS Route 53 上托管的域的证书。我没有暴露任何端口 80 或 443,因为服务器用于 VPN 并且没有公共(public)访问权限。

因此,实现此目的的唯一方法是通过路由 53 的 DNS 验证。

到目前为止我已经安装了 certbot 和 dns-route53 插件

sudo snap install --beta --classic certbot
sudo snap set certbot trust-plugin-with-root=ok
sudo snap install --beta certbot-dns-route53
sudo snap connect certbot:plugin certbot-dns-route53

我在我的 AWS 账户中创建了一个可以访问 Route53 的特殊用户,并且我在 ~/.aws/config 和 ~/.aws/credentials 中添加了访问 key ID 和 secret 访问 key ,看起来像这样这个

[default]
aws_access_key_id=foo
aws_secret_access_key=bar

基本上遵循此处给出的每个步骤:https://certbot-dns-route53.readthedocs.io/en/stable/

现在当我运行以下命令时:

sudo certbot certonly -d mydomain.com --dns-route53

它给出以下输出:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator dns-route53, Installer None
Requesting a certificate for mydomain.com
Performing the following challenges:
dns-01 challenge for mydomain.com
Cleaning up challenges
Unable to locate credentials
To use certbot-dns-route53, configure credentials as described at https://boto3.readthedocs.io/en/latest/guide/configuration.html#best-practices-for-configuring-credentials and add the necessary permissions for Route53 access.

我查看了错误消息中给出的文档:https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#best-practices-for-configuring-credentials

但我不认为我做错了什么

我什至通过执行 sudo su 进入根级别,并将 AWS key 导出为环境变量,甚至还导出了 home 中的 AWS key ,但它仍然向我抛出相同的错误。

最佳答案

所以我也遇到了同样的问题,这可能是因为您使用 sudo 运行 certbot,您什么时候这样做,无论您使用什么用户作为 ~/ 被忽略,而是在 /root/ 中查找。

我通过(centos)修复了这个问题,我的用户在其中有 .aws/ 目录,其中包含 configcredential 文件。

sudo -s
ln -s /home/centos/.aws/ ~/.aws
ls -lsa ~/.aws
... /root/.aws -> /home/centos/.aws/

关于ssl - 通过 DNS 为 Route53 颁发证书时,Certbot 无法找到 AWS 凭证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67485614/

相关文章:

c# - 购买的证书和开发证书之间的区别?

java - WebSphere 6.1 for Windows 上的 SSL 设置

iOS:解析 DNS SRV 记录

amazon-web-services - 确定性名称服务器地址

amazon-web-services - 使用 Elastic Beanstalk 的静态 IP

c# - TCPClient 连接到 Gmail 但未收到第一条消息

node.js - 用于负载均衡器类型服务的 Kubernetes SSL

dns - 将多个域名指向同一个地方

java - 在 Java 中发送 DNS 查询而不使用 InetAddress

apache - AWS 在一个 EC2 实例上托管多个域