Created
January 28, 2024 22:13
-
-
Save Jamie0/71c574dea0f974307b24ca0846b1ddff to your computer and use it in GitHub Desktop.
Script to nuke all _acme-challenge TXT records from a zone
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 | |
CF_ZONE_ID=x | |
curl -vk "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/dns_records?per_page=10000" \ | |
-H "X-Auth-Email: $LEXICON_CLOUDFLARE_USERNAME" \ | |
-H "X-Auth-Key: $LEXICON_CLOUDFLARE_TOKEN" \ | |
| jq -rc ".result[] | select( .name | startswith(\"_acme-challenge.$CERTBOT_DOMAIN\")) .id" \ | |
| grep . | tr '\n' '\0' \ | |
| xargs -0 -n1 -I{} \ | |
curl -vk "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/dns_records/{}" \ | |
-H "X-Auth-Email: $LEXICON_CLOUDFLARE_USERNAME" \ | |
-H "X-Auth-Key: $LEXICON_CLOUDFLARE_TOKEN" \ | |
--request DELETE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please help, I am in Shell Scripting Hell