go - 是什么原因导致瓮:acme:error:unauthorized 403 error in golang's acme/autocert?

标签 go https dns ssl-certificate tls1.2

完整的错误消息是:

403 urn:acme:error:unauthorized: Account creation on ACMEv1 is disabled. Please upgrade your ACME client to a version that supports ACMEv2 / RFC 8555. See https://community.letsencrypt.org/t/end-of-life-plan-for-acmev1/88430 for details

我已经用谷歌搜索了这个并查看了该链接,但我只是使用:

golang.org/x/crypto/acme/autocert

以非常正常的方式打包:

package main

import (
    "crypto/tls"
    "net/http"

    "github.com/gin-gonic/gin"
    "golang.org/x/crypto/acme/autocert"
)

func main() {

    router := gin.Default()
    hosts := []string{"yourdomain.com"}
    certManager := autocert.Manager{
        Prompt:     autocert.AcceptTOS,
        HostPolicy: autocert.HostWhitelist(hosts...),
        Cache:      autocert.DirCache("/certs"),
    }

    server := &http.Server{
        Addr:    ":https",
        Handler: router,
        TLSConfig: &tls.Config{
            GetCertificate: certManager.GetCertificate,
        },
    }

    server.ListenAndServeTLS("", "")
}

事实上,这段代码在过去 6 个月里一直运行良好。但就在今天,我打开了它所在的服务器,现在收到了上述消息。

我尝试获取最新版本的 golang,但仍然存在同样的问题。

我将主机的 DNS 更改为该新服务器的 IP,并且服务器的主机名是正确的。

据我所知,它与以前的工作服务器 100% 相同,但具有新的 IP。

golang 的 acme/autocert 真的已经过时并且不使用 ACMEv2 了吗?

最佳答案

此声明:

In fact this code has been running and working fine for the last 6 months. But just today I switched the server it was on and now get the above message.

可能表明您正在针对旧版本的 golang.org/x/crypto 进行构建 - 检查您的 go.mod 文件并确保您使用的是相当新的版本。我最近完成了一个使用几乎相同代码的项目。我的 go.mod 中的 require 看起来像这样:

golang.org/x/crypto v0.0.0-20200602180216-279210d13fed

关于go - 是什么原因导致瓮:acme:error:unauthorized 403 error in golang's acme/autocert?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62479445/

相关文章:

sql - 使用 Postgres 时为 "Operator does not exist: integer =?"

python - 在 Google App Engine 中使用 ctypes 来使用二进制文件?

java - 如何让jersey中的RESTful资源支持HTTPS

actionscript - 如何阻止 ustream 的嵌入式视频播放器从 https 抛出 ActionScript 错误?

python ipaddress()reverse_pointer 相当于 3.4

go - 如何确定接口(interface) slice 中的值类型{}

arrays - 在 Go 中打印数组值

java - 如何访问遇到 "MD2withRSA is disabled"的https网站

linux - 填充 Samba AD 反向区域

c# - 如何获取DNS中的TTL(Time To Live)?