From a1d18701ee635fe1041df54175533efc4a7e87c7 Mon Sep 17 00:00:00 2001 From: swoga Date: Mon, 24 Feb 2020 15:02:20 +0100 Subject: [PATCH] Implement rmACL() --- 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 f5d559a5c2..008e3d5abb 100644 --- a/pdns/dnsdist-console.cc +++ b/pdns/dnsdist-console.cc @@ -492,6 +492,7 @@ const std::vector g_consoleKeywords{ { "reloadAllCertificates", true, "", "reload all DNSCrypt and TLS certificates, along with their associated keys" }, { "RemoteLogAction", true, "RemoteLogger [, alterFunction [, serverID]]", "send the content of this query to a remote logger via Protocol Buffer. `alterFunction` is a callback, receiving a DNSQuestion and a DNSDistProtoBufMessage, that can be used to modify the Protocol Buffer content, for example for anonymization purposes. `serverID` is the server identifier." }, { "RemoteLogResponseAction", true, "RemoteLogger [,alterFunction [,includeCNAME [, serverID]]]", "send the content of this response to a remote logger via Protocol Buffer. `alterFunction` is the same callback than the one in `RemoteLogAction` and `includeCNAME` indicates whether CNAME records inside the response should be parsed and exported. The default is to only exports A and AAAA records. `serverID` is the server identifier." }, + { "rmACL", true, "netmask", "remove netmask from ACL" }, { "rmCacheHitResponseRule", true, "id", "remove cache hit response rule in position 'id', or whose uuid matches if 'id' is an UUID string" }, { "rmResponseRule", true, "id", "remove response rule in position 'id', or whose uuid matches if 'id' is an UUID string" }, { "rmRule", true, "id", "remove rule in position 'id', or whose uuid matches if 'id' is an UUID string" }, diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 8ff462b09f..2f20990ac5 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -547,6 +547,11 @@ static void setupLuaConfig(bool client, bool configCheck) g_ACL.modify([domain](NetmaskGroup& nmg) { nmg.addMask(domain); }); }); + g_lua.writeFunction("rmACL", [](const std::string& netmask) { + setLuaSideEffect(); + g_ACL.modify([netmask](NetmaskGroup& nmg) { nmg.deleteMask(netmask); }); + }); + g_lua.writeFunction("setLocal", [client](const std::string& addr, boost::optional vars) { setLuaSideEffect(); if(client) -- 2.47.2