Open jfoclpf opened 1 year ago
Hi João @jfoclpf this is pretty cool.
If it were me, I might curl https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn/hosts
directly. Here's why.
With each new release, I audit the diff
s from all our curated sources. Sometimes I'll catch something, and abort the release, and advise the curator of the problem or issue arising.
A blind pull
followed by python3 updateHostsFile.py
is probably ok, until it's not.
That's just a risk to be aware of...
Great tip @StevenBlack I didn't know you had already these combined files, then I use now this, no need to use docker and it is much faster
#!/usr/bin/env bash
# Simple cron job to update host file with spam block list
# /etc/cron.daily/hosts_update
FILE=/etc/hosts
# create empty file if not exists
if [ ! -f $FILE ]
then
touch $FILE
fi
# remove immutability
chattr -i $FILE
# This will replace /etc/hosts
wget https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn/hosts -q -O $FILE
# make the file immutable, i.e., protect anyone even sudo from altering it
chattr +i $FILE
# flush dns cache
service network-manager restart
What do you think? Am I missing something?