Comments (9)
- I forgot to add
type
logging on thedomain not found in DNS
message, so that explains the doubling there, since one is for A and the other for AAAA - That is weird that there's two
updating DNS record
logs, that definitely does mean there's two records in the slice. Probably need more logs in the steps of the loop atcaddy-dynamicdns/dynamicdns.go
Line 204 in 3cdd858
from caddy-dynamicdns.
Yep, this must be a problem with https://github.com/libdns/porkbun because this plugin uses SetRecords
which implies that existing records should be replaced instead of appended.
caddy-dynamicdns/dynamicdns.go
Line 247 in 3cdd858
from caddy-dynamicdns.
I ran it again with debug logging:
2023/09/02 09:24:58 DEBUG dynamic_dns found DNS record {"type": "A", "name": "wireguard.home.mietzen.xyz", "zone": "mietzen.xyz", "value": "xxx.xxx.xxx.123"}
2023/09/02 09:24:58 DEBUG dynamic_dns found DNS record {"type": "A", "name": "home-assistant.home.mietzen.xyz", "zone": "mietzen.xyz", "value": "xxx.xxx.xxx.123"}
2023/09/02 09:24:58 DEBUG dynamic_dns found DNS record {"type": "A", "name": "vaultwarden.home.mietzen.xyz", "zone": "mietzen.xyz", "value": "xxx.xxx.xxx.123"}
2023/09/02 09:24:58 DEBUG dynamic_dns found DNS record {"type": "A", "name": "wireguard.home.mietzen.xyz", "zone": "mietzen.xyz", "value": "xxx.xxx.xxx.172"}
2023/09/02 09:24:58 DEBUG dynamic_dns found DNS record {"type": "A", "name": "home-assistant.home.mietzen.xyz", "zone": "mietzen.xyz", "value": "xxx.xxx.xxx.172"}
2023/09/02 09:24:58 DEBUG dynamic_dns found DNS record {"type": "A", "name": "vaultwarden.home.mietzen.xyz", "zone": "mietzen.xyz", "value": "xxx.xxx.xxx.172"}
2023/09/02 09:24:58 INFO dynamic_dns domain not found in DNS {"domain": "wireguard.home.mietzen.xyz"}
2023/09/02 09:24:58 INFO dynamic_dns domain not found in DNS {"domain": "wireguard.home.mietzen.xyz"}
2023/09/02 09:24:58 INFO dynamic_dns domain not found in DNS {"domain": "home-assistant.home.mietzen.xyz"}
2023/09/02 09:24:58 INFO dynamic_dns domain not found in DNS {"domain": "home-assistant.home.mietzen.xyz"}
2023/09/02 09:24:58 INFO dynamic_dns domain not found in DNS {"domain": "vaultwarden.home.mietzen.xyz"}
2023/09/02 09:24:58 INFO dynamic_dns domain not found in DNS {"domain": "vaultwarden.home.mietzen.xyz"}
2023/09/02 09:24:58 DEBUG dynamic_dns looked up current IPs from DNS {"lastIPs": {"home-assistant.home.mietzen.xyz":{"A":[""],"AAAA":[""]},"vaultwarden.home.mietzen.xyz":{"A":[""],"AAAA":[""]},"wireguard.home.mietzen.xyz":{"A":[""],"AAAA":[""]}}}
2023/09/02 09:24:58 DEBUG dynamic_dns.ip_sources.command running command {"command": "/opt/CaddyV2/fritzbox_ext_ip", "args": ["192.168.178.1"], "dir": "", "timeout": 30000000000}
2023/09/02 09:24:59 DEBUG dynamic_dns.ip_sources.command parsed ip succesfull {"command": "/opt/CaddyV2/fritzbox_ext_ip", "args": ["192.168.178.1"], "stdout": "xxx.xxx.xxx.172\n", "ip": "xxx.xxx.xxx.172"}
2023/09/02 09:24:59 INFO dynamic_dns updating DNS record {"zone": "mietzen.xyz", "type": "A", "name": "wireguard.home", "value": "xxx.xxx.xxx.172", "ttl": 3600}
2023/09/02 09:24:59 INFO dynamic_dns updating DNS record {"zone": "mietzen.xyz", "type": "A", "name": "home-assistant.home", "value": "xxx.xxx.xxx.172", "ttl": 3600}
2023/09/02 09:24:59 INFO dynamic_dns updating DNS record {"zone": "mietzen.xyz", "type": "A", "name": "vaultwarden.home", "value": "xxx.xxx.xxx.172", "ttl": 3600}
2023/09/02 09:25:00 INFO dynamic_dns finished updating DNS {"current_ips": ["xxx.xxx.xxx.172"]}
dynamic_dns
seems to find the records, but doesn't associate them with the ones it should update.
2023/09/02 09:24:58 DEBUG dynamic_dns found DNS record {"type": "A", "name": "wireguard.home.mietzen.xyz", "zone": "mietzen.xyz", "value": "xxx.xxx.xxx.123"}
...
2023/09/02 09:24:58 INFO dynamic_dns domain not found in DNS {"domain": "wireguard.home.mietzen.xyz"}
...
2023/09/02 09:24:58 DEBUG dynamic_dns looked up current IPs from DNS {"lastIPs": {"home-assistant.home.mietzen.xyz":{"A":[""],"AAAA":[""]},"vaultwarden.home.mietzen.xyz":{"A":[""],"AAAA":[""]},"wireguard.home.mietzen.xyz":{"A":[""],"AAAA":[""]}}}
...
2023/09/02 09:24:59 INFO dynamic_dns updating DNS record {"zone": "mietzen.xyz", "type": "A", "name": "wireguard.home", "value": "xxx.xxx.xxx.172", "ttl": 3600}
My best guess is that zone
and name
are not properly handled by: https://github.com/libdns/porkbun or https://github.com/caddy-dns/porkbun
Since it includes the zone
in the name
and dynamic_dns
expects the name
to not include the zone
, is this right?
from caddy-dynamicdns.
I just ran into this with the Namecheap provider, too.
@francislavoie Isn't there an issue in this repo though ("lookupCurrentIPsFromDNS") that causes the "domain not found in DNS" in the first place? Even with a "SetRecords" fix in the provider, this will continue to happen.
In fact, in this case, it will update the "current" records map with a null IP, even when one exists. Just a hunch, but this might influence DNS providers in the "SetRecords" call to believe there isn't an outstanding record (sure, you could argue it could independently verify) for the affected zone(s) which might be the cause of this whole thing.
from caddy-dynamicdns.
@whirlthesquirrel To make sure I understand, are you suggesting that the records passed into SetRecords()
have different values (a different name and type)? As far as I can tell, that would be the only way to append instead of replace, at least with a correct implementation of SetRecords.
from caddy-dynamicdns.
@mholt I think I was reading too much into the "domain not found in DNS" logging and didn't see the post-processing that takes place before the call to "SetRecords".
Here are my log entries in debug:
caddy | {"level":"debug","ts":1694021296.4225838,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"*","zone":"example.com","value":"old_ip"}
caddy | {"level":"debug","ts":1694021296.4226384,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"@","zone":"example.com","value":"unrelated_ip"}
caddy | {"level":"debug","ts":1694021296.4226441,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"www","zone":"example.com","value":"unrelated_ip"}
caddy | {"level":"info","ts":1694021296.4226513,"logger":"dynamic_dns","msg":"domain not found in DNS","domain":"*.example.com"}
caddy | {"level":"info","ts":1694021296.4226577,"logger":"dynamic_dns","msg":"domain not found in DNS","domain":"*.example.com"}
caddy | {"level":"debug","ts":1694021296.4226687,"logger":"dynamic_dns","msg":"looked up current IPs from DNS","lastIPs":{"*.example.com":{"A":["old_ip"],"AAAA":[""]}}}
caddy | {"level":"debug","ts":1694021296.6638966,"logger":"dynamic_dns.ip_sources.simple_http","msg":"lookup","type":"IPv4","endpoint":"https://api64.ipify.org","ip":"new_ip"}
caddy | {"level":"info","ts":1694021296.6639485,"logger":"dynamic_dns","msg":"updating DNS record","zone":"example.com","type":"A","name":"*","value":"new_ip","ttl":0}
caddy | {"level":"info","ts":1694021296.6639616,"logger":"dynamic_dns","msg":"updating DNS record","zone":"example.com","type":"A","name":"*","value":"new_ip","ttl":0}
caddy | {"level":"info","ts":1694021297.377286,"logger":"dynamic_dns","msg":"finished updating DNS","current_ips":["new_ip"]}
I'm not sure I understand why there is two updates on the same record (or if it's still just one call to "SetRecords"), but I suppose that's not really related to this issue?
from caddy-dynamicdns.
I updated the logging to log the record type as you mentioned (I was thinking the same thing too), along with the current IPs.
From when there was no previously existing A record:
caddy | {"level":"debug","ts":1694096804.235109,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"@","zone":"example.com","value":"unrelated_ip"}
caddy | {"level":"debug","ts":1694096804.2352726,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"www","zone":"example.com","value":"unrelated_ip"}
caddy | {"level":"info","ts":1694096804.2352831,"logger":"dynamic_dns","msg":"domain not found in DNS","domain":"*.example.com","type":"A"}
caddy | {"level":"info","ts":1694096804.2352898,"logger":"dynamic_dns","msg":"domain not found in DNS","domain":"*.example.com","type":"AAAA"}
caddy | {"level":"debug","ts":1694096804.2353253,"logger":"dynamic_dns","msg":"looked up current IPs from DNS","lastIPs":{"*.example.com":{"A":[""],"AAAA":[""]}}}
caddy | {"level":"debug","ts":1694096804.417885,"logger":"dynamic_dns.ip_sources.simple_http","msg":"lookup","type":"IPv4","endpoint":"https://api64.ipify.org","ip":"new_ip"}
caddy | {"level":"debug","ts":1694096804.4179177,"logger":"dynamic_dns","msg":"found current IP","value":"new_ip","type":"A"}
caddy | {"level":"info","ts":1694096804.4179363,"logger":"dynamic_dns","msg":"updating DNS record","zone":"example.com","type":"A","name":"*","value":"new_ip","ttl":0}
caddy | {"level":"info","ts":1694096805.7142298,"logger":"dynamic_dns","msg":"finished updating DNS","current_ips":["new_ip"]}
From when there was a single, outdated A record:
caddy | {"level":"debug","ts":1694096926.982758,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"*","zone":"example.com","value":"old_ip"}
caddy | {"level":"debug","ts":1694096926.9828343,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"@","zone":"example.com","value":"unrelated_ip"}
caddy | {"level":"debug","ts":1694096926.9828475,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"www","zone":"example.com","value":"unrelated_ip"}
caddy | {"level":"info","ts":1694096926.9828606,"logger":"dynamic_dns","msg":"domain not found in DNS","domain":"*.example.com","type":"AAAA"}
caddy | {"level":"debug","ts":1694096926.9828837,"logger":"dynamic_dns","msg":"looked up current IPs from DNS","lastIPs":{"*.example.com":{"A":["old_ip"],"AAAA":[""]}}}
caddy | {"level":"debug","ts":1694096927.2460074,"logger":"dynamic_dns.ip_sources.simple_http","msg":"lookup","type":"IPv4","endpoint":"https://api64.ipify.org","ip":"new_ip"}
caddy | {"level":"debug","ts":1694096927.24605,"logger":"dynamic_dns","msg":"found current IP","value":"new_ip","type":"A"}
caddy | {"level":"info","ts":1694096927.2460687,"logger":"dynamic_dns","msg":"updating DNS record","zone":"example.com","type":"A","name":"*","value":"new_ip","ttl":0}
caddy | {"level":"info","ts":1694096928.0516918,"logger":"dynamic_dns","msg":"finished updating DNS","current_ips":["new_ip"]}
From when the new record has already been appended with the existing, outdated A record:
caddy | {"level":"debug","ts":1694096065.9506721,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"*","zone":"example.com","value":"old_ip"}
caddy | {"level":"debug","ts":1694096065.9507217,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"*","zone":"example.com","value":"new_ip"}
caddy | {"level":"debug","ts":1694096065.950729,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"@","zone":"example.com","value":"unrelated_ip"}
caddy | {"level":"debug","ts":1694096065.9507356,"logger":"dynamic_dns","msg":"found DNS record","type":"A","name":"www","zone":"example.com","value":"unrelated_ip"}
caddy | {"level":"info","ts":1694096065.950744,"logger":"dynamic_dns","msg":"domain not found in DNS","domain":"*.example.com","type":"AAAA"}
caddy | {"level":"debug","ts":1694096065.9507565,"logger":"dynamic_dns","msg":"looked up current IPs from DNS","lastIPs":{"*.example.com":{"A":["new_ip"],"AAAA":[""]}}}
caddy | {"level":"debug","ts":1694096066.222695,"logger":"dynamic_dns.ip_sources.simple_http","msg":"lookup","type":"IPv4","endpoint":"https://api64.ipify.org","ip":"new_ip"}
caddy | {"level":"debug","ts":1694096066.222732,"logger":"dynamic_dns","msg":"found current IP","value":"new_ip","type":"A"}
caddy | {"level":"debug","ts":1694096066.2227442,"logger":"dynamic_dns","msg":"no IP address change; no update needed"}
That's strange, because from the log I posted before, it looks like the middle case would be the one to reproduce the same behavior (2 "domain not found in DNS" entries, assuming "A" and "AAAA"?), which didn't this time. Not sure what's going on there and how it's different from before.
Should "domain not found in DNS" be emitted on "AAAA" records when only "versions ipv4" is specified?
Also, Namecheap has the concept of a "Dynamic DNS password", which is separate from an API key. To use the API, you have to have a whitelisted client IP. I believe Caddy was able to update the records without whitelisting, but not fetch the existing ones without the client IP being whitelisted. If fetching existing records is a requirement for proper functionality here, and since whitelisting a new IP would have to be done manually, it seems counter-intuitive to use an API key for dynamic DNS. Something to think about if the current DNS provider interface is not sufficient to solve this, as it would unnecessarily update every time.
from caddy-dynamicdns.
Not sure what's going on there and how it's different from before.
🤷♂️ I guess you're saying you can't replicate the problem after adjusting the logging?
Should "domain not found in DNS" be emitted on "AAAA" records when only "versions ipv4" is specified?
Probably not. An oversight when I implemented that I guess. PR is welcome if you want to adjust it 👍
I believe Caddy was able to update the records without whitelisting, but not fetch the existing ones without the client IP being whitelisted.
😱 that seems backwards... write operations should have "higher security" than read operations.
Either way I'd just argue "Namecheap's API is dumb and bad, and there's not much we can do about that".
from caddy-dynamicdns.
🤷♂️ I guess you're saying you can't replicate the problem after adjusting the logging?
Unfortunately, yeah. 😞
😱 that seems backwards... write operations should have "higher security" than read operations.
Either way I'd just argue "Namecheap's API is dumb and bad, and there's not much we can do about that".
Honestly, fair enough! 😆 Thanks for your help.
from caddy-dynamicdns.
Related Issues (20)
- domain not found in DNS HOT 9
- Bug: Will not update when one domain is outdated but another is up-to-date HOT 2
- [Feature request] Add an option to use address on specific interface directly. HOT 5
- do not update IPv6 HOT 3
- failed setting DNS record(s) with new IP address(es) - expected 1 zone, got 0 for [external.domain.tld] HOT 4
- Enable Cloudflare Proxy Status HOT 6
- [Feature Request] Get IP from Fritz!Box HOT 11
- Use own IP source HOT 2
- Variable for public ip HOT 16
- panic: assignment to entry in nil map HOT 4
- Using multiple providers HOT 4
- Add HA support. HOT 4
- Context canceled while creating new records when triggered by /load HOT 3
- Update fails for Digital Ocean HOT 4
- Use netip package?
- Possible issue with "ip_source interface" with dual stack interfaces HOT 13
- dns provider hetzner HOT 6
- Module not building with xcaddy HOT 8
- Interface IP source doesn't refresh when server connects to internet on boot HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caddy-dynamicdns.