Fix recommended permissions for /dev/net/tun
Subsystems (4)
PATCH 1/1 Fix recommended permissions for /dev/net/tun
There's no reason to restrict unprivileged users from opening the /dev/net/tun device node -- to do anything exciting requires CAP_NET_ADMIN or a persistent device which is owned by the user in question anyway. And if it _isn't_ openable by unprivileged users, then giving ownership of devices to those users is a fairly pointless exercise.
Documentation/networking/tuntap.txt +7 -4
@@ -39,10 +39,13 @@ Copyright (C) 1999-2000 Maxim Krasnyansk mknod /dev/net/tun c 10 200 Set permissions: - e.g. chmod 0700 /dev/net/tun - if you want the device only accessible by root. Giving regular users the - right to assign network devices is NOT a good idea. Users could assign - bogus network interfaces to trick firewalls or administrators. + e.g. chmod 0666 /dev/net/tun + There's no harm in allowing the device to be accessible by non-root users, + since CAP_NET_ADMIN is required for creating network devices or for + connecting to network devices which aren't owned by the user in question. + If you want to create persistent devices and give ownership of them to + unprivileged users, then you need the /dev/net/tun device to be usable by + those users. Driver module autoloading
Signature · 1 line
dwmw2
Quoted 4 lines · David Woodhouse
There's no reason to restrict unprivileged users from opening the
/dev/net/tundevice node -- to do anything exciting requiresCAP_NET_ADMINor a persistent device which is owned by the user in question anyway.
Hm, I lie. Let us alter reality to match my previous perception of it...
[PATCH] Require CAP_SYS_ADMIN to create tuntap devices.
The tuntap driver allows an admin to create persistent devices and assign ownership of them to individual users. Unfortunately, relaxing the permissions on the /dev/net/tun device node _also_ allows those users to create arbitrary new devices of their own. This patch corrects that, and adjusts the recommended permissions for the device node accordingly.
Documentation/networking/tuntap.txt +7 -4
@@ -39,10 +39,13 @@ Copyright (C) 1999-2000 Maxim Krasnyansk mknod /dev/net/tun c 10 200 Set permissions: - e.g. chmod 0700 /dev/net/tun - if you want the device only accessible by root. Giving regular users the - right to assign network devices is NOT a good idea. Users could assign - bogus network interfaces to trick firewalls or administrators. + e.g. chmod 0666 /dev/net/tun + There's no harm in allowing the device to be accessible by non-root users, + since CAP_NET_ADMIN is required for creating network devices or for + connecting to network devices which aren't owned by the user in question. + If you want to create persistent devices and give ownership of them to + unprivileged users, then you need the /dev/net/tun device to be usable by + those users. Driver module autoloading
drivers/net/tun.c +3 -0
@@ -490,6 +490,9 @@ static int tun_set_iff(struct file *file err = -EINVAL ; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +/* Set dev type */ if (ifr->ifr_flags &IFF_TUN ) {/* TUN device */
Signature · 1 line
dwmw2
Quoted 7 lines · David Woodhouse
Quoted 4 lines · David Woodhouse
There's no reason to restrict unprivileged users from opening the
/dev/net/tundevice node -- to do anything exciting requiresCAP_NET_ADMINor a persistent device which is owned by the user in question anyway.Hm, I lie. Let us alter reality to match my previous perception of it...
Perhaps you lie again :)
Are you sure you're adding a capable(CAP_SYS_ADMIN)? :P
Quoted 41 lines
[PATCH] Require
CAP_SYS_ADMINto create tuntap devices.The tuntap driver allows an admin to create persistent devices and assign ownership of them to individual users. Unfortunately, relaxing the permissions on the
/dev/net/tundevice node _also_ allows those users to create arbitrary new devices of their own. This patch corrects that, and adjusts the recommended permissions for the device node accordingly.Signed-off-by David Woodhouse <[email protected]>Documentation/networking/tuntap.txt +7
-4@@ -39,10 +39,13 @@ Copyright (C) 1999-2000 Maxim Krasnyansk mknod /dev/net/tun c 10 200 Set permissions: - e.g. chmod 0700 /dev/net/tun - if you want the device only accessible by root. Giving regular users the - right to assign network devices is NOT a good idea. Users could assign - bogus network interfaces to trick firewalls or administrators. + e.g. chmod 0666 /dev/net/tun + There's no harm in allowing the device to be accessible by non-root users, + since CAP_NET_ADMIN is required for creating network devices or for + connecting to network devices which aren't owned by the user in question. + If you want to create persistent devices and give ownership of them to + unprivileged users, then you need the /dev/net/tun device to be usable by + those users. Driver module autoloadingdrivers/net/tun.c +0
-0
drivers/net/tun.c static int tun_set_iff(struct file *file · line 498
Quoted 9 lines
drivers/net/tun.c +3
-0@@ -490,6 +490,9 @@ static int tun_set_iff(struct file *file err = -EINVAL ; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +/* Set dev type */ if (ifr->ifr_flags &IFF_TUN ) {/* TUN device */
Thanks,
Chase
Quoted 3 lines · Chase Venters
Perhaps you lie again :)
Are you sure you're adding a
capable(CAP_SYS_ADMIN)? :P
I'm going to go home now. G'night.
Signature · 1 line
dwmw2
PATCH 1/1 Require CAP_NET_ADMIN to create tuntap devices.
In reply to David WoodhouseThe tuntap driver allows an admin to create persistent devices and assign ownership of them to individual users. Unfortunately, relaxing the permissions on the /dev/net/tun device node so that they can actually use those devices will _also_ allow those users to create arbitrary new devices of their own. This patch corrects that, and adjusts the recommended permissions for the device node accordingly.
Documentation/networking/tuntap.txt +7 -4
@@ -39,10 +39,13 @@ Copyright (C) 1999-2000 Maxim Krasnyansk mknod /dev/net/tun c 10 200 Set permissions: - e.g. chmod 0700 /dev/net/tun - if you want the device only accessible by root. Giving regular users the - right to assign network devices is NOT a good idea. Users could assign - bogus network interfaces to trick firewalls or administrators. + e.g. chmod 0666 /dev/net/tun + There's no harm in allowing the device to be accessible by non-root users, + since CAP_NET_ADMIN is required for creating network devices or for + connecting to network devices which aren't owned by the user in question. + If you want to create persistent devices and give ownership of them to + unprivileged users, then you need the /dev/net/tun device to be usable by + those users. Driver module autoloading
drivers/net/tun.c +3 -0
@@ -490,6 +490,9 @@ static int tun_set_iff(struct file *file err = -EINVAL ; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +/* Set dev type */ if (ifr->ifr_flags &IFF_TUN ) {/* TUN device */
Signature · 1 line
dwmw2