|
|
Log in / Subscribe / Register

WireGuard bounces off FreeBSD—for now

By Jake Edge
March 24, 2021

The WireGuard VPN tunnel is a fast and easy-to-use solution for those who need or want a secure tunnel for their traffic. The project has been around since 2016, but it has had a somewhat circuitous route into Linux; it was merged for the 5.6 kernel, which was released in March 2020. Getting into Linux required WireGuard developer Jason A. Donenfeld to acquiesce to having WireGuard use some of the existing kernel crypto primitives, rather than merging his Zinc crypto library. Some of the same tensions that were seen in that process seem to be cropping up again in the more recent efforts to add WireGuard support to several BSD kernels.

Complaints

A March 15 posting from Donenfeld on the WireGuard mailing list set off something of a chain reaction; in it he described the current status of WireGuard support in FreeBSD 13, which was in the release candidate stage at that point. A week earlier, FreeBSD developer Kyle Evans had asked on the list about supporting FreeBSD's port of the if_wg implementation of WireGuard from OpenBSD in the user-space wireguard-tools. He noted that FreeBSD 13 was soon to be released. That upcoming deadline caused a flurry of activity that Donenfeld relayed in his message:

In the ensuing discussion I mentioned that we really need to get the actual if_wg kernel implementation up to snuff. We took the conversation to IRC, and agreed that we should work on figuring out what to do before the release date. At the same time, Matt Dunwoodie, who worked on the OpenBSD implementation, also took a look at what had become of that implementation in FreeBSD. Over the next week, the three of us dug in and completely reworked the implementation from top to bottom, each one of us pushing commits and taking passes through the code to ensure correctness.

He went on at some length about the problems that were found in the existing port, which had been done at the behest of Netgate, a network security company that makes the FreeBSD-based pfSense router and firewall distribution. Donenfeld's description of the state of the code in FreeBSD before he, Evans, and Dunwoodie did their week-long rework was rather eye-opening:

It was not pretty. I imagined strange Internet voices jeering, “this is what gives C a bad name!” There were random sleeps added to “fix” race conditions, validation functions that just returned true, catastrophic cryptographic vulnerabilities, whole parts of the protocol unimplemented, kernel panics, security bypasses, overflows, random printf statements deep in crypto code, the most spectacular buffer overflows, and the whole litany of awful things that go wrong when people aren't careful when they write C. Or, more simply, it seems typical of what happens when code ships that wasn't meant to. It was essentially an incomplete half-baked implementation – nothing close to something anybody would want on a production machine.

The lengthy post also laid out some of the philosophy behind the WireGuard project and Donenfeld's approach to compatible implementations, which is decidedly hands-on. It is "a radical departure from the traditional model, and one surely to raise some grumbles amongst graybeards". He concluded the message by saying that they had set out hoping to pull something together for the upcoming FreeBSD release, but had fallen short of that goal. Evans committed the changes they had worked on, but it "looks exceedingly likely" that FreeBSD will "just disable the module from the release, and revisit for 13.1, rather than merging our fixes a few short days before the release". The post led to coverage in the tech media—and a bunch of other effects.

Response

As might be guessed, Netgate was not particularly happy with what Donenfeld had to say—even less with how he said it—and was also less than pleased about the lack of warning regarding the problems. Netgate director of software engineering Scott Long posted a strongly worded response on the company blog; he also sent an email, apparently privately, to Donenfeld, who publicly replied on the WireGuard mailing list. In the blog post, Long pointed out that the WireGuard work had been put out for public review back in August 2020 and he took exception to some of what was posted:

Unfortunately, the public discussion has also veered into vague claims and slanderous attacks. This is where the lack of transparency, the lack of respect, and the inflation of ego is damaging and unproductive. We had hoped for a better collaboration than this, and it makes me doubt the motives of the attackers. And yes, I make deliberate use of the word “attacker” here, because that’s what this is, an attack on Netgate and on the FreeBSD and pfSense communities. Beware of anyone who says that they have all the answers. I also worry about the integrity of those who make vague statements and blanket, over-the-top accusations.

[...] By following the normal, well understood security disclosure process this entire incident could have been handled quickly and efficiently through normal channels. We have yet to see a full description of the problems claimed; their choice to do a complete rewrite obscures the evidence of what they believe they were fixing, and they have yet to submit their work through the normal FreeBSD Phabricator process for review. That said, we do look forward to the bug reports and subsequent evaluation of the code through this review process. Code development is an iterative process, and one that we continue to strive to be better at. In the end, we will all benefit.

