Skip to content

Allow changing the transit namespace

Julian Orth wireguard 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest11 patches 1 replyIn review
  2. v412 patches 3 repliesSuperseded
  3. v312 patches 0 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v210 patches0 repliesSuperseded
v17 patches9 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11netlink: check for CAP_NET_ADMIN manuallysrc/netlink.c+12 -30 replies
2/11netlink: allow specifying the device namespacesrc/netlink.c src/uapi/wireguard.h+87 -210 replies
3/11netlink: restrict access to the UDP socketsrc/netlink.c src/uapi/wireguard.h+25 -30 replies
4/11device: rename creating_net to transit_netsrc/device.c src/device.h src/netlink.c +1 more+18 -180 replies
5/11device: store a copy of the device netsrc/device.c src/device.h+20 -110 replies
6/11socket: allow modification of transit_netsrc/device.c src/netlink.c src/socket.c +1 more+17 -150 replies
7/11netlink: allow modification of transit netsrc/netlink.c src/uapi/wireguard.h+44 -181 reply
8/11tools: add framework for shared optionssrc/tools/containers.h src/tools/genkey.c src/tools/pubkey.c +6 more+72 -190 replies
9/11tools: allow specifying the device namespacesrc/tools/containers.h src/tools/ipc.c src/tools/ipc.h +7 more+155 -270 replies
10/11tools: allow modification of transit netsrc/tools/config.c src/tools/containers.h src/tools/ipc.c +2 more+24 -40 replies
11/11tests: add test for transit-netsrc/tests/netns.sh+40 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 00/11] Allow changing the transit namespace

Hi,

This is v5 of this series. This series makes the following changes:

* wg(1) can now access devices in another network namespace. The syntax is

    wg --netns <pid|file-path> <subcommand>

For example

    wg --netns 5363 show wg0

* wg(1) can now change the network namespace of the UDP socket of a device. The syntax is

wg set <device> transit-netns <pid|file-path>

For example

wg set wg0 transit-netns 5363

* When retrieving or modifying properties of the UDP socket (its incoming port or its network namespace), the netlink code now checks that the calling process has at least one of the following properties:

* The calling process' network namespace is the same as the (new) network namespace of the socket.
* The calling process has the CAP_NET_ADMIN capability in the (new) network namespace of the socket.

These changes allow a user to create a wg device in a user namespace and to set the network namespace of the UDP socket to the init namespace. This allows the user to communicate over a wg device even if the user does not have root in the init namespace.

The code of this version is almost identical to the previous version except that

* the first commit has been dropped and
* the code has been rebased on master.

Julian

Julian Orth (11):
netlink: check for CAP_NET_ADMIN manually
netlink: allow specifying the device namespace
netlink: restrict access to the UDP socket
device: rename creating_net to transit_net
device: store a copy of the device net
socket: allow modification of transit_net
netlink: allow modification of transit net
tools: add framework for shared options
tools: allow specifying the device namespace
tools: allow modification of transit net
tests: add test for transit-net

 src/device.c            |  35 ++++++----
 src/device.h            |   6 +-
 src/netlink.c           | 150 ++++++++++++++++++++++++++++++++--------
 src/socket.c            |  18 ++---
 src/socket.h            |   6 +-
 src/tests/netns.sh      |  40 +++++++++++
 src/tools/config.c      |   8 +++
 src/tools/containers.h  |  22 +++++-
 src/tools/genkey.c      |   3 +-
 src/tools/ipc.c         |  26 +++++--
 src/tools/ipc.h         |   7 +-
 src/tools/man/wg.8      |   9 ++-
 src/tools/netns.c       |  62 +++++++++++++++++
 src/tools/netns.h       |  18 +++++
 src/tools/pubkey.c      |   3 +-
 src/tools/set.c         |   6 +-
 src/tools/setconf.c     |   4 +-
 src/tools/show.c        |  35 +++++++---
 src/tools/showconf.c    |   4 +-
 src/tools/subcommands.h |  14 ++--
 src/tools/wg.c          |  64 +++++++++++++++--
 src/uapi/wireguard.h    |  39 ++++++++++-
 22 files changed, 477 insertions(+), 102 deletions(-)
 create mode 100644 src/tools/netns.c
 create mode 100644 src/tools/netns.h
Signature · 6 lines
2.19.2

_______________________________________________
WireGuard mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard