Httpd.conf 带有SSL的httpd将不会在OpenBSD 5.9(amd64)上启动

Httpd.conf 带有SSL的httpd将不会在OpenBSD 5.9(amd64)上启动,httpd.conf,openbsd,Httpd.conf,Openbsd,在最新的OpenBSD(digitalocean.com上的5.9/amd64)上,我能够使用这个httpd.conf文件在没有SSL的情况下启动httpd # cat /etc/httpd.conf interface="egress" domain="infmgr.com" prefork 3 types { include "/usr/share/misc/mime.types" } #server $domain { # listen on $interface tls port

在最新的OpenBSD(digitalocean.com上的5.9/amd64)上,我能够使用这个httpd.conf文件在没有SSL的情况下启动httpd

# cat /etc/httpd.conf
interface="egress"
domain="infmgr.com"
prefork 3
types { include "/usr/share/misc/mime.types" }
#server $domain {
#    listen on $interface tls port 443
#    tls {
#        certificate "/etc/ssl/server.crt"
#        key "/etc/ssl/private/server.key"
#    }
#    hsts
#    root "/htdocs/infmgr.com" # chrooted at /var/www/
#}
server $domain {
    listen on $interface port 80
    root "/htdocs/infmgr.com" # chrooted at /var/www/
#    block return 301 "https://$SERVER_NAME$REQUEST_URI"
}
# 
当我像这样更改注释掉的行时

# cat /etc/httpd.conf
interface="egress"
domain="infmgr.com"
prefork 3
types { include "/usr/share/misc/mime.types" }
server $domain {
    listen on $interface tls port 443
    tls {
        certificate "/etc/ssl/server.crt"
        key "/etc/ssl/private/server.key"
    }
    hsts
    root "/htdocs/infmgr.com" # chrooted at /var/www/
}
server $domain {
    listen on $interface port 80
#    root "/htdocs/infmgr.com" # chrooted at /var/www/
    block return 301 "https://$SERVER_NAME$REQUEST_URI"
}
# 
然后重新启动httpd

# rcctl restart httpd
httpd(ok)
httpd(ok)
# 
我在日志文件中发现以下错误

# cd /var/log
# ls -alt|head -4
total 5804
-rw-r--r--   1 root  wheel    26447 Jun  7 08:39 messages
-rw-r-----   1 root  wheel     5451 Jun  7 08:39 daemon
-rw-r-----   1 root  wheel  2504053 Jun  7 07:49 authlog
# tail messages
...
Jun  7 06:00:02 infmgr syslogd: restart
Jun  7 08:39:26 infmgr httpd: could not parse macro definition TLS
Jun  7 08:39:26 infmgr httpd: could not parse macro definition TLS
Jun  7 08:39:26 infmgr /bsd: httpd(40862): syscall 5 "wpath"
Jun  7 08:39:26 infmgr /bsd: crash of httpd(40862) signal 6
Jun  7 08:39:26 infmgr httpd[41393]: parent: proc_dispatch: Broken pipe
# tail -15 daemon
...
Jun  7 08:39:25 infmgr httpd[4728]: logger exiting, pid 4728
Jun  7 08:39:25 infmgr httpd[80131]: server exiting, pid 80131
Jun  7 08:39:25 infmgr httpd[85373]: server exiting, pid 85373
Jun  7 08:39:25 infmgr httpd[15598]: server exiting, pid 15598
Jun  7 08:39:25 infmgr httpd[30462]: parent terminating, pid 30462
Jun  7 08:39:26 infmgr httpd[41393]: startup
Jun  7 08:39:26 infmgr httpd[41393]: parent: proc_dispatch: Broken pipe
Jun  7 08:39:26 infmgr httpd[62127]: logger exiting, pid 62127
Jun  7 08:39:26 infmgr httpd[73062]: server exiting, pid 73062
Jun  7 08:39:26 infmgr httpd[93325]: server exiting, pid 93325
# 
我一直在关注这两个错误。。。 httpd无法分析宏定义TLS bsd httpd,syscall 5 wpath

我花了几个小时在谷歌上搜索,发现只有一个提到这可能是一个内核错误。我已经查过了

我已经离开了,寻求帮助。。。非常感谢

特洛伊。 #

