V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
LukeXuan
V2EX  ›  NGINX

centos7 systemctl 启动 nginx 时不请求 pem 的 passphrase?

  •  
  •   LukeXuan ·
    LukeXuan · Jun 26, 2015 · 4262 views
    This topic created in 3967 days ago, the information mentioned may be changed or developed.
    Jun 25 22:32:17 systemd[1]: Starting The nginx HTTP and reverse proxy server...
    Jun 25 22:32:17 nginx[32654]: Enter PEM pass phrase:
    Jun 25 22:32:17 nginx[32654]: nginx: [emerg] SSL_CTX_use_PrivateKey_file("/etc/ssl/certs/xxx.ke...M lib)
    Jun 25 22:32:17 nginx[32654]: nginx: configuration file /etc/nginx/nginx.conf test failed
    Jun 25 22:32:17 systemd[1]: nginx.service: control process exited, code=exited status=1
    Jun 25 22:32:17 systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
    Jun 25 22:32:17 systemd[1]: Unit nginx.service entered failed state.
    

    求解决方案!

    6 replies    2015-06-26 12:50:41 +08:00
    lilydjwg
        1
    lilydjwg  
       Jun 26, 2015
    为什么要设置 passphrase 呢?你打算在它每次重启的时候登录过去输密码?
    ryd994
        2
    ryd994  
       Jun 26, 2015
    服务器私钥加密码并卵
    要是真能黑到私钥文件,黑不到配置文件?
    私钥密码就是只是给人用的
    msg7086
        3
    msg7086  
       Jun 26, 2015
    @lilydjwg 这是怕nginx突然有一天叛变了带着楼主的私钥私奔了,所以果断套上×××以防××。
    LukeXuan
        4
    LukeXuan  
    OP
       Jun 26, 2015
    @msg7086
    @ryd994
    @lilydjwg
    黑到配置文件也没用吧 我又没在配置文件里写明
    问题是centos6时代用的service就可以正常地向我请求passphrase 为什么systemctl就不行了呢
    ryd994
        5
    ryd994  
       Jun 26, 2015
    @LukeXuan 你想的太简单了
    黑进你的服务器还有什么干不了?
    装个钩子或者替换systemctl,然后等你重启服务就行了
    lilydjwg
        6
    lilydjwg  
       Jun 26, 2015
    @LukeXuan 因为 systemd 不是 initscripts 呗。systemctl 是通过 D-Bus 告诉 systemd 要启动那个服务的,服务进程和你执行命令的终端没有关系。

    网上有个补丁,但是没有被接受: http://mailman.nginx.org/pipermail/nginx/2014-April/043281.html

    如上边那些邮件里说的,这样根本防不了被黑,除非黑你的人懒或者根本不懂;它只会给你「更安全」的错觉。因为即使你是人工登陆上去输入密码的,nginx 会去解密私钥并保存在内存中。攻击者只要去 nginx 内存里找就可以了。既然能拿到你的加密过的私钥,那么说明攻击者有 root 权限。既然TA有 root 权限,那么取得进程的内存完全没问题。

    你还记得 heartbleed 吗?不过是泄漏了一点点 nginx 的内存,也有人成功地取得了私钥: https://blog.cloudflare.com/the-results-of-the-cloudflare-challenge/
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5779 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 06:44 · PVG 14:44 · LAX 23:44 · JFK 02:44
    ♥ Do have faith in what you're doing.