]> granicus.if.org Git - pdns/commitdiff
dnsdist: add showSecurityStatus() command
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 14 Nov 2018 18:56:43 +0000 (19:56 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 15 Nov 2018 08:52:02 +0000 (09:52 +0100)
pdns/dnsdist-console.cc
pdns/dnsdist-lua.cc

index 10f1e91918409e441642974c3757e3e8ab7809f0..ab205d3a5657edd05cae865292122d8fac5c2f69 100644 (file)
@@ -462,6 +462,7 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "showResponseLatency", true, "", "show a plot of the response time latency distribution" },
   { "showResponseRules", true, "[{showUUIDs=false, truncateRuleWidth=-1}]", "show all defined response rules, optionally with their UUIDs and optionally truncated to a given width" },
   { "showRules", true, "[{showUUIDs=false, truncateRuleWidth=-1}]", "show all defined rules, optionally with their UUIDs and optionally truncated to a given width" },
+  { "showSecurityStatus", true, "", "Show the security status"},
   { "showSelfAnsweredResponseRules", true, "[{showUUIDs=false, truncateRuleWidth=-1}]", "show all defined self-answered response rules, optionally with their UUIDs and optionally truncated to a given width" },
   { "showServerPolicy", true, "", "show name of currently operational server selection policy" },
   { "showServers", true, "", "output all servers" },
index cae652c7825005439ec993d6c60934f34ee0c75c..2b7d7d5efba1bb08cf5ddc6d86b84501202522fd 100644 (file)
@@ -1268,6 +1268,11 @@ instance_name ? *instance_name : "main" ,
       g_outputBuffer = "dnsdist " + std::string(VERSION) + "\n";
     });
 
+  g_lua.writeFunction("showSecurityStatus", []() {
+      setLuaNoSideEffect();
+      g_outputBuffer = std::to_string(g_stats.securityStatus) + "\n";
+    });
+
 #ifdef HAVE_EBPF
   g_lua.writeFunction("setDefaultBPFFilter", [](std::shared_ptr<BPFFilter> bpf) {
       if (g_configurationDone) {