自己從頭搞整套 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 呢...):

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

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

透過 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)」這邊,這年頭要弄台不連網的電視機愈來愈難了...

Smart TV 與遊戲主機的 DNS 經常是設死的

Hacker News Daily 上看到「Your Smart TV is probably ignoring your PiHole」,裡面提到了很多遊戲主機並不會依照從 DHCP 拿到的 DNS 設定使用,而是直接設死:

Nearly 70% of smart TVs and 46% of game consoles were found to contain hardcoded DNS settings - allowing them to simply ignore your local network’s DNS server entirely. On average, Smart TVs generate an average of 60 megabytes of outgoing Internet traffic per day, all the while bypassing tools like PiHole.

裡面提到的論文是「Characterizing Smart Home IoT Traffic in the Wild」這篇,裡面分析了不同種類的裝置 DNS 的狀況,以及 HTTP/HTTPS 的比率:

回到原來的文章,裡面提到了用 NAT 的方式把 1.1.1.1 的 TCP/UDP Port 53 導到 Pi-hole 上面過濾,這樣看起來還行,下面的 DNS over TLSDNS over HTTPS 因為走其他特定的 TCP port,應該是不受影響...

透過 WebRTC 直接在網頁對傳檔案的服務

Twitter 上看到的服務 WEBWORMHOLE

透過 WebRTC 直接網頁對網頁傳資料,就不需要再透過第三方服務了。當然這樣做的前提是雙方都要在線上。

另外也可以在 cli 下面用:

之後要傳大檔案找不到空間放的時候可以用看看...

擋廣告的 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 to whitelist 1 or 2 URLs which was blocking a reset of an Alexa which had an issue, and a video conferencing system had all sorts of tracking and metrics built in which were causing some havoc until I whitelisted them. Otherwise, the Pi has been chugging along at 8% memory utilization, and the network is considerably faster when surfing the web.

對於手癢自己玩應該還可以,拿到辦公室的話應該會有不少東西掛掉... (不過文章作者好像想這樣做)

被告了就把證據滅掉... XD

這個好讚,在告知安全漏洞後還是不更新選舉用伺服器,於是就被告了,而在被告以後選舉單位就把證據給幹掉 XD:「Georgia election server wiped after lawsuit filed」。

The lawsuit, filed on July 3 by a diverse group of election reform advocates, aims to force Georgia to retire its antiquated and heavily criticized election technology. The server in question, which served as a statewide staging location for key election-related data, made national headlines in June after a security expert disclosed a gaping security hole that wasn’t fixed six months after he reported it to election authorities.

然後現在還找不到是誰下令幹掉的...

It’s not clear who ordered the server’s data irretrievably erased.

執政者用的方法都差不多...

歡樂的 Samsung Security Hole...

話說 Zite 給的文章愈來愈歡樂了,大概是安全性的文章點多了就自動丟這類的出來。

像是這篇「[ROOT][SECURITY] Root exploit on Exynos」講安全漏洞的,作者猜測這些手機都有問題:

  • Samsung Galaxy S2
  • Samsung Galaxy Note 2
  • MEIZU MX
  • 使用 Samsung source code 的 Exynos processor

後門是 /dev/exynos-mem,這功能與 /dev/mem 一樣,只是... 所有人都可以讀寫 XD (於是任何程式都可以讀寫整台機器裡任何一個記憶體區塊內的資料)

然後文章後面提供一包 PoC source,可以生出 root shell... XDDD