[Pdns-users] Blocklist file format
Darac Marjal
mailinglist at darac.org.uk
Sun Mar 5 15:29:01 UTC 2023
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 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/20230305/e77789d6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20230305/e77789d6/attachment.sig>
More information about the Pdns-users
mailing list