Fedora 27 LXDE-Verschlussdeckel sperrt den Bildschirm nicht (selinux acpid xscreensaver-command)

502
banjo67xxx

Ich habe acpid installiert und ein Ereignis für lid close eingerichtet, das im Debug-Modus funktioniert. Ich kann es jedoch nicht zum Funktionieren bringen, wenn acpid von systemd gestartet wird.

Ich habe die Vorschläge hier verwendet, um acpid Linux Suspend oder Sleep on Lid Close zu konfigurieren

cat / etc / acpi / events / lid

event=button[ /]lid action=/etc/acpi/actions/lid_down.sh % 

cat /etc/acpi/actions/lid_down.sh

#!/bin/bash  [ "$1" = "button/lid" ] && [ "$2" = "LID" ] && [ "$3" = "close" ] && xscreensaver-command -lock 

Das Ausführen von acpid -d -l funktioniert, aber systemctl start acpid erzeugt den folgenden Fehler, wenn ich den Deckel schließe

# ausearch -m avc -ts recent -i ---- type=AVC msg=audit(19/07/18 04:14:19.214:452) : avc: denied { connectto } for pid=16632 comm=xscreensaver-co path=/tmp/.X11-unix/X0 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:xserver_t:s0-s0:c0.c1023 tclass=unix_stream_socket permissive=0  

Welche Selinux-Richtlinien benötige ich, um den Befehl xscreensaver-command auf meinen Bildschirmsockel zuzulassen, wenn er von acpid gestartet wird?

================================================

Also habe ich mein Skript bearbeitet und kann es wie folgt funktionieren lassen:

cat /etc/acpi/actions/lid_down.sh

#!/bin/bash  [ "$1" = "button/lid" ] && [ "$2" = "LID" ] && [ "$3" = "close" ] && /usr/local/bin/xscreensaver-lock-all 

cat / usr / local / bin / xscreensaver-lock-all

#!/bin/bash  logger "screen saver lock script started" for user in $(ps -ef | awk '($0~/xscreensaver/&&$0!~/awk/)') do su $user -c "/usr/bin/xscreensaver-command -lock" done 

Ich habe versucht, verschiedene runcon-Optionen in lid_down.sh einzufügen, jedoch ohne Erfolg. Meine aktuelle Problemumgehung ist also:

# semanage permissive -a apmd_t 

Das führt jedoch zu folgenden Fehlern:

# ausearch -m avc -ts recent -i ---- type=AVC msg=audit(19/07/18 10:24:19.266:287) : avc: denied { bind } for pid=3372 comm=su scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:apmd_t:s0 tclass=netlink_selinux_socket permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.266:286) : avc: denied { create } for pid=3372 comm=su scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:apmd_t:s0 tclass=netlink_selinux_socket permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.267:288) : avc: denied { compute_av } for pid=3372 comm=su scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=security permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.268:292) : avc: denied { setgid } for pid=3372 comm=su capability=setgid scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:apmd_t:s0 tclass=capability permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.271:294) : avc: denied { setsched } for pid=3372 comm=su scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:apmd_t:s0 tclass=process permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.284:298) : avc: denied { read write } for pid=3372 comm=su name=lastlog dev="dm-0" ino=659972 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:lastlog_t:s0 tclass=file permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.285:299) : avc: denied { open } for pid=3372 comm=su path=/var/log/lastlog dev="dm-0" ino=659972 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:lastlog_t:s0 tclass=file permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.342:301) : avc: denied { connectto } for pid=3373 comm=xscreensaver-co path=/tmp/.X11-unix/X0 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:xserver_t:s0-s0:c0.c1023 tclass=unix_stream_socket permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.343:302) : avc: denied { read } for pid=3373 comm=xscreensaver-co name=.Xauthority dev="dm-4" ino=15466502 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:xauth_home_t:s0 tclass=file permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.343:303) : avc: denied { open } for pid=3373 comm=xscreensaver-co path=/home/ken/.Xauthority dev="dm-4" ino=15466502 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:xauth_home_t:s0 tclass=file permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.538:315) : avc: denied { read write } for pid=3374 comm=su name=lastlog dev="dm-0" ino=659972 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:lastlog_t:s0 tclass=file permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.538:316) : avc: denied { open } for pid=3374 comm=su path=/var/log/lastlog dev="dm-0" ino=659972 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:lastlog_t:s0 tclass=file permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.539:318) : avc: denied { setgid } for pid=3382 comm=su capability=setgid scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:apmd_t:s0 tclass=capability permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:19.543:319) : avc: denied { connectto } for pid=3382 comm=xscreensaver-co path=/tmp/.X11-unix/X0 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:xserver_t:s0-s0:c0.c1023 tclass=unix_stream_socket permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:22.153:336) : avc: denied { read write } for pid=3386 comm=su name=lastlog dev="dm-0" ino=659972 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:lastlog_t:s0 tclass=file permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:22.153:337) : avc: denied { open } for pid=3386 comm=su path=/var/log/lastlog dev="dm-0" ino=659972 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:lastlog_t:s0 tclass=file permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:22.153:339) : avc: denied { setgid } for pid=3395 comm=su capability=setgid scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:apmd_t:s0 tclass=capability permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:22.157:340) : avc: denied { connectto } for pid=3395 comm=xscreensaver-co path=/tmp/.X11-unix/X0 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:xserver_t:s0-s0:c0.c1023 tclass=unix_stream_socket permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:21.901:322) : avc: denied { create } for pid=3386 comm=su scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:apmd_t:s0 tclass=netlink_selinux_socket permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:21.901:323) : avc: denied { bind } for pid=3386 comm=su scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:apmd_t:s0 tclass=netlink_selinux_socket permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:21.901:324) : avc: denied { compute_av } for pid=3386 comm=su scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=security permissive=1  ---- type=AVC msg=audit(19/07/18 10:24:21.905:329) : avc: denied { setsched } for pid=3386 comm=su scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:apmd_t:s0 tclass=process permissive=1  

Es muss ein aufgeräumterer Weg dafür sein, ohne Selinux für ACPI zu deaktivieren

0

1 Antwort auf die Frage

0
grawity

Wenn Sie auf der Suche nach einem "saubereren" Weg sind, ist das Starten eines grafischen Programms zum Starten des Dienstes gleich. Das Design ist schlecht, nicht nur wegen SELinux.

Ändern Sie den Befehl in /usr/bin/loginctl lock-sessions. Dies sendet ein "Sperr" -Signal an alle grafischen Sitzungen, und jede Sitzung kann intern darauf reagieren (z. B. Starten eines Schließfachs ohne SELinux-Probleme). Die Chancen stehen gut, dass LXDE dies möglicherweise bereits unterstützt.

Wenn LXDE nicht auf das Sperrsignal reagiert, führen Sie einen Helfer aus, der Folgendes ausführt: