Skip to content

Instantly share code, notes, and snippets.

@Virenbar
Created May 10, 2024 18:13
Show Gist options
  • Save Virenbar/9a9daa0655393448a04c03deb4a7aa2a to your computer and use it in GitHub Desktop.
Save Virenbar/9a9daa0655393448a04c03deb4a7aa2a to your computer and use it in GitHub Desktop.
Certbot DNS Challenge for NetAngels API
#!/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
#!/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