duanbi8529 2017-08-17 12:06
浏览 200
已采纳

acme:<domain>的授权错误(acme / autocert)

When running the following code I get the error:

acme: authorization error for domain (where domain is replaced by my actual domain)

Has anyone else had this issue? The error returned does not give that much insight.

package main

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

    "golang.org/x/crypto/acme/autocert"
)

func main() {
    certManager := autocert.Manager{
        Prompt:     autocert.AcceptTOS,
        HostPolicy: autocert.HostWhitelist(<domain>), //your domain here
        Cache:      autocert.DirCache("cache"), //folder for storing certificates
    }

    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        w.Write([]byte("Hello world"))
    })

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

    if err := server.ListenAndServeTLS("", ""); err != nil {
        print(err.Error())
    }
}
  • 写回答

1条回答 默认 最新

  • drcb19700 2017-08-17 13:06
    关注

    Perhaps your server is on port 8086 and the tls challenge is on port 443? Try instead serving on port 443 (You may have to setcap your binary to allow it to do this).

    See this issue on lets encrypt:

    https://github.com/letsencrypt/acme-spec/issues/33

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器