簡體   English   中英

Certbot 無法找到環境變量憑據

[英]Certbot unable to locate environment variable credentials

我在運行 Apache 的 AWS EC2 實例上有一個 Ubuntu 20.04 服務器,我正在嘗試使用 certbot 獲取證書,但是我在使用憑據時遇到了問題。 下面是我運行的命令,后面是錯誤 output:

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.

我遵循了以下指南:

  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>

當我使用$ printenv AWS_ACCESS_KEY_ID$ printenv AWS_SECRET_ACCESS_KEY我在屏幕上顯示了憑據,所以我不明白為什么 certbot 無法找到它們。

有任何想法嗎?

通過以sudo身份運行 certbot 命令,不再設置環境變量。

連接到sudo su然后導出變量並運行或查看使用憑證文件以允許命令訪問 IAM 密鑰和 IAM 密鑰。

更多信息可在此處獲得。

因為您正在使用sudo來執行您的命令,正如您在上面提供的那樣(這里再次供參考):

sudo certbot certonly --dns-route53 --dns-route53-propagation-seconds 30 -d mydomain.com -d *.mydomain.com -i apache

然后使用用戶root的環境變量和主目錄,而不是當前登錄用戶的環境變量和主目錄。 因此,您必須確保您的設置適用於 root 用戶。

就我而言,我更喜歡使用配置文件而不是環境變量。 由於sudo ,此配置文件路徑和名稱為~/.aws/config ,其內容為:

[default]
aws_access_key_id=<YOUR ACCESS KEY TO AWS>
aws_secret_access_key=<YOUR SECRET ACCESS KEY TO AWS>

更多細節在這里

現在,Linux 中的根主目錄很可能是/root ,所以這就是我要開始的地方。 詳情在這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM