【问题标题】:Certbot unable to find AWS credentials when issuing certificate via dns for route53通过 dns 为 route53 颁发证书时,Certbot 无法找到 AWS 凭证
【发布时间】:2022-02-17 23:22:59
【问题描述】:

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

因此,唯一的方法是通过路由 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 中添加了访问密钥 ID 和秘密访问密钥,看起来像这个

[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 密钥作为环境变量导出到那里,甚至还在家中导出了 AWS 密钥,但它仍然给我带来了同样的错误。

【问题讨论】:

  • 遇到同样的问题,你能解决吗?
  • 不,很遗憾我找不到解决方案

标签: ssl dns amazon-route53 lets-encrypt certbot


【解决方案1】:

所以我也遇到了同样的问题,很可能是因为您使用 sudo 运行 certbot,您什么时候这样做,无论您用作 ~/ 的用户,都会被忽略,相反,它正在寻找在/root/

我通过 (centos) 修复它是我的用户,其中我有 .aws/ 目录和 configcredential 文件。

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

【讨论】:

    猜你喜欢
    • 2021-07-25
    • 2016-04-20
    • 1970-01-01
    • 2019-06-01
    • 2021-09-29
    • 2022-12-16
    • 1970-01-01
    • 1970-01-01
    • 2019-02-13
    相关资源
    最近更新 更多