From: Remi Gacogne Date: Wed, 15 May 2019 15:11:44 +0000 (+0200) Subject: dnsdist: Expose SNI to the Lua DNSQuestion object as well X-Git-Tag: rec-4.2.0-rc1~3^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15e21d849e5354a3f647929a3c8b0c883553fafb;p=thirdparty%2Fpdns.git dnsdist: Expose SNI to the Lua DNSQuestion object as well --- diff --git a/pdns/dnsdist-lua-bindings-dnsquestion.cc b/pdns/dnsdist-lua-bindings-dnsquestion.cc index dbbb6cdba9..1392397e89 100644 --- a/pdns/dnsdist-lua-bindings-dnsquestion.cc +++ b/pdns/dnsdist-lua-bindings-dnsquestion.cc @@ -85,6 +85,10 @@ void setupLuaBindingsDNSQuestion() return true; }); + g_lua.registerFunction("getServerNameIndication", [](const DNSQuestion& dq) { + return dq.sni; + }); + g_lua.registerFunction("sendTrap", [](const DNSQuestion& dq, boost::optional reason) { #ifdef HAVE_NET_SNMP if (g_snmpAgent && g_snmpTrapsEnabled) { diff --git a/pdns/dnsdistdist/docs/reference/dq.rst b/pdns/dnsdistdist/docs/reference/dq.rst index e451eb62e0..d8f37c51ba 100644 --- a/pdns/dnsdistdist/docs/reference/dq.rst +++ b/pdns/dnsdistdist/docs/reference/dq.rst @@ -92,6 +92,14 @@ This state can be modified from the various hooks. :returns: A table of EDNSOptionView objects, indexed on the ECS Option code + .. method:: DNSQuestion:getServerNameIndication() -> string + + .. versionadded:: 1.4.0 + + Return the TLS Server Name Indication (SNI) value sent by the client over DoT or DoH, if any + + :returns: A string containing the TLS SNI value, if any + .. method:: DNSQuestion:getTag(key) -> string .. versionadded:: 1.2.0