【问题标题】:Getting AccessDenied Error Trying to Get Wildcard SSL with Certbot and Route53 Plugin尝试使用 Certbot 和 Route53 插件获取通配符 SSL 时出现 AccessDenied 错误
【发布时间】:2022-11-08 20:37:05
【问题描述】:

我的任务是为某些域设置通配符 SSL。这些域通过 AWS Route53 托管。

我在用证书机器人在一个Ubuntu 20.4托管应用程序的机器。我还为 Certbot 安装了 Route53 DNS 插件。

我运行这个命令:

sudo certbot certonly --dns-route53 --email 'me@derp.com' --domain 'mywebsite.rocks' --domain '*.mywebsite.rocks' --agree-tos --non-interactive

出于安全原因删除真实域

我收到此错误:

An error occurred (AccessDenied) when calling the ListHostedZones operation: User: arn:aws:sts::789148085273:assumed-role/AmazonLightsailInstanceRole/i-0871f2572906140c4 is not authorized to perform: route53:ListHostedZones because no identity-based policy allows the route53:ListHostedZones action

让我先解释一下我是如何在 AWS 控制台中设置 IAM 用户的。

  1. 我使用此配置创建了一个新策略
    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "derp0",
                "Effect": "Allow",
                "Action": [
                    "route53:GetHostedZone",
                    "route53:ChangeResourceRecordSets",
                    "route53:ListResourceRecordSets"
                ],
                "Resource": "arn:aws:route53:::hostedzone/WHAT-EVER-MY-ID-IS-HERE"
            },
            {
                "Sid": "derp1",
                "Effect": "Allow",
                "Action": "route53:ListHostedZones",
                "Resource": "*"
            }
        ]
    }
    

    用我的实际域的托管区域 ID 替换 WHAT-EVER-MY-ID-IS-HERE

    1. 然后我创建了一个新的IAM 用户在设置过程中,我将上述策略附加给用户。

    2. 然后我创建了一个访问密钥对于我的新用户并记下AccessKeyIdSecretAccessKey。这有权以编程方式使用。

    3. 在服务器上,我按照文档中的说明在/root/.aws/config 创建了一个配置文件。我也试过~/.aws/config但是当我使用sudo 时,前者似乎是首选位置(不过我可能是错的,在我的测试期间,无论如何都没有工作)

    如前所述,我运行命令并得到错误。

    在网上到处搜索解决方案,但找不到。

    感谢我从民间获得的任何帮助。

【问题讨论】:

    标签: amazon-web-services amazon-route53 certbot


    【解决方案1】:

    经过快速检查,我能够找到以下文章:

    https://certbot-dns-route53.readthedocs.io/en/stable/

    看看它,它可能会帮助您设置必要的策略。

    当然,如果不是必须使用 AWS,您可以随时将网站部署到另一个提供商,而无需设置策略,一切都会顺利进行。

    【讨论】:

      【解决方案2】:

      谢谢你的帖子......

      尝试在 CentOS 7.9 上遇到此错误时

      certbot certonly -d *.mydomain.com --dns-route53 -m xxxxxxx@gmail.com --agree-tos --non-interactive --server https://acme-v02.api.letsencrypt.org/directory

      将调试日志保存到 /var/log/letsencrypt/letsencrypt.log

      在共享凭证文件中找到凭证:~/.aws/credentials

      选择的插件:Authenticator dns-route53,安装程序无

      启动新的 HTTPS 连接(一):acme-v02.api.letsencrypt.org

      为 *.mydomain.com 申请证书

      执行以下挑战:

      ydomain.com 的 dns-01 挑战

      启动新的 HTTPS 连接(一):route53.none.amazonaws.com

      启动新的 HTTPS 连接(2):route53.none.amazonaws.com

      启动新的 HTTPS 连接(3):route53.none.amazonaws.com

      启动新的 HTTPS 连接(4):route53.none.amazonaws.com

      启动新的 HTTPS 连接(5):route53.none.amazonaws.com

      清理挑战

      启动新的 HTTPS 连接(6):route53.none.amazonaws.com

      启动新的 HTTPS 连接(7):route53.none.amazonaws.com

      启动新的 HTTPS 连接 (8):route53.none.amazonaws.com

      启动新的 HTTPS 连接(9):route53.none.amazonaws.com

      启动新的 HTTPS 连接(10):route53.none.amazonaws.com

      恢复期间遇到异常:SSLError:主机名“route53.none.amazonaws.com”与“*.bizland.com”、“bizland.com”中的任何一个都不匹配

      一个意料之外的问题发生了:

      SSLError:主机名“route53.none.amazonaws.com”与“*.bizland.com”、“bizland.com”中的任何一个都不匹配

      有关详细信息,请参阅 /var/log/letsencrypt 中的日志文件。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-12-16
        • 1970-01-01
        • 1970-01-01
        • 2022-12-19
        • 2016-11-23
        • 2014-07-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多