For his part, Evans was displeased with his role in the uproar and, on March 16, announced that he would be removing WireGuard from FreeBSD until sometime after the upcoming release. He and others planned to keep working on it moving forward.

The problem is that this work, in particular, is a driver with fairly severe security implications. Review by "three developers working and beating on it" is not the higher bar that we should be holding this to.

He followed that up with a message stepping down from the wireguard-freebsd project entirely on March 18, as well as a response to Donenfeld's original post. He said that he did not "appreciate how you handled this initial communication" and felt that some of the complaints were exaggerated, though he did acknowledge multiple problems in the existing code. Beyond that:

I've additionally recommended, as a developer and not in any kind of official capacity, that we can't include if_wg in any future version of base. We cannot have our users being put at the risk of this kind of publicity if we can't get security advisories issued in time. Ports is a fine place, where security issues can be addressed expeditiously and more in line with how the WireGuard project chooses to handle them.

For now, development will continue in the wireguard-freebsd Git repository, but by the sounds, it will not be returning to the FreeBSD kernel anytime soon. On March 22, Warner Losh put out a message from the FreeBSD core team on the freebsd-hackers mailing list about the "WireGuard controversy":

Core unconditionally values the work of all contributors, and seeks a culture of cooperation, respect, and collaboration. The public discourse over WireGuard in the past week does not meet these standards and is damaging to our community if not checked. As such, WireGuard development for FreeBSD will now proceed outside of the base system. For those who wish to evaluate, test, or experiment with WireGuard, snapshots will be available via the ports and package systems.

NetBSD

As alluded to in Donenfeld's original post, there have also been efforts to add WireGuard support in NetBSD, but those have not gone entirely smoothly, seemingly. An August 2020 thread started by Donenfeld on the tech-kern and tech-net mailing lists for NetBSD was similarly critical of an existing WireGuard implementation; he asked that the existing code be reverted in favor of an evaluation of the proper path forward. He offered to work with Taylor R Campbell, who had picked up some code written by Ryota Ozaki back in 2018; "it seemed to be in pretty good shape when I reviewed it this year, with a few small issues I saw, so I dusted it off and merged it".

In that thread, Campbell and others repeatedly asked Donenfeld to describe the problems he said that he found, but that was not how Donenfeld wanted to proceed:

This isn't about some random bug here or there, or a TODO list of little errors and optimizations, or something that one would normally say, "well, the bones are there, so let's throw this in the tree, and we'll clean it up as a gradual evolutionary thing." Rather, the foundation is incomplete, and its current form does not belong in a tree.

[...] The right course of action here is to revert the code, and then after we can evaluate which direction we want to go in -- whether it's doing a full teardown of Ozaki-san's code, or whether it's doing a simple port of the OpenBSD code.

It would seem that Campbell and Donenfeld never actually got to that point; Donenfeld said that he hoped "to be able to lend a hand similarly to the NetBSD developers soon" in the original FreeBSD announcement. Part of the disconnect here may be the type of review that Donenfeld is looking for; he talked about what he and Dunwoodie had done over a year's time to get the OpenBSD implementation into shape ("continual code reviews, knowledge transfers, and he even showed up at my house at some point to read code together"). Matt Macy, who was the author of the FreeBSD version that was so heavily criticized mentioned a similar requirement in a FreeBSD bug report:

Jason had insisted that the code needed to be reviewed by him, but he won't actually spend any time on reviewing the code unless I'm actually sitting there engaging with him directly. The OpenBSD dev appears to have spent many dozens of hours with him. However, I simply have no time or inclination for that. I'm not sure who in the FreeBSD community has the crypto background to review the protocol bits as well as the energy to do so.

By all accounts, WireGuard itself is an excellent VPN solution, but it would seem that unlike the usual approach for a network protocol, where multiple implementations are made independently based on a specification, WireGuard needs to be treated differently. Donenfeld is justifiably proud of his accomplishment, but his requirements for other implementations seem far too rigid—at least for some communities. As we have seen in several different operating system projects (Linux, FreeBSD, NetBSD), Donenfeld often expects that the other, much larger projects conform to his exacting standards and methods. In the end, that attitude may discomfit more than just graybeards.



The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:

Note: you can avoid this step in the future by logging into your LWN account.


Copyright © 2021, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds