使用受密码保护的 SSL 密钥在 Apache 2 上由 logrotate 导致的故障
我在 Debian 上安装了 Apache 2,并安装了 mod_ssl。 服务器私钥受启动时需要输入的密码保护。 错误和访问日志每周进行 logrotate。 我发现 Apache 在 logrotate 运行后不久就崩溃并出现与密码相关的错误。
据我了解,logrotate 在归档日志后会向 Apache 发出 SIGHUP,我怀疑这会导致重新加载以及随后无法获取服务器密钥的密码。
好了,我的理论已经足够了,问题是:
是否有一种“最佳实践”方式来配置 Apache,以允许其 SSL 服务器密钥受到密码保护(无需将该密码存储在某个文件中),以便它logrotate运行时不会崩溃吗?
在服务器启动时要求用户输入是可以的,但不需要重新启动或重新加载。
I have an Apache 2 installation on Debian with mod_ssl installed. The server private key is protected by a passphase that needs to be entered on start-up. The error and access logs are subject to logrotate on a weekly basis. I find that Apache crashes with a passphrase-related error shortly after logrotate runs.
I understand that logrotate fires a SIGHUP to Apache after archiving logs and I suspect this is causing a reload and subsequent failure getting the passphrase for the server key.
Well, enough with my theories, here is the question:
Is there a "best practice" way in which to configure Apache to allow its SSL server keys to be protected by a passphrase (without storing that passphrase in a file somewhere) so that it won't crash when logrotate runs?
It is fine to require user input on server startup, but not restart or reload.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 Cronolog,它不需要叹息。 这是一个例子:
You could use Cronolog, which does not require a sighup. Here's an example:
一种选择是使用 Apache 提供的日志轮换工具。 它的配置与系统 logrotate 略有不同,但由于它与管道一起使用,因此可以在不重新启动 Apache 的情况下移动文件。
One option is to use Apache's provided log rotation tool. Its configured a bit differently than the system logrotate, but as it works with pipes, can move files around without an Apache restart.
您还可以使用以下命令关闭密码:
you can also turn off the passphrase by using the following command: