[Pdns-users] Blocklist file format

Clifford Dsouza clifford at microscan.co.in
Sun Mar 5 10:28:35 UTC 2023


Hi

I've configured Powerdns to block certain domain using lua..

The lua file the recursor.conf refers to has the below code

-----------------------------------------------------
blocked_domains=newDS()

 blocked_domains:add(dofile("/etc/pdns-recursor/blocklist.lua"))

function preresolve(dq)

  if(not blocked_domains:check(dq.qname) or (dq.qtype ~= pdns.A and dq.qtype ~= pdns.AAAA)) then
            return false
                else

  dq:addAnswer(pdns.A, "182.X.X.X", 60, "blockpage.co.in")
return true
end
   end
-----------------------------------------------------
the code references the block list file that has the below format
-----------------------------------------------------
return {
"site1.tobeblocked.com",
"site2.tobeblocked.com",
"site3.tobeblocked.com",
}
--------------------------------------------------

Is there a way I can populate the blocklist file it with the list of domains that I want to block, one domain per line, instead of the other extra characters that i need to type, I just want to avoid syntax errors when updating the file.


Thanks

Clifford

NOTICE: This message contains privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you are hereby notified that you must not disseminate, copy or take any action in reliance on it. If you have received this message in error please notify Microscan Infocommtech Pvt. Ltd. immediately. Any views expressed in this message are those of the individual sender, except where the sender has the authority to issue and specifically states them. Tel - 022-66870600 Fax - 022-66870800
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20230305/a1b7348e/attachment.htm>


More information about the Pdns-users mailing list