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

    DNS-O-Matic patch for 1.2.3-Release

    Scheduled Pinned Locked Moved DHCP and DNS
    16 Posts 5 Posters 11.3k Views
    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.
    • V
      vynce
      last edited by

      Yes, it should work on the embedded version; that's what I'm using. I actually haven't tested it on the full installed version.

      I don't know why it's failing. Maybe you've already applied the patch or otherwise modified those files (?) – if you try to apply the patch twice in a row, it will fail the second time. You could try to undo the patch using the instructions at the end of my original post and the reapply it. If it still fails, post the contents of the .rej files (cat /etc/inc/dyndns.class.rej, etc…) and maybe we can tell what's going on from that.

      1 Reply Last reply Reply Quote 0
      • K
        keithalbert
        last edited by

        This was my first attempt to use the patch on a new install.  I have squid and squidguard installed if this might affect anything.  I did not modify any files directly on the router prior to trying the patch.

        Here is the contents of the .rej file:

        Thanks in advace!


        *** 117,123 ****
          if ($this->_detectChange() == FALSE) {
          $this->_error(10);
          } else {

        • if ($this->_dnsService == 'dyndns' ||
            $this->_dnsService == 'dyndns-static' ||
            $this->_dnsService == 'dyndns-custom' ||
            $this->_dnsService == 'dhs' ||
          –- 117,124 ----
            if ($this->_detectChange() == FALSE) {
            $this->_error(10);
            } else {
        • if ($this->_dnsService == 'dnsomatic' ||
        • $this->_dnsService == 'dyndns' ||
            $this->_dnsService == 'dyndns-static' ||
            $this->_dnsService == 'dyndns-custom' ||
            $this->_dnsService == 'dhs' ||

        *** 373,386 ****
          curl_close($ch);
          $this->_checkStatus($data);
          break;
        -                                case 'staticcling':
        -                                        $needsIP = FALSE;
        -                                        curl_setopt($ch, CURLOPT_URL, 'http://www.staticcling.org/update.html?login='.$this->_dnsUser.'&pass='.$this->_dnsPass);
        -                                        $data = curl_exec($ch);
        -                                        if (@curl_error($ch)) log_error("Curl error occured: " . curl_error($ch));
        -                                        curl_close($ch);
        -                                        $this->_checkStatus($data);
        -                                        break;
          default:
          break;
          }
        --- 374,409 ----
          curl_close($ch);
          $this->_checkStatus($data);
          break;

        • case 'staticcling':
          +                    $needsIP = FALSE;
          +                    curl_setopt($ch, CURLOPT_URL, 'http://www.staticcling.org/update.html?login='.$this->_dnsUser.'&pass='.$this->_dnsPass);
          +                    $data = curl_exec($ch);
          +                    if (@curl_error($ch)) log_error("Curl error occured: " . curl_error($ch));
          +                    curl_close($ch);
          +                    $this->_checkStatus($data);
          +                    break;
        • case 'dnsomatic':
        • /* Example syntax
        • https://username:password@updates.dnsomatic.com/nic/update?hostname=yourhostname&myip=ipaddress&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG
        • */
        • $needsIP = FALSE;
        • log_error("DNS-O-Matic: DNS update() starting.");
        • if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") $this->_dnsWildcard = "ON";
        • curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        • curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
        • $server = "https://" . $this->_dnsUser . ":" . $this->_dnsPass . "@updates.dnsomatic.com/nic/update?hostname=";
        • if($this->_dnsServer)
        • $server = $this->_dnsServer;
        • if($this->_dnsPort)
        • $port = ":" . $this->_dnsPort;
        • curl_setopt($ch, CURLOPT_URL, $server . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NOCHG');
        • $data = curl_exec($ch);
        • if (@curl_error($ch)) log_error("Request completed. DNS-O-Matic reported: " . curl_error($ch));
        • curl_close($ch);
        • $this->_checkStatus($data);
        • break;
            default:
            break;
            }

        *** 395,400 ****
          log_error("DynDns: Current Service: {$this->_dnsService}");
          $successful_update = false;
          switch ($this->_dnsService) {
          case 'dyndns':
          if (preg_match('/notfqdn/i', $data)) {
          $status = "phpDynDNS: (Error) Not A FQDN!";
        --- 418,445 ----
          log_error("DynDns: Current Service: {$this->_dnsService}");
          $successful_update = false;
          switch ($this->_dnsService) {

        • case 'dnsomatic':
        • if (preg_match('/badauth/i', $data)) {
        • $status = "DNS-O-Matic: The DNS-O-Matic username or password specified are incorrect. No updates will be distributed to services until this is resolved.";
        • } else if (preg_match('/notfqdn /i', $data)) {
        • $status = "DNS-O-Matic: The hostname specified is not a fully-qualified domain name. If no hostnames included, notfqdn will be returned once.";
        • } else if (preg_match('/nohost/i', $data)) {
        • $status = "DNS-O-Matic: The hostname passed could not be matched to any services configured. The service field will be blank in the return code.";
        • } else if (preg_match('/numhost/i', $data)) {
        • $status = "DNS-O-Matic: You may update up to 20 hosts. numhost is returned if you try to update more than 20 or update a round-robin.";
        • } else if (preg_match('/abuse/i', $data)) {
        • $status = "DNS-O-Matic: The hostname is blocked for update abuse.";
        • } else if (preg_match('/good/i', $data)) {
        • $status = "DNS-O-Matic: (Success) IP Address Changed Successfully! (".$this->_dnsIP.")";
        • $successful_update = true;
        • } else if (preg_match('/dnserr/i', $data)) {
        • $status = "DNS-O-Matic: DNS error encountered. Stop updating for 30 minutes.";
        • } else {
        • $status = "DNS-O-Matic: (Unknown Response)";
        • log_error("DNS-O-Matic: PAYLOAD: {$data}");
        • $this->_debug($data);
        • }
        • break;
            case 'dyndns':
            if (preg_match('/notfqdn/i', $data)) {
            $status = "phpDynDNS: (Error) Not A FQDN!";
        1 Reply Last reply Reply Quote 0
        • V
          vynce
          last edited by

          I wonder if squid/squidguard modify these files – I can't think of any reason why they would. It looks like I'll need one more thing. Could you attach your dyndns.class and services_dyndns.php files? Here's how to copy them from the router to the current directory on your desktop:

          scp root@192.168.1.1:/etc/inc/dyndns.class .
          scp root@192.168.1.1:/usr/local/www/services_dyndns.php .

          1 Reply Last reply Reply Quote 0
          • K
            keithalbert
            last edited by

            files attached

            dyndns.class.txt
            services_dyndns.php.txt

            1 Reply Last reply Reply Quote 0
            • V
              vynce
              last edited by

              The only difference between the files that you attached and the original pfSense ones is that yours have DOS line endings. This leads me to think that the problem is probably due to non-Unix line endings in the patch. Your web browser might have changed the line endings in the patch when it downloaded it because it thought that the patch was a text file.

              There are two ways to fix the line endings. The first is to use a good text editor like Notepad++ to convert the line endings in the patch from DOS/Windows to Unix before scp'ing it to your pfSense box.

              The other way is to convert the patch's line endings on your pfSense box. It was difficult finding a way to do this due to the limited utilities in pfSense, but this worked in my testing:

              awk '{ sub(/\r$/,""); print }' dnsomatic_1.2.3.patch > dnsomatic_1.2.3_fixed.patch

              Then just use dnsomatic_1.2.3_fixed.patch in the patch command.

              1 Reply Last reply Reply Quote 0
              • K
                keithalbert
                last edited by

                Worked like a charm.  Thanks for the help.

                1 Reply Last reply Reply Quote 0
                • V
                  vynce
                  last edited by

                  Cool, I'm glad that worked. :)

                  1 Reply Last reply Reply Quote 0
                  • D
                    davidindesignlondon.co.u
                    last edited by

                    here were two things wrong. The ordering of the steps needed to be changed so that the filesystem was remounted read/write before scp'ing, and the patch needed to be scp'ed as the root user instead of the admin user.

                    Works perfectly here too. Thanks. :)

                    –----------------------
                    Live with passion

                    1 Reply Last reply Reply Quote 0
                    • CNLiberalC
                      CNLiberal
                      last edited by

                      I'm very new to pfSense.  I have applied these patches.  They seemed to work fine.  There was no error.  However, now I want to enable the DNS-O-Matic server.  I have signed up for an account, but I don't know where/how in pfSense to add this.  What do I do?  I've tried going to:  Services:DynamicDNS Client but I don't know what settings to add.  Thanks!

                      Jim

                      pfSense 2.7.2-RELEASE

                      Dell R210 II
                      Intel E3-1340 v2
                      8GB RAM
                      SSD ZFS Mirror
                      Intel X520-DA2, RJ45 SFP+ (WAN) and 10Gb SFP+ DAC (LAN)
                      1 x Cisco 3850 12XS-S (Core Switch)
                      2 x Cisco 3750X PoE Gig Switch (Access Stack)
                      3 x Cisco 2802i APs (Mobility Express)

                      1 Reply Last reply Reply Quote 0
                      • V
                        vynce
                        last edited by

                        Here's a basic setup in pfSense:

                        • Go go Services and then Dynamic DNS.

                        • Check the "Enable" checkbox in the Dynamic DNS header.
                            Service Type: DNS-O-Matic
                            Hostname: all.dnsomatic.com
                            MX: <leave blank="">Wildcard: Check
                            Username: <your dns-o-matic="" username="">Password:</your></leave>

                        • Click save.

                        See the DNS-O-Matic documentation for more details.

                        A DynDNS tip
                        If you have multiple hostnames mapped to the same IP address with DynDNS and you're using DNS-O-Matic to keep them up to date, list all of the hostnames as a comma-separated list in the host field of a single service entry in DNS-O-Matic. For example, create a single DynDNS service entry in DNS-O-Matic, enter your DynDNS username and password, and then your list of hosts: myhost1.homeip.net,myhost2.dyndns.net,myhost3.dyndns.net. I have found this to be much more reliable than creating a separate service entry for each hostname because it updates all of those hosts at once instead of one at a time. This is specific to the DynDNS update API.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.