【问题标题】:Error turnkey linux confconsole dehydrated .well-known/acme-challenge 404 NOT FOUND错误交钥匙 linux confconsole dehydrated .well-known/acme-challenge 404 NOT FOUND
【发布时间】:2019-08-22 00:16:50
【问题描述】:

使用 RamNode 的 Turnkey Linux 发行版时,我注意到我的网站证书已过期,并且 https 链接被标记为“继续”对话框。进一步研究这个问题,Turnkey Linux 使用 confconsole 和 Let's Encrypt 来请求新证书。多个 [virtual] 域需要用户手动使用 cronjob 每天在 /etc/cron.daily/confconsole-dehydrad 下调用的 dehydrad-wrapper,但会导致错误:

/var/log/confconsole/letsencrypt.log

[2019-03-09 05:35:04] dehydrated-wrapper: FATAL: An unexpected service is listening on port 80: nginx:
[2019-03-09 05:35:04] dehydrated-wrapper: WARNING: Something went wrong, restoring original cert & key.
Restarting SSL tunnels: [stopped: /etc/stunnel/stunnel.conf] [Started: /etc/stunnel/stunnel.conf] stunnel.
[2019-03-09 05:35:09] dehydrated-wrapper: WARNING: Check today's previous log entries for details of error.
[2019-03-09 05:35:09] cron: ERROR: dehydrated-wrapper exited with a non-zero exit code.
[2019-03-10 05:35:04] cron: /etc/ssl/private/cert.pem has expired or will do so within 30 days. Attempting renewal.

解决方案: 使用

更新 /usr/lib/confconsole/plugins.d/Lets_Encrypt/dehydrad-wrapper

替换:

netstat -ltpn | grep ":80 " | head -1 | cut -d/ -f2 | sed -e 's [[:space:]].*$||'

与:

netstat -ltpn | grep ":80 " | head -1 | cut -d/ -f2 \
   | sed -e 's|[[:space:]].*$||; s|[^a-zA-Z0-9]||'

喜欢这个提交https://github.com/turnkeylinux/confconsole/commit/d1e61c4767c2148663429d63bc3a42925af8cbcd

然后再次手动运行 cronjob 或等待明天: /etc/cron.daily/confconsole-脱水

[2019-03-31 19:26:45] confconsole.hook.sh: SUCCESS: Cert request successful. Writing cert.pem & cert.key for DOMAIN1 to /etc/ssl/private
[2019-03-31 19:26:52] confconsole.hook.sh: SUCCESS: Cert request successful. Writing cert.pem & cert.key for DOMAIN2 to /etc/ssl/private
[2019-03-31 19:26:59] confconsole.hook.sh: SUCCESS: Cert request successful. Writing cert.pem & cert.key for DOMAIN3 to /etc/ssl/private

谢谢你,我希望它能节省你一些时间

相关链接:https://github.com/turnkeylinux/tracker/issues/976

【问题讨论】:

    标签: ssl nginx certificate lets-encrypt turnkeylinux.org


    【解决方案1】:

    我已经在问题帖中回答了这个问题,但是,这又是机器人的答案。

    解决方案:使用

    更新 /usr/lib/confconsole/plugins.d/Lets_Encrypt/dehydrad-wrapper

    替换:

    netstat -ltpn | grep ":80 " | head -1 | cut -d/ -f2 | sed -e 's [[:space:]].*$||'
    

    与:

    netstat -ltpn | grep ":80 " | head -1 | cut -d/ -f2 \
       | sed -e 's|[[:space:]].*$||; s|[^a-zA-Z0-9]||'
    

    我可以通过讨论根本问题来进一步扩展解决方案。

    由于 dehydrad-wrapper 中的行已将 WEBSERVER 变量分配给 nginx:,因此 dehydrad 在请求和更新证书之前无法停止 nginx。将nginx: 添加到case 语句将允许您停止nginx,但将无法启动nginx: 进程,因为它不存在,以托管.well-known/acme-challenges 位置,导致脱水尝试时出现404验证 https ssl 证书是否正确配置。

    【讨论】:

      猜你喜欢
      • 2018-11-09
      • 2017-06-07
      • 2020-08-30
      • 2021-07-25
      • 2019-01-04
      • 2018-02-25
      • 1970-01-01
      • 2019-04-05
      • 1970-01-01
      相关资源
      最近更新 更多