summaryrefslogtreecommitdiff
path: root/vps/functions/verify_ptr.sh
diff options
context:
space:
mode:
Diffstat (limited to 'vps/functions/verify_ptr.sh')
-rwxr-xr-xvps/functions/verify_ptr.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/vps/functions/verify_ptr.sh b/vps/functions/verify_ptr.sh
new file mode 100755
index 0000000..8ce2f6c
--- /dev/null
+++ b/vps/functions/verify_ptr.sh
@@ -0,0 +1,29 @@
+verify_ptr() {
+ LABEL="$1"
+ IP=$(curl -s -H "Authorization: Bearer $LINODE_API_TOKEN" https://api.linode.com/v4/linode/instances \
+ | jq -r --arg LABEL "$LABEL" '.data[] | select(.label == $LABEL) | .ipv4[0]')
+ LINODE_ID=$(curl -s -H "Authorization: Bearer $LINODE_API_TOKEN" https://api.linode.com/v4/linode/instances \
+ | jq -r --arg LABEL "$LABEL" '.data[] | select(.label == $LABEL) | .id')
+
+ if [[ -z "$IP" || -z "$LINODE_ID" ]]; then
+ echo "❌ Could not retrieve IP or Linode ID for label '$LABEL'"
+ return 1
+ fi
+
+ echo "Re-attempting rDNS update for $LABEL ($IP)..."
+ PTR_NAME="${LABEL}.doinkle.pro"
+ RDNS_PAYLOAD=$(cat <<EOF
+{
+ "rdns": "$PTR_NAME"
+}
+EOF
+)
+
+ RESPONSE=$(curl -s -w "\nHTTP Status: %{http_code}\n" -X PUT \
+ -H "Authorization: Bearer $LINODE_API_TOKEN" \
+ -H "Content-Type: application/json" \
+ -d "$RDNS_PAYLOAD" \
+ "https://api.linode.com/v4/linode/instances/$LINODE_ID/ips/$IP")
+
+ echo "$RESPONSE"
+}