openssl生成自签证书

步骤

#创建两个文件 cn.cnf和server.cnf ,分别插入下面的内容

bash 复制代码
[ req ]
default_bits       = 4096
distinguished_name = req_distinguished_name
req_extensions     = req_ext
prompt             = no

[ req_distinguished_name ]
countryName                = CN
stateOrProvinceName        = BeiJing
localityName               = BeiJing
organizationName           = WeiOrg
organizationalUnitName     = WeiUnit
commonName                 = localhost

[ req_ext ]
subjectAltName = @alt_names

[ alt_names ]
DNS.1 = localhost
DNS.2 = example.com #配置域名的写法
IP.1  = 127.0.0.1
IP.2  = 192.168.110.9 #配置ip写法

分别执行下面的命令

bash 复制代码
openssl genpkey -algorithm RSA -out ca.key -pkeyopt rsa_keygen_bits:4096

openssl req -x509 -new -key ca.key -out ca.crt -days 3650 -config ca.cnf

openssl genpkey -algorithm RSA -out server.key -pkeyopt rsa_keygen_bits:4096

openssl req -new -key server.key -out server.csr -config server.cnf

openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 365 -extfile server.cnf -extensions req_ext
安装证书过程

待后续...

相关推荐
阿阿越17 小时前
Linux系统编程 -- 进程优先级、切换和调度
linux·运维·服务器
wanhengidc17 小时前
云手机存在哪些技术瓶颈
运维·服务器·安全·智能手机·生活
IT199517 小时前
C++使用“长度前缀法”解决TCP“粘包 / 拆包”问题
服务器·网络·c++·tcp/ip
德迅云安全—珍珍17 小时前
物理服务器、云服务器、裸金属服务器的区别
运维·服务器
好记忆不如烂笔头abc18 小时前
超微服务器的ipmi调整风扇运行模式
运维·服务器
一个响当当的名号18 小时前
ASP.NET 期末突击
运维·服务器
@Wufan18 小时前
ubuntu服务器子用户(无sudo权限)安装/切换多个版本cuda
linux·服务器·ubuntu·cuda
studytosky18 小时前
Linux 基础开发工具(3):Git 控制与 GDB 调试实用指南
linux·运维·服务器·网络·数据库·git
WG_1719 小时前
Linux:环境变量
linux·运维·服务器
NZT-4819 小时前
服务器访问github受限的解决办法
运维·服务器·github