Nginx

為什麼我無法在 FreeBSD 12.0-STABLE 設置上使用我的 nginx、libressl 進行 OCSP 裝訂?

  • May 13, 2019

經過數小時的嘗試,我必須為我的問題尋求幫助。我正在嘗試讓 OCSP 裝訂與我的設置一起使用,但這樣做並不成功。

這是我的 nginx 配置,沒有任何不相關的位。

user www www;
worker_processes 5;
error_log /var/log/nginx/error.log;
events {
   worker_connections 1024;
}

http {
include mime.types;
index index.html index.htm;

log_format   main '$remote_addr - $remote_user [$time_local]  $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

aio on;

sendfile on;
autoindex on;
autoindex_exact_size off;

tcp_nopush on;
tcp_nodelay on;

ignore_invalid_headers on;

keepalive_timeout 70;

gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_types text/plain text/css application/xml application/javascript application/json font/opentype text/cache-manifest text/x-cross-domain-policy text/xml application/x-javascript;
gzip_vary on;

ssl_certificate fullchain.pem;
ssl_certificate_key server.key;
ssl_trusted_certificate trusted.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
ssl_ecdh_curve secp384r1;
ssl_prefer_server_ciphers on;
ssl_dhparam dh4096.pem;
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
resolver 1.1.1.1 1.0.0.1 valid=300s;
resolver_timeout 5s;
add_header Strict-Transport-Security "max-age=63072000";
add_header X-Frame-Options "DENY";
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1, mode=block";
add_header Content-Security-Policy "upgrade-insecure-requests";
map "$scheme:$http_upgrade_insecure_requests" $shouldUpgrade {
   default 0;
   "http:1" 1;
}

map $http_accept $webp_suffix {
   default "";
   "~*webp" ".webp";
}

expires -1;
add_header Cache-Control "public";

server {
   listen 80;

   listen [::]:80;
   listen 443 ssl http2;

   server_name localhost ;
   access_log /var/log/nginx/access.log main;
   root /www/;
   error_page 404 /404.html;

   if ($shouldUpgrade) {
       return 307 https://$host$request_uri;
   }

}
}

我在日誌文件中收到錯誤:

2019/04/30 21:28:07 [error] 28718#100839: OCSP_basic_verify() failed (SSL: error:27FFF076:OCSP routines:CRYPTO_internal:signer certificate not found) while requesting certificate status, responder: ocsp.int-x3.letsencrypt.org, peer: 2.16.100.83:80, certificate: "/usr/local/etc/nginx/fullchain.pem"

無論我嘗試在給定的文件中包含什麼ssl_trusted_certificate,我都無法解決這個問題。我嘗試包括完整的鏈,將根 CA 添加到它,只有 CA,只有中介。將根 CA 添加到提供給 ssl_certificate 的 fullchain.pem 文件會導致 SSL 驗證網站出錯。

儘管如此,我仍然OCSP Stapling not enabled.https://ssldecoder.orgOCSP response: no response sent使用 openssl s_client 時收到提示

任何幫助,將不勝感激。我正在使用讓我們加密。

FreeBSD security/libressl 最近升級到 2.9.1。自從 LibreSSL 中的版本更改以來,OCSP 裝訂對我來說也已停止在 nginx 中工作,所以我假設庫或 nginx 與它的互動中存在潛在問題。

編輯:與此同時,Elias Ohm 在 FreeBSD bug tracker 上對此進行了更詳細的分析。TL;DR:這是一個 nginx 錯誤,它在使用較新的 OpenSSL API 時使用了錯誤的函式來訪問證書鏈。

引用自:https://serverfault.com/questions/965324