[Solved] Dynamic DNS with DigitalOcean

Started by jerrac, October 27, 2019, 10:30:30 PM

Previous topic - Next topic
October 27, 2019, 10:30:30 PM Last Edit: October 30, 2019, 12:47:18 AM by jerrac
DigitalOcean is listed as a service type. But I can't seem to get it to work.

I made sure to run updates today, so I am on the latest stable version.

I've confirmed my domain is configured to use Digital Ocean's nameservers, and I've added the domain, with an A record, to my DO account. I also made sure to wait long enough for the TTL to rollover.

When configuring the domain, I use these settings:

* Enable: checked
* Service type: DigitalOcean
* Interface to monitor: WAN
* Hostname: tipperthecat.life
* MX: empty
* Wildcards: Unchecked
* Verbose Logging: Checked
* Username: My DO username.
* Password: The token I generated in DO today.
* Description: Empty.

When I click "Save and Force Update", I get this in the "General Log":

QuoteOct 27 14:23:48    opnsense: /services_dyndns_edit.php: Dynamic DNS Record ID (< DO Username >): UNKNOWN ERROR
Oct 27 14:23:48    opnsense: /services_dyndns_edit.php: Dynamic DNS Record ID (< DO Username >): PAYLOAD: {"id":"not_found","message":"The resource you were accessing could not be found."}
Oct 27 14:23:48    opnsense: /services_dyndns_edit.php: Dynamic DNS (tipperthecat.life): Current Service: digitalocean
Oct 27 14:23:48    opnsense: /services_dyndns_edit.php: Dynamic DNS (tipperthecat.life): _checkStatus() starting.
Oct 27 14:23:47    opnsense: /services_dyndns_edit.php: Dynamic DNS (tipperthecat.life via DigitalOcean): _update() starting.
Oct 27 14:23:47    opnsense: /services_dyndns_edit.php: Dynamic DNS (tipperthecat.life): running dyndns_failover_interface for wan. found em0
Oct 27 14:23:47    opnsense: /services_dyndns_edit.php: Dynamic DNS (tipperthecat.life): 73.25.124.39 extracted
Oct 27 14:23:47    opnsense: /services_dyndns_edit.php: Dynamic DNS: updatedns() starting

Any ideas?

> Edit: Marking as solved.

October 29, 2019, 07:22:51 AM #1 Last Edit: October 29, 2019, 08:00:09 AM by johannsg
I found the answer in the source comments: https://github.com/opnsense/plugins/commit/a93a949ec26e2a35f85ba7614a94d0188562606e

The username should be DigitalOcean DNS record ID, while the hostname is your top-level domain name. You'll need to query DO's API to obtain the record ID -- you can use the following cURL command (replace API_TOKEN and DOMAIN_NAME with your info):


curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" "https://api.digitalocean.com/v2/domains/DOMAIN_NAME/records"


This will return a JSON response that should include the record "id" for your host. For example:


{ "id": 1234567890, "type":"A", "name": "home", "data": "1.1.1.1"... }