Created
May 10, 2024 18:13
-
-
Save Virenbar/9a9daa0655393448a04c03deb4a7aa2a to your computer and use it in GitHub Desktop.
Certbot DNS Challenge for NetAngels API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Основные параметры | |
KEY="<key>" | |
ID="<record_id>" | |
NAME="_acme-challenge.<domain>" | |
#CERTBOT_VALIDATION="test" | |
TOKEN=$(curl --location 'https://panel.netangels.ru/api/gateway/token/' \ | |
--header 'Content-Type: application/x-www-form-urlencoded' \ | |
--data-urlencode 'api_key='$KEY | jq -r '.token') | |
curl --location 'https://api-ms.netangels.ru/api/v1/dns/records/'$ID'/' \ | |
--header 'Content-Type: application/json' \ | |
--header 'Authorization: Bearer '$TOKEN \ | |
--data '{ | |
"name": "'$NAME'", | |
"ttl": 600, | |
"value": "'$CERTBOT_VALIDATION'" | |
}' | |
echo -e "Record updated" | |
# Ожидание обновления | |
sleep 300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
cd $DIR | |
sudo certbot certonly --manual --preferred-challenges=dns -d *.<domain> --manual-auth-hook ./net-angels-auth.sh --non-interactive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment