You are not logged in.

#126 2012-09-13 15:20:32

gaenserich
Member
From: Michigan
Registered: 2010-06-07
Posts: 116
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

A few new tidbits!

Version 0.11.1 (13.09.2012)
*accumulated fixes with feedback (thanks tlvince)
*fixed hostsblock-urlcheck's misidentification of colons in urls


Check out hostsblock for system-wide ad- and malware-blocking.

Offline

#127 2012-09-19 12:41:39

sadi
Member
From: Istanbul
Registered: 2012-04-02
Posts: 51

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

After I recently switched to a 64-bit system, my kwakd has been failing to start from time to time.
However, I can get it up and running again with "sudo /usr/local/bin/kwakd -b -p 80" and then "sudo /etc/init.d/dnsmasq restart". This may suggest a problem in the file which contains this command under "/etc/init.d" but I don't think it has changed.
Does anyone have any idea about this?

Offline

#128 2012-09-19 14:04:47

sadi
Member
From: Istanbul
Registered: 2012-04-02
Posts: 51

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

I've found it!
Apparently, I forgot the last step of manually installing kwakd:
sudo update-rc.d kwakd defaults
This was essential to make /etc/init.d/kwakd start.

Offline

#129 2012-10-01 14:04:56

ontobelli
Member
From: Mexico City
Registered: 2011-02-06
Posts: 127

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

sadi wrote:

I've found it!
Apparently, I forgot the last step of manually installing kwakd:
sudo update-rc.d kwakd defaults
This was essential to make /etc/init.d/kwakd start.


About kwakd.

1) I have migrated to systemd and cannot start it with initscripts any more.

2) kwakd recently changed to allow been executed as a normal user instead of root.
I start it from the desktop environment autostart with "kwakd -b -p 80"

Offline

#130 2012-10-01 15:29:12

tlvince
Member
Registered: 2010-07-06
Posts: 53
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

ontobelli wrote:

1) I have migrated to systemd and cannot start it with initscripts any more.

kwakd maintainer here. I've just updated the package to include a systemd service.

Offline

#131 2012-10-01 15:45:03

ontobelli
Member
From: Mexico City
Registered: 2011-02-06
Posts: 127

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

tlvince wrote:
ontobelli wrote:

1) I have migrated to systemd and cannot start it with initscripts any more.

kwakd maintainer here. I've just updated the package to include a systemd service.

I have just updated AUR packages and notice your kwakd update tlvince.

Thank you for your lightning fast response.  smile

Offline

#132 2012-10-05 10:28:42

ixnine
Member
Registered: 2008-11-01
Posts: 60

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Does hostsblock hide the elements in the page? Or will it just display blank, white space?

Offline

#133 2012-10-05 11:09:21

sadi
Member
From: Istanbul
Registered: 2012-04-02
Posts: 51

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

As far as I know, hostsblock merely blocks access, in which case web browsers merely return an error message, while kwakd provides a blank/white space instead of error message which may also increase speed in addition to a better appearance.

Offline

#134 2012-10-06 09:32:46

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

I don't get it. I followed all the installation steps, including dnsmasq and kwakd, both services are running, hosts.adblock is populated, and websites are still riddled with ads...


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#135 2012-10-06 10:02:02

ixnine
Member
Registered: 2008-11-01
Posts: 60

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Did you add hosts.adblock to dnsmasq as an additional host file?

Offline

#136 2012-10-06 10:12:57

ontobelli
Member
From: Mexico City
Registered: 2011-02-06
Posts: 127

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Lockheed wrote:

I don't get it. I followed all the installation steps, including dnsmasq and kwakd, both services are running, hosts.adblock is populated, and websites are still riddled with ads...

You need to configure  /etc/hostsblock/rc.conf and /etc/dnsmasq.conf

if you use /etc/hosts.block you need to configure

addn-hosts=/etc/hosts.block
listen-address=127.0.0.1

read the wiki
http://wiki.archlinux.org/index.php/Dnsmasq

Offline

#137 2012-10-08 19:23:51

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Unfortunately, I have this all already done:

/etc/dnsmasq.conf

listen-address=127.0.0.1
addn-hosts=/etc/hosts.adblock

/etc/hostsblock/rc.conf

logfile="/var/log/hostsblock.log"
cachedir="/var/cache/hostsblock"
tmpdir="/dev/shm"

# FINAL HOSTSFILE. The final hosts file that combines together all downloaded
# blocklists. If not using a dns caching daemon like dnsmasq, this should be
# /etc/hosts. Include hosts file entries which you want to maintain in the
# "hostshead" entry, such as your loopback device (e.g. 127.0.0.1 localhosts)
hostsfile="/etc/hosts"
#hostsfile="/etc/hosts" # If not using a dns caching daemon
redirecturl="127.0.0.1"
redirects="0"
postprocess(){                #
    /etc/rc.d/dnsmasq restart # For dnsmasq under initscripts
}                             #

hostshead="0"
blacklist="/etc/hostsblock/black.list"
whitelist="/etc/hostsblock/white.list"
blocklists=(
## HIGHLY RECOMMENDED LISTS
'http://winhelp2002.mvps.org/hosts.zip'			# anti-ad and anti-malware list (winhelp2002.mvps.org/hosts.htm)
'http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&mimetype=plaintext' # anti-ad (pgl.yoyo.org/adservers/)
'http://hosts-file.net/download/hosts.zip'		# hpHosts main anti-ad and anti-malware (hosts-file.net/)
'http://www.malwaredomainlist.com/hostslist/hosts.txt'  # anti-malware (www.malwaredomainlist.com/)
'http://hosts-file.net/ad_servers.asp'			# anti-ads-only version of hpHosts main list (hosts-file.net)
## RECOMMENDED LISTS
'http://hosts-file.net/hphosts-partial.asp'		# hpHosts inter-release (hosts-file.net/)
'http://hostsfile.org/Downloads/BadHosts.unx.zip'	# anti-malware (hostsfile.org/hosts.html)
'http://hostsfile.mine.nu/Hosts.zip'			# anti-ad (hostsfile.mine.nu)
'http://someonewhocares.org/hosts/hosts'		# anti-ad and anti-malware (someonewhocares.org/hosts/)
'http://sysctl.org/cameleon/hosts'			# anti-ad (sysctl.org/cameleon/) 
'http://www.ismeh.com/HOSTS'				# anti-ads for mobile devices

rc.conf
DAEMONS=(@syslog-ng dbus acpid sensors @hddtemp netfs @crond @wicd alsa @hdapsd @bluetooth dnsmasq kwakd irqbalance cpufreq slim)


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#138 2012-10-08 20:17:28

ontobelli
Member
From: Mexico City
Registered: 2011-02-06
Posts: 127

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Lockheed wrote:

Unfortunately, I have this all already done:

hostsfile="/etc/hosts"

That is wrong. Must be.

hostsfile="/etc/hosts.block"

You need to have in /etc/hosts

127.0.0.1 localhost.localdomain localhost "YOUR HOSTNAME"
::1	        localhost.localdomain localhost "YOUR HOSTNAME"

Last edited by ontobelli (2012-10-08 20:23:18)

Offline

#139 2012-10-08 20:34:26

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

I think you meant /etc/hosts.adblock? In any case, it didn't help.


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#140 2012-10-09 05:34:02

sadi
Member
From: Istanbul
Registered: 2012-04-02
Posts: 51

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

It seems you've got hostsblock filename wrong in both cases, which should be:

/etc/dnsmasq.conf        ===>  addn-hosts=/etc/hosts.block
/etc/hostsblock/rc.conf  ===>  hostsfile=/etc/hosts.block

Offline

#141 2012-10-09 13:32:10

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

hosts.block is 8mb in size. hosts.adblock is 8/3mb. Also, in the later, the ip addresses are all 0.0.0.0 while in the former: 127.0.0.1
AFAIK, hostsblock utility uses hosts.adblock file. Am I wrong?


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#142 2012-10-09 13:50:16

sadi
Member
From: Istanbul
Registered: 2012-04-02
Posts: 51

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

It's all explained here: http://gaenserich.github.com/hostsblock/

The file "/etc/hostsblock/rc.conf" has these lines by default:

hostsfile="/etc/hosts.block"
#hostsfile="/etc/hosts" # If not using a dns caching daemon

You have apparently changed this part, which you shouldn't have.

You should also modify "/etc/dnsmasq.conf" as this:

addn-hosts=/etc/hosts.block

The file "hosts.adblock" is probably a leftover from some other adblocking tool used before (or produced while thinkering with the hostsblock script files?), which I guess can be deleted.

Offline

#143 2012-10-10 08:02:25

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Unfortunately, it didn't change a thing. For example, onet.pl is still riddled with ads.


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#144 2012-10-10 09:06:32

sadi
Member
From: Istanbul
Registered: 2012-04-02
Posts: 51

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

I think you should test if the "/etc/hosts.block" file is being used by your system for DNS purposes.
For example, you can pick a website from there (e.g. www.1000downloads.com, if this is in your list) and check if your browser displays it.
If it is displayed, there may be something wrong with your installation.

Offline

#145 2012-10-10 09:33:48

megadriver
Member
From: Spain
Registered: 2010-02-03
Posts: 58
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Check the permissions of "/etc/hosts.block".

In my case, I noticed hostsblock created it as readable by root only (-rw-------), so dnsmasq (which runs as the "dnsmasq" user) couldn't read it, thus nothing was being blocked.

"sudo chmod a+r /etc/hosts.block" should do the trick.

Hope it helps.

Offline

#146 2012-10-10 09:52:16

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

sadi, Yes, this page is being displayed. But I don't know what else can I do to try to fix it. Everything seems right.


megadriver, Yeah, thanks. But it didn't - permissions were fine.


I am using dhclient, if it makes any difference.


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#147 2012-10-10 10:00:55

sadi
Member
From: Istanbul
Registered: 2012-04-02
Posts: 51

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

In order to identify where the problem is perhaps you might uninstall dnsmasq and kwakd, and first try using only the file "/etc/hosts" to do the blocking by simply copying and pasting the entire contents of the file /etc/hosts.block" underneath the system entries in your hosts file, and restarting your computer.
If the problem is still there, there might be something in your network configuration that needs to be fixed, which is beyond me...

Offline

#148 2012-10-10 10:10:34

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Ok, that worked. So how do I get dnsmasq to work now?


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#149 2012-10-10 10:51:23

sadi
Member
From: Istanbul
Registered: 2012-04-02
Posts: 51

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

So the problem was in dnsmasq configuration.
You can now restore your hosts and hosts.block files in previous state.
Simply install dnsmasq, and then only make 2 changes in its configuration file "/etc/dnsmasq.conf":

listen-address=127.0.0.1
addn-hosts=/etc/hosts.block

and then restart, it should work.

Offline

#150 2012-10-10 11:02:31

ixnine
Member
Registered: 2008-11-01
Posts: 60

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Don't forget to start dnsmasq.

Offline

Board footer

Powered by FluxBB