Skip to contentSkip to conversation

package/polkit: bump to version 0.116

PATCH Superseded aduskett at gmail.com 2 participants 10 messages Nov 28, 2019 – Nov 29, 2019

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover package/polkit: bump to version 0.116

From: Adam Duskett <[email protected]>

In this patch series I have bumped polkit to version 0.116.
I have also added the following:
- Two tests of which ensure that polkit is working properly on systems running both init.d and systemd.
- Service files for both systemd and init.d
- A polkitd user upon which the polkitd daemon rely.
- Setting permissions to the proper directories for the polkit user.

Adam Duskett (6):
package/polkit: bump to version 0.116 package/polkit: support different authentication frameworks package/polkit: add systemd service file. package/polkit: add init service file
polkit-rules-test-systemd: new test
polkit-rules-test-initd: new test

 DEVELOPERS                                    |   4 +
 .../0001-make-netgroup-support-optional.patch | 232 ++++++++++++++++++
 package/polkit/Config.in                      |  23 +-
 package/polkit/S50polkit                      |  15 ++
 package/polkit/polkit.hash                    |   2 +-
 package/polkit/polkit.mk                      |  39 ++-
 package/polkit/polkit.service                 |   7 +
 package/systemd/Config.in                     |  14 +-
 package/udisks/Config.in                      |  27 +-
 .../package/br2-external/polkit/Config.in     |   2 +
 .../package/br2-external/polkit/external.desc |   1 +
 .../package/br2-external/polkit/external.mk   |   1 +
 .../package/polkit-rules-test-initd/Config.in |   6 +
 .../polkit-rules-test-initd/hello-polkit.c    |   6 +
 .../hello-polkit.policy                       |  14 ++
 .../hello-polkit.rules                        |   6 +
 .../polkit-rules-test-initd.mk                |  31 +++
 .../polkit-rules-test-systemd/Config.in       |   6 +
 .../polkit-rules-test-systemd.mk              |  20 ++
 .../systemd-timesyncd-restart.rules           |   7 +
 .../tests/package/test_polkit_initd.py        |  53 ++++
 .../tests/package/test_polkit_systemd.py      |  51 ++++
 22 files changed, 546 insertions(+), 21 deletions(-)
 create mode 100644 package/polkit/0001-make-netgroup-support-optional.patch
 create mode 100644 package/polkit/S50polkit
 create mode 100644 package/polkit/polkit.service
 create mode 100644 support/testing/tests/package/br2-external/polkit/Config.in
 create mode 100644 support/testing/tests/package/br2-external/polkit/external.desc
 create mode 100644 support/testing/tests/package/br2-external/polkit/external.mk
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/Config.in
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/hello-polkit.c
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/hello-polkit.policy
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/hello-polkit.rules
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/polkit-rules-test-initd.mk
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-systemd/Config.in
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-systemd/polkit-rules-test-systemd.mk
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-systemd/systemd-timesyncd-restart.rules
 create mode 100644 support/testing/tests/package/test_polkit_initd.py
 create mode 100644 support/testing/tests/package/test_polkit_systemd.py
Signature · 1 line
2.23.0
#1 lore raw

PATCH v4 1/6 package/polkit: bump to version 0.116

From: Adam Duskett <[email protected]>

Other changes:
- Add spidermonkey as a dependency.
- Add 0001-make-netgroup-support-optional.patch to allow building on musl.
- Add a runtime dependency on dbus.
- Add --disable-libelongind.
- Add --disable-libsystemd-login.
- Update dependencies for systemd pam support.
- Update dependencies for udisks.

---
 DEVELOPERS                                    |   1 +
 .../0001-make-netgroup-support-optional.patch | 232 ++++++++++++++++++
 package/polkit/Config.in                      |  23 +-
 package/polkit/polkit.hash                    |   2 +-
 package/polkit/polkit.mk                      |   8 +-
 package/systemd/Config.in                     |  14 +-
 package/udisks/Config.in                      |  27 +-
 7 files changed, 288 insertions(+), 19 deletions(-)
 create mode 100644 package/polkit/0001-make-netgroup-support-optional.patch
DEVELOPERS +1 -0
index 78387c0468..00dd4d39e9 100644
@@ -53,6 +53,7 @@ F:	package/openjdk/
 F:	package/openjdk-bin/
 F:	package/php/
 F:	package/policycoreutils/
