Skip to contentSkip to conversation

package/iputils: use capabilties (branch yem/iputils-caps)

PATCH New Yann E. MORIN 3 participants 7 messages Aug 1, 2019

lore
Share & tools
lore
#0 lore raw

v7 cover package/iputils: use capabilties (branch yem/iputils-caps)

Hello All!

This small series changes iputils to use capabilities if support for extended attributes is enabled.

Additionally, arping can be used for arp poisoning, so it should not be usable by a non-root user. As such, we remove the setuid bit, and do not assign it a capability either.

Regards,
Yann E. MORIN.

The following changes since commit 152e160bf6fcbb8f73c60944107e3a82f91edf50

package/netsurf: add optional dependency on webp (2019-08-01 16:54:04 +0200)

are available in the git repository at:

git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to 7357ef816dae35990f461175f35135fb4996eb54

package/iputils: use capabilities if possible (2019-08-01 18:18:07 +0200)

----------------------------------------------------------------
Petr Vorel (1):
package/iputils: use capabilities if possible

Yann E. MORIN (1):
package/iputils: drop setuid on arping

 package/iputils/iputils.mk | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v7 1/2 package/iputils: drop setuid on arping

arping can be used for arp poisoning, so it should really not be setuid.

---
 package/iputils/iputils.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/iputils/iputils.mk +1 -1
index b28222138f..7482bbdca1 100644
@@ -80,7 +80,7 @@ IPUTILS_POST_INSTALL_TARGET_HOOKS += IPUTILS_CREATE_PING6_SYMLINK
 # handle permissions ourselves
 IPUTILS_CONF_OPTS += -DNO_SETCAP_OR_SUID=true
 define IPUTILS_PERMISSIONS
-	/usr/sbin/arping      f 4755 0 0 - - - - -
+	/usr/sbin/arping      f  755 0 0 - - - - -
 	/usr/bin/clockdiff    f 4755 0 0 - - - - -
 	/bin/ping             f 4755 0 0 - - - - -
 	/usr/bin/traceroute6  f 4755 0 0 - - - - -
Signature · 1 line
2.20.1
#2 lore raw

PATCH v7 1/2 package/iputils: drop setuid on arping

Hi Yann,

Quoted 4 lines

arping can be used for arp poisoning, so it should really not be setuid.

+1

Quoted 9 lines
---
 package/iputils/iputils.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/iputils/iputils.mk +0 -0
index b28222138f..7482bbdca1 100644

package/iputils/iputils.mk IPUTILS_POST_INSTALL_TARGET_HOOKS += IPUTILS_CREATE_PING6_SYMLINK · line 86

Quoted 8 lines
package/iputils/iputils.mk +1 -1
@@ -80,7 +80,7 @@ IPUTILS_POST_INSTALL_TARGET_HOOKS += IPUTILS_CREATE_PING6_SYMLINK
 # handle permissions ourselves
 IPUTILS_CONF_OPTS += -DNO_SETCAP_OR_SUID=true
 define IPUTILS_PERMISSIONS
-	/usr/sbin/arping      f 4755 0 0 - - - - -
+	/usr/sbin/arping      f  755 0 0 - - - - -
 	/usr/bin/clockdiff    f 4755 0 0 - - - - -
 	/bin/ping             f 4755 0 0 - - - - -
 	/usr/bin/traceroute6  f 4755 0 0 - - - - -

Kind regards,
Petr

#4 lore raw

PATCH v7 2/2 package/iputils: use capabilities if possible

In reply to Yann E. MORIN

From: Petr Vorel <[email protected]>

If support for extended attributes is enabled, then we can use them to store capabilities. If not, we keep using the setuid bit.

arping does not get a capability, as it can be used for arp poisoning.

[yann.morin.1998 at free.fr:
- resort to using q full-fledged conditional block
]

---
Changes v6 -> v7:
- use a full if-block

---
 package/iputils/iputils.mk | 12 ++++++++++++
 1 file changed, 12 insertions(+)
