Skip to contentSkip to conversation

iputils: Add capability for clockdiff, ping, traceroute6

RFC PATCH New Petr Vorel 1 participant 1 message Aug 1, 2019

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

RFC PATCH v6 1/1 iputils: Add capability for clockdiff, ping, traceroute6

and fallback to setuid if xattr not enabled.

Not setting xattr on arping as it can be used for ARP Poisoning.

Use cap_net_raw+p (drop +e) as upstream sets that via cap_set_flag(), see https://github.com/iputils/iputils/issues/194

---
Hi,

hope this is the final version :).

Kind regards,
Petr

* devices_table.txt for xattrs enabled:
/usr/sbin/arping f 4755 0 0 - - - - -

	/usr/bin/clockdiff    f 0755 0 0 - - - - -
	|xattr cap_net_raw+p
	/bin/ping             f 0755 0 0 - - - - -
	|xattr cap_net_raw+p
	/usr/bin/traceroute6  f 0755 0 0 - - - - -
	|xattr cap_net_raw+p

* devices_table.txt for setuid:
...
/usr/sbin/arping f 4755 0 0 - - - - -

	/usr/bin/clockdiff    f 4755 0 0 - - - - -
	
	/bin/ping             f 4755 0 0 - - - - -
	
	/usr/bin/traceroute6  f 4755 0 0 - - - - -

...

 package/iputils/iputils.mk | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
package/iputils/iputils.mk +12 -3
index 8e6a3e2fc5..e353e821f9 100644
@@ -73,11 +73,20 @@ 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)
+IPUTILS_CAPABILITY = |xattr cap_net_raw+p
+MAYBE_SUID = 0
+else
+MAYBE_SUID = 4
+endif
 define IPUTILS_PERMISSIONS
 	/usr/sbin/arping      f 4755 0 0 - - - - -
-	/usr/bin/clockdiff    f 4755 0 0 - - - - -
-	/bin/ping             f 4755 0 0 - - - - -
-	/usr/bin/traceroute6  f 4755 0 0 - - - - -
+	/usr/bin/clockdiff    f $(MAYBE_SUID)755 0 0 - - - - -
+	$(IPUTILS_CAPABILITY)
+	/bin/ping             f $(MAYBE_SUID)755 0 0 - - - - -
+	$(IPUTILS_CAPABILITY)
+	/usr/bin/traceroute6  f $(MAYBE_SUID)755 0 0 - - - - -
+	$(IPUTILS_CAPABILITY)
 endef
 
 $(eval $(meson-package))
Signature · 1 line
2.22.0