3

自己從頭搞整套 Pi-hole 方案 (DNS 阻擋廣告的方案)

 1 year ago
source link: https://blog.gslin.org/archives/2022/10/17/10925/%e8%87%aa%e5%b7%b1%e5%be%9e%e9%a0%ad%e6%90%9e%e6%95%b4%e5%a5%97-pi-hole-%e6%96%b9%e6%a1%88-dns-%e9%98%bb%e6%93%8b%e5%bb%a3%e5%91%8a%e7%9a%84%e6%96%b9%e6%a1%88/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

自己從頭搞整套 Pi-hole 方案 (DNS 阻擋廣告的方案)

如果不用 Pi-hole 這種套件的話,從頭自己搞差不多就是這樣:「Ads blocking with OpenBSD unbound(8)」。

作者除了阻擋的必要功能部份以外,還把 log 導出來丟進 InfluxDB,透過 Grafana 可以看狀態,這類似於 Pi-hole 提供的方案:

Grafana to render the statistics ;
InfluxDB to store the information ;
syslogd(8) and awk(1) to turn DNS queries into statistics ;
collectd(1) and shell script to store unbound statistics and logs ;
unbound(8) and shell script to get and block DNS queries.

對應的 diagram 長這樣 (但為什麼作者要用 comic sans 呢...):

U1uavlS.png

瀏覽器可以用 uBlock Origin 這類方案來做,可以擋的更細緻,而手機 app 一般就只能靠這種方法過濾掉部份的廣告。

如果想要擋更多的話 (像是只擋某個 url,而不是整個 domain),得用自建的 root CA 加上 MITM 的方式攔 HTTPS 連線,這通常都是在手機上面跑 virtual VPN,像是 iOS 上的 Surge 5 或是 Quantumult X

Related

透過 DNS 擋 Smart TV 的廣告

在 Hacker News Daily 上看到「Smart-TV Blocklist for Pi-hole」這個,給 Pi-hole 吃的 blocklist,可以拿來擋 Smart TV 抓一堆廣告亂搞,另外很多自己刷的 WRT 也都支援這個格式,不一定要自己弄 Pi-hole,像是我家裡的 AdvancedTomato 也有支援: 本來馬上想到的是 AdGuard 提供的 DNS 94.140.14.14,結果掃了一下發現都沒有擋掉,難怪會需要另外自己搞... 另外一個想到的搞法是 NextDNS,但 IPv4 的部份要固定 IP 才有辦法 (像是 HiNet 提供的 PPPoE 固一),免費版的 quota 拿來掛 Smart TV 應該夠用... Hacker News 上的討論在「Smart-TV blocklist for Pi-Hole (perflyst.github.io)」這邊,這年頭要弄台不連網的電視機愈來愈難了...

March 14, 2022

In "Computer"

擋廣告的 Pi-hole

Pi-hole 最近愈來愈紅的一個計畫,技術上是透過 DNS 把不想要的網域名稱擋掉,通常就是擋掉各種 tracking 與廣告系統。 因為是透過 DNS 擋,當然沒有像 uBlock Origin 直接 parse 網頁內容來的有效,但對於方便性來說則是大勝,只需要在網路設備上設一次,所有的裝置都可以用到。 剛剛看到「How a Single Raspberry Pi made my Home Network Faster」這篇,可以看到 Pi-hole 有不錯的介面可以看 (讓你自我感覺良好?XD): 文章作者跑了一個月後,也直言還是有些東西會壞掉,需要設定一些白名單讓他動: Review after 1 month in operation The Pi-Hole has been running for 1 month now on my home network. I have had…

April 16, 2019

In "Computer"

透過 /etc/hosts 擋廣告與追蹤的軟體

在 Hacker News Daily 上看到 Maza ad blocking,這是一個擋廣告與追蹤的軟體,原理就是在 DNS 上檔掉某些網域。 運作方式跟 Pi-hole 接近,其中 Pi-hole 是提供一個 DNS server 擋,這套軟體則是透過 /etc/hosts 來擋。 目前只支援 macOS 與 Linux,不過這樣看起來使用的族群有點怪,因為在 desktop 上有更多手段可以擋,透過 DNS 類的擋法主要還是拿來對手機上無法無天的 app... 不過先關注一下好了,之後也許會在某些場合下用到?

April 1, 2020

In "Computer"

a611ee8db44c8d03a20edf0bf5a71d80?s=49&d=identicon&r=gAuthor Gea-Suan LinPosted on October 17, 2022Categories Computer, DNS, Murmuring, Network, Privacy, Service, Software, WWWTags ad, block, blocker, dns, grafana, hole, influxdb, pi, unbound

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn More)

Post navigation


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK