News for hackers. Stuff that matters.
Re:Show HN: Wag, MFA and Enrollment for WireGuard by aragilar on Saturday May 11, 2024 @07:21AM (#40327450)
Given there are numerous other options for wireguard management, what does Wag provide that the others do not?

Additionally, given tailscale (and headscale) exist and are fairly established, the main value proposition of a different provider would be something that tailscale couldn't do/can't be (due to design considerations). Is there something where you've chosen to do something different (e.g. given this is linux-only, why not use named network namespaces)?

Re:Show HN: Wag, MFA and Enrollment for WireGuard by helloooooooo on Saturday May 11, 2024 @08:08AM (#40327599)
You know people can just do these things for fun right? It doesn’t have to be intended as any form of competitor.
Re:Show HN: Wag, MFA and Enrollment for WireGuard by stavros on Saturday May 11, 2024 @08:15AM (#40327618)
This is one of my pet peeves about HN. It's Entrepreneur News, not Hacker News. A hacker's first response would be "this is cool!" whereas here it's "what's the business case for this?".
Re:Show HN: Wag, MFA and Enrollment for WireGuard by mbreese on Saturday May 11, 2024 @12:14PM (#40329007)
I don’t know if the parent was edited or not, but that’s not how I read the parent post.

I didn’t take it as malicious, but trying to understand more about this method. I’d love for the author to tell us a bit more about how it works. I’m curious about what obstacles the author hit and how they got around them.

Note: re: the flagged sibling comment. Yeah, that one doesn’t get the benefit of the doubt and was out of bounds.

Re:Show HN: Wag, MFA and Enrollment for WireGuard by stavros on Saturday May 11, 2024 @12:17PM (#40329025)
Oh, I'm not saying it's malicious, it's just a mindset of "creating a thing must be externally motivated" vs "we make things because we like making things".
Re:Show HN: Wag, MFA and Enrollment for WireGuard by mbreese on Saturday May 11, 2024 @06:38PM (#40331076)
I agree that that dichotomy is on display here quite often. And it isn’t a good mindset. Making for the sake of making and learning should be celebrated.

I just didn’t get that vibe from the now flagged comment by @aragilar. I saw it as a genuine curiosity about the design choices. Maybe I was wrong.

    “¯\_(ツ)_/¯“
Re:Show HN: Wag, MFA and Enrollment for WireGuard by Nullence on Sunday May 12, 2024 @05:39AM (#40333231)
Welp, I have no idea if anyone will read this as its been a little while since it was put up and is in a flagged comment, but hey I'll do a lil explanation of some of the issues I ran in to, and how it works.

How it works:

In short, Wag adds an eBPF program to a WireGuard device that it instantiates. The eBPF program uses a number of hash maps and LPM (longest prefix matching trie) maps to determine the policies that are applied traffic coming in on the wireguard device. These policies based on the ACLs defined per user/group, and contain MFA/Allow/Deny rules which require mfa, allow without auth and deny always respectively.

Wag also watches all the wireguard peers ingress IP addresses, and when an address changes it deauthenticates the user and requires the user to complete a login challenge. This is done by basically setting a bit in the maps exposed to eBPF that says "unauthorised"

Challenges:

First and foremost with WireGuard there is no good way of determining if an "external ip" i.e where the user is connecting from has changed. There was a patch set submitted for review in 2022~ that was never actually added to the kernel that would have added netlink compatibility and thus event based notification that things had changed, but alas that was never reviewed by Jason Donenfeld and has quietly died the death.

Secondly was defining multiple policies per route was quite difficult as eBPF doesnt do dynamic memory even in userland exposed maps and I wanted multiple rules per route, i.e you might allow port 80/tcp when MFA has passed but otherwise always allow 22/tcp. So to do that I had to define a maximum number of rules that could be inserted as one memory blob into the LPM map that the ebpf program would then linearly search to make its decision.

Thirdly has been making everything highly available which has been a bit of an on-going battle with ETCd mainly around how it manages cluster certificates as they dont (as of 2024 but it may be coming soon) expose the right structures to allow for dyanmic certificate creation, so you have to kind of make a wrapper around that in order to get everything going.

Im sure there are other things that I've had struggles with, but these are what come to mind immediately!

Re:Show HN: Wag, MFA and Enrollment for WireGuard by aragilar on Monday May 13, 2024 @09:02AM (#40342864)
Ooh, this looks cool! I'm mildly curious given Windows apparently is adding support for eBPF whether you could also get this running on Windows as well.

On the patch, maybe try reposting it on the list, with the pointer to your project to see if that provokes a new review?

Re:Show HN: Wag, MFA and Enrollment for WireGuard by Nullence on Tuesday May 14, 2024 @06:58PM (#40361107)
Haha, me and a friend were both looking at the windows eBPF project and wondering if it might work. Im not really looking to support windows, but if someone comes to me and tells me it works I'll pop it on the read me
Re:Show HN: Wag, MFA and Enrollment for WireGuard by mbreese on Tuesday May 14, 2024 @05:15PM (#40360246)
Thank you for posting this. These are the types of details that you just don’t get unless the author has really worked through these issues in depth.

Best of luck with the project!

Re:Show HN: Wag, MFA and Enrollment for WireGuard by Nullence on Tuesday May 14, 2024 @07:00PM (#40361121)
Thanks! It's been a bit of a labor of love for quite a while, these are the big three but there are a bunch of other little things.

Like the time I had to optimise map insertion because the linux kernel does some truly insane locking when you use specific types of eBPF maps:

https://github.com/NHAS/wag/issues/84

This is slated to be improved (or has already been improved in kernel 6.8?). But for now wag sort of just side steps it in a horribly stateful way.

[dead]
Re:Show HN: Wag, MFA and Enrollment for WireGuard by tristor on Saturday May 11, 2024 @11:23AM (#40328662)
I am a cynical and curmudgeonly person so I am usually want to agree with your take, however I think you have missed something critically important:

Most technical people learn by doing. There is value in doing something even if you throw it away, even with hardware in meatspace, because it gains you knowledge and intuition about how the better/established thing works. This knowledge can be golden.

I have a very deep understanding of a lot of systems that most people never touch because they “just work” and are well implemented. I have that understanding exactly because of garbage toy projects (most of which I never shared). This knowledge has made me invaluable in many projects/jobs in my life, because nobody else bothers to understand those systems.

In fact, one of the most obvious (although perhaps not most efficient) ways to do clean room reverse engineering is to treat a system as a modeled black box and try to naively reimplement it using your own assumptions and then benchmark your outputs against the black box model. This reveals significant knowledge about the workings of the black box.

Re:Show HN: Wag, MFA and Enrollment for WireGuard by linsomniac on Saturday May 11, 2024 @08:53AM (#40327748)
You sound like a fun guy to have at parties. :-)
[dead]
Re:Show HN: Wag, MFA and Enrollment for WireGuard by pvg on Saturday May 11, 2024 @11:25AM (#40328675)
It's not fun

If it's not fun or interesting for you, just read something other than Show HN's. This sort of meta is totally offtopic in an actual Show HN which is about the work being shown rather than your personal feelings about the category.

Re:Show HN: Wag, MFA and Enrollment for WireGuard by mynameisvlad on Saturday May 11, 2024 @09:41AM (#40327989)
That was quite clearly expressed in the OP:

> Obviously instead of using an off the shelf solution like tailscale, I decided to reinvent the wheel which has honestly been quite fun with learning about eBPF, and recently clustering and HA with etcd!

Just because you don’t see or don’t care to see the point doesn’t mean that it doesn’t exist. And just because it’s not fun to you does not mean it’s not fun to anyone.

As everyone else has said, people can choose to have fun with their free time and what they do with it is up to them. “This isn’t a viable competitor” is an extremely shallow dismissal of one’s work when the motivating factor isn’t even remotely making a competitor. Which some people couldn’t give two shits about.

Re:Show HN: Wag, MFA and Enrollment for WireGuard by gremlinunderway on Saturday May 11, 2024 @09:34AM (#40327945)
I play a video game that I'm sure someone has speedrun way faster than me, and got way more points and did it with way more efficiently than me.

I still play video games.

Making a Tailscale replacement doesnt sound fun for me, but for some I guess it is? Why shit on that? Who cares?

Re:Show HN: Wag, MFA and Enrollment for WireGuard by zeotroph on Saturday May 11, 2024 @09:33AM (#40327943)
"Numerous others" which also support MFA, have some (Web)-UI and are also open source? I only know of DefGuard[1], which aspires to do a lot more.

1: https://github.com/DefGuard/defguard discussed at https://news.ycombinator.com/item?id=36056080

Re:Show HN: Wag, MFA and Enrollment for WireGuard by aragilar on Sunday May 12, 2024 @02:08AM (#40332540)
https://github.com/netbirdio/netbird seems to be completely open source (BSD), https://github.com/gravitl/netmaker?tab=License-1-ov-file#re... uses Apache for the non-pro stuff, and both of those I found by simply looking at https://github.com/topics/wireguard

This is why I asked, the phrase "I decided to reinvent the wheel which has honestly been quite fun with learning about eBPF, and recently clustering and HA with etcd" makes it sound like it's doing a bunch of cool stuff (which I want to hear about!), but the readme says nothing about those.

Re:Show HN: Wag, MFA and Enrollment for WireGuard by Nullence on Sunday May 12, 2024 @05:26AM (#40333196)
Ah the readme is definitely more geared to "how can I use this" rather than "how does this work.

Primarily because I want people to have a reasonably good time setting it up, rather than having to go through my explanation on things!

Re:Show HN: Wag, MFA and Enrollment for WireGuard by Nullence on Sunday May 12, 2024 @05:24AM (#40333188)
Man Deguard definitely looks slick and the UI looks really nice!

I'd be super interested to know how they track "session state" as their do seem to rely very heavily on adding proxies and other additional software layers in front of the wireguard connection itself (https://defguard.gitbook.io/defguard/admin-and-features/wire...)

With wag specifically it's all just wireguard and a tiny bit of ebpf to do the management, along with tracking the external IP to determine if its time to re-challenge a user.

Re:Show HN: Wag, MFA and Enrollment for WireGuard by lmeyerov on Saturday May 11, 2024 @10:21AM (#40328259)
TailScale made key parts of their stack proprietary, route key bits centrally, and I'm sure other issues. And, just like with browsers, alts are good. I'd expect a lot of whitespace for a more open, secure, and usable impl.

Most people do not use TailScale. I'd encourage doing the work of understanding why, there is likely a big opportunity somewhere here.

Re:Show HN: Wag, MFA and Enrollment for WireGuard by drio on Saturday May 11, 2024 @12:33PM (#40329109)
> Most people do not use TailScale. I'd encourage doing the work of understanding why, there is likely a big opportunity somewhere here.

When you use Tailscale extensively, it becomes your new network. Now all your systems depend on a piece of software that you do not fully control. The control plane is not open source, and it is a key component of Tailscale. Headscale is a great effort, but it doesn't have feature parity with Tailscale (1). Moreover, the dedicated team at Tailscale keeps releasing amazing new functionality regularly.

That being said, if I had to buy software from a company, Tailscale would be my first pick. I respect and trust the founders and the early engineers working there.

As a side note, I'm planning to contribute to Headscale. This technology is crucial, and I want to help ensure its success.

(1) The functionality offered by Headscale is sufficient to build a robust mesh network and enjoy its benefits. Kudos to the team and to Tailscale for supporting it.

Re:Show HN: Wag, MFA and Enrollment for WireGuard by aborsy on Saturday May 11, 2024 @02:43PM (#40329865)
The security of the devices don’t depend on Tailscale coordination server, if tail lock is enabled.

An attacker with access to coordination or relay servers would be able to change whatever is in the admin console, which are basically ACLs.

Am I missing anything?

Re:Show HN: Wag, MFA and Enrollment for WireGuard by lmeyerov on Saturday May 11, 2024 @02:22PM (#40329763)
That's true today, no reason to be true tomorrow, else we would all still be on mosaic or netscape or firefox (who fired the rust/servo team afaict once they weren't as valued)