openssl创建证书解决不安全问题

1.首先生成根证书和私钥,我全部保存在D:\

openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -subj "/C=CN/ST=JiangSu/L=SuZhou/O=LinkAsia" -keyout D:/CA-private.key -out D:/CA-certificate.crt -reqexts v3_req -extensions v3_ca

2.生成自签名证书私钥 private.key

openssl genrsa -out D:/private.key 2048

3.根据自签名证书私钥生成自签名证书申请文件 private.csr

openssl req -new -key D:/private.key -subj "/C=CN/ST=JiangSu/L=SuZhou/O=LinkAsia/CN=127.0.0.1" -sha256 -out D:/private.csr

4.在D:/手动创建一个private.ext文件

内容如下

req

default_bits = 1024

distinguished_name = req_distinguished_name

req_extensions = san

extensions = san

req_distinguished_name

countryName = CN

stateOrProvinceName = Definesys

localityName = Definesys

organizationName = Definesys

SAN

authorityKeyIdentifier=keyid,issuer

basicConstraints=CA:FALSE

keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment

subjectAltName = IP:127.0.0.1

5.根据根证书私钥及根证书-CA CA-certificate.crt -CAkey CA-private.key、自签名证书申请文件 -in private.csr、自签名证书扩展文件 -extfile private.ext,生成自签名证书 -out private.crt

openssl x509 -req -days 36500 -in D:/private.csr -CA D:/CA-certificate.crt -CAkey D:/CA-private.key -CAcreateserial -sha256 -out D:/private.crt -extfile D:/private.ext -extensions SAN

6.在nginx中配置

7.安装 CA-certificate.crt到受信任的根证书颁发机构下

8.安装好的证书信息

9.最终访问效果

相关推荐
007php0071 小时前
Jenkins+docker 微服务实现自动化部署安装和部署过程
运维·数据库·git·docker·微服务·自动化·jenkins
路溪非溪1 小时前
嵌入式Linux驱动开发杂项总结
linux·运维·驱动开发
2501_920047031 小时前
nginx-限速-限制并发连接数-限制请求数
运维·nginx
RainbowJie12 小时前
Gemini CLI 与 MCP 服务器:释放本地工具的强大潜力
java·服务器·spring boot·后端·python·单元测试·maven
蓝黑20202 小时前
VSCode远程连接阿里云ECS服务器
服务器·vscode·阿里云
网硕互联的小客服2 小时前
服务器支持IPv6吗?如何让服务器支持IPv6
运维·服务器·ip
小猪猪屁2 小时前
注入攻击和 XSS 攻击,谁在偷你的数据?
前端·安全
三无少女指南3 小时前
动态线程池核心解密:从 Nacos 到 Pub/Sub 架构的实现与对比
运维·架构
码间舞4 小时前
道路千万条,安全第一条!要对付XSS等攻击你有什么手段?你知道什么是CSP吗?
前端·后端·安全
poison_Program4 小时前
使用 Prometheus 监控服务器节点:Node Exporter 详解与配置
运维·服务器·prometheus