+F:	package/polkit/
 F:	package/python3/
 F:	package/python-aioredis/
 F:	package/python-asgiref/
package/polkit/0001-make-netgroup-support-optional.patch new file +232 -0

232 lines not on this page · raw message

package/polkit/Config.in +18 -5
index ac17cb4dc3..853f81347a 100644
@@ -1,11 +1,17 @@
 config BR2_PACKAGE_POLKIT
 	bool "polkit"
+	depends on BR2_INSTALL_LIBSTDCPP # spidermonkey
+	depends on BR2_PACKAGE_DBUS # runtime
+	depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS # spidermonkey
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # spidermonkey
+	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # spidermonkey
 	depends on BR2_USE_MMU # libglib2
-	depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2
-	depends on BR2_TOOLCHAIN_USES_GLIBC
 	depends on BR2_USE_WCHAR # libglib2
-	select BR2_PACKAGE_LIBGLIB2
+	depends on !BR2_STATIC_LIBS # spidermonkey
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC # spidermonkey
 	select BR2_PACKAGE_EXPAT
+	select BR2_PACKAGE_LIBGLIB2
+	select BR2_PACKAGE_SPIDERMONKEY
 	help
 	  PolicyKit is a toolkit for defining and handling
 	  authorizations. It is used for allowing unprivileged
@@ -13,6 +19,13 @@ config BR2_PACKAGE_POLKIT
 
 	  http://www.freedesktop.org/wiki/Software/polkit
 
-comment "polkit needs a toolchain w/ wchar, threads"
+comment "polkit needs a glibc or musl toolchain with C++, wchar, dynamic library, NPTL, gcc >= 4.9"
 	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_PACKAGE_DBUS
+	depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_USES_UCLIBC || \
+		!BR2_INSTALL_LIBSTDCPP || \
+		BR2_STATIC_LIBS || \
+		!BR2_TOOLCHAIN_HAS_THREADS_NPTL || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
+		!BR2_USE_WCHAR
package/polkit/polkit.hash +1 -1
index 6368091c4a..bacd682139 100644
@@ -1,5 +1,5 @@
 # Locally calculated after checking pgp signature
-sha256	8fdc7cc8ba4750fcce1a4db9daa759c12afebc7901237e1c993c38f08985e1df	polkit-0.105.tar.gz
+sha256	88170c9e711e8db305a12fdb8234fac5706c61969b94e084d0f117d8ec5d34b1	polkit-0.116.tar.gz
 
 # Locally calculated
 sha256	d2e2aa973e29c75e1b492e67ea7b7da9de2d501d49a934657971fd74f9a0b0a8	COPYING
package/polkit/polkit.mk +5 -3
index fb4c171c52..507d1865fa 100644
@@ -4,20 +4,22 @@
 #
 ################################################################################
 
-POLKIT_VERSION = 0.105
+POLKIT_VERSION = 0.116
 POLKIT_SITE = http://www.freedesktop.org/software/polkit/releases
 POLKIT_LICENSE = GPL-2.0
 POLKIT_LICENSE_FILES = COPYING
 
 POLKIT_INSTALL_STAGING = YES
 
-POLKIT_DEPENDENCIES = libglib2 host-intltool expat
+POLKIT_DEPENDENCIES = libglib2 host-intltool expat spidermonkey
 
 # We could also support --with-authfw=pam
 POLKIT_CONF_OPTS = \
 	--with-authfw=shadow \
 	--with-os-type=unknown \
 	--disable-man-pages \
-	--disable-examples
+	--disable-examples \
+	--disable-libelogind \
+	--disable-libsystemd-login
 
 $(eval $(autotools-package))
package/systemd/Config.in +11 -3
index aef39abe27..abfe35d17b 100644
@@ -275,7 +275,11 @@ config BR2_PACKAGE_SYSTEMD_NETWORKD
 
 config BR2_PACKAGE_SYSTEMD_POLKIT
 	bool "enable polkit support"
-	depends on BR2_TOOLCHAIN_USES_GLIBC # polkit
+	depends on BR2_INSTALL_LIBSTDCPP # polkit -> spidermonkey
+	depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS # polkit -> spidermonkey
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # polkit -> spidermonkey
+	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # polkit -> spidermonkey
+	depends on BR2_USE_WCHAR # libglib2
 	select BR2_PACKAGE_POLKIT
 	help
 	  If enabled, systemd is built with polkit support and policy
