]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: set correct group for systemd-journal-upload tests 30316/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 4 Dec 2023 20:33:15 +0000 (21:33 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 5 Dec 2023 08:07:14 +0000 (09:07 +0100)
We can't use the systemd-journal-upload user here, since it's created
dynamically by DynamicUser=yes. However, we can use the group specified
in SupplementaryGroups=, so do exactly that.

test/test-functions
test/units/testsuite-04.journal-remote.sh

index 556346d7d57d1fb1d2308d5d52b818495dd3ece3..42b003878986ef0a02fa5ac8243d83f786b6b1e5 100644 (file)
@@ -157,6 +157,7 @@ BASICTOOLS=(
     bash
     capsh
     cat
+    chgrp
     chmod
     chown
     chroot
@@ -2870,14 +2871,14 @@ inst_binary() {
 
     # Same as above, but we need to wrap certain libraries unconditionally
     #
-    # chown, getent, login, setfacl, su, useradd, userdel
+    # chgrp, chown, getent, login, setfacl, su, useradd, userdel
     #    - dlopen() (not only) systemd's PAM modules
     # ls, mkfs.*, mksquashfs, mkswap, setpriv, stat
     #   - pull in nss_systemd with certain options (like ls -l) when
     #     nsswitch.conf uses [SUCCESS=merge] (like on Arch Linux)
     # delv, dig - pull in nss_resolve if `resolve` is in nsswitch.conf
     # tar - called by machinectl in TEST-25
-    bin_rx='/(agetty|chown|curl|delv|dig|getfacl|getent|id|login|ls|mkfs\.[a-z0-9]+|mksquashfs|mkswap|setfacl|setpriv|stat|su|tar|useradd|userdel)$'
+    bin_rx='/(agetty|chgrp|chown|curl|delv|dig|getfacl|getent|id|login|ls|mkfs\.[a-z0-9]+|mksquashfs|mkswap|setfacl|setpriv|stat|su|tar|useradd|userdel)$'
     if get_bool "$IS_BUILT_WITH_ASAN" && [[ "$bin" =~ $bin_rx ]]; then
         wrap_binary=1
         # Ugh, so we want to disable LSan in most cases for the wrapped binaries, since
index c543129da954d8bef075610588532892df485eb9..b7d9cbd81ba9650f65daae2095aa9ddaf6869c6f 100755 (executable)
@@ -161,8 +161,8 @@ openssl x509 -req -days 7 \
              -CA /run/systemd/remote-pki/ca.crt \
              -CAkey /run/systemd/remote-pki/ca.key \
              -out /run/systemd/remote-pki/server.crt
-setfacl -R -m "u:systemd-journal-remote:rwX" /run/systemd/remote-pki
-setfacl -R -m "u:systemd-journal-upload:rwX" /run/systemd/remote-pki
+chown -R systemd-journal-remote:systemd-journal /run/systemd/remote-pki
+chmod -R g+rwX /run/systemd/remote-pki
 
 # Reconfigure journal-upload/journal remote with the new keys
 cat >/run/systemd/journal-remote.conf.d/99-test.conf <<EOF
@@ -215,7 +215,8 @@ cat >/run/systemd/system/systemd-journal-upload.service.d/99-test.conf <<EOF
 Restart=no
 EOF
 systemctl daemon-reload
-setfacl -R -m "u:systemd-journal-upload:rwX" /run/systemd/journal-remote-tls
+chgrp -R systemd-journal /run/systemd/journal-remote-tls
+chmod -R g+rwX /run/systemd/journal-remote-tls
 
 systemctl restart systemd-journal-upload
 timeout 10 bash -xec 'while [[ "$(systemctl show -P ActiveState systemd-journal-upload)" != failed ]]; do sleep 1; done'