使用RamNode的Turnkey Linux发行版,我注意到我的网站的证书已过期,并且https链接带有“继续”对话框标记。进一步研究该问题,Turnkey Linux将confconsole与Let's Encrypt结合使用以请求新证书。多个[虚拟]域要求用户手动使用cronjob在/etc/cron.daily/confconsole-dehydrated下每天调用的脱水包装器,但会导致错误:
/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/dehydred-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
最佳答案
我已经在《问题邮报》本身中回答了这个问题,但是,这又是机器人的答案。
解决方案:使用以下命令更新/usr/lib/confconsole/plugins.d/Lets_Encrypt/dehydred-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]||'
通过讨论根本问题,我可以进一步扩展解决方案。
因为脱水包装中的行已将
WEBSERVER
变量分配给nginx:
,所以脱水在请求和更新证书之前无法停止nginx
。将nginx:
添加到case语句将允许您停止nginx,但由于它不存在而无法启动nginx:
进程来承载.well-known/acme-challenges
位置,当脱水尝试执行时,将导致404。验证是否正确配置了https ssl证书。