index.md - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
index.md (1941B) | |
--- | |
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 <https://r-36.net/scm/hosts-gen> | |
10 | |
11 % git clone 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-… | |
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=host… | |
45 | |
46 They are supposed to be written in `/etc/hosts` file to disable DNS reso… | |
47 | |
48 Get the script from here : | |
49 [zerohosts.sh](https://si3t.ch/code/zerohosts/zerohost.sh). | |
50 | |
51 Include your own `/etc/hosts` rules by including a file as an argument | |
52 | |
53 zerohosts.sh /etc/myhosts.txt > /etc/hosts | |
54 | |
55 Run the script each time you want to update the lists using a cronjob, or | |
56 `/etc/rc.local`. | |
57 | |
58 | |
59 * Main page : <https://si3t.ch/code/zerohosts/> | |
60 * Author : < prx (at) si3t (dot) ch > | |
61 (feel free to suggest improvements) | |
62 | |
63 | |
64 firejail | |
65 -------- | |
66 | |
67 If you don't want to use your /etc/hosts file, you can use firejail: | |
68 | |
69 firejail --noprofile --hosts-file="~/adblockhosts" surf "example.com" |