From: Pieter Lexis Date: Wed, 14 Nov 2018 18:56:43 +0000 (+0100) Subject: dnsdist: add showSecurityStatus() command X-Git-Tag: auth-4.2.0-alpha1~30^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb0ca4605f8c90bed31217248ca6c77740975109;p=pdns dnsdist: add showSecurityStatus() command --- diff --git a/pdns/dnsdist-console.cc b/pdns/dnsdist-console.cc index 10f1e9191..ab205d3a5 100644 --- a/pdns/dnsdist-console.cc +++ b/pdns/dnsdist-console.cc @@ -462,6 +462,7 @@ const std::vector 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" }, diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index cae652c78..2b7d7d5ef 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -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 bpf) { if (g_configurationDone) {