package/iputils/iputils.mk +12 -0
index 7482bbdca1..cbcce89684 100644
@@ -79,11 +79,23 @@ IPUTILS_POST_INSTALL_TARGET_HOOKS += IPUTILS_CREATE_PING6_SYMLINK
 
 # handle permissions ourselves
 IPUTILS_CONF_OPTS += -DNO_SETCAP_OR_SUID=true
+ifeq ($(BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES),y)
+define IPUTILS_PERMISSIONS
+	/usr/sbin/arping      f 755 0 0 - - - - -
+	/usr/bin/clockdiff    f 755 0 0 - - - - -
+	|xattr cap_net_raw+p
+	/bin/ping             f 755 0 0 - - - - -
+	|xattr cap_net_raw+p
+	/usr/bin/traceroute6  f 755 0 0 - - - - -
+	|xattr cap_net_raw+p
+endef
+else
 define IPUTILS_PERMISSIONS
 	/usr/sbin/arping      f  755 0 0 - - - - -
 	/usr/bin/clockdiff    f 4755 0 0 - - - - -
 	/bin/ping             f 4755 0 0 - - - - -
 	/usr/bin/traceroute6  f 4755 0 0 - - - - -
 endef
+endif
 
 $(eval $(meson-package))
Signature · 1 line
2.20.1
#5 lore raw

PATCH v7 2/2 package/iputils: use capabilities if possible

Hi Yann,

Quoted 36 lines

From: Petr Vorel <[email protected]>

If support for extended attributes is enabled, then we can use them to store capabilities. If not, we keep using the setuid bit.

arping does not get a capability, as it can be used for arp poisoning.

[yann.morin.1998 at free.fr:
- resort to using q full-fledged conditional block
]

---
Changes v6 -> v7:
- use a full if-block

---
 package/iputils/iputils.mk | 12 ++++++++++++
 1 file changed, 12 insertions(+)
package/iputils/iputils.mk +8 -0
index 7482bbdca1..cbcce89684 100644
@@ -79,11 +79,23 @@ IPUTILS_POST_INSTALL_TARGET_HOOKS += IPUTILS_CREATE_PING6_SYMLINK
 
 # handle permissions ourselves
 IPUTILS_CONF_OPTS += -DNO_SETCAP_OR_SUID=true
+ifeq ($(BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES),y)
+define IPUTILS_PERMISSIONS
+	/usr/sbin/arping      f 755 0 0 - - - - -
+	/usr/bin/clockdiff    f 755 0 0 - - - - -
+	|xattr cap_net_raw+p
+	/bin/ping             f 755 0 0 - - - - -
+	|xattr cap_net_raw+p
+	/usr/bin/traceroute6  f 755 0 0 - - - - -

package/iputils/iputils.mk IPUTILS_POST_INSTALL_TARGET_HOOKS += IPUTILS_CREATE_PING6_SYMLINK · line 99

Quoted 10 lines
package/iputils/iputils.mk +4 -0
+	|xattr cap_net_raw+p
+endef
+else
 define IPUTILS_PERMISSIONS
 	/usr/sbin/arping      f  755 0 0 - - - - -
 	/usr/bin/clockdiff    f 4755 0 0 - - - - -
 	/bin/ping             f 4755 0 0 - - - - -
 	/usr/bin/traceroute6  f 4755 0 0 - - - - -
 endef
+endif

I wanted to avoid duplicity, but this is really clearer to read! Thanks for fixing arping setuid.

Kind regards,
Petr

Quoted 1 line
package/iputils/iputils.mk +0 -0
 $(eval $(meson-package))
#6 lore raw

PATCH v7 2/2 package/iputils: use capabilities if possible

In reply to Yann E. MORIN
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: Petr Vorel <[email protected]>
If support for extended attributes is enabled, then we can use them to store capabilities. If not, we keep using the setuid bit.

arping does not get a capability, as it can be used for arp poisoning.

Quoted 8 lines

[yann.morin.1998 at free.fr:
- resort to using q full-fledged conditional block
]

---
Changes v6 -> v7:
- use a full if-block

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard