Skip to content

Instantly share code, notes, and snippets.

View vavrusa's full-sized avatar

Marek Vavruša vavrusa

View GitHub Profile
@vavrusa
vavrusa / slowdrip.lua
Last active August 29, 2015 14:24
DNS slowdrip
local slowdrip = {
tracked = {},
blocked = {},
window = 60, -- Length of the tracking window
threshold = 100, -- Number of NXDOMAINs before blocking
-- Track suffixes of names leading to NXDOMAIN
layer = {
finish = function(state, req, answer)
local parent = answer:qname()
parent = parent:sub(parent:find('.',0,true), -1)
Near-stretch ideas
------------------
* I *quite* like how it's built, but it's too much *PowerDNS*-y, hacking on it is a pain (if you work on cheap virtuals like me) because of long build times and dependencies (I know, but try it yourself on the budget DigitalOcean droplet...), I'd say lose the legacy and make it really a standalone thing.
* The configuration is sometimes confusing, like if I set it up to listen on local interfaces, it happily does so but it silently drops all queries because the ACL allows localhost only (uhm, maybe it needs to say something in verbose mode or documentation update).
* The config format for IPv6 has a poor choice of ':' as a separator, it's not possible to forward to IPv6 address on a custom port.
Far-stretch ideas
-----------------
3 0.979429111596
4 0.979429111596
5 0.979429111596
6 0.979429111596
7 0.979429111596
8 0.979429111596
9 0.979429111596
10 0.979429111596
11 0.979429111596
12 0.979429111596