LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-13-2014, 06:46 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
hostsblock 0.12.3 (slackbuilds): it did not modify /etc/hosts.


Hi: this is Slackware 14.0. I downloaded the hostsblock 0.12.3 (ad blocking software) from Slackbuilds (which is for 14.1) created the tarball and installpkg'ed it. It should have modified /etc/hosts and copied the original to /etc/hostsblock/hosts.head. But it only copied the one onto the other. Did he think /etc/hosts was alright already?
Code:
bill@server:~/HOSTSBLOCK$ cat /etc/hosts
#
# hosts		This file describes a number of hostname-to-address
#		mappings for the TCP/IP subsystem.  It is mostly
#		used at boot time, when no name servers are running.
#		On small systems, this file can be used instead of a
#		"named" name server.  Just add the names, addresses
#		and any aliases to this file...
#
# By the way, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1
# should NEVER be named with the name of the machine.  It causes problems
# for some (stupid) programs, irc and reputedly talk. :^)
#

# For loopbacking.
127.0.0.1		localhost
192.168.1.123		server.DN1 server
192.168.1.124   local.DN2 local

# End of hosts.

bill@server:~/HOSTSBLOCK$
Was he fooled by 14.0?
 
Old 08-14-2014, 12:00 AM   #2
bosth
Member
 
Registered: Apr 2011
Location: British Columbia, Canada
Posts: 304

Rep: Reputation: 127Reputation: 127
Check that /etc/hostsblock/rc.conf is configured correctly and see if /var/log/hostsblock.log contains any information.
 
Old 08-14-2014, 10:24 AM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
I read this which I hadn't:
Code:
bill@server:/etc/hostsblock$ head -n18 rc.conf
############################## NOTES FOR THE USER ##############################
# CRON. To run this utility as a cronjob, either symlink it as root by invoking
# "ln -sf /usr/sbin/hostsblock /etc/cron.weekly/hostsblock" (or change
# "cron.weekly" to the appropriate time period) or use "crontab -e" to have cron
# manually run the program. Make sure to run this utility yourself first to make
# sure it operates properly.
#
# DNSMASQ. It is suggested that users make use of a dns caching daemon like
# dnsmasq. See https://wiki.archlinux.org/index.php/Dnsmasq#DNS_Cache_Setup for
# directions. The default settings assume that you will be using dnsmasq. Make
# sure you add "addn-hosts=/etc/hosts.block" in dnsmasq, where /etc/hosts.block
# is your final hosts file (see the "hostsfile" variable).
#
# IF NOT USING DNSMASQ. If you decide not to use a dns caching daemon like
# dnsmasq, you will have to use the default system hosts file /etc/hosts. Make
# sure to copy your original to /etc/hostsblock/hosts.head to include your
# original entries, e.g. local loopback. This file will also include commented
# out alternative settings for this scenario.
bill@server:/etc/hostsblock$
My case it that of not having the dnsmasq daemon running. I'll first do: '/usr/sbin/hostsblock' as everything in /etc/hostsblock/rc.conf seems to be well setup. For instance my not having dnsmasq seems to have taken into account. On the other hand I have these two sections:
Code:
# 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" # If not using a dns caching daemon
Code:
# HEAD FILE. File containing hosts file entries which you want at the beginning
# of the resultant hosts file, e.g. for loopback devices and IPV6 entries. Use
# your original /etc/hosts file here if you are writing your final blocklist to
# /etc/hosts so as to preserve your loopback devices. Give hostshead="0" to
# disable this feature. For those targeting /etc/hosts, it is advisable to copy
# their old /etc/hosts file to this file so as to preserve existing entries.
hostshead="/etc/hostsblock/hosts.head" # If not using dns caching.
So it seems I have nothing else to do, except 'ln -sf /usr/sbin/hostsblock /etc/cron.weekly/hostsblock'. Thanks for your reply.

EDIT: still it does not modify /etc/hosts. The log file:
Code:
bill@server:/etc/hostsblock$ cat /var/log/hostsblock.log 

Hostsblock started at 08/14/2014 12:30:06

Checking blocklists for updates...
   http://winhelp2002.mvps.org/hosts.zip...UPDATED
   http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&mimetype=plaintext...UPDATED
   http://hosts-file.net/download/hosts.zip...UPDATED
   http://www.malwaredomainlist.com/hostslist/hosts.txt...UPDATED
   http://hosts-file.net/ad_servers.asp...UPDATED
   http://hosts-file.net/hphosts-partial.asp...UPDATED
   http://hostsfile.mine.nu/Hosts.zip...UPDATED
   http://someonewhocares.org/hosts/hosts...UPDATED
   http://sysctl.org/cameleon/hosts...UPDATED
   http://www.ismeh.com/HOSTS...FAILED
Script exiting @ 08/14/2014 12:30:40bill@server:/etc/hostsblock$

Last edited by stf92; 08-14-2014 at 10:50 AM.
 
Old 08-14-2014, 10:30 AM   #4
bosth
Member
 
Registered: Apr 2011
Location: British Columbia, Canada
Posts: 304

Rep: Reputation: 127Reputation: 127
hostshead should contain your original /etc/hosts so that hostsblock can use it to generate your new hosts file.
 
Old 08-14-2014, 12:26 PM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Yes I know. But new entries in /etc/hosts should appear as hostsblock is run. I don't see any new entry.
 
Old 09-17-2014, 05:13 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
OT / FWIW using /etc/hosts for redirecting lookups like that is a crude, past millennium way of dealing with things.
 
Old 09-17-2014, 05:50 PM   #7
bosth
Member
 
Registered: Apr 2011
Location: British Columbia, Canada
Posts: 304

Rep: Reputation: 127Reputation: 127
unSpawn, suggestions?
 
Old 09-17-2014, 05:59 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Thanks for asking. For effective, usable and efficient distro and browser-agnostic filtering you can't beat a filtering proxy. Then you can block the stuff mentioned for example here: https://www.linuxquestions.org/quest...9/#post3585760
 
Old 09-17-2014, 06:54 PM   #9
bosth
Member
 
Registered: Apr 2011
Location: British Columbia, Canada
Posts: 304

Rep: Reputation: 127Reputation: 127
I spent a long time running Privoxy. It works quite well but requires the overhead of maintenance and tuning, in addition to attention to enforce that programs adhere to proxy settings (desktop or env var). I also use blocks like RequestPolicy and cookie management on my primary browser, but because I am running multiple browsers for >1 accounts on my system, I do not wish to rely on these for the main blocking workload.

For me a hosts file is simple and effective.
 
  


Reply

Tags
dont_use_a_hosts_file


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script for hosts, numbers of hosts and users connected to squid server arunabh_biswas Programming 5 08-28-2010 04:11 AM
can't restrict sshd access through hosts.allow and hosts.deny but was working earlier farhan Linux - Security 4 04-18-2008 07:41 AM
Use SlackBuilds.org or my own hosting to offer up SlackBuilds? hollywoodb Slackware 6 11-30-2006 08:56 PM
How to modify the library path variable?modify the Electronkz Linux - Newbie 1 04-13-2004 06:18 AM
modify file access & modify timestamps i2itstud Linux - General 1 05-20-2003 03:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration