下载cfssl
wget https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 -O /usr/bin/cfssl
wget https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 -O /usr/bin/cfssl-json
wget https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64 -O /usr/bin/cfssl-certinfo
chmod +x /usr/bin/cfssl*
在/opt下创建certs文件夹开始创建证书
cd certs
touch ca-csr.json
{
"CN": "xxx", 名称
"hosts": [
],
"key": {
"algo": "rsa", # 加密方法
"size": 2048
},
"names": [
{
"C": "CN", # 国家
"ST": "beijing", # 省市
"L": "beijing", # 成诗
"O": "xxx", # 组织名称
"OU": "xxx" # 组织内项目组名称
}
],
"ca": {
"expiry": "175200h" # 证书期限
}
}
使用cfssl生成
cfssl gencert -initca ca-csr.json | cfssl-json -bare ca