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

Custom Dynamic DNS using PUT instead of GET

Scheduled Pinned Locked Moved General pfSense Questions
8 Posts 3 Posters 780 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.
  • K
    kendrickbros
    last edited by Mar 28, 2019, 8:22 PM

    My dynamic DNS update URL requires HTTP PUT instead of GET in the form:

    curl -X PUT --user {email}:{password} https://{fqdn}/admin/dns/custom[/qname[/rtype]]
    

    So I tried putting the correctly formatted curl command into the "Update URL" field for the "Custom" service type of "Dynamic DNS Client". Of course that didn't work because the update URL field expects a URL and not a curl command.

    I can specify the URL alone, but is there a way to specify PUT instead of GET?

    1 Reply Last reply Reply Quote 0
    • S
      stephenw10 Netgate Administrator
      last edited by Mar 31, 2019, 7:46 PM

      I'm not aware of a way to do that with the pfSense config. I think you would need to use a custom script or patch the existing code.

      Steve

      1 Reply Last reply Reply Quote 1
      • J
        jimp Rebel Alliance Developer Netgate
        last edited by Apr 1, 2019, 4:56 PM

        That would need custom code/scripting to handle the different method. The whole setup at the moment is geared toward using GET. I could see POST and PUT being useful but the latter two would need more work. PUT especially would likely have to format the submitted data differently (e.g. JSON), depending on what the server expects.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • K
          kendrickbros
          last edited by Apr 1, 2019, 5:29 PM

          The DDNS server I'm referring to is Mail-in-a-Box which has an elegant REST-style API for managing custom DNS records. For instance, the following command sets pfsense.mydomain.com to point to the IP address of the machine you are executing curl on:

          curl -X PUT https://box.mydomain.com/admin/dns/custom/pfsense.mydomain.com
          

          But pfSense will only permit a GET request and not a PUT request. In fact, many dynamic DNS APIs utilize GET for update functionality, and pfSense supports 40+ different DDNS services, so while I appreciate the popular view of GET for updating DDNS, it would be nice if the "Custom" DDNS option of pfSense optionally supported the elegant REST-style API of PUT or POST for DDNS update functionality.

          Perhaps the answer is to augment pfSense with a "cURL" DDNS option which would allow the specification of a minimal set of curl options including:

          -X, --request <command> - Specifies a custom request method to use when communicating with the HTTP server.
          -d, --data <data> Sends  the  specified data in a POST request.
          

          The benefit to this approach would be tremendous flexibility in calling various DDNS providers whose APIs are more REST-centric.

          1 Reply Last reply Reply Quote 0
          • S
            stephenw10 Netgate Administrator
            last edited by stephenw10 Apr 1, 2019, 5:48 PM Apr 1, 2019, 5:46 PM

            I could be misreading this but there do seem to be a number of clients (3) using PUT already. For example:
            https://github.com/pfsense/pfsense/blob/8800ee6f90d2ac91ca9c2886bd260bc1a4e12893/src/etc/inc/dyndns.class#L804

            Maybe you could just add your provider via a pull request?

            Steve

            1 Reply Last reply Reply Quote 1
            • J
              jimp Rebel Alliance Developer Netgate
              last edited by Apr 1, 2019, 5:57 PM

              Yes, it could be done that way as a new provider. Though having the option in custom could be handy for others using private servers or other providers they don't want to add the code for.

              Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

              Need help fast? Netgate Global Support!

              Do not Chat/PM for help!

              1 Reply Last reply Reply Quote 0
              • K
                kendrickbros
                last edited by Apr 1, 2019, 5:57 PM

                I think you're right! I spent so much time trying to get the Custom option to work, that I didn't realize some of the other providers require PUT.

                I'm not a PHP-programmer, but I'll study the code and try to make sense of it. I'm sure it would be a piece of cake for the programmer of this code to add support for MIAB.

                1 Reply Last reply Reply Quote 0
                • K
                  kendrickbros
                  last edited by Apr 3, 2019, 3:50 AM

                  I've spent some time looking over the code for DDNS, and I see at least three files that would need to be changed in order to add support for PUT to the "Custom" DNS provider.

                  src/usr/local/www/services_dyndns_edit.php
                  src/etc/inc/dyndns.class
                  src/etc/inc/services.inc
                  

                  I'm thinking of adding a new flag 'curl_use_http_put' similar to the existing 'curl_ssl_verifypeer' flag so that the "Custom" provider UI will display a new checkbox to capture the option in "src/usr/local/www/services_dyndns_edit.php".

                  The flag 'curl_use_http_put' would need to be passed to "src/etc/inc/dyndns.class" where the logic to act on the flag would evaluated.

                  One thing I don't yet understand is how the configuration is persisted. Would someone provide an overview of how the DDNS service is initialized and settings persisted?

                  1 Reply Last reply Reply Quote 0
                  1 out of 8
                  • First post
                    1/8
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                    This community forum collects and processes your personal information.
                    consent.not_received