Some bugfixes.
This commit is contained in:
@@ -24,20 +24,19 @@ openssl req -x509 -newkey rsa:4096 -keyout $CERT_DIR/key.pem -out $CERT_DIR/full
|
||||
}
|
||||
|
||||
|
||||
if [[ "$(ls -A $CERT_DIR)" == "" ]]; then
|
||||
if [[ "$(ls $CERT_DIR)" == "" ]]; then
|
||||
echo "$DOMAIN not contains certificates, creates new."
|
||||
mkdir -p $CERT_DIR;
|
||||
CURL_CHECK="curl -s -o /dev/null -w "%{http_code}" https://$LETSENCRYPT_URL";
|
||||
|
||||
if [[ "$(eval $CURL_CHECK)" != "200" ]] ; then
|
||||
create_self_signed_certificate;
|
||||
fi
|
||||
else
|
||||
file="$CERT_DIR/letsencrypt"
|
||||
{
|
||||
echo "{ \"DOMAIN\": \"$DOMAIN\" }"
|
||||
} >> "$file"
|
||||
fi
|
||||
|
||||
CURL_CHECK="curl -s -o /dev/null -w "%{http_code}" https://$LETSENCRYPT_URL";
|
||||
|
||||
if [[ "$(eval $CURL_CHECK)" != "200" ]] ; then
|
||||
create_self_signed_certificate;
|
||||
else
|
||||
letsencrypt_certificates;
|
||||
fi
|
||||
|
||||
|
12
scripts/digest_registry.sh
Normal file
12
scripts/digest_registry.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
ref="${1:-library/ubuntu:latest}"
|
||||
repo="${ref%:*}"
|
||||
tag="${ref##*:}"
|
||||
acceptM="application/vnd.docker.distribution.manifest.v2+json"
|
||||
acceptML="application/vnd.docker.distribution.manifest.list.v2+json"
|
||||
token=$(curl -s "https://auth.docker.io/token?service=registry.docker.io&scope=repository:${repo}:pull" | jq -r '.token')
|
||||
curl -H "Accept: ${acceptM}" \
|
||||
-H "Accept: ${acceptML}" \
|
||||
-H "Authorization: Bearer $token" \
|
||||
-I -s "https://registry-1.docker.io/v2/${repo}/manifests/${tag}"
|
@@ -7,6 +7,7 @@ DEL=$2
|
||||
if [[ $DEL != "" ]]; then
|
||||
echo "$DOMAIN DELETED";
|
||||
rm $DOMAIN.conf;
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
DOMAIN_SOURCE=/domains/$DOMAIN
|
||||
@@ -31,7 +32,7 @@ echo $DOMAIN;
|
||||
|
||||
file="/tmp/$DOMAIN.conf"
|
||||
|
||||
cp -a /scripts/nginx_template.conf /tmp/$DOMAIN.conf
|
||||
#cp -a /scripts/nginx_template.conf /tmp/$DOMAIN.conf
|
||||
|
||||
{
|
||||
|
||||
@@ -44,11 +45,11 @@ rewrite_log on;"
|
||||
echo
|
||||
|
||||
if [[ $REDIRECT_HTTP != "" && $HTTP_PORT != "" ]]; then
|
||||
echo "return 301 http://$REDIRECT_HTTP;
|
||||
}"
|
||||
echo "return 301 http://$REDIRECT_HTTP;"
|
||||
|
||||
elif [[ $REDIRECT_HTTPS != "" && $HTTP_PORT != "" ]]; then
|
||||
echo "return 301 https://$REDIRECT_HTTPS;
|
||||
}"
|
||||
echo "return 301 https://$REDIRECT_HTTPS;"
|
||||
|
||||
else
|
||||
if [[ $ERROR_PAGE != "" && $HTTP_PORT != "" ]]; then
|
||||
echo "error_page 404 /$ERROR_PAGE;
|
||||
@@ -75,11 +76,7 @@ location = /$ERROR_PAGE {
|
||||
proxy_set_header Connection "'$http_connection'";
|
||||
proxy_cookie_path / /;
|
||||
access_log off;
|
||||
}"
|
||||
fi
|
||||
|
||||
if [[ $HTTPS_PORT == "" ]] ; then
|
||||
echo "}
|
||||
}
|
||||
}"
|
||||
fi
|
||||
|
||||
@@ -128,8 +125,7 @@ echo "proxy_redirect off;
|
||||
proxy_set_header Connection "'$http_connection'";
|
||||
proxy_cookie_path / /;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
}
|
||||
}"
|
||||
fi
|
||||
|
||||
|
@@ -178,8 +178,9 @@ do
|
||||
|
||||
parent="/"$(echo $dir|cut -d / -f2)
|
||||
|
||||
if [[ "${parent}" == "${CERT_DIR}" && "${op}" == "CREATE,CLOSE_WRITE,CLOSE" && "${file}" == "new_certificate" ]]; then
|
||||
if [[ "${parent}" == "${CERT_DIR}" && "${op}" == "CREATE,CLOSE_WRITE,CLOSE" ]]; then
|
||||
DOMAIN=$(echo $dir|cut -d / -f3);
|
||||
echo "file: "$file;
|
||||
echo "New cert created: '$DOMAIN'";
|
||||
#check_proxy_state;
|
||||
|
||||
|
Reference in New Issue
Block a user