[ACME] Better HTTP verification

master
andryyy 2019-06-29 20:28:03 +02:00
parent 7665cc2ae7
commit 014a0c7af5
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
2 changed files with 6 additions and 6 deletions

View File

@ -133,16 +133,16 @@ get_ipv6(){
verify_challenge_path(){ verify_challenge_path(){
# verify_challenge_path URL 4|6 # verify_challenge_path URL 4|6
RAND_FILE=${RANDOM}${RANDOM}${RANDOM} RANDOM_N=${RANDOM}${RANDOM}${RANDOM}
touch /var/www/acme/${RAND_FILE} echo ${RANDOM_N} > /var/www/acme/${RANDOM_N}
if [[ ${SKIP_HTTP_VERIFICATION} == "y" ]]; then if [[ ${SKIP_HTTP_VERIFICATION} == "y" ]]; then
echo '(skipping check, returning 0)' echo '(skipping check, returning 0)'
return 0 return 0
elif [[ "$(curl -${2} http://${1}/.well-known/acme-challenge/${RAND_FILE} --write-out %{http_code} --silent --output /dev/null)" =~ ^(2|3) ]]; then elif [[ "$(curl -${2} -L http://${1}/.well-known/acme-challenge/${RANDOM_N} --silent)" == "${RANDOM_N}" ]]; then
rm /var/www/acme/${RAND_FILE} rm /var/www/acme/${RANDOM_N}
return 0 return 0
else else
rm /var/www/acme/${RAND_FILE} rm /var/www/acme/${RANDOM_N}
return 1 return 1
fi fi
} }

View File

@ -311,7 +311,7 @@ services:
acme-mailcow: acme-mailcow:
depends_on: depends_on:
- nginx-mailcow - nginx-mailcow
image: mailcow/acme:1.57 image: mailcow/acme:1.58
build: ./data/Dockerfiles/acme build: ./data/Dockerfiles/acme
dns: dns:
- ${IPV4_NETWORK:-172.22.1}.254 - ${IPV4_NETWORK:-172.22.1}.254