@@ -64,6 +64,72 @@ verify_services() {
6464 pass " user audio services are running"
6565}
6666
67+ verify_printing_security () {
68+ local cups_browsed_pid lpinfo_output printer_name printer_process printer_tmp
69+
70+ ! pacman -Q cups-pdf > /dev/null 2>&1 || fail " CUPS-PDF is absent"
71+ pass " the root CUPS-PDF backend is not installed"
72+
73+ getent passwd cups-browsed > /dev/null || fail " the cups-browsed service account exists"
74+ [[ $( systemctl show -P User cups-browsed.service) == " cups-browsed" ]] ||
75+ fail " cups-browsed runs as its service account"
76+ [[ $( systemctl show -P Group cups-browsed.service) == " cups-browsed" ]] ||
77+ fail " cups-browsed runs as its service group"
78+ systemctl is-active --quiet cups-browsed.service || fail " cups-browsed is running"
79+
80+ cups_browsed_pid=$( systemctl show -P MainPID cups-browsed.service)
81+ [[ -r /proc/$cups_browsed_pid /status ]] || fail " cups-browsed has a readable process status"
82+ [[ $( awk ' /^Uid:/{print $2}' " /proc/$cups_browsed_pid /status" ) != 0 ]] ||
83+ fail " cups-browsed does not run with root UID"
84+ [[ $( awk ' /^CapEff:/{print $2}' " /proc/$cups_browsed_pid /status" ) == " 0000000000000000" ]] ||
85+ fail " cups-browsed has no effective Linux capabilities"
86+
87+ [[ $( stat -c ' %a %U:%G' /var/cache/cups-browsed) == " 750 cups-browsed:cups-browsed" ]] ||
88+ fail " cups-browsed has an isolated cache" " $( stat -c ' %a %U:%G' /var/cache/cups-browsed) "
89+ [[ " $( id -nG cups-browsed) " != * " cups " * ]] ||
90+ fail " cups-browsed is separate from the print-filter group"
91+
92+ if lpinfo_output=$( LC_ALL=C timeout 10 lpinfo -v < /dev/null 2>&1 ) ; then
93+ fail " the desktop user cannot administer CUPS without authentication"
94+ elif [[ $lpinfo_output != * " Forbidden" * ]]; then
95+ fail " CUPS explicitly denies unauthenticated desktop administration" " $lpinfo_output "
96+ fi
97+
98+ pass " CUPS discovery is isolated from root, filters, and passwordless desktop administration"
99+
100+ # A live driverless printer proves the non-root daemon can still discover and
101+ # create queues without the CAP_NET_BIND_SERVICE Ubuntu carries downstream.
102+ printer_name=" OmarchyAcceptancePrinter"
103+ printer_tmp=$( mktemp -d)
104+ printf ' #!/bin/bash\nexit 0\n' > " $printer_tmp /command"
105+ chmod 0700 " $printer_tmp /command"
106+ mkdir -m 0700 " $printer_tmp /spool"
107+
108+ ippeveprinter -p 18631 -d " $printer_tmp /spool" -c " $printer_tmp /command" " $printer_name " \
109+ > " $printer_tmp /ippeveprinter.log" 2>&1 &
110+ printer_process=$!
111+
112+ printing_test_cleanup () {
113+ kill " $printer_process " > /dev/null 2>&1 || true
114+ wait " $printer_process " > /dev/null 2>&1 || true
115+ rm -rf " $printer_tmp "
116+ }
117+ trap printing_test_cleanup EXIT
118+
119+ for _ in {1..30}; do
120+ lpstat -v " $printer_name " 2> /dev/null | grep -q " implicitclass://$printer_name /" && break
121+ sleep 1
122+ done
123+
124+ lpstat -v " $printer_name " 2> /dev/null | grep -q " implicitclass://$printer_name /" ||
125+ fail " non-root cups-browsed discovers a driverless IPP printer" " $( < " $printer_tmp /ippeveprinter.log" ) "
126+
127+ printing_test_cleanup
128+ trap - EXIT
129+
130+ pass " non-root cups-browsed still creates driverless IPP queues without capabilities"
131+ }
132+
67133verify_runtime_tools () {
68134 # Docker access is intentionally NOT granted to the desktop user: the docker
69135 # group is root-equivalent, so a rogue process running as the user could
@@ -107,7 +173,7 @@ verify_user_setup() {
107173 pass " Omarchy user state and shell configuration exist"
108174}
109175
110- for check in verify_core_packages verify_defaults verify_services verify_runtime_tools verify_user_setup; do
176+ for check in verify_core_packages verify_defaults verify_services verify_printing_security verify_runtime_tools verify_user_setup; do
111177 if ! (" $check " ); then
112178 status=1
113179 fi
0 commit comments