当前位置:网站首页>OpenSSL self signed certificate issuance script -- the road to building a dream
OpenSSL self signed certificate issuance script -- the road to building a dream
2022-07-22 15:22:00 【The road to dream】
#!/bin/bash
#openssl Generate self signed certificate script
read -p " Please enter your organization :" organization
read -p " Please enter your domain name :" FQ
# Generate CA Certificate private key ca.key
openssl genrsa -out ca.key 4096
# according to ca Certificate private key generation CA certificate ca.crt
openssl req -x509 -new -nodes -sha512 -days 3650 \
-subj "/C=CN/ST=Beijing/L=Beijing/O=${organization}/OU=${organization}/CN=${FQ}" \
-key ca.key \
-out ca.crt
# Generate server private key yourdomain.com.key
openssl genrsa -out ${FQ}.key 4096
# Generate the certificate signature request CSR yourdomain.com.csr
openssl req -sha512 -new \
-subj "/C=CN/ST=Beijing/L=Beijing/O=${organization}/OU=${organization}/CN=${FQ}" \
-key ${FQ}.key \
-out ${FQ}.csr
# Generate x509 v3 Extension files
cat > v3.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1=${FQ}
DNS.2=${organization}
EOF
# Use this v3.ext File generation certificate yourdomain.com.crt
openssl x509 -req -sha512 -days 3650 \
-extfile v3.ext \
-CA ca.crt -CAkey ca.key -CAcreateserial \
-in ${FQ}.csr \
-out ${FQ}.crt
# Instructions
echo "a. Will server certificate ${FQ}.crt And the key ${FQ}.key Copied to the cert or ssl Under the table of contents "
mkdir -p /data/cert
cp ${FQ}.crt /data/cert/
cp ${FQ}.key /data/cert/
echo "b. Will server certificate ${FQ}.crt The encoding format is converted to ${FQ}.cert, Provide to Docker Use "
openssl x509 -inform PEM -in ${FQ}.crt -out ${FQ}.cert
echo "c. Will server certificate 、 Key and CA File copy to Harbor Host computer Docker certificate In the folder "
# Create certificate folder
mkdir -p /etc/docker/certs.d/${FQ}
# Copy server certificate
cp ${FQ}.cert /etc/docker/certs.d/${FQ}/
# Copy the server private key
cp ${FQ}.key /etc/docker/certs.d/${FQ}/
# Copy the self signed certification authority ca certificate
cp ca.crt /etc/docker/certs.d/${FQ}/
systemctl restart docker
边栏推荐
- [cloud native kubernetes] jobs and cronjobs management under kubernetes cluster
- JDBC编程
- 心肌黄酶丨Worthington克氏梭菌心肌黄酶的特性
- Timed time test
- Release time test
- Myocardial xanthase -- characteristics of myocardial xanthase of Clostridium crenatum Worthington
- 双人成行本地安装&X360ce模拟手柄教程&xpadder手柄模拟键盘鼠标
- Rebound shell carries out suid authorization through ordinary users
- Do you know who the "open source queen" is-- Facing the threat of being fired, she still insisted on opening a famous project
- 记线上双写失败日志mysql错误排查原因
猜你喜欢
Graffiti Wi Fi & ble SoC development slide strip (5) -- burning authorization
Let security move | no matter what industry network architecture, these six tactics win the target
《PyTorch深度學習實踐》-1-Overview
Equal protection compliance 2022 series | one center + triple protection, helping the construction of enterprise level protection to be more scientific
Rebound shell carries out suid authorization through ordinary users
Study on the secretory enzymes of Worthington fungi -- galactose oxidase scheme
Redis的拓展方案
NAT Technology
Analysis sample of a video app
RPC core module summary
随机推荐
电流探头应该如何选择
Architecture design scheme (continuously updating ing)
With no performance forecast, BOE is silent at this time?
Study on the secretory enzymes of Worthington fungi -- galactose oxidase scheme
AIDL总结
Worthington植物原生质体制备丨纤维素酶方案
涂鸦Wi-Fi&BLE SoC开发幻彩灯带(5)----烧录授权
Open source demo | release of open source example of arcall applet
[Social Media Marketing] come in and learn about WhatsApp business API? Don't worry about going to sea!
Release time test
Pdf to image and content reading
MySQL练习一数据库的知识
Redis使用Jedis操作
MySQL Workbench使用教程
Classification and application of slip rings
ClickHouse相关SQL总结:创建表、分区/主键/排序设置、删除表、删除分区、修改表字段
Silicon Valley class notes (middle)
21jvm memory model (JMM)
Cell isolation study - Worthington Clostridium protease program
NFC Introduction (2)