Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Brian <brian@mutualaid.info>
To: wireguard@lists.zx2c4.com
Subject: Support for running as non-root user on OpenBSD with WG_TUN_FD?
Date: Wed, 25 Mar 2020 21:31:49 -0400	[thread overview]
Message-ID: <B5A44FC5-FCE3-4A6C-BA82-77173CC2B42C@mutualaid.info> (raw)

Hi there,

From what I can find, I should be able to run wireguard-go as a non-root user on OpenBSD, as long as I set the MTU on the interface to 1420 before starting WireGuard: https://git.zx2c4.com/wireguard-go/commit/?id=4d5819183e218e040fa0a73df560b4a4a9a768d7

I have the tun2 interface configured with the MTU set to 1420. However, I’m seeing the following error when actually running wireguard-go as the non-root user:

ERROR: (tun2) 2020/03/24 22:47:37 Failed to create TUN device: open /dev/tun2: permission denied

I don’t know Go very well, but it seems like main.go calls the CreateTUN function, and CreateTUN (in tun_openbsd.go) tries to open /dev/tun2 in read-write mode? There seems to be an option to set the WG_TUN_FD environment variable, so that CreateTUNFromFile gets called instead of CreateTUN, but I don’t understand how to properly get a file descriptor in this context.

Thanks for any insight anyone can provide!

-Brian

             reply	other threads:[~2020-03-30  2:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26  1:31 Brian [this message]
2020-03-30 17:17 ` Brian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B5A44FC5-FCE3-4A6C-BA82-77173CC2B42C@mutualaid.info \
    --to=brian@mutualaid.info \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).