创建内部 CA证书 自签SSL证书

创建目录:

mkdir -p /root/ipmi-ca
cd /root/ipmi-ca

生成 CA 私钥:

openssl genrsa -out fastmos-ca.key 2048

生成 CA 根证书:

openssl req -x509 -new -nodes \
-key fastmos-ca.key \
-sha256 \
-days 3650 \
-out fastmos-ca.crt \
-subj "/C=HK/ST=Hong Kong/L=Hong Kong/O=FASTMOS/CN=FASTMOS-CA"

查看 CA 证书:

openssl x509 -in fastmos-ca.crt -noout -subject -issuer -dates

正常类似:

subject=C = HK, ST = Hong Kong, L = Hong Kong, O = FASTMOS, CN = FASTMOS-CA
issuer=C = HK, ST = Hong Kong, L = Hong Kong, O = FASTMOS, CN = FASTMOS-CA
notAfter=...

三、把 CA 根证书导入电脑

只需要导入:

fastmos-ca.crt

不要导入:

fastmos-ca.key

Windows 操作:

双击 fastmos-ca.crt
→ 安装证书
→ 本地计算机
→ 将所有证书放入下列存储
→ 受信任的根证书颁发机构
→ 完成

导入后,Chrome / Edge / Firefox 企业版通常都会信任这个 CA。

四、签发证书

假设是:

192.168.1.2

创建配置文件:

cat > 192.168.1.2.cnf <<'EOF'
[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
req_extensions = v3_req

[dn]
C = HK
ST = Hong Kong
L = Hong Kong
O = FASTMOS
OU = IPMI
CN = 192.168.1.2

[v3_req]
subjectAltName = IP:192.168.1.2
keyUsage = digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth
EOF

生成 IPMI 私钥和 CSR:

openssl req -new -nodes -newkey rsa:2048 \
-keyout 192.168.1.2.key \
-out 192.168.1.2.csr \
-config 192.168.1.2.cnf

用 FASTMOS CA 签发证书:

openssl x509 -req \
-in 192.168.1.2.csr \
-CA fastmos-ca.crt \
-CAkey fastmos-ca.key \
-CAcreateserial \
-out 192.168.1.2.crt \
-days 3650 \
-sha256 \
-extfile 192.168.1.2.cnf \
-extensions v3_req


联系在线客服

服务器免费测试满意付款