Undefined activation ordering between ‘setuid-program-service-type’ and ‘account-service-type’

  • Open
  • quality assurance status badge
Details
2 participants
  • Brian Cully
  • Leo Famulari
Owner
unassigned
Submitted by
Brian Cully
Severity
normal
Blocked by

Debbugs page

Brian Cully wrote 2 years ago
Undefined activation ordering between ‘setuid-p rogram-service-type’ and ‘account-service-type’
(address . bug-guix@gnu.org)
878rf24dqz.fsf@psyduck.jhoto.kublai.com
There is currently no way to ensure that an account exists before
creating /run/setuid-programs, which means a setuid-program which
uses a custom user or group will fail to be created if setuid
activation happens before account activation.

As an example, here's a system config where I'm trying to install
‘/run/setuid-programs/dumpcap’ as setuid root with a primary group
of ‘wireshark’, also created by this config:

Toggle snippet (72 lines)
(use-modules (gnu)
(gnu system setuid))
(use-package-modules networking)
(use-service-modules setuid)

;; TODO: make name configurable
(define %wireshark-groups
(list (user-group
(name "wireshark")
(system? #t))))

(define %wireshark-setuid-programs
(list (setuid-program
(program (file-append wireshark "/bin/dumpcap"))
(group "wireshark")
#;(mask #o550))))

(define wireshark-service-type
(service-type
(name 'wireshark)
(description "Allow use of wireshark by regular users in the
@code{wireshark} group.")
(extensions
(list (service-extension account-service-type
(const %wireshark-groups))
(service-extension setuid-program-service-type
(const %wireshark-setuid-programs))))
(default-value #f)))

(operating-system
(locale "en_US.utf8")
(timezone "America/New_York")
(keyboard-layout (keyboard-layout "us"))
(host-name "wireshark-test")

(users (cons* (user-account
(name "test")
(group "users")
(password (crypt "test" "$6$test"))
(supplementary-groups
'("wireshark")))
%base-user-accounts))
(packages
(cons*
(specification->package "wireshark")
%base-packages))

(services
(cons*
(service wireshark-service-type)
%base-services))

(bootloader
(bootloader-configuration
(bootloader grub-efi-bootloader)
(targets '("/boot/efi"))
(keyboard-layout keyboard-layout)))

(file-systems
(cons* (file-system
(mount-point "/")
(device
(uuid "14f4e958-be9e-41bb-bd25-e90a7330093c"
'btrfs))
(type "btrfs"))
(file-system
(mount-point "/boot/efi")
(device (uuid "6866-56B1" 'fat32))
(type "vfat"))
%base-file-systems)))

When trying to boot this system in a VM, I'm told that the dumpcap
binary couldn't be created because the file wasn't found. The
returned error is improperly attributed: the source file does
exist, and the error code is actually coming from getgrent(3)
which cannot find the ‘wireshark’ group.

Tracing through the activation scripts shows this to be because,
in this case, setuid-program activation happens before
account-activation.

Thanks to jpoiret for doing a lot of the investigative work here,
which I'm merely verifying through testing.

I believe the correct solution here is to move ‘setuid-program’
activation to a one-shot Shepherd service, because Shepherd allows
explicit ordering, as well as other advantages. To that end, I
have a patch which does precisely that, which I will send to the
patches list shorty.

-bjc
Leo Famulari wrote 2 years ago
(no subject)
(address . control@debbugs.gnu.org)
ZDGcy6RNtaSIyPQT@jasmine.lan
block 62725 with 62726
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 62725@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 62725
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help