让我们加密-Nginx-OCSP装订


11

我想在我的Nginx服务器中启用OCSP装订。我在用着

  • nginx版本:nginx / 1.6.2
  • Debian
  • 让我们加密证书

我在这件事上真的没有经验,所以这可能是一个琐碎的问题。

这是我的Nginx安全配置

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_dhparam /etc/ssl/private/dhparams_4096.pem;

这是我的站点/服务器安全性配置:

    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";

    # All files have been generated by Let's encrypt
    ssl_certificate /etc/letsencrypt/live/myexample.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/myexample.org/privkey.pem;

    # Everything below this line was added to enable OCSP stapling
    # What is that (generated file) and is that required at all?
    ssl_trusted_certificate /etc/letsencrypt/live/myexample.org/chain.pem;

    ssl_stapling on;
    ssl_stapling_verify on;
    resolver 8.8.8.8 8.8.4.4 valid=300s;
    resolver_timeout 5s;

我读到,这足以启用OCSP装订。

但是如果我使用

 openssl s_client -connect myexample.org:443 -tls1 -tlsextdebug -status

我将收到以下答复:

TLS server extension "renegotiation info" (id=65281), len=1
0001 - <SPACES/NULS>
TLS server extension "EC point formats" (id=11), len=4
0000 - 03 00 01 02                                       ....
TLS server extension "session ticket" (id=35), len=0
TLS server extension "heartbeat" (id=15), len=1
0000 - 01                                                .
OCSP response: no response sent
depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X1
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/CN=myexample.org
   i:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X1
 1 s:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X1
   i:/O=Digital Signature Trust Co./CN=DST Root CA X3
---
[...]

特别

OCSP response: no response sent

我究竟做错了什么?

证书层次结构:

  • DST根CA X3
    • 让我们加密授权X1
      • myexample.org

编辑:

OCSP: URI: http://ocsp.int-x1.letsencrypt.org/
CA-Issuer: URI: http://cert.int-x1.letsencrypt.org/

您的链中的证书是否在其AIA扩展名中设置了OCSP URL?
garethTheRed

1
@Braiam-您已链接到正确的文档吗?那里没有提到OCSP。对于为该评论+1的任何人-您是先阅读了吗?
garethTheRed

@garethTheRed我已经编辑了帖子,以添加证书中的OCSP URL。
ST-DDT

@Braiam我已经阅读了您的链接文档,并且AFAICT正确执行了其中所述的所有操作。(cronjob除外,与安全性和我的问题均无关)
ST-DDT

大!在那里。不幸的是,我对nginx的处理不多,因此无法真正帮助您配置它。URL是否真的存在是我想到的第一件事。唯一的其他想法是您fullchain.pemchain.pem文件-它们相同吗?ssl_trusted_certificate指令不应该也使用fullchain.pem文件吗?
garethTheRed

Answers:


10

按照标准的nginx设置,您无需指定ssl_trusted_certificate链。以下内容就足够了:

ssl_certificate /etc/letsencrypt/live/myexample.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myexample.org/privkey.pem;
ssl_stapling on;
ssl_stapling_verify on;

请参阅此处以获取更多上下文。


很好,这简化了我的nginx conf并同样有效!
Shautieh

使用此网站ssldecoder.org进行测试时,我仍然收到错误提示?
亚历山大·史兰兹

确实解决了问题,当您有多个SSL时,您需要在所有块中启用它,否则Nginx会静默失败。
亚历山大·史兰兹

9

我根据在那儿找到的教程找到了解决方案:

cd /etc/ssl/private
wget -O - https://letsencrypt.org/certs/isrgrootx1.pem https://letsencrypt.org/certs/lets-encrypt-x1-cross-signed.pem https://letsencrypt.org/certs/letsencryptauthorityx1.pem https://www.identrust.com/certificates/trustid/root-download-x3.html | tee -a ca-certs.pem> /dev/null

并将其添加到您的站点/服务器配置

ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/ssl/private/ca-certs.pem;

重新加载您的配置

重要信息:打开浏览器并访问您的网页一次。

然后,您可以使用以下cmd在本地测试服务器:

openssl s_client -connect myexample.org:443 -tls1 -tlsextdebug -status

您很可能会收到这样的有效回复

OCSP response:
======================================
OCSP Response Data:
    OCSP Response Status: successful (0x0)
    Response Type: Basic OCSP Response
    Version: 1 (0x0)
    Responder Id: C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X1

不用担心,如果您得到

Verify return code: 20 (unable to get local issuer certificate)

在底部以及,在咱们的加密证书尚未在默认信任的证书存储。(我没有太多的SSL经验,所以我可能是错的)

如果在服务器上执行以下cmd,则不会显示该错误:

openssl s_client -CApath /etc/ssl/private/ -connect myexample.org:443 -tls1 -tlsextdebug -status

之后,您可以使用以下方法测试服务器:

https://www.digicert.com/help/

请注意,目前ssllabs测试不会接收OCSP响应。我认为这是因为“默认加密”证书存储区中还没有“让我们加密”证书。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.