@@ -285,8 +289,12 @@ config BR2_PACKAGE_SYSTEMD_POLKIT
 
 	  http://wiki.freedesktop.org/www/Software/polkit/
 
-comment "polkit support needs a glibc toolchain"
-	depends on !BR2_TOOLCHAIN_USES_GLIBC
+comment "polkit support needs a toolchain with C++, wchar, NPTL, gcc >= 4.9"
+	depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS
+	depends on !BR2_INSTALL_LIBSTDCPP || \
+		!BR2_TOOLCHAIN_HAS_THREADS_NPTL || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
+		!BR2_USE_WCHAR
 
 config BR2_PACKAGE_SYSTEMD_QUOTACHECK
 	bool "enable quotacheck tools"
package/udisks/Config.in +20 -7
index c1e5538fb5..c320eb1e1b 100644
@@ -1,11 +1,14 @@
 config BR2_PACKAGE_UDISKS
 	bool "udisks"
+	depends on BR2_INSTALL_LIBSTDCPP # spidermonkey
 	depends on BR2_PACKAGE_HAS_UDEV
-	depends on BR2_TOOLCHAIN_HAS_THREADS # dbus-glib -> glib2
-	depends on BR2_TOOLCHAIN_USES_GLIBC # polkit, lvm2
-	depends on BR2_USE_MMU # lvm2
-	depends on !BR2_STATIC_LIBS # lvm2
+	depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS # spidermonkey
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # spidermonkey
+	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # polkit
+	depends on BR2_USE_MMU # lvm2, polkit
 	depends on BR2_USE_WCHAR # dbus-glib -> glib2
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC # polkit, lvm2
+	depends on !BR2_STATIC_LIBS # lvm2, spidermonkey
 	select BR2_PACKAGE_DBUS
 	select BR2_PACKAGE_DBUS_GLIB
 	select BR2_PACKAGE_SG3_UTILS
@@ -30,17 +33,27 @@ if BR2_PACKAGE_UDISKS
 
 config BR2_PACKAGE_UDISKS_LVM2
 	bool "lvm2 support"
+	# The lvm app library can't compile agianst musl
+	depends on BR2_TOOLCHAIN_USES_GLIBC
 	select BR2_PACKAGE_LVM2_APP_LIBRARY
 	help
 	  Enable LVM2 support
 
+comment "lvm2 support needs a glibc toolchain"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC
+
 endif
 
 comment "udisks needs udev /dev management"
 	depends on BR2_USE_MMU
 	depends on !BR2_PACKAGE_HAS_UDEV
 
-comment "udisks needs a glibc toolchain w/ wchar, threads, dynamic library"
+comment "udisks needs a glibc or musl toolchain with C++, wchar, dynamic library, NPTL, gcc >= 4.9"
 	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
-		BR2_STATIC_LIBS || !BR2_TOOLCHAIN_USES_GLIBC
+	depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_USES_UCLIBC || \
+		!BR2_INSTALL_LIBSTDCPP || \
+		BR2_STATIC_LIBS || \
+		!BR2_TOOLCHAIN_HAS_THREADS_NPTL || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
+		!BR2_USE_WCHAR
Signature · 1 line
2.23.0
#2 lore raw

PATCH v4 2/6 package/polkit: support different authentication frameworks

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

Use pam if available, otherwise use shadow.

---
 package/polkit/polkit.mk | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
package/polkit/polkit.mk +7 -2
index 507d1865fa..0c17e9bc27 100644
@@ -13,13 +13,18 @@ POLKIT_INSTALL_STAGING = YES
 
 POLKIT_DEPENDENCIES = libglib2 host-intltool expat spidermonkey
 
-# We could also support --with-authfw=pam
 POLKIT_CONF_OPTS = \
-	--with-authfw=shadow \
 	--with-os-type=unknown \
 	--disable-man-pages \
 	--disable-examples \
 	--disable-libelogind \
 	--disable-libsystemd-login
 
+ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
+POLKIT_CONF_OPTS += --with-authfw=pam
+else
+POLKIT_CONF_OPTS += --with-authfw=shadow
+endif
+
+
 $(eval $(autotools-package))
Signature · 1 line
2.23.0
#3 lore raw

PATCH v4 3/6 package/polkit: add systemd service file.

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

- Add polkit.service for systemd based systems.
- Add a polkitd user upon which /usr/lib/polkit-1/polkitd relies.
- Set appropriate directory permissions to allow the polkitd user to access rules and actions.
- Set appropriate default attributes for the pkexec binary.

