]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Expose SNI to the Lua DNSQuestion object as well
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 15 May 2019 15:11:44 +0000 (17:11 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 May 2019 09:10:28 +0000 (11:10 +0200)
pdns/dnsdist-lua-bindings-dnsquestion.cc
pdns/dnsdistdist/docs/reference/dq.rst

index dbbb6cdba95ea2f0c08d4a0d8308d9618f725053..1392397e89c71874d3eb0ec67172a07182d1ab88 100644 (file)
@@ -85,6 +85,10 @@ void setupLuaBindingsDNSQuestion()
       return true;
     });
 
+  g_lua.registerFunction<std::string(DNSQuestion::*)()>("getServerNameIndication", [](const DNSQuestion& dq) {
+      return dq.sni;
+    });
+
   g_lua.registerFunction<void(DNSQuestion::*)(std::string)>("sendTrap", [](const DNSQuestion& dq, boost::optional<std::string> reason) {
 #ifdef HAVE_NET_SNMP
       if (g_snmpAgent && g_snmpTrapsEnabled) {
index e451eb62e06616619ff862d6cd75970def55b775..d8f37c51bae6028ef2d3c1502cc48628eeb957b5 100644 (file)
@@ -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