更新

根据客人的回答,这里有一些注释

我非常感谢你的帮助

我不知道httpd-d和直接运行命令。看看/etc/rc.d/httpd脚本,它应该是显而易见的:)我还需要进一步处理它

相应目录中的server.crt和server.key是正确的。我在其他地方找到了一组命令,它们生成了哈希值,并进行了比较,从理论上证明了这两种方法应该是可行的。我甚至将它们复制到chrooted目录中,而chrooted目录没有任何作用:/

“httpd-n”返回“配置正常”

我确实对/etc/rc.config.local文件做了一些更改,将parm设置为“-DSSL”。看到SSL宏解析错误(如上),我用“-DTLS”替换,只是为了看到错误将替换为TLS而不是SSL。它在错误中继续使用SSL。在debug语句之后,它变为TLS,所以我从本地配置中删除了“-DTLS”。。。这修复了解析错误。剩下的只是“崩溃”和“wpath”错误

我正在使用最新版本的OpenBSD,2016年6月2日

更新

我创建此脚本是为了检查证书

# httpd_cert_verify.sh

echo "compare the following md5 hashes. They should be the same..."
openssl rsa -noout -modulus -in /etc/ssl/private/server.key | openssl md5
openssl x509 -noout -modulus -in /etc/ssl/server.crt | openssl md5

echo "Check the permissions on these files, they should be readable by 'system' (-r--------)"
ls -al /etc/ssl/private/server.key
ls -al /etc/ssl/server.crt
使用以下结果运行它

# sh httpd_cert_verify.sh  
compare the following md5 hashes. They should be the same...
Enter pass phrase for /etc/ssl/private/server.key:
(stdin)= 0e8abeb155ad81a8a8db0f6036fcca13
(stdin)= 0e8abeb155ad81a8a8db0f6036fcca13
Check the permissions on these files, they should be readable by 'system' (-r--------)
-r--------  1 root  wheel  1858 Jun  5 19:40 /etc/ssl/private/server.key
-rw-r--r--  1 root  wheel  2176 Jun  5 19:39 /etc/ssl/server.crt
#

我假设文件“/etc/ssl/server.crt”和“/etc/ssl/private/server.key”存在并且是正确的

还可以尝试在调试模式下运行httpd-d,并使用-n检查配置文件,而不是使用rcctl restart httpd

如果仍然不起作用,我认为您应该使用以下最新版本:

并查看是否出现相同的错误。

技术详细信息: wpath错误意味着它试图在文件系统中不应该写的地方写东西。看

我想在这一点上,你应该联系misc@openbsd.org带着这个问题


另外,请联系雷克弗洛伊特reyk@openbsd.org,是“OpenBSD httpd”的主要作者。

我在-current上看到了相同的错误,我想这可能是由于最近在质押系统调用中的更改/在httpd中的质押更改

您可能应该尝试OpenBSD的稳定版本或发布版本(可能您已经尝试过),这应该是可行的


我感谢您推荐我查看“杂项”邮件列表。那里的一张海报能够解决这个问题。他们指出需要从私有ssl密钥中删除密钥。这就是我所做的。。。 卡林, 成功了。谢谢大家!

# history
 1       cd /etc/ssl/pr
 2       cd /etc/ssl/private/
 3       cp server.key server.key.backup
 4       openssl rsa -in server.key -out server.key
 5       ls -al
 6       rcctl start httpd
 7       tail /var/log/messages
 8       date
 # exit 
特洛伊


#

我根本无法复制这一点。我尝试了5.9版本和最新版本(几天前)。甚至注册了Digitalocean,并在那里尝试,看看是否有什么奇怪的事情发生。您可以运行
ktrace-i httpd-vvd
(希望它会崩溃),然后运行
kdump
并发布最后20-30行左右吗?请小心,因为kdump输出可能包括您的TLS证书密钥;问题在于承诺的失败。这不应该发生,即使你的钥匙有问题。几乎可以肯定,某个地方有一只虫子。ktrace输出应该显示它在被杀死之前试图打开以进行写入的文件,这将有助于指出原因。您需要从私钥中删除密码。httpd不支持这一点。我希望在libssl的深处有一个不起眼的角落案例,但现实从来没有这么有趣:-(