Navigation

    Netgate Discussion Forum
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search

    Dynamic DNS support for Gandi LiveDNS?

    DHCP and DNS
    3
    3
    1945
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      Antimatter47 last edited by

      Hello,

      Gandi.net supports updating DNS records using their API, both on their old DNS platform and their new LiveDNS platform. Would it be possible to support this in pfSense's dynamic DNS feature? A quick search found a few scripts that are supposed to do this for LiveDNS:

      https://github.com/Gandi/api-examples/blob/master/bash/livedns/mywanip.sh
      https://github.com/cavebeat/gandi-live-dns
      https://github.com/plut0nium/gandi-dynamic-livedns
      https://github.com/rmarchant/gandi-ddns

      Alternatively, I have very limited scripting and command line skills, but how realistic would it be to run one of these scripts on a pfSense machine, using whatever mechanism it is that triggers pfSense's built-in dynamic DNS clients to perform an update, to trigger the custom script?

      Thanks!

      1 Reply Last reply Reply Quote 0
      • T
        trumee last edited by

        I am using this script with a cron entry.

        
        0 	* 	* 	* 	* 	root 	/usr/local/bin/gandi.sh
        
        

        I had to install bash since it doesnt come with FreeBSD. The downside is that it is not linked to WAN. You may want to look at this.

        –---------------------------------------------------------------------------------
        Second approach was to run nginx/php on a separate FreeBSD server. The script i used were

        
        $cat /usr/local/bin/mywanip4.sh
        
        #!/usr/local/bin/bash
        
        DOMAIN="mydomain.com"
        RECORD="myrecord"
        APIKEY="MYKEY"
        
        API="https://dns.api.gandi.net/api/v5/"
        
        IP4=$1
        
        if [[ -z "$IP4"  ]]; then
            echo "Something went wrong. Can not get your IP from WAN "
            exit 1
        fi
        
        if [[ ! -z "$IP4" ]]; then
            DATA='{"rrset_values": ["'$IP4'"]}'
            curl -s -XPUT -d "$DATA" \
                -H"X-Api-Key: $APIKEY" \
                -H"Content-Type: application/json" \
                "$API/domains/$DOMAIN/records/$RECORD/A"
        fi
        
        # cat /usr/local/www/nginx/gandi_update.php 
           if(isset($_GET['ip']) && filter_var($_GET['ip'], FILTER_VALIDATE_IP))
           {
              $output = shell_exec('./mywanip4.sh ' . $_GET['ip']);
              echo "OK";
           }
           else
              echo "FAIL";
        ?>
        
        

        I had to install php56-filter and bash packages on the FreeBSD server to make it work. The update URL was http://192.16.1.2/gandi_update.php?ip=%IP%

        1 Reply Last reply Reply Quote 0
        • E
          evantill last edited by evantill

          I have added Gandi LiveDNS as a Dynamic DNS Client.

          https://github.com/pfsense/pfsense/pull/4061

          https://redmine.pfsense.org/issues/9452

          1 Reply Last reply Reply Quote 0
          • First post
            Last post