<div dir="ltr">Having a policy list implemented directly in pdns-resolver it will be a very nice feature <span><span>nowadays IMHO.<br></span></span></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 5, 2023 at 5:29 PM Darac Marjal via Pdns-users <<a href="mailto:pdns-users@mailman.powerdns.com">pdns-users@mailman.powerdns.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>You might find <a href="https://github.com/thommay/blocklister" target="_blank">https://github.com/thommay/blocklister</a> 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.<br>
</p>
<p><br>
</p>
<div>On 05/03/2023 10:28, Clifford Dsouza
via Pdns-users wrote:<br>
</div>
<blockquote type="cite">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Hi</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
I've configured Powerdns to block certain domain using lua..</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
The lua file the recursor.conf refers to has the below code</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
-----------------------------------------------------</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
blocked_domains=newDS()
<div><br>
</div>
<div> blocked_domains:add(dofile("/etc/pdns-recursor/blocklist.lua"))</div>
<div><br>
</div>
<div>function preresolve(dq)</div>
<div><br>
</div>
<div> if(not
blocked_domains:check(dq.qname) or (dq.qtype ~= pdns.A and
dq.qtype ~= pdns.AAAA)) then</div>
<div> return false</div>
<div> else</div>
<div><br>
</div>
<div> dq:addAnswer(pdns.A, "182.X.X.X", 60, "<a href="http://blockpage.co.in" target="_blank">blockpage.co.in</a>")<br>
</div>
<div>return true</div>
<div>end</div>
<div> end</div>
-----------------------------------------------------</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
the code references the block list file that has the below
format</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
-----------------------------------------------------</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
return {
<div>"<a href="http://site1.tobeblocked.com" target="_blank">site1.tobeblocked.com</a>",</div>
<div>"<span style="background-color:rgb(255,255,255);display:inline"><a href="http://site2.tobeblocked.com" target="_blank">site2.tobeblocked.com</a></span>",</div>
<div>"<span style="background-color:rgb(255,255,255);display:inline"><a href="http://site3.tobeblocked.com" target="_blank">site3.tobeblocked.com</a></span>",</div>
<div>}</div>
<div>--------------------------------------------------<br>
</div>
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">Is there a way I can </span><span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;background-color:rgb(255,255,255);font-size:12pt;display:inline">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.</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;background-color:rgb(255,255,255);font-size:12pt;display:inline"><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;background-color:rgb(255,255,255);font-size:12pt;display:inline"><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;background-color:rgb(255,255,255);font-size:12pt;display:inline">Thanks </span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;background-color:rgb(255,255,255);font-size:12pt;display:inline"><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;background-color:rgb(255,255,255);font-size:12pt;display:inline">Clifford</span></div>
<br>
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
<br>
<fieldset></fieldset>
<pre>_______________________________________________
Pdns-users mailing list
<a href="mailto:Pdns-users@mailman.powerdns.com" target="_blank">Pdns-users@mailman.powerdns.com</a>
<a href="https://mailman.powerdns.com/mailman/listinfo/pdns-users" target="_blank">https://mailman.powerdns.com/mailman/listinfo/pdns-users</a>
</pre>
</blockquote>
</div>
_______________________________________________<br>
Pdns-users mailing list<br>
<a href="mailto:Pdns-users@mailman.powerdns.com" target="_blank">Pdns-users@mailman.powerdns.com</a><br>
<a href="https://mailman.powerdns.com/mailman/listinfo/pdns-users" rel="noreferrer" target="_blank">https://mailman.powerdns.com/mailman/listinfo/pdns-users</a><br>
</blockquote></div>