Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Brian <brian@mutualaid.info>
To: wireguard@lists.zx2c4.com
Subject: Re: Support for running as non-root user on OpenBSD with WG_TUN_FD?
Date: Mon, 30 Mar 2020 13:17:36 -0400	[thread overview]
Message-ID: <DD8A540E-EA7C-403A-875F-3A88CB19F4C6@mutualaid.info> (raw)
In-Reply-To: <B5A44FC5-FCE3-4A6C-BA82-77173CC2B42C@mutualaid.info>

> On Mar 25, 2020, at 9:31 PM, Brian <brian@mutualaid.info> wrote:

> 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.

I’ve since done some reading and I think that WG_TUN_FD is designed more for contexts like running Wireguard in a container.

I’ve been able to get it working as a non-root user on OpenBSD but I did have to give the _wireguard user or group read/write permissions on /dev/tun2 and /var/run/wireguard. I’m exploring some alternatives to this but don’t think there is a bug or anything here. If there are any “best practices” for running wireguard-go as a non-root user I’d love to hear them!

-Brian

      reply	other threads:[~2020-04-04 22:45 UTC|newest]

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

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=DD8A540E-EA7C-403A-875F-3A88CB19F4C6@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).