Sign inSign up

nnorman062/certbot-az-cli

By nnorman062

•Updated over 4 years ago

Image
0

906

nnorman062/certbot-az-cli repository overview

⁠Certbot AZ-CLI

Certbot Docker image which has been installed with az-cli⁠.

⁠How to

Ensure you have latest docker and running.

docker -v

Create two simple script for adding and deleting txt record in azure dns

add-dns-record.sh:

SUB_DOMAIN=$(echo "$CERTBOT_DOMAIN"| sed -e  's/\.*[^\.]*\.[^\.]*\.[^\.]*$//')
az cloud set -n <AZURE_CLOUD_REGION>
az login -u <USERNAME> -p <PASSOWRD>
az network dns record-set txt add-record -g <DNS_ZONE_RESOURCE_GROUP> -z <DNS_ZONE_NAME> -n "_acme-challenge.$SUB_DOMAIN" -v $CERTBOT_VALIDATION
sleep 25

delete-dns-record.sh:

SUB_DOMAIN=$(echo "$CERTBOT_DOMAIN"| sed -e  's/\.*[^\.]*\.[^\.]*\.[^\.]*$//')
az cloud set -n <AZURE_CLOUD_REGION>
az login -u <USERNAME> -p <PASSOWRD>
az network dns record-set txt delete -g <DNS_ZONE_RESOURCE_GROUP> -z <DNS_ZONE_NAME> -n "_acme-challenge.$SUB_DOMAIN" --yes

⁠Usage

Assuming that the scripts are located in working_directory/script

docker run -it --rm --name certbot \
    -v "$PWD/letsencrypt:/etc/letsencrypt" \
    -v "$PWD/scripts:/var/scripts" \
	nnorman062/certbot-az-cli \
    certonly --manual \
    --manual-auth-hook "/var/scripts/add-dns-record.sh" \
    --manual-cleanup-hook "/var/scripts/delete-dns-record.sh" \
    --disable-hook-validation \
    --preferred-challenges "dns-01" \
    --agree-tos \
    -d "*.example.com" \
    -m "[email protected]" \
    --no-eff-email \
    --manual-public-ip-logging-ok \
    --renew-by-default

⁠License

MIT⁠

Tag summary

Content type

Image

Digest

Size

139.3 MB

Last updated

about 5 years ago

docker pull nnorman062/certbot-az-cli