Created
          February 14, 2018 07:25 
        
      - 
      
- 
        Save marcaurele/4898f5c08ec9e7dc57ef2d3ded63b172 to your computer and use it in GitHub Desktop. 
    Certbot/Let's encrypt hook for DNS authentication using Gandi Live DNS service
  
        
  
    
      This file contains hidden or 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 | |
| # To be used in certbot command as --manual-cleanup-hook parameter | |
| #APIKEY="" | |
| if [ -f /tmp/CERTBOT_$CERTBOT_DOMAIN/ZONE_RECORD_HREF ]; then | |
| ZONE_RECORD_HREF=$(cat /tmp/CERTBOT_$CERTBOT_DOMAIN/ZONE_RECORD_HREF) | |
| rm -f /tmp/CERTBOT_$CERTBOT_DOMAIN/ZONE_RECORD_HREF | |
| fi | |
| if [ -f /tmp/CERTBOT_$CERTBOT_DOMAIN/RECORD_NAME ]; then | |
| RECORD_NAME=$(cat /tmp/CERTBOT_$CERTBOT_DOMAIN/RECORD_NAME) | |
| rm -f /tmp/CERTBOT_$CERTBOT_DOMAIN/RECORD_NAME | |
| fi | |
| # Remove the challenge TXT record from the zone | |
| if [ -n "${ZONE_RECORD_HREF}" ]; then | |
| if [ -n "${RECORD_NAME}" ]; then | |
| curl --silent -X DELETE "$ZONE_RECORD_HREF/$RECORD_NAME/TXT" \ | |
| -H "X-Api-Key: $APIKEY" \ | |
| -H "Content-Type: application/json" | |
| fi | |
| fi | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Authentication hook is https://gist.github.com/marcaurele/fa3c19ce025ca02452a015e94927514e