Selinux begann nach dem Yum-Update, PHP-Exec-Aufrufe zu blockieren

Selinux begann nach dem Yum-Update, PHP-Exec-Aufrufe zu blockieren

Ich habe PHP verwendetAusführungBefehl zum Ausgeben lpr -P printer_name /var/www/html/somefile.pdf, aber nach einem RHEL-Systemupdate (7.2 auf 7.3) hat Selinux beschlossen, diese Anfragen zu blockieren.

Selinux-Berechtigungen der zum Drucken gesendeten Datei:

ls -lZ /var/www/html/somefile.pdf
-rw-r-----. apache webdev system_u:object_r:httpd_sys_rw_content_t:s0 /var/www/html/somefile.pdf

Im Prüfprotokoll wird Folgendes angezeigt, das dem obigen cmdPHP-Bericht entspricht:

Zeit->Do 3. Nov 15:07:02 2016

Typ=PATH, Nachricht=Audit(1478200022.446:5151): Element=0, Name=„/etc/cups/lpoptions“, Inode=134317708, Dev=fd:03, Modus=0100644, Ouid=0, Ogid=7, Rdev=00:00, Objekt=System_u:Objekt_r:cupsd_rw_etc_t:s0, Objekttyp=NORMAL

Typ=CWD Nachricht=Prüfung(1478200022.446:5151): cwd="/var/www/html"

Typ=SYSCALL msg=audit(1478200022.446:5151): arch=c000003e syscall=2 Erfolg=ja exit=5 a0=7fff26837c70 a1=0 a2=0 a3=9 Elemente=1 ppid=19397 pid=46644 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(keine) ses=4294967295 comm="lpr" exe="/usr/bin/lpr.cups" subj=system_u:system_r:httpd_t:s0 Schlüssel=(null)

Typ=AVC, Nachricht=Audit(1478200022.446:5151): avc: verweigert { öffnen } für pid=46644, comm="lpr" Pfad="/etc/cups/lpoptions" dev="dm-3" ino=134317708, scontext=system_u:system_r:httpd_t:s0, tcontext=system_u:object_r:cupsd_rw_etc_t:s0, tclass=Datei

Typ=AVC, Nachricht=Audit(1478200022.446:5151): avc: { Lesen } verweigert für pid=46644, comm="lpr" name="lpoptions" dev="dm-3" ino=134317708, scontext=system_u:system_r:httpd_t:s0, tcontext=system_u:object_r:cupsd_rw_etc_t:s0, tclass=Datei

Hier ist die aktuelle Selinux-Konfiguration:

# getsebool -a | grep httpd
httpd_anon_write --> off
httpd_builtin_scripting --> on
httpd_can_check_spam --> off
httpd_can_connect_ftp --> off
httpd_can_connect_ldap --> off
httpd_can_connect_mythtv --> off
httpd_can_connect_zabbix --> off
httpd_can_network_connect --> on
httpd_can_network_connect_cobbler --> off
httpd_can_network_connect_db --> off
httpd_can_network_memcache --> off
httpd_can_network_relay --> off
httpd_can_sendmail --> on
httpd_dbus_avahi --> off
httpd_dbus_sssd --> off
httpd_dontaudit_search_dirs --> off
httpd_enable_cgi --> on
httpd_enable_ftp_server --> off
httpd_enable_homedirs --> off
httpd_execmem --> off
httpd_graceful_shutdown --> on
httpd_manage_ipa --> off
httpd_mod_auth_ntlm_winbind --> off
httpd_mod_auth_pam --> off
httpd_read_user_content --> off
httpd_run_ipa --> off
httpd_run_preupgrade --> off
httpd_run_stickshift --> off
httpd_serve_cobbler_files --> off
httpd_setrlimit --> off
httpd_ssi_exec --> on
httpd_sys_script_anon_write --> off
httpd_tmp_exec --> off
httpd_tty_comm --> off
httpd_unified --> off
httpd_use_cifs --> off
httpd_use_fusefs --> off
httpd_use_gpg --> off
httpd_use_nfs --> on
httpd_use_openstack --> off
httpd_use_sasl --> off
httpd_verify_dns --> off

Was ist der Grund für die Ablehnung?

Antwort1

Ich habe einige zusätzliche seLinux-Tools installiert, umHilfe bei der Fehlerbehebung:

yum install setroubleshoot setools

Dann rannte

sealert -a /var/log/audit/audit.log

Die Ausgabe schlug die folgenden Änderungen vor:

ausearch -c 'lpr' --raw | audit2allow -M my-lpr
semodule -i my-lpr.pp
ausearch -c 'wkhtmltopdf-amd' --raw | audit2allow -M my-wkhtmltopdfamd
semodule -i my-wkhtmltopdfamd.pp

Habe diese Befehle ausgegeben und kann jetzt wieder aus meiner PHP-App drucken.

verwandte Informationen