使用公司签名证书时,Docker nginx连接被拒绝(端口80和443)



我在docker环境中作为反向代理运行nginx。以下是用于创建实例的Dockerfile。

FROM nginx:1.18.0
ENV https_proxy=http://someproxy.nt.gov.au:8080
ENV http_proxy=http://someproxy.nt.gov.au:8080
RUN env
COPY nginx.conf /etc/nginx/nginx.conf
COPY server-chain.cert /etc/nginx/server.cert
COPY server-chain.key /etc/nginx/server.key
COPY /html /usr/share/nginx/html
RUN echo 'alias ll="ls -la"' >> ~/.bashrc
EXPOSE 80
EXPOSE 443
STOPSIGNAL SIGQUIT

CMD ["nginx", "-g", "daemon off;"]

以下是nginx.conf文件的上游指令和服务器{}部分,其余部分是默认的

upstream cics-liberty {
server some-app-server:3000 ;
}

server {
listen       80;
listen       443 ssl;
listen  [::]:80;
server_name  localhost;
ssl_certificate server.cert;
ssl_certificate_key server.key;
#charset koi8-r;
#access_log  /var/log/nginx/host.access.log  main;
location / {
root   /usr/share/nginx/html;
index  index.html index.htm;
}
location /offtocics/ {
proxy_pass http://cics-liberty ;
}
location /barcode/ {
proxy_pass http://cics-liberty ;
}
location /birt_wlp_s1/ {
proxy_pass http://cics-liberty ;
}
location /scope2/ {
proxy_pass http://cics-liberty ;
}
...
}

实例化服务器的docker命令是

docker run -it --name webserver -d -p 8047:80 -p 8046:443 webserver:0.1

我正在运行其中的两个实例,其中一个使用自签名证书。另一个有我们公司CA签署的证书包。

使用自签名证书的服务器的行为符合预期。使用由公司CA签名的证书的服务器拒绝http和https://strong>端口上的连接。

两者的日志记录输出是相同的,只是服务器拒绝连接在访问日志中没有任何内容。它看起来甚至在到达web服务器之前就被拒绝了。

docker环境在其内部虚拟网络中没有任何防火墙

我用自签名证书重建了失败的Web服务器,它按预期工作。

这是我的配置错误。我将证书捆绑包从PCKS7重新格式化为PEM格式,但我没有解密相关的私钥。

一旦我安装了私钥的解密版本-一切都好。

最新更新