ubuntu 制作 ssl 证书

安装 openssl

sudo apt install openssl

生成 SSL 证书

生成私钥 (Private Key)

openssl genrsa -out private.key 2048

在当前目录生成 private.key

生成证书签名请求 (CSR - Certificate Signing Request)

openssl req -new -key private.key -out certificate.csr -subj "/C=US/ST=California/L=San Francisco/O=My Company/OU=IT Department/CN=proxy.com"

在当前目录生成 certificate.csr

创建配置文件

sudo vim config.ext

复制代码
subjectKeyIdentifier   = hash
authorityKeyIdentifier = keyid:always,issuer:always
basicConstraints       = CA:TRUE
keyUsage               = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign
subjectAltName         = DNS:proxy.com, DNS:www.proxy.com, IP:192.168.5.116
issuerAltName          = issuer:copy

生成自签名证书 (Self-signed Certificate)

openssl x509 -req -days 365 -in certificate.csr -signkey private.key -out certificate.crt -extfile config.ext

在当前目录生成 certificate.crt

-days 365 参数表示证书的有效期为 365 天,可以根据需要调整。

验证:

验证证书信息

openssl x509 -in certificate.crt -noout -text

相关推荐
不能跑的代码不是好代码5 小时前
Linux系统常用命令中文速查表
linux·运维·服务器
石一峰6996 小时前
深入理解 Linux 中断三层机制与 1-Wire 时序锁原理
linux·运维·服务器
无限码农7 小时前
Linux上通过cmake编译uchardet
linux·运维·服务器
ACP广源盛139246256738 小时前
IX8024@ACP# 搭配此芯 AI 服务器 + 爱芯元智产品完整方案
大数据·运维·服务器·人工智能·分布式·嵌入式硬件
Hiyajo pray10 小时前
SDN 访问控制性能调优方法
服务器·网络·网络安全
huainingning11 小时前
交换机通过ftp下载文件或者传输文件到ftp服务器
运维·服务器·网络
小池先生12 小时前
Windows服务器如何备份
运维·服务器
运维大师13 小时前
【Linux运维极简教程】05-软件包管理
linux·运维·服务器
sramdram14 小时前
数字温度传感器应用于服务器系统热管理方案的优势
服务器·温度传感器·数字温度传感器
hehelm14 小时前
IO 多路复用 — Reactor
linux·服务器·网络·数据库·c++