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

相关推荐
coder_lorraine16 分钟前
OpenResty 安装指南
服务器·前端
ZZZKKKRTSAE18 分钟前
玩转rhel9 Apache
linux·运维·服务器·apache·web
Z_zz_Z___39 分钟前
DNS协议解析过程
linux·服务器·网络
砍光二叉树1 小时前
【MYSQL8】springboot项目,开启ssl证书安全连接
spring boot·mysql·ssl
hryyx2 小时前
Linux磁盘限速(Ubuntu24实测)
linux·运维·服务器
阿巴~阿巴~2 小时前
Linux进程状态实战指南:转换关系、监控命令与状态解析
linux·运维·服务器
cpsvps2 小时前
香港服务器Python自动化巡检脚本开发与邮件告警集成
服务器·python·自动化
爱吃土豆的马铃薯ㅤㅤㅤㅤㅤㅤㅤㅤㅤ2 小时前
linux打包指令和移动指令
linux·运维·服务器
mini小新3 小时前
PostgreSQL如何进行跨服务器迁移数据
服务器·数据库·postgresql·数据迁移
阿蒙Amon3 小时前
C#日期、时间和时区:全球化应用的时间处理艺术
java·服务器·c#