我正在尝试将此证书与 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 规则很容易编写,最终看起来像这样:
# InfluxDB
server {
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 来签署我的常规证书,但这似乎也比我需要做的更像是一种黑客行为。
慕工程0101907
猛跑小猪
随时随地看视频慕课网APP
相关分类