---
 package/polkit/polkit.mk      | 17 +++++++++++++++++
 package/polkit/polkit.service |  7 +++++++
 2 files changed, 24 insertions(+)
 create mode 100644 package/polkit/polkit.service
package/polkit/polkit.mk +17 -0
index 0c17e9bc27..b440cd2f1c 100644
@@ -26,5 +26,22 @@ else
 POLKIT_CONF_OPTS += --with-authfw=shadow
 endif
 
+define POLKIT_USERS
+	polkitd -1 polkitd -1 * - - - Polkit Daemon
+endef
+
+define POLKIT_PERMISSIONS
+	/etc/polkit-1 r 750 root polkitd - - - - -
+	/usr/share/polkit-1 r 750 root polkitd - - - - -
+	/usr/bin/pkexec f 4755 root root - - - - -
+endef
+
+define POLKIT_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 package/polkit/polkit.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/polkit.service
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+	ln -sf ../../../../usr/lib/systemd/system/polkit.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/polkit.service
+endef
 
 $(eval $(autotools-package))
package/polkit/polkit.service new file +7 -0
new file mode 100644
index 0000000000..013e3684c5
@@ -0,0 +1,7 @@
+[Unit]
+Description=Authorization Manager
+
+[Service]
+Type=dbus
+BusName=org.freedesktop.PolicyKit1
+ExecStart=/usr/lib/polkit-1/polkitd --no-debug
Signature · 1 line
2.23.0
#4 lore raw

PATCH v4 3/6 package/polkit: add systemd service file.

Please add an [Install] section matching your initialisation routine... This will simplify our migration to host-systemd
and is also more correct.

Thx

Le jeu. 28 nov. 2019 ? 02:26, <[email protected]> a ?crit :

Quoted 64 lines

From: Adam Duskett <[email protected]>

- Add polkit.service for systemd based systems.
- Add a polkitd user upon which /usr/lib/polkit-1/polkitd relies.
- Set appropriate directory permissions to allow the polkitd user to access rules and actions.
- Set appropriate default attributes for the pkexec binary.

---
 package/polkit/polkit.mk      | 17 +++++++++++++++++
 package/polkit/polkit.service |  7 +++++++
 2 files changed, 24 insertions(+)
 create mode 100644 package/polkit/polkit.service
package/polkit/polkit.mk +17 -0
index 0c17e9bc27..b440cd2f1c 100644
@@ -26,5 +26,22 @@ else
 POLKIT_CONF_OPTS += --with-authfw=shadow
 endif
 
+define POLKIT_USERS
+       polkitd -1 polkitd -1 * - - - Polkit Daemon
+endef
+
+define POLKIT_PERMISSIONS
+       /etc/polkit-1 r 750 root polkitd - - - - -
+       /usr/share/polkit-1 r 750 root polkitd - - - - -
+       /usr/bin/pkexec f 4755 root root - - - - -
+endef
+
+define POLKIT_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -D -m 644 package/polkit/polkit.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/polkit.service
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+       ln -sf ../../../../usr/lib/systemd/system/polkit.service \
+
 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/polkit.service
+endef
 

$(eval $(autotools-package))

package/polkit/polkit.service new file +7 -1
new file mode 100644
index 0000000000..013e3684c5
@@ -0,0 +1,7 @@
+[Unit]
+Description=Authorization Manager
+
+[Service]
+Type=dbus
+BusName=org.freedesktop.PolicyKit1
+ExecStart=/usr/lib/polkit-1/polkitd --no-debug
--

2.23.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 21 lines
[image: SMILE]  <http://www.smile.eu/>

20 rue des Jardins
92600 Asni?res-sur-Seine
*J?r?my ROSEN*
Architecte technique

[image: email] jeremy.rosen at smile.fr
[image: phone]  +33 6 88 25 87 42
[image: url] http://www.smile.eu

[image: Twitter] <https://twitter.com/GroupeSmile> [image: Facebook]
<https://www.facebook.com/smileopensource> [image: LinkedIn]
<https://www.linkedin.com/company/smile> [image: Github]
<https://github.com/Smile-SA>

[image: D?couvrez l?univers Smile, rendez-vous sur smile.eu]
<https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20191129/2cf31e52/attachment.html>
#5 lore raw

PATCH v4 3/6 package/polkit: add systemd service file.

