]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Implement rmACL()
authorswoga <swoga@users.noreply.github.com>
Mon, 24 Feb 2020 14:02:20 +0000 (15:02 +0100)
committerswoga <swoga@users.noreply.github.com>
Mon, 24 Feb 2020 14:02:20 +0000 (15:02 +0100)
pdns/dnsdist-console.cc
pdns/dnsdist-lua.cc

index f5d559a5c2f0d8ec1314dd030d1a1f7573baa864..008e3d5abbadcad37d1bb743e4d6fbb22bae8352 100644 (file)
@@ -492,6 +492,7 @@ const std::vector<ConsoleKeyword> 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" },
index 8ff462b09fa97852dc83e21dfa99a9b283a6dc0a..2f20990ac55fe316176ad4767914bcab2b69ae5d 100644 (file)
@@ -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<localbind_t> vars) {
       setLuaSideEffect();
       if(client)