From eb0ca4605f8c90bed31217248ca6c77740975109 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Wed, 14 Nov 2018 19:56:43 +0100 Subject: [PATCH] dnsdist: add showSecurityStatus() command --- pdns/dnsdist-console.cc | 1 + pdns/dnsdist-lua.cc | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/pdns/dnsdist-console.cc b/pdns/dnsdist-console.cc index 10f1e91918..ab205d3a56 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 cae652c782..2b7d7d5efb 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) { -- 2.47.2