从 letsencrypt 生成 ssl 时出错

Getting error while generating ssl from letsencrypt

您好,我正在学习如何使用 certbot 在 ubuntu 18.04 中安装加密证书。

我已经通过

安装了 certbot
sudo snap install --beta --classic certbot

授权

sudo snap set certbot trust-plugin-with-root=ok

因为我使用 aws ec2 所以我 运行

sudo snap install --beta certbot-dns-route53

现在,我是运行宁命令

/snap/bin/certbot certonly \
  --dns-route53 \
  -d *.example.com

我遇到错误:

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.

我是在 vps 中安装 SSL 证书的新手。请告知如何生成证书以安装通配符。

是的。错误很明显,您需要 Amazon Web Services Route 53 API 才能通过创建并随后删除 TXT 记录来完成 dns-01 挑战 (DNS01),并且此插件需要包含 Amazon Web Sevices [=38= 的配置文件] 具有以下权限的帐户凭据:

route53:ListHostedZones
route53:GetChange
route53:ChangeResourceRecordSets

您可以获得这些权限,这些权限可以在如下所示的 AWS 策略中捕获。

{
    "Version": "2012-10-17",
    "Id": "certbot-dns-route53 sample policy",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "route53:ListHostedZones",
                "route53:GetChange"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Effect" : "Allow",
            "Action" : [
                "route53:ChangeResourceRecordSets"
            ],
            "Resource" : [
                "arn:aws:route53:::hostedzone/YOURHOSTEDZONEID"
            ]
        }
    ]
}

最后,您可以为 AWS Route 53 插件设置配置配置文件 或者通过 使用 AWS_ACCESS_KEY_ID 和 AWS_SECRET_ACCESS_KEY 环境变量。或者

在默认位置使用凭证配置文件,~/.aws/config。或者

在使用 AWS_CONFIG_FILE 环境变量。

示例配置文件是:

[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

您可以在 https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/access-control-overview.html

中进一步阅读

https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/r53-api-permissions-ref.html

https://boto3.readthedocs.io/en/latest/guide/configuration.html#best-practices-for-configuring-credentials