I'd like to use MACsec (802.1AE) to secure the Ethernet connection of an OpenWRT wifi access point.
I've benchmarked MACsec on the hardware (Zyxel NWA50AX Pro) and it outperforms Wireguard by about 30% (presumably because the SoC includes AES extensions which Linux's MACsec implementation is using, whereas Wireguard's chacha20 encryption runs a slower SIMD algorithm).
Using MACsec also keeps things simpler in some ways because it's a layer 2 option, so I don't have to implement workarounds for zeroconf etc. and wifi roaming works in a straightforward way (something like GRETAP over Wireguard would be a lower performance alternative option for this particular hardware).
Although I won't be using it in this particular scenario, some "business/enterprise" oriented rack-mount switches commonly implement MACsec in hardware, which sometimes makes it a good option for those type of environments. The Linux kernel also now has MACsec hardware offload support, and I believe MACsec offload is includes in various silicon including "Enterprise" PCIe NICs, QCA hardware, and a few Ethernet PHYs (e.g. Aquantia, Realtek, and Microchip all have offerings).
It is possible to set up MACsec with a set of static keys using ip
from the OpenWRT ip-full
package, but this alone isn't a viable solution because unless you implement some custom solution for manual key rotation, the link "stops" after 2^32 packets (at this point 802.1AE requires key rotation to prevent replay attacks).
The normal way of implementing 802.1AE on Linux is to use wpa_supplicant
to manage the keys - it uses an extension to 802.1X (as used for "WPA2-Enterprise") to set up a MACsec link (both "enterprise-style" user+password and also preshared key options are support). This Red Hat article gives a good intro, including a demo of an "ad-hoc" key management setup: https://developers.redhat.com/blog/2017/06/28/whats-new-in-macsec-setting-up-macsec-using-wpa_supplicant-and-optionally-networkmanager
Unfortunately (despite the name), the OpenWRT wpad
"full" packages don't compile in MACsec support. 802.1X on wired Ethernet devices is included, but without the MACsec extensions, this is vulnerable to eavesdropping and MITM attacks.
As a PoC, I've recompiled the OpenWRT package to include MACsec, but doing-so requires it to be linked against libnl
instead of libnl-tiny
.
Here are some options for adding MACsec support to wpa_supplicant (and hostapd) in OpenWRT permanently:
Have the "full" wpad package include MACsec and require libnl
(I assume this is a non-starter because the additional storage and possibly runtime RAM requirements would make this unusable on some supported hardware).
Add a "fuller" wpad package config to include MACsec and require libnl
. Name TBC.
I've only had a quick look at the code, but I don't think adapting the hostapd MACsec support to build with libnl-tiny
would be a viable alternative.
Any thoughts?
@nbd ?