hectorm / hblock

Improve your security and privacy by blocking ads, tracking and malware domains.

Home Page:https://hblock.molinero.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IPv6 please

danispringer opened this issue · comments

Please add support for IPv6.
I believe what needs to be done is:
In addition to

0.0.0.0 example.com
0.0.0.0 www.example.com

Please also add

::1 www.example.com
::1 example.com

Thanks

Could you confirm if hectorm/hblock#108 solves your issue?

I can try to follow the code given in #108 (comment)
However, I don't understand the reply to that comment. So I'm not sure what I should be trying (I'm on Mac as well, like that user).

Thanks

And: should I be running that command anywhere, or specifically while in /etc/hosts?
Ok, in /etc/, got it.
Gonna test now. At first no webpage would load ever. Restarted, cleared Safari cache, and flushed DNS cache. Retrying now...

Ok so I tried visiting livejasmin.com and it works. So I'm guessing the hosts file is not working.

@hectorm any updates? thanks

In order to help you I will need more information.

Could you please provide the exact steps you are following to use hBlock?
Could you check in the hBlock website if the status appears as active?
Could you in your terminal run ping hblock-check.molinero.dev and provide the output?

@hectorm so:
I don't remember how I installed it, but I think it was using the commands listed in the README
My output for which hblock is /usr/local/bin/hblock
Status is "not currently using..."

My output for the above ping command is (after a long wait):

PING hblock-check.molinero.dev (0.0.0.0): 56 data bytes
ping: sendto: Socket is not connected
ping: sendto: Socket is not connected
Request timeout for icmp_seq 0
ping: sendto: Socket is not connected
Request timeout for icmp_seq 1
ping: sendto: Socket is not connected
Request timeout for icmp_seq 2
ping: sendto: Socket is not connected
Request timeout for icmp_seq 3
ping: sendto: Socket is not connected
Request timeout for icmp_seq 4
ping: sendto: Socket is not connected
Request timeout for icmp_seq 5
ping: sendto: Socket is not connected
Request timeout for icmp_seq 6
ping: sendto: Socket is not connected
Request timeout for icmp_seq 7
ping: sendto: Socket is not connected
Request timeout for icmp_seq 8
ping: sendto: Socket is not connected
Request timeout for icmp_seq 9
ping: sendto: Socket is not connected
Request timeout for icmp_seq 10
ping: sendto: Socket is not connected
Request timeout for icmp_seq 11
ping: sendto: Socket is not connected
Request timeout for icmp_seq 12
ping: sendto: Socket is not connected
Request timeout for icmp_seq 13
ping: sendto: Socket is not connected
Request timeout for icmp_seq 14
ping: sendto: Socket is not connected
Request timeout for icmp_seq 15
ping: sendto: Socket is not connected
Request timeout for icmp_seq 16
ping: sendto: Socket is not connected
Request timeout for icmp_seq 17
ping: sendto: Socket is not connected
Request timeout for icmp_seq 18
ping: sendto: Socket is not connected
Request timeout for icmp_seq 19
ping: sendto: Socket is not connected
Request timeout for icmp_seq 20
ping: sendto: Socket is not connected
Request timeout for icmp_seq 21
ping: sendto: Socket is not connected
Request timeout for icmp_seq 22
ping: sendto: Socket is not connected
Request timeout for icmp_seq 23
ping: sendto: Socket is not connected
Request timeout for icmp_seq 24
ping: sendto: Socket is not connected
Request timeout for icmp_seq 25
ping: sendto: Socket is not connected
Request timeout for icmp_seq 26
ping: sendto: Socket is not connected
Request timeout for icmp_seq 27
ping: sendto: Socket is not connected
Request timeout for icmp_seq 28
ping: sendto: Socket is not connected
Request timeout for icmp_seq 29
ping: sendto: Socket is not connected
Request timeout for icmp_seq 30
ping: sendto: Socket is not connected
Request timeout for icmp_seq 31
ping: sendto: Socket is not connected
Request timeout for icmp_seq 32
ping: sendto: Socket is not connected
Request timeout for icmp_seq 33
ping: sendto: Socket is not connected
Request timeout for icmp_seq 34
ping: sendto: Socket is not connected
Request timeout for icmp_seq 35
ping: sendto: Socket is not connected
Request timeout for icmp_seq 36
^C
--- hblock-check.molinero.dev ping statistics ---
38 packets transmitted, 0 packets received, 100.0% packet loss

At least the ping test shows that your hosts file is being used, if it doesn't work with Safari maybe it's because #108 or because you have a proxy configured in the browser.

If the cause is the linked issue the solution is simple, run hBlock with the following options:

hblock -T '0.0.0.0 %D\n:: %D'

If you want to change the default hBlock options so that you don't have to specify them every time, you can create a file in /etc/hblock/environment with the following content:

HBLOCK_TEMPLATE='0.0.0.0 %D\n:: %D'

@hectorm hello again,
I'm still not sure if it's working.
I'm getting mixed results here: https://canyoublockit.com/extreme-test/
Thanks

This one seems to be a pretty solid test, too: https://www.sparknotes.com

Also: most websites are now loading very slowly.

I'm not sure what's going on with your system but I don't think it's because of a bug in hBlock. It may be that a too large hosts file is causing problems but there is nothing I can do about it.

Hi, #108 chiming in here :)

This is probably macOS-specific. When enabled, macOS prefers IPv6 over IPv4, including DNS queries.

macOS uses ping6 for ping via IPv6, "regular" ping uses IPv4.
So, to check if a domain resolves and can be pinged via IPv6, you have to use the ping6 command, i.e. ping6 hblock-check.molinero.dev.

The command to enable blocking via hblock in macOS for both IPv4 and IPv6 has to be

hblock -T '0.0.0.0 %D\n:: %D'

I.e., the output file path -O ./hosts has to be omitted.

Otherwise the hosts file will be saved to your user home folder. If no explicit file output path is set, the default macOS hosts file path of /etc/hosts will be used. If there is a hosts file (no extension, generic document icon) in your user home folder, it can be deleted.

Please check the hosts file in /etc/hosts.
(Finder "Go" menu → "Go to Folder" or keyboard Shift-Command-G, enter /etc/hosts in the popup window that appears, press Enter/Return. The /etc folder should open with the hosts file selected.)

etc

If you open the hosts file in a text editor (even TextEdit is fine), every domain to block should appear twice, once with 0.0.0.0 and once with :: in front of the domain URL.

Alternatively, if you don't need IPv6 support explicitly, you can disable IPv6 client-side in macOS (looks like in macOS 13 Ventura there is a GUI setting in the Network preferences, in older macOS versions command line is needed). This way, you could just use the hblock command (without any options) in Terminal, plus the hosts file size will be half.

Sidenote: my hunch is you installed hblock via homebrew. Can you please check if Terminal/command line brew list brings up anything?

Sidenote: my hunch is you installed hblock via homebrew. Can you check if Terminal brew list brings up anything?

Indeed, brew list shows hblock. What can I do now?

Thanks

Probably a good idea to brew upgrade to make sure homebrew and hblock are up-to-date, then the steps in the post above.

@danispringer
Typo in hblock command (-O has to be removed as well, along with the file path).

hblock -T '0.0.0.0 %D\n:: %D'

(Corrected in my first answer as well, please refresh this page, I also added some screenshots.)

@danispringer

Any progress?