Managing Ad lists in 5.0

I have a question regarding the functionality of ad lists on 5.0 now that adlists.list is gone.

Before upgrading to 5.0, I used a script to manually update the adlists.list file with custom lists. Now that I'm on 5.0, is there still a way to automate adding and removing block lists to the adlists.list equivalent?

Here's a similar thread to what I would like to do but this doesn't really provide much info.

The gravity and other lists are now contained in an SQL database. The general method for changing these would be;

stop pihole-FTL

use SQL commands to change the appropriate database entries

start pihole-FTL

https://deploy-preview-201--pihole-docs.netlify.com/database/gravity/

When running pihole -g to update Gravity, it looks like the entire database is being replaced with a new one. Is there a way I can add my blocklists to a file that the update process pulls into the new db?

You could try to inject your addresses via sql directely into gravity.db adlist table by something like

sudo -u pihole sqlite3 /etc/pihole/gravity.db 'insert into adlist(address, enabled,date_added, date_modified,comment) values ("test.domain", "1", strftime("%s","now"), strftime("%s","now"), "comment");'

and run pihole -g afterwards.

Maybe best would be to put it into a script, start a sql transacrition, interate through your list of adlists to add and finish the transaction.

That's a start for sure. Is that adding a domain or a list of domains? I would like to pull a file with a custom list of domains from my GitHub (eg. adlists.list) and update gravity with it. Is that feasible?

I also know next to nothing about SQL commands or scripting.

SQL knowledge will be required to do what you wish to do. There are a number of books available.

1 Like

This is adding a single adlist (formerly 'blocklist').

You mean pulling something like this and than add each of this adlists? That is feasible by iterating over each line and add them via the command listed above.

Do you really need to script something like this? How often do the adlists.list change? How m any adlists are on your adlist.list?

If it's enough to add them once and only update them from time to time you could also use the WEB GUI. It supports mass injection by space-separation.

I'm specifically wanting to be able to make changes to my ad lists and have several pihole servers referring to the GitHub and auto update gravity with the changes each night.

Ah I see....

Maybe this is something for you then?

Dang. How did I not know about this already?? This should do what I need. Thanks!

You're welcome. No need to reinvent the wheel.