[Pdns-users] Blocklist file format

Adrian M adrian.minta at gmail.com
Tue Mar 7 06:46:54 UTC 2023


Having a policy list implemented directly in pdns-resolver it will be a
very nice feature nowadays IMHO.

On Sun, Mar 5, 2023 at 5:29 PM Darac Marjal via Pdns-users <
pdns-users at mailman.powerdns.com> wrote:

> You might find https://github.com/thommay/blocklister useful. This script
> takes lists of domains - in the common adblock format - and compiles them
> into a lua file, performing sorting and deduplication as it goes.
>
>
> On 05/03/2023 10:28, Clifford Dsouza via Pdns-users wrote:
>
> 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
>
> _______________________________________________
> Pdns-users mailing listPdns-users at mailman.powerdns.comhttps://mailman.powerdns.com/mailman/listinfo/pdns-users
>
> _______________________________________________
> Pdns-users mailing list
> Pdns-users at mailman.powerdns.com
> https://mailman.powerdns.com/mailman/listinfo/pdns-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20230307/774bfa94/attachment.htm>


More information about the Pdns-users mailing list