I'm not sure what you mean by this, could you explain?

Thanks!

Adam

Quoted 86 lines · J?r?my ROSEN

Please add an [Install] section matching your initialisation routine... This will simplify our migration to host-systemd
and is also more correct.

Thx

Le jeu. 28 nov. 2019 ? 02:26, <[email protected]> a ?crit :

Quoted 59 lines

From: Adam Duskett <[email protected]>

- Add polkit.service for systemd based systems.
- Add a polkitd user upon which /usr/lib/polkit-1/polkitd relies.
- Set appropriate directory permissions to allow the polkitd user to access rules and actions.
- Set appropriate default attributes for the pkexec binary.

---
 package/polkit/polkit.mk      | 17 +++++++++++++++++
 package/polkit/polkit.service |  7 +++++++
 2 files changed, 24 insertions(+)
 create mode 100644 package/polkit/polkit.service
package/polkit/polkit.mk +17 -0
index 0c17e9bc27..b440cd2f1c 100644
@@ -26,5 +26,22 @@ else
 POLKIT_CONF_OPTS += --with-authfw=shadow
 endif
 
+define POLKIT_USERS
+       polkitd -1 polkitd -1 * - - - Polkit Daemon
+endef
+
+define POLKIT_PERMISSIONS
+       /etc/polkit-1 r 750 root polkitd - - - - -
+       /usr/share/polkit-1 r 750 root polkitd - - - - -
+       /usr/bin/pkexec f 4755 root root - - - - -
+endef
+
+define POLKIT_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -D -m 644 package/polkit/polkit.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/polkit.service
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+       ln -sf ../../../../usr/lib/systemd/system/polkit.service \
+
 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/polkit.service
+endef
 

$(eval $(autotools-package))

package/polkit/polkit.service new file +7 -1
new file mode 100644
index 0000000000..013e3684c5
@@ -0,0 +1,7 @@
+[Unit]
+Description=Authorization Manager
+
+[Service]
+Type=dbus
+BusName=org.freedesktop.PolicyKit1
+ExecStart=/usr/lib/polkit-1/polkitd --no-debug
--

2.23.0

Quoted 5 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--
[image: SMILE] <http://www.smile.eu/>

20 rue des Jardins
92600 Asni?res-sur-Seine
*J?r?my ROSEN*
Architecte technique

[image: email] jeremy.rosen at smile.fr
[image: phone] +33 6 88 25 87 42
[image: url] http://www.smile.eu

Quoted 8 lines

[image: Twitter] <https://twitter.com/GroupeSmile> [image: Facebook]
<https://www.facebook.com/smileopensource> [image: LinkedIn]
<https://www.linkedin.com/company/smile> [image: Github]
<https://github.com/Smile-SA>

[image: D?couvrez l?univers Smile, rendez-vous sur smile.eu]
<https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20191129/bc2663c4/attachment.html>

#6 lore raw

PATCH v4 3/6 package/polkit: add systemd service file.

at the bottom of the .service file, please add

[Install}
WantedBy=multi-user.target

Le ven. 29 nov. 2019 ? 21:34, Adam Duskett <[email protected]> a ?crit :

Quoted 105 lines

I'm not sure what you mean by this, could you explain?

Thanks!

Adam

Quoted 95 lines · J?r?my ROSEN

Please add an [Install] section matching your initialisation routine... This will simplify our migration to host-systemd
and is also more correct.

Thx

Le jeu. 28 nov. 2019 ? 02:26, <[email protected]> a ?crit :

Quoted 60 lines

From: Adam Duskett <[email protected]>

- Add polkit.service for systemd based systems.
- Add a polkitd user upon which /usr/lib/polkit-1/polkitd relies.
- Set appropriate directory permissions to allow the polkitd user to access rules and actions.
- Set appropriate default attributes for the pkexec binary.

---
 package/polkit/polkit.mk      | 17 +++++++++++++++++
 package/polkit/polkit.service |  7 +++++++
 2 files changed, 24 insertions(+)
 create mode 100644 package/polkit/polkit.service
package/polkit/polkit.mk +17 -0
index 0c17e9bc27..b440cd2f1c 100644
@@ -26,5 +26,22 @@ else
 POLKIT_CONF_OPTS += --with-authfw=shadow
 endif
 
