[英]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.
我遵循了以下指南:
並選擇使用環境變量設置憑據:
$ export AWS_ACCESS_KEY_ID=<id>
$ export AWS_SECRET_ACCESS_KEY=<secret>
當我使用$ printenv AWS_ACCESS_KEY_ID
和$ printenv AWS_SECRET_ACCESS_KEY
我在屏幕上顯示了憑據,所以我不明白為什么 certbot 無法找到它們。
有任何想法嗎?
因為您正在使用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.