From: "Nils Andreas Svee" <me@lochnair.net>
To: "Florent B." <florent@coppint.com>,
"WireGuard mailing list" <wireguard@lists.zx2c4.com>
Subject: Re: Enable Wireguard only for specific user
Date: Thu, 30 Sep 2021 12:53:29 +0200 [thread overview]
Message-ID: <ac93f873-83fd-43b1-a247-f7df94cf0c36@www.fastmail.com> (raw)
In-Reply-To: <0fd0ed22-732c-0ea5-5067-538dc0842869@coppint.com>
Hi,
What I've had success with is using policy-based routing, selecting the routing table to use based on UID's.
You create a new routing table for the WireGuard VPN and add a rule directing that users traffic to that table.
Using commands you can do this to route traffic from the user with UID 1000 to table 500.
> ip rule add pref 20 uidrange 1000-1000 lookup 500
You can also do this in systemd-networkd if you're using that. Not sure about other network managers.
Best Regards
Nils
On Thu, Sep 30, 2021, at 12:40, Florent B. wrote:
> Hi list,
>
> On a Linux system (Ubuntu), I would like to enable Wireguard VPN only
> for a single user on my system.
>
> Currently by default, every packet of every user is getting though
> Wireguard.
>
> How can I do to route packets only for 1 user ?
>
> I think I have to play with packets marking (wg show wg0 fwmark /
> iptables owner/mark module), I tried some commands but was unable to
> success.
>
> Can someone help please ?
>
> Thank you.
>
> Florent
next prev parent reply other threads:[~2021-09-30 10:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 10:40 Florent B.
2021-09-30 10:53 ` Nils Andreas Svee [this message]
2021-09-30 11:01 ` Florent B.
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=ac93f873-83fd-43b1-a247-f7df94cf0c36@www.fastmail.com \
--to=me@lochnair.net \
--cc=florent@coppint.com \
--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).