Instalei o acpid e configurei um evento para fechar a tampa, que funciona no modo de depuração, mas não consigo fazê-lo funcionar quando o acpid é iniciado pelo systemd.
Eu usei as sugestões aqui para configurar o acpid
Linux suspender ou dormir na tampa
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
executando acpid -d -l funciona, mas systemctl start acpid produz o seguinte erro ao fechar a tampa
# 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
Qual diretiva do selinux eu preciso para permitir o acesso do xscreensaver-command ao meu soquete de exibição quando iniciado a partir do acpid?
=============================================== =
Então, editei meu script e consegui que ele funcionasse da seguinte forma:
cat /etc/acpi/actions/lid_down.sh
#!/bin/bash
[ "$1" = "button/lid" ] && [ "$2" = "LID" ] && [ "$3" = "close" ] && /usr/local/bin/xscreensaver-lock-all
cat / pt / local / bin / xscreensaver-lock-all
#!/bin/bash
logger "screen saver lock script started"
for user in $(ps -ef | awk '($0~/xscreensaver/&&$0!~/awk/){print $1}')
do
su $user -c "/usr/bin/xscreensaver-command -lock"
done
Eu tentei inserir várias opções runcon no lid_down.sh, mas sem sucesso. Então, minha solução atual é:
# semanage permissive -a apmd_t
Mas isso produz os seguintes erros:
# 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
Deve haver uma maneira mais simples de fazer isso sem desabilitar o selinux para o acpi