1 Star 0 Fork 1.2K

gispdr/docker

forked from Kenny小狼/docker 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gencert.sh 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
KennyLee 提交于 2019-06-26 16:36 . 完善registry-frontend
#!/bin/sh
# 最终证书存放的目录
FOLDER_DIR=certs/
# 证书文件名字,默认为空的话代表用输入domain作为证书文件名字
CERT_NAME=registry
# create self-signed server certificate:
read -p "Enter your domain [www.example.com]: " DOMAIN
echo "Create server key..."
if [ -z "$CERT_NAME" ]; then
CERT_NAME=$DOMAIN
fi
openssl genrsa -des3 -out $CERT_NAME.key 1024
echo "Create server certificate signing request..."
SUBJECT="/C=CN/ST=BeiJing/L=Dongcheng/CN=$DOMAIN"
openssl req -new -subj $SUBJECT -key $CERT_NAME.key -out $CERT_NAME.csr
echo "Remove password..."
mv $CERT_NAME.key $CERT_NAME.origin.key
openssl rsa -in $CERT_NAME.origin.key -out $CERT_NAME.key
echo "Sign SSL certificate..."
openssl x509 -req -days 3650 -in $CERT_NAME.csr -signkey $CERT_NAME.key -out $CERT_NAME.crt
echo "TODO:"
echo "Copy $DOMAIN.crt to /etc/nginx/ssl/$DOMAIN.crt"
echo "Copy $DOMAIN.key to /etc/nginx/ssl/$DOMAIN.key"
echo "Add configuration in nginx:"
echo "server {"
echo " ..."
echo " listen 443 ssl;"
echo " ssl_certificate /etc/nginx/ssl/$DOMAIN.crt;"
echo " ssl_certificate_key /etc/nginx/ssl/$DOMAIN.key;"
echo "}"
if [ -n "$FOLDER_DIR" ]; then
mv $CERT_NAME.key $FOLDER_DIR
mv $CERT_NAME.crt $FOLDER_DIR
mv $CERT_NAME.csr $FOLDER_DIR
mv $CERT_NAME.origin.key $FOLDER_DIR
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Docker
1
https://gitee.com/gispdr/docker.git
git@gitee.com:gispdr/docker.git
gispdr
docker
docker
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385