我正在嘗試將此證書與 Nginx 反向代理后面的 InfluxDB 其余端點和我用 GoLang 編寫的簡單客戶端之間的連接一起使用。我開始使用使用 openssl 生成的 SSL 證書,該鏈接中的教程指導我創建和自唱證書。但是每次嘗試建立此連接時都會出現此錯誤:x509: certificate signed by unknown authority (possibly because of "x509: invalid signature: parent certificate cannot sign this kind of certificate" while trying to verify candidate authority certificate "<My Certificate Name>")我還沒有找到解決這個問題的方法,但我會展示我認為相關的內容:據我所知,InfluxDB 的 nginx 規則很容易編寫,最終看起來像這樣:# InfluxDBserver { ssl on; ssl_protocols TLSV1.2 TLSV1.1 TLSV1; ssl_certificate /etc/nginx/server.crt; ssl_certificate_key /etc/nginx/server.key; listen 8086; access_log /var/log/nginx/influxdb.access.log; error_log /var/log/nginx/influxdb.error.log; location / { include /etc/nginx/conf.d/options.conf.inc; include /etc/nginx/conf.d/auth.conf.inc; proxy_pass http://127.0.0.1:8087; } }options.conf.inc 在哪里: if ($request_method = OPTIONS) { add_header Access-Control-Allow-Origin $served_at; add_header Access-Control-Allow-Methods "GET, OPTIONS"; add_header Access-Control-Allow-Headers "Authorization"; add_header Access-Control-Allow-Credentials "true"; add_header Content-Length 0; add_header Content-Type text/plain; return 200; }auto.conf.inc 在哪里: add_header Access-Control-Allow-Headers "Authorization"; add_header Access-Control-Allow-Credentials "true"; auth_basic "Restricted"; auth_basic_user_file <pathTo>.htpasswd; error_page 401 /401.html;正如您在我的 golang 代碼中看到的那樣,我InsecureSkipVerify在 tlsConfig 對象上使用了標志。將此設置為 true 會使一切正常,但似乎本質上不好做,因為它首先破壞了使用證書的很多意義。我留下的選項似乎是生成 CA 證書并使用 THAT 來簽署我的常規證書,但這似乎也比我需要做的更像是一種黑客行為。
使用自簽名 SSL 證書
慕工程0101907
2021-12-20 19:01:25