+define POLKIT_USERS
+       polkitd -1 polkitd -1 * - - - Polkit Daemon
+endef
+
+define POLKIT_PERMISSIONS
+       /etc/polkit-1 r 750 root polkitd - - - - -
+       /usr/share/polkit-1 r 750 root polkitd - - - - -
+       /usr/bin/pkexec f 4755 root root - - - - -
+endef
+
+define POLKIT_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -D -m 644 package/polkit/polkit.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/polkit.service
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+       ln -sf ../../../../usr/lib/systemd/system/polkit.service \
+
 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/polkit.service
+endef
 

$(eval $(autotools-package))

package/polkit/polkit.service new file +7 -1
new file mode 100644
index 0000000000..013e3684c5
@@ -0,0 +1,7 @@
+[Unit]
+Description=Authorization Manager
+
+[Service]
+Type=dbus
+BusName=org.freedesktop.PolicyKit1
+ExecStart=/usr/lib/polkit-1/polkitd --no-debug
--

2.23.0

Quoted 5 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--
[image: SMILE] <http://www.smile.eu/>

20 rue des Jardins
92600 Asni?res-sur-Seine
*J?r?my ROSEN*
Architecte technique

[image: email] jeremy.rosen at smile.fr
[image: phone] +33 6 88 25 87 42
[image: url] http://www.smile.eu

[image: Twitter] <https://twitter.com/GroupeSmile> [image: Facebook]
<https://www.facebook.com/smileopensource> [image: LinkedIn]
<https://www.linkedin.com/company/smile> [image: Github]
<https://github.com/Smile-SA>

[image: D?couvrez l?univers Smile, rendez-vous sur smile.eu]
<https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature>

Signature · 21 lines
[image: SMILE]  <http://www.smile.eu/>

20 rue des Jardins
92600 Asni?res-sur-Seine
*J?r?my ROSEN*
Architecte technique

[image: email] jeremy.rosen at smile.fr
[image: phone]  +33 6 88 25 87 42
[image: url] http://www.smile.eu

[image: Twitter] <https://twitter.com/GroupeSmile> [image: Facebook]
<https://www.facebook.com/smileopensource> [image: LinkedIn]
<https://www.linkedin.com/company/smile> [image: Github]
<https://github.com/Smile-SA>

[image: D?couvrez l?univers Smile, rendez-vous sur smile.eu]
<https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20191129/b1e8ee61/attachment.html>
#7 lore raw

PATCH v4 4/6 package/polkit: add init service file

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

Add a S50polkit file which starts polkit for non-systemd based systems.

---
 package/polkit/S50polkit | 15 +++++++++++++++
 package/polkit/polkit.mk |  5 +++++
 2 files changed, 20 insertions(+)
 create mode 100644 package/polkit/S50polkit
package/polkit/S50polkit new file +15 -0
new file mode 100644
index 0000000000..55c10e99ae
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# start polkitd
+#
+
+case "$1" in
+	start)
+		start-stop-daemon -q -S -x /usr/lib/polkit-1/polkitd -- --no-debug &
+		;;
+	*)
+  echo "Usage: $0 {start}"
+		exit 1
+esac
+
+exit $?
package/polkit/polkit.mk +5 -0
index b440cd2f1c..8bb4512aee 100644
@@ -44,4 +44,9 @@ define POLKIT_INSTALL_INIT_SYSTEMD
 		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/polkit.service
 endef
 
+define POLKIT_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 package/polkit/S50polkit \
+		$(TARGET_DIR)/etc/init.d/S50polkit
+endef
+
 $(eval $(autotools-package))
Signature · 1 line
2.23.0
#8 lore raw

PATCH v4 5/6 polkit-rules-test-systemd: new test

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

This test is a simple integration test of the polkit package on systems running systemd.

It consists of the following:
- The brtest user attempts to restart the systemd-timesyncd service and is denied.

- A systemd-timesyncd-restart.rules file provided by polkit-rules-test-systemd is copied from /root/ to /etc/polkit-1/rules.d

- The brtest user attempts to restart the systemd-timesyncd service and should now succeed.

