gaenserich / hostsblock

an ad- and malware-blocking script for Linux
https://github.com/gaenserich/hostsblock
225 stars 28 forks source link

Fails when cache dir not present - useless error messages & missing config file documentation #96

Open ohnonot opened 5 years ago

ohnonot commented 5 years ago

Better error reporting please!

Just installed hostsblock (in fact it's a re-install, but I'd deleted all hostsblock-related files beforehand).

Followed the procedures from README, yet:

systemctl -n999 status hostsblock
● hostsblock.service - Block bad domains system-wide
   Loaded: loaded (/usr/lib/systemd/system/hostsblock.service; static; vendor preset: disabled)
   Active: inactive (dead) since Mon 2019-09-02 07:34:44 EEST; 4h 45min ago
  Process: 514 ExecStart=/usr/lib/hostsblock.sh (code=exited, status=0/SUCCESS)
 Main PID: 514 (code=exited, status=0/SUCCESS)

Sep 02 07:34:15 arch systemd[1]: Starting Block bad domains system-wide...
Sep 02 07:34:15 arch hostsblock.sh[514]: Checking blocklists and/or redirectlists for updates...
Sep 02 07:34:17 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://raw.githubusercontent.com/anudeepND/blacklist/master/adservers.txt
Sep 02 07:34:17 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://hosts-file.net/hphosts-partial.txt
Sep 02 07:34:17 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://hosts-file.net/grm.txt
Sep 02 07:34:17 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://raw.githubusercontent.com/StevenBlack/hosts/master/data/add.Spam/hosts
Sep 02 07:34:17 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://v.firebog.net/hosts/AdguardDNS.txt
Sep 02 07:34:17 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://reddestdream.github.io/Projects/MinimalHosts/etc/MinimalHostsBlocker/minimalhosts
Sep 02 07:34:17 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://raw.githubusercontent.com/StevenBlack/hosts/master/data/KADhosts/hosts
Sep 02 07:34:17 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://v.firebog.net/hosts/static/w3kbl.txt
Sep 02 07:34:17 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://adaway.org/hosts.txt
Sep 02 07:34:18 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://hosts-file.net/ad_servers.txt
Sep 02 07:34:18 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://v.firebog.net/hosts/Easylist.txt
Sep 02 07:34:18 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
Sep 02 07:34:18 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&mimetype=plaintext
Sep 02 07:34:19 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://raw.githubusercontent.com/StevenBlack/hosts/master/data/UncheckyAds/hosts
Sep 02 07:34:19 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://v.firebog.net/hosts/Prigent-Ads.txt
Sep 02 07:34:19 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt
Sep 02 07:34:19 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://www.squidblacklist.org/downloads/dg-ads.acl
Sep 02 07:34:19 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://v.firebog.net/hosts/Easyprivacy.txt
Sep 02 07:34:19 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://raw.githubusercontent.com/StevenBlack/hosts/master/data/add.2o7Net/hosts
Sep 02 07:34:19 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt
Sep 02 07:34:28 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://v.firebog.net/hosts/Prigent-Malware.txt
Sep 02 07:34:28 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://bitbucket.org/ethanr/dns-blacklists/raw/8575c9f96e5b4a1308f2f12394abd86d0927a4a0/bad_lists/Mandiant_APT1_Report_Appen>
Sep 02 07:34:29 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt
Sep 02 07:34:29 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://v.firebog.net/hosts/Prigent-Phishing.txt
Sep 02 07:34:29 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://hosts-file.net/emd.txt
Sep 02 07:34:29 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://hosts-file.net/exp.txt
Sep 02 07:34:29 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://mirror1.malwaredomains.com/files/justdomains
Sep 02 07:34:30 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://ransomwaretracker.abuse.ch/downloads/LY_C2_DOMBL.txt
Sep 02 07:34:30 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt
Sep 02 07:34:30 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://ransomwaretracker.abuse.ch/downloads/CW_C2_DOMBL.txt
Sep 02 07:34:30 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://phishing.army/download/phishing_army_blocklist_extended.txt
Sep 02 07:34:30 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt
Sep 02 07:34:30 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://ransomwaretracker.abuse.ch/downloads/TC_C2_DOMBL.txt
Sep 02 07:34:30 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://ransomwaretracker.abuse.ch/downloads/TL_C2_DOMBL.txt
Sep 02 07:34:30 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist
Sep 02 07:34:31 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://v.firebog.net/hosts/Shalla-mal.txt
Sep 02 07:34:31 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://www.squidblacklist.org/downloads/dg-malicious.acl
Sep 02 07:34:31 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://raw.githubusercontent.com/StevenBlack/hosts/master/data/add.Risk/hosts
Sep 02 07:34:33 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://zerodot1.gitlab.io/CoinBlockerLists/hosts
Sep 02 07:34:43 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://www.malwaredomainlist.com/hostslist/hosts.txt
Sep 02 07:34:43 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://hosts-file.net/psh.txt
Sep 02 07:34:44 arch hostsblock.sh[514]:     FAILED to refresh/download blocklist https://mirror.cedia.org.ec/malwaredomains/immortal_domains.txt
Sep 02 07:34:44 arch hostsblock.sh[514]: No new changes. DONE.
Sep 02 07:34:44 arch systemd[1]: hostsblock.service: Succeeded.
Sep 02 07:34:44 arch systemd[1]: Started Block bad domains system-wide.

Very unimaginative error message. And "succeeded"? Hardly. At least tell systemd that "something" went wrong.

What could it mean? I wondered, suspecting networking issues, or missing user permissions... until, after a day or two, I created the cache directory on a hunch... the one that is labeled "DEFAULT" in the "well-documented" config file, not mentioning that the whole script fails with an undescriptive error when it isn't present.

After that, everything fell into place:
hostsblock.service executes, and hostsblock-hosts-clobber.path follows suit.

Sorry for the rant, but this isn't the first time I find serious problems with hostsblock. Why not make it all a little simpler, and make sure that basic stuff like sane error messages works?