Getting Started with WireGuard
miguelmota.com
miguelmota.com
Excuse my ignorance, but can someone explain why a kernel based networking stack has less of an attack surface then a user-space based stack?
I mean logically user-space should be more secure no?
- It has a vastly smaller attack surface than e.g. OpenVPN, because it is much less complex.
- Its performance is improved by being kernel based.
- Compatibility is helped by it being in the mainline kernel, i.e. every device shipping a recent enough kernel will be able to have it (no need to deploy/version libraries etc).
These don't have anything to do with each other.
note openvpn sans openssl is 70k (supports multiple crypto libs), but given Wireguard's code size is including crypto, it seems apt to compare totals.
linus on a comparison, "Can I just once again state my love for it and hope it gets merged soon? Maybe the code isn't perfect, but I've skimmed it, and compared to the horrors that are OpenVPN and IPSec, it's a work of art." https://lwn.net/Articles/761939/
https://wireguard.com/ should put that quote up as a, well, social proof.
[0] https://prosecco.gforge.inria.fr/personal/bblanche/cryptover...
It's bigger if you include all the service and virtual net device and UI stuff, but IPSec doesn't include any of that so comparing to the ZT core is apples to apples.
We just did phase I of a professional audit for V2. It was a design audit, but we're doing a code audit too. V2's code base will be a bit cleaner.
I'm curious if the stalwarts of the network security space, with their old and crusty VPN concentrators, finally move on WireGuard. Likely not until enough customers move away from them to a solution using, or they get around to finally running a recent kernel.
It's still smaller, but no need to do useless comparisons.
Hosting WireGuard in-kernel is a performance and compatibility strategy. Being hosted in kernel makes WireGuard higher-risk, which Jason mitigates with other software security tactics, like a simple design that can be implemented without dynamic allocation, and a tiny codebase.
The keep has a smaller attack surface than the castle. Of course if the keep is compromised, your security just failed, dramatically.
You are conflating two independent things. An external library could be very secure or not. Same for implementing the same function internally.
However, IF that code is compromised, the consequences are much more catastrophic.
Can you elaborate on which attacks userland system are susceptible to that a kernel is not?
Also reading /proc/nnnn/mem does not work even for your own processes and even though file node protections seem to allow it, not sure where that security enhancement comes from.
I guess we need a new networking how-to?
Anyone aware of some resources I might have missed?
OK, I guess the nftables wiki is the "how-to": https://wiki.nftables.org/wiki-nftables/index.php/Main_Page
At any rate, I agree information on bpf as a iptables work-a-like is scarce. This helps a bit:
https://www.netronome.com/blog/bpf-ebpf-xdp-and-bpfilter-wha...
Then there's of course the kernel docs, eg: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
See also: https://blog.cloudflare.com/introducing-the-bpf-tools/
Something I wrote for the ArchWiki [1]:
> BPF is a system used to load and execute bytecode within the kernel dynamically during runtime. It is used in a number of Linux kernel subsystems such as networking (e.g. XDP, tc), tracing (e.g. kprobes, uprobes, tracepoints) and security (e.g. seccomp). It is also useful for advanced network security, performance profiling and dynamic tracing.
> BPF was originally an acronym of "Berkeley Packet Filter" since the original classic BPF was used for packet capture tools for BSD. This eventually evolved into Extended BPF (eBPF), which was shortly afterwards renamed to just BPF (not an acronym). BPF should not be confused with packet filtering tools like iptables or netfilter, although BPF can be used to implement packet filtering tools.
lwn.net has a decent (although 3 years old) intro article [2]. Cilium has a good document on how they use BPF to implement a packet filter [3].
[1] https://wiki.archlinux.org/index.php/Security#BPF_hardening
So unfortunately it makes less sense for one-liners. Case in point: to use the masquerade action in a postrouting/nat chain, you also have to register a (possibly empty) prerouting/nat chain.
You don't have to do that since Linux 4.18: https://wiki.nftables.org/wiki-nftables/index.php/Performing...
I remember hearing that this is the case for naive HTTPS compression, but I never properly had insight in the how.
http://blogs.gnome.org/thaller/2019/03/15/wireguard-in-netwo...
[1] https://forum.manjaro.org/t/wireguard-with-networkmanager-1-... [2] https://github.com/max-moser/network-manager-wireguard/
I assume that I can't really install the KDE applet without installing the entire KDE suite, so this was my goto solution.
Edit: I see that wireguard support is in the works but is not merged yet: https://gitlab.gnome.org/GNOME/network-manager-applet/-/merg...
https://www.naut.ca/blog/2020/02/17/setting-up-a-wireguard-v...
Everything I have found so far is about consumer VPN stuff.
I'm interested in possibly using wireshark for server-to-server as a less painful alternative to TLS.
Wireguard uses a custom protocol that isn't supported by Windows' built-in VPN client. Most OSes only natively support IPsec/L2TP or PPTP.
There is a wire guard client for Windows.
[^1]: https://manpages.debian.org/unstable/wireguard-tools/wg-quic...
https://www.naut.ca/blog/2020/02/17/setting-up-a-wireguard-v...