简体   繁体   English

自定义Web服务器和自签名证书

[英]Custom web server & self-signed certificate

First of all let me to say my knowledge of ssl and criptography protocols is very limited. 首先,我想说我对SSL和密码术协议的了解非常有限。 Please be patient if I say something blatantly wrong :-) . 如果我公然说错了,请耐心等待:-)。 Feel free to correct me! 随时纠正我!

I'm building a custom web server to be deployed inside an isolated local network; 我正在构建一个自定义Web服务器,以将其部署在一个隔离的本地网络中。 this is how I run my service (Python code): 这就是我运行服务的方式(Python代码):

ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
ssl_context.load_cert_chain(certfile='mykey.crt', keyfile='mykey.key')
... client connects to https port 443 ...
ssl_sock = ssl_context.wrap_socket(sock, server_side=True)

This is how I generated mykey.crt and mykey.key files: 这就是我生成mykey.crt和mykey.key文件的方式:

$ openssl genrsa -des3 -out mykey.orig.key 2048
$ openssl rsa -in mykey.orig.key -out mykey.key
$ openssl req -new -key mykey.key -out mykey.csr
$ openssl x509 -req -days 3650 -in mykey.csr -signkey mykey.key -out mykey.crt

So far so good, my webserver works very well. 到目前为止,我的网络服务器运行良好。 But I have go past the "not secure" warning that Firefox rightfully shove in my face. 但是我已经克服了Firefox正确推向我的“不安全”警告。

I'd like to install my self-signed certificate in the few clients that are going access my web server in order to permanently avoid the warning. 我想在将要访问我的Web服务器的少数客户端中安装我的自签名证书,以便永久避免该警告。

I followed every single certificate installation guide I was able to find but I absolutely cannot get Firefox (and Chrome) accept my certificate. 我遵循了能够找到的每份证书安装指南,但是我绝对无法使Firefox(和Chrome)接受我的证书。 And I get no error message whatsoever from the browsers. 而且我没有从浏览器中收到任何错误消息。 I think I'm missing something in the certificate generation commands. 我认为证书生成命令中缺少某些内容。

Somebody could help me? 有人可以帮我吗? Thanks a lot! 非常感谢!

self-signed certificate can uses only for tests. 自签名证书只能用于测试。 You have to get the certificate from an 'Accredited certification authority' 您必须从“授权的证书颁发机构”获得证书

2) check please : self-signed certificate need to has next data: URL, address, name, email 2)请检查:自签名证书需要具有下一个数据:URL,地址,名称,电子邮件

3) you should use a certificate signed by a CA 3)您应该使用由CA签署的证书

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM