用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

相关推荐
芋只因38 分钟前
HTTP & HTTPS 详解
网络协议·http·https
2501_915909061 小时前
完整指南:如何将iOS应用上架到App Store
android·ios·小程序·https·uni-app·iphone·webview
2501_915909062 天前
全面解析前端开发中常用的浏览器调试工具及其使用场景
android·ios·小程序·https·uni-app·iphone·webview
树下水月2 天前
HTTPS 站点请求 HTTP的API 接口服务报错的问题
网络协议·http·https
皮卡祺q2 天前
【Java网络编程核心-0】从OSI七层到TCP/IP模型深度解析(HTTP协议、TCP、UDP 、 IP协议)
网络·网络协议·tcp/ip·http·https·udp
相思难忘成疾2 天前
RHCE 综合实验:基于 Nginx 实现 openlab 多站点部署、用户访问控制与 HTTPS 加密访问
linux·运维·nginx·http·https·rhel
Howrun7772 天前
从公钥密码学到 HTTPS:一文读懂数字证书与信任链条
网络协议·http·https
p***76982 天前
docker compose安装mindoc 后添加https访问反向代理配置教程
jvm·docker·https
weixin_457507212 天前
centos安装docker配置自动HTTPS部署多个项目
docker·https·centos
XiYang-DING2 天前
【Java EE】 HTTPS协议
java·https·java-ee