sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

index.md (1973B)


      1 Adblocking using /etc/hosts
      2 ===========================
      3 
      4 Adblocking is a non-trivial task, but there are trivial solutions.
      5 
      6 host-gen
      7 --------
      8 
      9 Install hosts-gen from <http://git.r-36.net/hosts-gen/>
     10 
     11 	% git clone git://git.r-36.net/hosts-gen
     12 	% cd hosts-gen
     13 	% sudo make install
     14 
     15 Make sure all your custom configuration from your current /etc/hosts is
     16 preserved in a file in /etc/hosts.d. The files have to begin with a
     17 number, a minus and then the name.
     18 
     19 Install the gethostszero script.
     20 
     21 	# In the above directory.
     22 	% sudo cp examples/gethostszero /bin
     23 	% sudo chmod 775 /bin/gethostszero
     24 	% sudo /bin/gethostszero
     25 	% sudo hosts-gen 
     26 
     27 Now the /etc/hosts with the zero hosts is ready and will be used in any
     28 further started application.
     29 
     30 The gethostszero file can of course be reused to more easier create the
     31 /etc/hosts file. A cronjob can be used to update the file and run hosts-gen
     32 again.
     33 
     34 
     35 * Author : Christoph Lohmann < 20h (at) r-36 (dot) net >
     36 
     37 
     38 zerohosts
     39 ---------
     40 
     41 The following script gather well-known and trusted lists from various
     42 places : [adaway](https://adaway.org/hosts.txt), 
     43 [someonewhocares](https://someonewhocares.org/hosts/zero/hosts),
     44 [pgl.yoyo](https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext)...
     45 
     46 They are written in `/etc/hosts` file to disable DNS resolution.
     47 
     48 Get the script in an archive from here :
     49 [zerohosts.tgz](https://si3t.ch/code/zerohosts.tgz).
     50 
     51 Include your own `/etc/hosts` rules by including a file as an argument
     52 
     53 	zerohosts /etc/myhosts.txt
     54 
     55 Run the script each time you want to update the lists using a cronjob, or
     56 `/etc/rc.local` : 
     57 
     58 	/usr/local/sbin/zerohosts &
     59 
     60 
     61 * Main page : <https://si3t.ch/Logiciel-libre/Code/zerohosts.xhtml>
     62 * Author : < prx (at) si3t (dot) ch > 
     63   (feel free to suggest improvements)
     64 
     65 
     66 firejail
     67 --------
     68 
     69 If you don't want to use your /etc/hosts file, you can use firejail:
     70     
     71     firejail --noprofile --hosts-file="~/adblockhosts" surf "example.com"