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

相关推荐
xdscode9 小时前
Linux云服务器安装openclaw,并对接飞书通道
linux·服务器·飞书·openclaw
lswzw9 小时前
win11家庭版 安装 openclaw
服务器
LegendNoTitle10 小时前
计算机三级等级考试 网络技术 选择题考点详细梳理
服务器·前端·经验分享·笔记·php
2401_8772742410 小时前
从匿名管道到 Master-Slave 进程池:Linux 进程间通信深度实践
linux·服务器·c++
feng_you_ying_li10 小时前
linux之用户的权限详解(4)
linux·运维·服务器
二进制person11 小时前
JavaEE初阶 --网络编程
linux·服务器·网络
Irissgwe12 小时前
进程间通信
linux·服务器·网络·c++·进程间通信
岁岁种桃花儿13 小时前
AI超级智能开发系列从入门到上天第四篇:AI应用方案设计
java·服务器·开发语言
HelloTonyGo13 小时前
个人游戏笔记本免费“养龙虾”(Win10+WSL2+OpenClaw 部署与配置指南)
windows·ubuntu·wsl2·openclaw
TEC_INO13 小时前
嵌入式 Linux 开发知识总结
linux·运维·服务器