用openssl 创建自签名证书用于内网HTTPS

主要命令

openssl req -x509 -newkey rsa:2048 -out CA.cer -outform PEM -keyout CA.pvk -days 10000 -verbose -nodes -sha256 -subj "/CN=ynbit CA"

openssl req -newkey rsa:2048 -keyout ServerCA.pvk -out ServerCA.req -subj /CN=10.20.0.17-sha256 -nodes

openssl x509 -req -CA CA.cer -CAkey CA.pvk -in ServerCA.req -out ServerCA.cer -days 10000 -extfile Server.ini -sha256 -set_serial 0x1111

Server.ini内容如下:

#开始

subjectAltName = @ynbtn

extendedKeyUsage = serverAuth

ynbtn

域名,如有多个用DNS.2,DNS.3...来增加

DNS.1 =

IP地址

IP.1 = 10.20.0.17

#结束

在iis 上使用时必须转换为pfx.

openssl pkcs12 -export -out server.pfx -inkey server.key -in server.cer

上法生成的pfx在windows server 2016 上无法使用,导入时始终提示密码不正常,据说在2019上可以使用。

增加参数如下后可以正常使用。

openssl pkcs12 -macalg SHA1 -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DES -export -out serv.pfx -inkey serverca.pvk -in serverca.cer

在windows客户端导入ca.cer,将正常使用。

参考文献

内网使用openssl自签名证书开启https连接,同时解决chrome浏览器中的不安全访问

https://blog.csdn.net/weixin_44021888/article/details/140175819

导入pfx到IIS Windows Server 2016 -指定的网络密码不正确

https://www.saoniuhuo.com/question/detail-2195591.html

相关推荐
2501_915918411 天前
PerfDog 太贵?iOS 性能监控工具的功能对比与选择
android·ios·小程序·https·uni-app·iphone·webview
weixin_545019321 天前
Nginx 配置SSL实现HTTPS访问
nginx·https·ssl
2501_915909062 天前
IPA 深度混淆是什么意思?从混淆强度到实际效果的解读
android·ios·小程序·https·uni-app·iphone·webview
HelloWorld工程师4 天前
新手如何快速申请SSL通配符证书...
网络协议·https·ssl
AlfredZhao6 天前
Linux 主机防火墙如何同时开启 80 和 443?
http·https·firewall
儒雅的烤地瓜6 天前
计算机网络 | 路由器局域网(内网)IP和外网(公网)IP的区别与联系
网关·tcp/ip·智能路由器·ip·外网·内网·nat技术
小蜗牛的路6 天前
使用OpenSSL生成本地证书https+nginx
网络协议·nginx·https
墨香幽梦客7 天前
数据安全三板斧:Https/SSL加密+PCI-DSS合规+HIPAA医疗数据防护
网络协议·https·ssl
牛奶10 天前
HTTPS你不知道的事
前端·https·浏览器
AlfredZhao13 天前
生产环境里,为什么不建议把普通端口直接暴露到公网?
linux·https·443·80