Cal*_*leb 5 startup arch-linux ssl systemd apache-httpd
我对使用 Arch Linux 还比较陌生,我认为我一定错过了正确执行此操作的明显方法,但是 - 没有自己启动守护程序 - 我无法弄清楚如何在启动时解锁受密码保护的 SSL 密钥服务正常。使用不受保护的密钥或没有 SSL 配置,Apache 会使用 systemd 服务正常启动。一旦我尝试使用受保护的密钥,我就会得到如下信息:
$ sudo systemctl start httpd
Job for httpd.service failed.
$ sudo systemctl status httpd
httpd.service - Apache Web Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
Active: failed (Result: exit-code) since Mon 2014-02-10 11:47:07 UTC; 13ms ago
Process: 26035 ExecStop=/usr/bin/apachectl graceful-stop (code=exited, status=0/SUCCESS)
Process: 26042 ExecStart=/usr/bin/apachectl start (code=exited, status=1/FAILURE)
Main PID: 25500 (code=exited, status=0/SUCCESS)
systemd[1]: Starting Apache Web Server...
apachectl[26042]: Apache/2.2.26 mod_ssl/2.2.26 (Pass Phrase Dialog)
apachectl[26042]: Some of your private key files are encrypted for security reasons.
apachectl[26042]: In order to read them you have to provide the pass phrases.
apachectl[26042]: Server {name redacted}:443 (RSA)
apachectl[26042]: Enter pass phrase:Apache:mod_ssl:Error: Private key not found.
apachectl[26042]: **Stopped
systemd[1]: httpd.service: control process exited, code=exited status=1
systemd[1]: Failed to start Apache Web Server.
systemd[1]: Unit httpd.service entered failed state.
Run Code Online (Sandbox Code Playgroud)
据我所知,Apache 知道它需要解锁我的密钥,但是如果 systemd 知道需要显示密码提示,那么任何这样做的尝试都不会到达我的 shell 并且默默地失败。
使用 systemd 启动 Apache 和解锁受保护的 SSL 密钥的最佳实践方式(或Arch Way™)是什么?
小智 1
我不确定 systemd 的做法,但 Apache 使这成为可能,但它是通过 SSLPassPhraseDialog 指令启动的。基本上,您在文件中创建一个小的 shell 脚本:
SSLPassPhraseDialog /etc/domain.com_ssl_passphrase.sh
Run Code Online (Sandbox Code Playgroud)
文件内容:
#!/bin/bash
echo "passphrase"
Run Code Online (Sandbox Code Playgroud)
确保该文件可执行:
chmod +x /etc/domain.com_ssl_passphrase.sh
Run Code Online (Sandbox Code Playgroud)
现在,当您通过 systemd 启动 Apache 时,它将在加载站点的 SSL 配置时执行该脚本。
| 归档时间: |
|
| 查看次数: |
9296 次 |
| 最近记录: |