---
 DEVELOPERS                                    |  2 +
 .../package/br2-external/polkit/Config.in     |  2 +
 .../package/br2-external/polkit/external.desc |  1 +
 .../package/br2-external/polkit/external.mk   |  1 +
 .../polkit-rules-test-systemd/Config.in       |  6 +++
 .../polkit-rules-test-systemd.mk              | 20 ++++++++
 .../systemd-timesyncd-restart.rules           |  7 +++
 .../tests/package/test_polkit_systemd.py      | 51 +++++++++++++++++++
 8 files changed, 90 insertions(+)
 create mode 100644 support/testing/tests/package/br2-external/polkit/Config.in
 create mode 100644 support/testing/tests/package/br2-external/polkit/external.desc
 create mode 100644 support/testing/tests/package/br2-external/polkit/external.mk
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-systemd/Config.in
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-systemd/polkit-rules-test-systemd.mk
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-systemd/systemd-timesyncd-restart.rules
 create mode 100644 support/testing/tests/package/test_polkit_systemd.py
DEVELOPERS +2 -0
index 00dd4d39e9..2c99ace54f 100644
@@ -76,6 +76,8 @@ F:	package/setools/
 F:	package/sngrep/
 F:	package/spidermonkey/
 F:	package/systemd/
+F:	support/testing/tests/package/br2-external/polkit/
+F:	support/testing/tests/package/test_polkit_systemd.py
 
 N:	Adam Heinrich <[email protected]>
 F:	package/jack1/
