Bug: LuaDNS provider ignores "host" config value and always updates the first "A" or "AAAA" in the zone #147

Closed
opened 2025-11-20 04:20:56 -05:00 by saavagebueno · 4 comments
Owner

Originally created by @lymanepp on GitHub (Sep 30, 2021).

Originally assigned to: @qdm12 on GitHub.

LuaDNS provider ignores "host" config value and always updates the first "A" or "AAAA" in the zone

  1. Is this urgent: No, but it prevents me from having multiple "A" records in a zone
  2. DNS provider(s) you use: LuaDNS
  3. Program version:

Running version latest built on 2021-09-12T01:15:32Z (commit 01f4044)

  1. What are you using to run the container: Docker (QNAP container station)
  2. Extra information (optional)

Here are the LuaDNS "A" records in the zone after updating. You can see that only the first "A" record in the https://api.luadns.com/v1/zones/{zone_id}/records response is updated.
image

The following lines in the getRecord method only match the record type and ignore the host.

	for _, record := range records {
		if record.Type == recordType {
			return record, nil
		}
	}

Here's a trimmed copy of the https://api.luadns.com/v1/zones/{zone_id}/records response before running ddns-updater.

[
	{
		"id": 99999992,
		"name": "host1.example.com.",
		"type": "A",
		"content": "0.0.0.0",
		"ttl": 300,
		"zone_id": 9999,
		"generated": false,
		"created_at": "2021-09-30T15:44:20.142193Z",
		"updated_at": "2021-09-30T15:44:59.28068Z"
	},
	{
		"id": 99999993,
		"name": "host2.example.com.",
		"type": "A",
		"content": "0.0.0.0",
		"ttl": 300,
		"zone_id": 9999,
		"generated": false,
		"created_at": "2021-09-30T15:44:20.147579Z",
		"updated_at": "2021-09-30T15:44:20.147581Z"
	}
]

Logs:

2021/09/30 15:45:17 INFO Found 2 settings to update records
2021/09/30 15:45:17 INFO Reading history from database: domain example.com host host1
2021/09/30 15:45:17 INFO Reading history from database: domain example.com host host2
2021/09/30 15:45:17 INFO healthcheck server: listening on 127.0.0.1:9999
2021/09/30 15:45:17 INFO http server: listening on :8000
2021/09/30 15:45:17 INFO backup: disabled
2021/09/30 15:45:17 "GET http://127.0.0.1:8000/ HTTP/1.1" from 10.0.52.1:41216 - 200 1942B in 49.774µs
2021/09/30 15:45:17 INFO IPv4 address of host1.example.com is <nil> and your IPv4 address is 71.208.54.208
2021/09/30 15:45:17 INFO IPv4 address of host2.example.com is <nil> and your IPv4 address is 71.208.54.208
2021/09/30 15:45:17 INFO Updating record [domain: example.com | host: host1 | provider: luadns | ip: ipv4] to use 71.208.54.208
2021/09/30 15:45:18 INFO Updating record [domain: example.com | host: host2 | provider: luadns | ip: ipv4] to use 71.208.54.208

Configuration file (remove your credentials!):

{
  "settings": [
    {
      "provider": "luadns",
      "domain": "example.com",
      "host": "host1",
      "email": "jdoe@example.com",
      "token": "********************************",
      "ip_version": "ipv4"
    },
    {
      "provider": "luadns",
      "domain": "example.com",
      "host": "host2",
      "email": "jdoe@example.com",
      "token": "********************************",
      "ip_version": "ipv4"
    }
  ]
}

Host OS: QNAP QTS 4.5.4

