pdns icon indicating copy to clipboard operation
pdns copied to clipboard

dnsdist: add a Rule Selector to match DoT rules

Open franklouwers opened this issue 1 year ago • 3 comments

  • Program: dnsdist
  • Issue type: Feature request

Short description

A selector which matches DoT (and DoT only) packets should exist, so I can do the following:

addAction(DOTRule('.*'), LuaAction(dot_handling))

Usecase

A single dnsdist instance can handle multiple "transport mechanisms" of the DNS protocol: udp/53, tcp/53, DoH, DoQ, DoT, some of these wrapped in Proxy Protocol capsules.

As a dns operator, I might want to handle some of those transport mechanisms differently than others on the same node.

For most of those, I can use a proper Selection Rule in combination with an addAction() to apply a certain function or behaviour.

Selectors exist for DoH (-variants) using HTTPHeaderRule(), for EDNS options, for the Proxy Protocol etc.

However, there is currently no way to select only DoT traffic.

Description

The closest thing would be SNIRule(), but that matches both DoT and DoH.

We would use DSTPortRule() to target only the DoT pool, but properly selecting DoT would of course be better.

Alternative would be to send all traffic to a rule, and use dq:getProtocol() and string-matching to branch out to different functions.

franklouwers avatar Apr 11 '24 10:04 franklouwers

I agree a rule to match on the incoming protocol would be useful, perhaps something like: IncomingProtocolRule(protocol), with the protocol as a (case-insensitive) string.

I'm not sure I understand what .* represents in your example?

rgacogne avatar Apr 15 '24 08:04 rgacogne

Could be regexp match on the SNI, but just on the protocol would be enough...

franklouwers avatar Apr 15 '24 09:04 franklouwers

Understood, thanks!

rgacogne avatar Apr 15 '24 09:04 rgacogne