musl 的 DNS reolsver 支援 TCP fallback

Facebook 上看到這篇:

剛好想起前陣子在 Hacker News 上看到「Musl 1.2.4 adds TCP DNS fallback (openwall.com)」這個消息,裡面的連結是今年五月 musl 1.2.4 的出版公告:「musl 1.2.4 released」(話說 openwall 網站似乎有擋 HiNet 的 IP,我是走第四台網路看的,或是參考 Internet Archive 上面的連結)。

musl 1.2.4 一個很重要的改變是在 DNS resolver 上支援了 TCP fallback (也就是支援 DNS over TCP),這改善了長久以來在 container 裡面使用 Alpine Linux 偶而會因為 DNS 遇到沒有照標準做的 server 而中雷的問題:

This release adds TCP fallback to the DNS stub resolver, fixing the longstanding inability to query large DNS records and incompatibility with recursive nameservers that don't give partial results in truncated UDP responses. It also makes a number of other bug fixes and improvements in DNS and related functionality, including making both the modern and legacy API results differentiate between NODATA and NxDomain conditions so that the caller can handle them differently.

查了一下對應的標準,跑去問 ChatGPT 的 GPT-4:

但 ChatGPT 引用的東西都不能直接當作是實際的文字,只能當作一個起點去找。實際翻 RFC 1035 可以翻到:

Messages carried by UDP are restricted to 512 bytes (not counting the IP or UDP headers). Longer messages are truncated and the TC bit is set in the header.

所以的確在 UDP response 的規範是 512 bytes,要取得完整的資料只能往 TCP 查詢。而 musl 有了這個 TCP fallback 總算是補掉了 Alpine Linux 的一個大坑。

而 musl 1.2.4 則是在 Alpine Linux 3.18 才開始使用:「Alpine 3.18.0 released」。

musl libc 1.2.4 – now with TCP fallback in DNS resolver

所以回到開頭,提到 Alpine Linux 3.16 還是有問題的人,是應該會遇到問題沒錯,因為 3.16 的 musl 本來就沒 TCP fallback?遇到不標準的 DNS server 的確是會噴...

Anyway,Alpine Linux 的 DNS 問題應該會變成過去式...

Alpine Linux 決定將 OpenSSL 換成 LibreSSL

之前看到 Alpine Linux 是從 Docker 這邊看到的,可以弄出還蠻小巧的 image...

前幾天看到他們宣佈打算將 OpenSSL 換掉,換成 LibreSSL:「[alpine-devel] Alpine edge has switched to libressl」。而且理由也講的頗直接,覺得 OpenSSL 的改善速度還是不滿意,而且市場上有其他還不錯的方案可以選:

While OpenSSL is trying to fix the broken code, libressl has simply removed it.

這樣 LibreSSL 又多了生力軍,之前比較大的應該只有 OpenBSD...

Docker 在 Mac 與 Windows 上使用 xhyve 與 Hyper-V

DockerMac OS XWindows 上開始支援其他的 VM Host 了:「Docker for Mac and Windows Beta: the simplest way to use Docker on your laptop」。

之前在 Mac OS X 與 Windows 上必須使用 VirtualBox 跑一個 Linux Host 起來,而現在可以用 xhyveHyper-V,另外剛剛發現 Linux 的部份也換到 Alpine Linux 上了 (不知道是不是這次才換的):

Faster and more reliable: no more VirtualBox! The Docker engine is running in an Alpine Linux distribution on top of an xhyve Virtual Machine on Mac OS X or on a Hyper-V VM on Windows, and that VM is managed by the Docker application. You don’t need docker-machine to run Docker for Mac and Windows.

Docker 預定將 Official Image 從 Ubuntu 換到 Alpine Linux

在「Docker Official Images are Moving to Alpine Linux」這邊看到的消息,消息引用自 Hacker News 上的討論串:「CoreOS Overview, Part One (deis.com)」,其中 shykes 這樣說:

Disclaimer: I work at Docker.

Incidentay, we have hired Natanael Copa, the awesome creator of Alpine Linux and are in the process of switching the Docker official image library from ubuntu to Alpine. You can help us with pull requests to https://github.com/docker-library if you want :)

所以已經雇用 Alpine 的創辦人,並且開始把 Docker 所使用的 Ubuntu-based image 換成 Alpine-based image,後續應該會有更多消息 (& 更正式的消息) 被放出來...

超小的 Docker Image

Hacker News Daily 上看到「Super small Docker image based on Alpine Linux」這個專案,看了一下是 BusyBox 類的專案,不過套件支援度比起其他 BusyBox 專案多不少。

基於 Alpine Linux 的系統:

Alpine Linux is an independent, non-commercial, general purpose Linux distribution designed for power users who appreciate security, simplicity and resource efficiency.

musl libc 與 BusyBox:

Alpine Linux is built around musl libc and busybox. This makes it smaller and more resource efficient than traditional GNU/Linux distributions. A container requires no more than 8 MB and a minimal installation to disk requires around 130 MB of storage. Not only do you get a fully-fledged Linux environment but a large selection of packages from the repository.

可以拿來玩看看,不過一般狀態下應該還是會拿 UbuntuDebian 的系統來用吧,環境標準多了。(不需要自己花時間找問題)