Originally created by @lymanepp on GitHub (Sep 30, 2021). Originally assigned to: @qdm12 on GitHub. <!-- YOU CAN CHAT THERE EVENTUALLY: https://github.com/qdm12/ddns-updater/discussions --> LuaDNS provider ignores "host" config value and always updates the first "A" or "AAAA" in the zone 1. Is this urgent: No, but it prevents me from having multiple "A" records in a zone 2. DNS provider(s) you use: LuaDNS 3. Program version: ```Running version latest built on 2021-09-12T01:15:32Z (commit 01f4044)``` 4. What are you using to run the container: Docker (QNAP container station) 5. Extra information (optional) Here are the LuaDNS "A" records in the zone after updating. You can see that only the first "A" record in the https://api.luadns.com/v1/zones/{zone_id}/records response is updated. ![image](https://user-images.githubusercontent.com/4195527/135488632-760b449b-41bc-442a-93de-eb7cdc51c388.png) The following lines in the _getRecord_ method only match the record type and ignore the host. ``` for _, record := range records { if record.Type == recordType { return record, nil } } ``` Here's a trimmed copy of the https://api.luadns.com/v1/zones/{zone_id}/records response before running ddns-updater. ``` [ { "id": 99999992, "name": "host1.example.com.", "type": "A", "content": "0.0.0.0", "ttl": 300, "zone_id": 9999, "generated": false, "created_at": "2021-09-30T15:44:20.142193Z", "updated_at": "2021-09-30T15:44:59.28068Z" }, { "id": 99999993, "name": "host2.example.com.", "type": "A", "content": "0.0.0.0", "ttl": 300, "zone_id": 9999, "generated": false, "created_at": "2021-09-30T15:44:20.147579Z", "updated_at": "2021-09-30T15:44:20.147581Z" } ] ``` Logs: ``` 2021/09/30 15:45:17 INFO Found 2 settings to update records 2021/09/30 15:45:17 INFO Reading history from database: domain example.com host host1 2021/09/30 15:45:17 INFO Reading history from database: domain example.com host host2 2021/09/30 15:45:17 INFO healthcheck server: listening on 127.0.0.1:9999 2021/09/30 15:45:17 INFO http server: listening on :8000 2021/09/30 15:45:17 INFO backup: disabled 2021/09/30 15:45:17 "GET http://127.0.0.1:8000/ HTTP/1.1" from 10.0.52.1:41216 - 200 1942B in 49.774µs 2021/09/30 15:45:17 INFO IPv4 address of host1.example.com is <nil> and your IPv4 address is 71.208.54.208 2021/09/30 15:45:17 INFO IPv4 address of host2.example.com is <nil> and your IPv4 address is 71.208.54.208 2021/09/30 15:45:17 INFO Updating record [domain: example.com | host: host1 | provider: luadns | ip: ipv4] to use 71.208.54.208 2021/09/30 15:45:18 INFO Updating record [domain: example.com | host: host2 | provider: luadns | ip: ipv4] to use 71.208.54.208 ``` Configuration file (**remove your credentials!**): ``` { "settings": [ { "provider": "luadns", "domain": "example.com", "host": "host1", "email": "jdoe@example.com", "token": "********************************", "ip_version": "ipv4" }, { "provider": "luadns", "domain": "example.com", "host": "host2", "email": "jdoe@example.com", "token": "********************************", "ip_version": "ipv4" } ] } ``` Host OS: QNAP QTS 4.5.4
Author
Owner

@lymanepp commented on GitHub (Oct 1, 2021):

I created pull request https://github.com/qdm12/ddns-updater/pull/249 with a proposed fix.

@lymanepp commented on GitHub (Oct 1, 2021): I created pull request https://github.com/qdm12/ddns-updater/pull/249 with a proposed fix.
Author
Owner

@qdm12 commented on GitHub (Oct 2, 2021):

Hey @lymanepp thank you for the detailed issue and digging in there to fix it yourself 💯

And also sorry for the delay answering, I was a bit swamped with work recently. I wrote a comment on your PR to test the container with your changes 😉

@qdm12 commented on GitHub (Oct 2, 2021): Hey @lymanepp thank you for the detailed issue and digging in there to fix it yourself 💯 And also sorry for the delay answering, I was a bit swamped with work recently. I wrote a comment on your PR to test the container with your changes 😉
Author
Owner

@lymanepp commented on GitHub (Oct 5, 2021):

Hey @qdm12, the PR has been updated and is ready to be merged.

@lymanepp commented on GitHub (Oct 5, 2021): Hey @qdm12, the PR has been updated and is ready to be merged.
Author
Owner

@qdm12 commented on GitHub (Oct 6, 2021):

Merged thanks for the contribution!! 🏅

@qdm12 commented on GitHub (Oct 6, 2021): Merged thanks for the contribution!! 🏅
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ddns-updater#147