Certbot 无法找到环境变量凭据

Tom*_*Tom 4 apache ubuntu amazon-web-services lets-encrypt certbot

我在运行 Apache 的 AWS EC2 实例上有一个 Ubuntu 20.04 服务器,我正在尝试使用 certbot 获取证书,但是我在获取凭据时遇到了问题。下面是我运行的命令,后面是错误输出:

user@address:~$ sudo certbot certonly --dns-route53 --dns-route53-propagation-seconds 30 -d mydomain.com -d *.mydomain.com -i apache

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator dns-route53, Installer apache
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for mydomain.com
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.
Run Code Online (Sandbox Code Playgroud)

我遵循了以下指南:

  1. https://certbot.eff.org/lets-encrypt/ubuntufocal-apache.html(通配符选项卡,直到第 6 步)
  2. https://certbot-dns-route53.readthedocs.io/en/stable/(创建了 IAM 策略并将其应用于新用户)

并选择使用环境变量设置凭据:

$ export AWS_ACCESS_KEY_ID=<id>
$ export AWS_SECRET_ACCESS_KEY=<secret>
Run Code Online (Sandbox Code Playgroud)

当我使用$ printenv AWS_ACCESS_KEY_ID$ printenv AWS_SECRET_ACCESS_KEY在屏幕上显示凭据时,我不明白为什么 certbot 无法找到它们。

有任何想法吗?

Chr*_*ams 6

通过运行 certbot 命令,因为sudo不再设置环境变量。

连接到sudo su然后导出变量并运行或查看使用凭证文件以允许命令访问 IAM 密钥和 IAM 机密。

此处提供更多信息。

  • 嘿汤姆,我遇到了同样的问题。但 certbot 不会读取我的配置/凭据文件,也不会读取环境变量。你在哪里创建配置文件 (2认同)
  • @Chris Williams - 你建议的两个选项都不适合我的情况。我在根目录和主目录中创建了环境变量,并使用了凭据文件。 (2认同)