用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_915106322 天前
深入解析HTTPS抓包原理、中间人攻击及反抓包技术攻防
数据库·网络协议·ios·小程序·https·uni-app·iphone
Arden Zhao2 天前
Gihtub HTTP添加为HTTPS证书
https·github
游戏开发爱好者82 天前
React Grab工具详解:AI助力Vue3、Svelte和Solid前端元素调试
android·ios·小程序·https·uni-app·iphone·webview
黄毛火烧雪下3 天前
Mac 上用 Charles 抓取 iPhone 的 HTTPS 请求
网络协议·macos·https
TO_ZRG3 天前
Android HTTPS 防抓包原理与实现(Java)
android·java·https
薛定谔的猫喵喵4 天前
【从 HTTP 到 HTTPS】Flask 多项目迁移到 Nginx 子路径完整实战
python·nginx·http·https·flask·ssl
zhz52144 天前
Spring Boot + 腾讯 Kona 实现 TLCP 8443 国密 HTTPS 排障实录(奇安信浏览器已通)
spring boot·后端·https·国密·gmssl·kona
Shawn Dev4 天前
使用 Certbot 为 Nginx 自动申请 HTTPS 证书并配置自动续签
运维·nginx·https
2501_915918414 天前
Linux 上生成 AppStoreInfo.plist,App Store 上架 iOS
android·ios·小程序·https·uni-app·iphone·webview
Zzzzmo_4 天前
【网络原理】HTTP/HTTPS协议
计算机网络·http·https