Replies: 4 comments 8 replies
-
I will look at the other point later, but to answer one of your questions: For randomizaition of TTLs in Lua, the following script does "work", but on the other hand is extremely broken, as all records in the same recordset (same name and type) should have the same TTL. Also I expect increasing TTLs compared to the original can cause bad side effects. SO DON'T USE IN PRODUCTION!. function randomizeTTL(originalTTL)
if originalTTL <= 300 then
return math.random(600, 900)
else
return math.random(3000, 4000)
end
end
function postresolve(dq)
records = dq:getRecords()
for i, record in pairs(records) do
local newTTL = randomizeTTL(record.ttl)
record.ttl = newTTL
end
dq:setRecords(records)
return true
end |
Beta Was this translation helpful? Give feedback.
-
https://datatracker.ietf.org/doc/html/rfc2181#section-5.2 explains why resource records in a resource record set (defined as having the same name and type) must have the same TTL. Clients are even supposed to drop RRSets having divergent TTLs. |
Beta Was this translation helpful? Give feedback.
-
This might work indeed. Note you still might encounter issues if the RRSIG RR TTL does not match the TTL of the RRSet it signs (see https://www.rfc-editor.org/rfc/rfc4034 section 3 last sentence). There might be other edge cases as well. Some randomn thoughts/remarks: As for refreshing all the records in the cache, I would argue against that, as it will fill the cache with useless records: records that will never be re-queried by clients (not only pseudo random attacks, but also genuine transient records. There's also the case of records that do not exist anymore (are not served anymore by auths): re-querying those wil fill up the negative cache with what is likely useless data as the original record was meant to be transient. Add to that that the cache is a finite resource: if it fills up, the recursor still has to evict records. Now I think a mechanism that makes a difference between the TTLs sent to the client and the one internally used for cache expiration could be effective: the internal TTLs still would be the one received from the auth. The one sent to the client could still be much lower, even 1 for all maybe records (I did not think this through 100%). This would require internal modification to the record cache and/or packet cache, though. Maybe dnsdist would be easier for this approach. Generally speaking, I believe what you are trying to achieve is hard. The proposed methods might help a bit achieving what you are trying to do, but a big gap remains: to see if a name was in the cache, it is enough to measure the response times. A cache hit will be orders of magnitude faster than a cache miss. If you do not introduce delays in your cache hit respones it still will be trivial to tell them apart from cache hits. But introducing delays will create big queues of work in rec or dnsdist, so that has big drawbacks. |
Beta Was this translation helpful? Give feedback.
-
That is a bold statement, which I don't think is true. While it mightlook like that in your particular use case, one pseudo random attack on a wildcard name and the cache explodes. As for refreshing: the current mechanism works as a best effort mechanism, with even some rate limiting built in. Using the same mechanism for a full cache refresh is not going to fly is my gut feeling. Not so much because it increases load of authoritative servers. The big pain point wil be the increase of the amount of work to be done by the recursor itself. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First of all, Hi!
Nothing to hide is a privacy infrastructure provider in the Netherlands (https://nothingtohide.nl/) and we're working on making DNS more resistant to timeless timing attacks and correlation attacks. This is a important feature for anonymity networks, especially with the current state of surveillance in many countries.
This entails much more than just adding functionality to dnsdist/Recursor, but by far the biggest challenges are how to add 3 features to dnsdist/Recursor. These are explained below and I hope some people with much more knowledgable than me can help with this :).
It's much appreciated!
1 Random TTL to clients (dnsdist)
DNS frontend (dnsdist) answers client requests with a random TTL within a configured range.
[1]
2 DNS hot cache (Recursor)
The DNS cache refreshes all cached records before they expire.
[2] https://blog.powerdns.com/2022/04/28/refreshing-of-almost-expired-records-keeping-the-cache-hot
3 Random TTL in cache (Recursor)
The DNS cache contains random TTL values, depending on a record's original TTL value.
/usr/local/etc/pdns/recursor.yml:
/usr/local/etc/pdns/recursor.lua:
dig
just consistently returns the cached original TTLs, so my fiddling with Lua isn't working. And to be clear: I'm not a programmer, so with my limited shell scripting experience, I've scoured the internet for examples in git repos and documentation. This is what came out of it after much trial and error.4 Domain feedback loop (for information)
This isn't so much a PowerDNS software feature, but I thought I'd share it anyway in case people like getting some more background information about how the cache is reloaded.
I'm building a tool to automate a weekly domain feedback loop, in order to sync the preload cache between recursors and the make clearing the cache (rebooting for kernel updates) possible without losing the valuable cache entries. The idea is to grow the preload list with actively used records. Roughly as follows:
Beta Was this translation helpful? Give feedback.
All reactions