【问题标题】:Yaws with SSL gives the error "SSL accept failed: timeout"带有 SSL 的 Yaws 给出错误“SSL 接受失败:超时”
【发布时间】:2017-06-08 17:50:20
【问题描述】:

我使用 certbot 为我的网站生成了一个 Let's encrypt 证书,但是当我尝试连接它时 Yaws 给了我一个 SSL accept failed: timeout 错误(当然是在超时之后)。有趣的是,当我将 example.com 重定向到我机器上的 hosts 文件中的服务器的本地 IP 地址并连接到 example.com:8080 时,它可以工作,但当我在不编辑主机文件的情况下连接到 example.com 或从我的手机超过4G。这是我的网络服务器的配置文件(它是conf.d中唯一的配置文件):

<server www.example.com>
    port = 8080
    listen = 0.0.0.0
    docroot = /usr/share/yaws
    <ssl>
        keyfile = /etc/letsencrypt/live/example.com/privkey.pem
        certfile = /etc/letsencrypt/live/example.com/fullchain.pem
    </ssl>
</server>

我确保 yaws 用户可以读取密钥文件和证书。密钥文件旁边是 README,其中包含以下内容:

`privkey.pem`  : the private key for your certificate.
`fullchain.pem`: the certificate file used in most server software.
`chain.pem`    : used for OCSP stapling in Nginx >=1.3.7.
`cert.pem`     : will break many server configurations, and should not be used
                 without reading further documentation (see link below).
We recommend not moving these files. For more information, see the Certbot
User Guide at https://certbot.eff.org/docs/using.html#where-are-my-certificates.

所以我比较确定我使用了正确的文件(其他文件给了我错误,例如 badmatch{tls_alert,"decrypt error"})。我还尝试了一些琐碎的事情,比如在 URL 之前写 https://,但它没有解决问题,而且,当服务器在没有 SSL 的情况下运行时一切正常。我的服务器上运行的 Erlang 版本是 Erlang/OTP 19。另外,如果不清楚,域实际上不是 example.com

另外,example.com 会通过 cname 重定向到 examplecom.duckdns.org,如果这很重要的话。

更新:

我的服务器正在侦听端口 8080,该端口是从外部端口 80 转发的,用于 https 连接,而默认 https 端口是端口 443。我的另一个错误是连接到http://example.com 而不是https://example.com。将外部端口 443 转发到内部端口 8443 并将 yaws 配置为侦听端口 8443 修复了所有问题。

【问题讨论】:

    标签: ssl timeout yaws certbot


    【解决方案1】:

    请务必理解,当您执行curl -v https://example.com:8080 之类的操作时,您会遇到超时,是吗? (这里https协议和端口8080当然是必须的)

    当在 SSL vhost 上收到未加密的请求时,可以触发接受期间的 SSL 超时。

    您能否也提供以下命令的输出:

    echo -e "HEAD / HTTP/1.0\r\n\r\n" | openssl s_client -connect mysite.com:8080 -ign_eof 
    

    最后,您运行的是哪个版本的 Yaws?在哪个操作系统上?

    【讨论】:

    • 原来我搞砸了端口转发,取消搞砸解决了问题。我将详细信息编辑到我的原始帖子中。
    猜你喜欢
    • 1970-01-01
    • 2016-06-13
    • 2018-11-06
    • 2017-02-17
    • 1970-01-01
    • 2018-08-23
    • 2018-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多