194 points · by ingve · 9y ago · 234 comments
> The native, fully-featured API systemd-resolved exposes on the bus. See the API Documentation for details. Usage of this API is generally recommended to clients as it is asynchronous and fully featured (for example, properly returns DNSSEC validation status and interface scope for addresses as necessary for supporting link-local networking).
systemd wants applications to depend on systemd-resolved so it becomes irreplaceable. This is very bad, because the first thing you should do on a system with systemd-resolved is uninstall it. The systemd developers are not qualified to write either DNS software[2] or C code that talks to the network.
[1] https://www.freedesktop.org/software/systemd/man/systemd-res...
[2] See http://seclists.org/oss-sec/2014/q4/592, which came out after Lennart Poettering had the hubris to call systemd-resolved a "pretty complete caching DNS and LLMNR stub resolver"[3] even though the dangers of DNS cache poisoning were already well known at the time.
Thanks, I just realized that my Arch installation has nih-emd-resolved enabled as the default backend for glibc getaddrinfo and friends. This is how it happens:
https://www.freedesktop.org/software/systemd/man/nss-resolve...
I'm not responsible for any harm to systemd resulting from the use of this information ;)
edit:
And yes, the current version of the package is 232, built in January, so should be vulnerable.
I thought we were trying to move towards "everything is a file" ... isn't that the goal of the plan9/Inferno movement ?
I thought that was the progressive direction in UNIX design.
We want to move away from "everything is a file" ?
See also:
https://www.freedesktop.org/software/systemd/man/systemd-res...
LLMNR and per-interface DNS resolution are features that very few applications need. Those that do can link with their own resolver libraries.
Moreover: Strictly speaking what is in the C library, to use the jargon, is a stub resolver; with all of the things that you mention not actually belonging in the C library in the first place.
https://lists.dns-oarc.net/pipermail/dns-operations/2016-Jun... discussed at https://news.ycombinator.com/item?id=11845051
The 3rd bullet point is worth reading several times, in order to take in the absurdity of it all.
Because on most distros, using unbound or BIND9 as local DNS server, they bind to all interfaces, publicly.
Which is the reason why DNS amplification DDoS even is possible.
I’ve seen it often enough happen, and basically every person who’s set up their own servers has made the mistake of leaving the defaults.
But many distros actually install a DNS server by default, usually unbound or BIND9, and while some bind it to localhost, many bind it to all interfaces.
As you said, that’s not necessary for most users, yet, major distros do it.
The versions provided by most cloud hosters are also misconfigured to listen on all interfaces.
As nation states are hording zero days, and the security sheep herd insists updates are the way to go, I have never been more convinced that sticking to an OLD AND TRUSTED source code base for your infrastructure is the way to go. You can pop layers on top of that to get newer software running if you like, but trying to keep up with this psuedo-rolling-release avalanche of crap coming down the pipe is not a fair burden for administrators to handle. The devs need to shove it because we don't want it. I am hoping the next economic recession starves out the enthusiasm for disposable infrastructure and "move fast and break things" and businesses can go back to focusing on long term stability.
I recently (2016) built a little network appliance for a specific task that needed to be safe and secure.
I used FreeBSD 4.11.
Jessie is not vulnerable.
Stretch is vulnerable (no patch yet), but systemd-resolved is not enabled by default.
I'm sick of Linux Servers I use, being "improved" with Desktop implementation in mind.
And you can't criticise it anywhere (watch the downvotes).
The problem is it lacks the mysterious as in Zen and the Art of Motorcycle Maintenance class "quality". Merely glitter around a turd.
However we're stuck with it so it's suck it up or move on.
On the subject of moving on, you could run FreeBSD to run your servers. Much lower resource overheads, native ZFS, simple service management, some documentation worth more than toilet paper and the best thing of all, more sleep at night. Now there are binary updates and packages it's pretty easy. No more make world of any of that stuff.
Nonsense. HN has plenty of comments criticizing systemd, some of them in this very thread. They just have to be substantial, not merely empty rants or technically wrong claims.
I'd add Slackware to that list, at least for now. I've switched some servers to OpenBSD and a few others to Slackware, plus I've switched to Slackware for a laptop I use.
I'm cautiously optimistic that Patrick will keep systemd out of Slackware for the foreseeable future. It is after all one of the most BSD like Linux distros available.
This here is the hubris and arrogance of the entire thing.
I take heart that in the linux community, there is enough technical skill to come up with a viable, more in spirit of linux alternative. And I believe that I shall see the day where it is implemented. Lenny P and the gang should be less arrogant, and better at improving their product with this in mind. No one needs red hats "buy in" for this.
It's also fairly transparent that RedHat would like Linux to be more obfuscated so that more enterprises will have to depend on it for support. But that's no surprise. What was surprising was that the Debian foundation not only opted to adopt systemd, but did so long before it was anywhere near proven to be stable, reliable code. This is contrary to their longstanding methodology. Ubuntu's adoption of systemd was simply the result of following Debian upstream. If only enough people could organize Debian to reverse course on systemd, if only until systemd proves to be stable and reliable (likely never). However, let's not pretend this is the first time that Linux has deviated from traditional UNIX and compatibility. There's always been Linuxisms, systemd is just by far the most egregious case.
FreeBSD has really come of age with pkgng though, and I'm happy to see it garner more attention now due to systemd woes. It has always excelled in certain ways, which is why Whatsapp was able to scale to millions of connections on a single box way back in 2012, its process/thread scheduling resulting in more responsiveness under load, better packet filtering, containerization much earlier on (jails), native ZFS, etc.
This is not a fair criticism to levy against an entire Linux distro company. There are many people at RedHat, SUSE, etc that very much cafe about the future of the Linux ecosystem and abhor the idea of obfuscating the operating system.
Sincerely, a SUSE developer who abhors the idea of obfuscating the operating system.
Not to mention Kay Sievers which was even hated by Linus Torvalds: https://lkml.org/lkml/2014/4/2/420
I would understand if the products are actually good, but in case of systemd...
There are some caveats, but I would not mind using it on production servers. Sadly I haven't been able to convince my colleagues yet.
With the latter, you're referring to base. FreeBSD isn't really any more monolithic than your average distro in that regard though; it's just that with some services, the userland, and the like it (historically) made sense to maintain with particular stable versions of the kernel. Base is being slimmed down where possible though: bind has been replaced with unbound, dma is likely going to replace sendmail in FreeBSD 11, IIRC, and now that pkgng is proven, the process of packaging the base system should be complete for FreeBSD 12, which will allow freebsd-update to be (mostly) replaced.
FreeBSD is, like all(?) other Unices written in C, as is most of the userland.
> userspace must match kernel
Just as far as it is true for Linux. If the interfaces don't change, the userspace tools will happily talk with any kernel. In now 19 years of FreeBSD usage on all my servers and on my laptop I ran into problems caused by a mismatch kernel<->userspace maybe 3 times. OTOH, the comparison is unfair with BSD-boxes reaching uptimes > 1 year easily.
Someone would ask this sooner or later, so.. why is this written in C, really?
The shoggoth keep sprouting pseudopods as devs gets bored and think they can reimplement a time tested daemon in a weekend.
"Ph'nglui mglw'nafh Cthulhu Raleigh[1] wgah'nagl fhtagn" ("In his house at Raleigh, dead Cthulhu waits dreaming.")
1. I'm so sorry, but I couldn't keep myself from punning Red-Hat-sponsored systemd with the Cthulu mythos. For the non-Lovecraft fans, the original city is named "R'lyeh"
Specifically, DBus does not use XML for any message passing or data serialization. It uses its custom binary on-wire format.
Also to consume or provide DBus services you do not need to interact with any XML whatsoever (except maybe for Polkit but that’s not DBus).
You're spot on.
When systemd was started, Rust barely had a working compiler and go had been announced for about one year.
All have GNU/Linux compilers available.
FreePascal, Oberon, ActiveOberon, are all great (I'm hesitant to say I know Oberon since I haven't written Oberon code in like 15 years), but besides having the same problem as Ada above, the communities maintaining the compilers are small and understandingly fragile. systemd is still going to be here 15 years from now. Oberon -- who knows?
Modula really belongs in a museum :-).
Besides, they'd all need things like D-Bus bindings etc., a working, stable compiler is just the first step.
Like, this stuff was built tens of years ago and that code is crappy too but we have pretty much got rid of the most obvious security issues. Nobody wants to relive history so you can finally implement a broken DNS client.
I believe systemd-resolved, however, is one of those components that is entirely optional, and which nothing explicitly depends on... which makes it weird that Ubuntu chose to use it by default.
we picked "resolved" as that is small and lightweight, already present (part of the systemd package), does not require D-Bus (unlike dnsmasq), supports DNSSEC, provides transparent fallback to contacting the real DNS servers directly (in case anything goes wrong with the local resolver), and avoids the first issue above that /etc/resolv.conf always shows 127.0.0.1.
Yet. Wouldn't be the first time some "optional" component became mandatory.
Because systemd
A lot of it is legacy, of course. The steering heads of projects have been around for over 30 years in many cases. These are people who dedicate their lives to a cause, and a lot of it is relation to a vision of the perfect OS circa 1990 - albeit, systemd doesn't follow that philosophy, but the participants in the project are cut from the same cloth, with some new blood and ideas mixed in enough to cast aside the unix philosophy but not enough to change course away from C.
And its all free software, after all. The developers of coreutils, Linux, Mesa, GCC, systemd, NetworkManager, Samba, NFS, and so many other services and applications in use by millions all at least started out as a project of passion. They chose C because that is where their passion lay. We are seeing a new age of such passions emerging around Rust, which is great to see. Whether or not Redox or similar projects can develop the momentum to approach the C lineage is something to be seen (and I would add the permissive licensing is not helping their situation) but the spark is definitely there.
Back when GNU/Linux was still at 0.x versions, the OS industry was starting to move to C++. Even though Mac OS, OS/2 and Windows APIs and kernel were written in C, everyone was using C++ with PowerPlant, OWL, MFC, CSet++ or languages like Object Pascal.
OS like Symbian and BeOS were even fully written in C++.
But the adoption of GNU/LInux and BSD with the sacred C, meant everyone that wanted to play ball need to use C instead, so the adoption grew and here we are.
* Rewriting a codebase is much harder than it seems
* systemd is pretty big (376,726 LOC according to Open Hub) which makes it even harder to rewrite
* All maintainers and contributors are C programmers
* Distros don't want their codebase to be made up of many different languages* If your project lacks people with the required skill set, then reach out to programmers who got what you need and educate yourself.
* Distro codebases are not just C since forever, they are a mix of all kinds of stuff, in particular but not limited to C, C++, perl, shell, python.
> * Rewriting a codebase is much harder than it seems
… which is why systemd shouldn't be doing it.That ship sailed a long time ago. Distros already contain C/C++/Python/Perl/Shell Script and others. It is meaningless if you added Go/Rust to that mix.
That's about twice as much as the Linux kernel when I started using a Linux distribution, I believe...
However, I noticed Bruce Perens' message on the Devuan list about the idea of providing a libsystemd0 interface that calls non-systemd services to complete the requests that come in to the systemd API:
https://lists.dyne.org/lurker/message/20170618.121634.7c0d5b...
The plumbing for something like that could indeed be written in Rust. :)
edit: typo
The further you go back in time the less relevant the question is. And arguably any projects in the future written in C instead of a safer language really need to justify that choice if they sit on a security boundary.
C will be around for another hundred years or more. But hopefully new software looks beyond C giving that programmers seemingly cannot write and maintain secure software in it.
As Hoare so elegantly described at his Turing award speech, regarding Algol compilers, done in 1981:
"Many years later we asked our customers whether they wished us to provide an option to switch off these checks in the interests of efficiency on production runs. Unanimously, they urged us not to--they already knew how frequently subscript errors occur on production runs where failure to detect them could be disastrous. I note with fear and horror that even in 1980, language designers and users have not learned this lesson. In any respectable branch of engineering, failure to observe such elementary precautions would have long been against the law."
Algol dialects like ESPOL and its successor NEWP where used for systems programming the Burroughs B5500 in 1961, 10 years before C was born, nowadays still sold by Unisys as ClearPath MCP.
This may or may not apply to things like systemd which live somewhere on the boundary between what would be pure "system" and "application" programs, but it is undeniably true that application program code, such as that of a document editor or a calculator, should be solely concerned with the application side of things, i.e. correctness and efficient implementation of what is otherwise known as "business logic", and security is usually not one of them - contrary to a very common, but mistaken, perception. It is the "system" component of the execution environment that should focus on what it has been designed for in the first place.
Therefore, ideally, it should not matter what programming language is used to write application software - whether it is C, Rust, Prolog, or SQL; it does sound ironic, though, that the most demanding pieces of a system - demanding in terms of reliability and security - are usually written in an "unsafe" language.
Some one called a title another systemd's vulnerability a click biat
Quote
Try to guess what title catches more clicks: 1. CVE-2017-9445: systemd Hit By New Security Vulnerability 2. CVE-2017-9445: systemd-resolved, which is not recommended on most systems and isn't used outside of Ubuntu Hit By New Security Vulnerability
systemd & upstartd all aim to replace pid 1/init. Which as far as i'm concerned anything beyond bsd init is over complicating things, and these are the results.
Use DNSSEC, it's pretty tamper proof, keys are in HSM and "geo distributed" ( https://www.schneier.com/blog/archives/2010/07/dnssec_root_k... ), the weak points are probably the facilities themselves in the US (one on the East Coast and one on the West Coast), but the trust anchor is pretty much fixed in the root servers, and it'd be quickly discovered if someone rolled a new one out of schedule.
In years of watching for mentions of DNSSEC on HN, I can't remember off the top of my head a single case in which DNSSEC was introduced into a conversation as having some benefit where that benefit was real. It's weird what people believe about DNSSEC.
Edit: It seems Ubuntu builds it together with systemd so users have no choice. There may be a good technical reason for this, but I'm not sure what it is because it seems very user-hostile to remove choice like this.
Edit2: Upon further inspection this appears to be common practice, you just don't enable the parts you don't want. It would be nice if they could be put into separate packages or something of that nature though.
Unless you have so little storage you can't afford to have an extra binary installed in the system, there is no downside of having it on the machine.
You can still disable the daemon and switch to another one (like dnsmasq), as if it was in a different package.
[1] https://lists.ubuntu.com/archives/ubuntu-devel/2016-May/0393...
Regardless, I'm sure there are some people who would love to claim a few KiB back without having to compile things for themselves.
Then this DNS resolver could get the distribution and usage it deserves based on its own merits.
Of course, that's not going to happen, because the creators want systemd to be an OS by itself, with every buggy unreliable component standing as a monument to them only, and that means strong-arming in projects that could never compete with the existing working solutions on merits.
In contrast i can pass data between GNU core utils, BSD equivalent, busybox, toybox, and expect things to work. Because the way they communicate is documented and stable.