WG_QUICK_USERSPACE_IMPLEMENTATION=boringtun doesn't appear to do anything
greg-hydrogen opened this issue · comments
Hello Everyone,
I was looking to test boringtun and I followed the instructions provided in the README
when running the following:
WG_QUICK_USERSPACE_IMPLEMENTATION=boringtun WG_SUDO=1 wg-quick up wg0
It doesn't appear to do anything, I don't see any process for boringtun started
How does the WG_QUICK_USERSPACE_IMPLEMENTATION variable understand that boringtun exists, is there a specific folder it needs to be placed?
Any logs that I can be provided?
Thanks,
Greg
You should use the path to the installed boringtun binary for that variable.
@Noah-Kennedy - changing the variable to the location of the binary hasn't changed the behavior
WG_QUICK_USERSPACE_IMPLEMENTATION=/usr/bin/boringtun WG_SUDO=1 wg-quick up wg0
Anything else I can check?
@greg-hydrogen I am not familiar with this environment variable. Can you point me towards documentation on it?
@Noah-Kennedy - I just got this information from the main page
https://github.com/cloudflare/boringtun
under the "Runniing" section of the README
🤦 how did I forget that lol!
Did you install from the master branch or did you do cargo install boringtun
?
I built it from git master using
cargo build --bin boringtun-cli --release
and then copying the binary to /usr/bin/
you have to use
sudo WG_QUICK_USERSPACE_IMPLEMENTATION=/usr/bin/boringtun WG_SUDO=1 wg-quick up wg0
wg-quick runs as root anyway, but executes sudo without inheriting environment variables. running WG_QUICK_USERSPACE_IMPLEMENTATION=/usr/bin/boringtun WG_SUDO=1 wg-quick up wg0
and passing -E to sudo in that line also works
running with sudo, and sudo -E doesn't change the behaviour, I also modified the wg-quick script on the line you identified and added -E after sudo and that didn't change anything as well
I must be doing something wrong, but I don't see it, is there anything else I should try?
I also faced the same problem, so I checked the source code of wg-quick and found that line would unconditionally use the kernel module if it existed. Modify it to something like this will work
add_if() {
local ret
if [ ! -z "${WG_QUICK_USERSPACE_IMPLEMENTATION}" ]; then
echo "[!] Found WG_QUICK_USERSPACE_IMPLEMENTATION. Use userspace implementation instead." >&2
cmd "${WG_QUICK_USERSPACE_IMPLEMENTATION:-wireguard-go}" "$INTERFACE"
elif ! cmd ip link add "$INTERFACE" type wireguard; then
ret=$?
[[ -e /sys/module/wireguard ]] || ! command -v "${WG_QUICK_USERSPACE_IMPLEMENTATION:-wireguard-go}" >/dev/null && exit $ret
echo "[!] Missing WireGuard kernel module. Falling back to slow userspace implementation." >&2
cmd "${WG_QUICK_USERSPACE_IMPLEMENTATION:-wireguard-go}" "$INTERFACE"
fi
}
@greg-hydrogen any update?
I have the same problem, I use version: boringtun-0.5.2, then run:
sudo WG_QUICK_USERSPACE_IMPLEMENTATION=boringtun-cli WG_SUDO=1 wg-quick up ./w02.conf