support/testing/tests/package/br2-external/polkit/Config.in new file +2 -0
new file mode 100644
index 0000000000..97309b9fca
@@ -0,0 +1,2 @@
+source "$BR2_EXTERNAL_POLKIT_PATH/package/polkit-rules-test-initd/Config.in"
+source "$BR2_EXTERNAL_POLKIT_PATH/package/polkit-rules-test-systemd/Config.in"
support/testing/tests/package/br2-external/polkit/external.desc new file +1 -0
new file mode 100644
index 0000000000..ecef48692b
@@ -0,0 +1 @@
+name: POLKIT
support/testing/tests/package/br2-external/polkit/external.mk new file +1 -0
new file mode 100644
index 0000000000..64e369cce4
@@ -0,0 +1 @@
+include $(sort $(wildcard $(BR2_EXTERNAL_POLKIT_PATH)/package/*/*.mk))
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-systemd/Config.in new file +6 -0
new file mode 100644
index 0000000000..662b991d3b
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_POLKIT_RULES_TEST_SYSTEMD
+	bool "polkit rules test for systemd"
+	depends on BR2_PACKAGE_POLKIT
+	help
+	  Simple test to ensure polkit is loading and enforcing rules
+	  correctly using a rules file meant for systemd.
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-systemd/polkit-rules-test-systemd.mk new file +20 -0
new file mode 100644
index 0000000000..19a6be2b2f
@@ -0,0 +1,20 @@
+################################################################################
+#
+# polkit-rules-test-systemd
+#
+################################################################################
+
+POLKIT_RULES_TEST_SYSTEMD_DEPENDENCIES = polkit
+
+define POLKIT_RULES_TEST_SYSTEMD_USERS
+	brtest  -1  brtest  -1   =password  /home/brtest /bin/sh brtest
+endef
+
+define POLKIT_RULES_TEST_SYSTEMD_INSTALL_TARGET_CMDS
+	mkdir -p $(TARGET_DIR)/etc/polkit-1/rules.d
+
+	$(INSTALL) -D $(POLKIT_RULES_TEST_SYSTEMD_PKGDIR)/systemd-timesyncd-restart.rules \
+		$(TARGET_DIR)/root/systemd-timesyncd-restart.rules
+endef
+
+$(eval $(generic-package))
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-systemd/systemd-timesyncd-restart.rules new file +7 -0
new file mode 100644
index 0000000000..9461195091
@@ -0,0 +1,7 @@
+polkit.addRule(function(action, subject) {
+    if (action.id == "org.freedesktop.systemd1.manage-units" &&
+        action.lookup("unit") == "systemd-timesyncd.service" &&
+        subject.user == "brtest") {
+        return polkit.Result.YES;
+    }
+});
support/testing/tests/package/test_polkit_systemd.py new file +51 -0

51 lines not on this page · raw message

Signature · 1 line
2.23.0
#9 lore raw

PATCH v4 6/6 polkit-rules-test-initd: new test

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

This test is a simple integration test of the polkit package on systems not running systemd.

It consists of the following:
- A simple hello world c application that outputs "Hello polkit!" is compiled and installed to $(TARGET_DIR)/usr/bin/

- The brtest user attempts to run "pkexec hello-polkit" and is denied.

- A hello-polkit.rules file provided by polkit-rules-test-initd is copied from /root/ to /etc/polkit-1/rules.d

- The brtest user attempts to run "pkexec hello-polkit" and should not succeed with the output "Hello polkit!"

---
 DEVELOPERS                                    |  1 +
 .../package/polkit-rules-test-initd/Config.in |  6 +++
 .../polkit-rules-test-initd/hello-polkit.c    |  6 +++
 .../hello-polkit.policy                       | 14 +++++
 .../hello-polkit.rules                        |  6 +++
 .../polkit-rules-test-initd.mk                | 31 +++++++++++
 .../tests/package/test_polkit_initd.py        | 53 +++++++++++++++++++
 7 files changed, 117 insertions(+)
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/Config.in
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/hello-polkit.c
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/hello-polkit.policy
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/hello-polkit.rules
 create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/polkit-rules-test-initd.mk
 create mode 100644 support/testing/tests/package/test_polkit_initd.py
DEVELOPERS +1 -0
index 2c99ace54f..deeef53a2d 100644
@@ -77,6 +77,7 @@ F:	package/sngrep/
 F:	package/spidermonkey/
 F:	package/systemd/
 F:	support/testing/tests/package/br2-external/polkit/
+F:	support/testing/tests/package/test_polkit_initd.py
 F:	support/testing/tests/package/test_polkit_systemd.py
 
 N:	Adam Heinrich <[email protected]>
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/Config.in new file +6 -0
new file mode 100644
index 0000000000..f19fc2660d
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_POLKIT_RULES_TEST_INITD
+	bool "polkit rules test for initd"
+	depends on BR2_PACKAGE_POLKIT
+	help
+	  Simple test to ensure polkit is loading and enforcing rules
+	  correctly using initd.
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/hello-polkit.c new file +6 -0
new file mode 100644
index 0000000000..cf5343cd75
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(void){
+    printf("Hello polkit!\n");
+    return 0;
+}
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/hello-polkit.policy new file +14 -0
new file mode 100644
index 0000000000..8220293175
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+ "http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
+<policyconfig>
+  <action id="org.freedesktop.policykit.pkexec.hello-polkit">
+    <message>Authentication is required to run the hello world test program</message>
+    <defaults>
+      <allow_inactive>no</allow_inactive>
+      <allow_active>no</allow_active>
+    </defaults>
+    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/hello-polkit</annotate>
+  </action>
+</policyconfig>
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/hello-polkit.rules new file +6 -0
new file mode 100644
index 0000000000..a0a66f644d
@@ -0,0 +1,6 @@
+polkit.addRule(function(action, subject) {
+   if (action.id == "org.freedesktop.policykit.pkexec.hello-polkit" &&
+       subject.user == "brtest") {
+       return polkit.Result.YES;
+   }
+});
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test-initd/polkit-rules-test-initd.mk new file +31 -0
new file mode 100644
index 0000000000..394c3e4405
@@ -0,0 +1,31 @@
+################################################################################
+#
+# polkit-rules-test-initd
+#
+################################################################################
+
+POLKIT_RULES_TEST_INITD_DEPENDENCIES = polkit
+
+define POLKIT_RULES_TEST_INITD_USERS
+	brtest  -1  brtest  -1   =password  /home/brtest /bin/sh brtest
+endef
+
+define POLKIT_RULES_TEST_INITD_BUILD_CMDS
+	$(INSTALL) -D $(POLKIT_RULES_TEST_INITD_PKGDIR)/hello-polkit.c $(@D)/hello-polkit.c
+	$(TARGET_CC) $(@D)/hello-polkit.c -o $(@D)/hello-polkit
+endef
+
+
+define POLKIT_RULES_TEST_INITD_INSTALL_TARGET_CMDS
+	mkdir -p $(TARGET_DIR)/usr/share/polkit-1/actions/
+	$(INSTALL) -D $(@D)/hello-polkit $(TARGET_DIR)/usr/bin/hello-polkit
+
+	$(INSTALL) -D $(POLKIT_RULES_TEST_INITD_PKGDIR)/hello-polkit.policy \
+		$(TARGET_DIR)/usr/share/polkit-1/actions/hello-polkit.policy
+
+	$(INSTALL) -D $(POLKIT_RULES_TEST_INITD_PKGDIR)/hello-polkit.rules \
+		$(TARGET_DIR)/root/hello-polkit.rules
+
+endef
+
+$(eval $(generic-package))
support/testing/tests/package/test_polkit_initd.py new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.23.0