Redhat Apache fast-cgi Autorisation selinux
Mon installation apache Lancement php comme fastcgi, Et virtuel
Les hôtes indiquent sur / home /
/ public_html.
et fastcgi Maisons /
/cgi-bin/php.fcgi
Réglage public_html de selinux Était:
Propriétaire et groupe - Ceci est un utilisateur, tel qu'un utilisateur someuser:
Quand il visite le site, je reçois un message "interdit ...», Et dans le journal, il est écrit:
[PT, 7 Septembre, 12:02:51 2012] [Erreur] [Client x.x.x.x] (13) Accès refusé: accès à /cgi-bin/php.fcgi/info.php Interdit
Mon selinux conf:
Alors je tue Selinux (SELINUX = disabled), Redémarrez le système et tout fonctionne !!!!!
Résumer Selinux, Je ne veux pas désactiver Selinux. J'ai essayé sans succès:
Et ça peut mieux changer Selinux
SELINUX = Utilisation forcée SELINUX = résolu
Et désactiver selinux pour httpd?
(Je pense qu'il est préférable de trouver la configuration correcte.)
Merci pour toute suggestion à ce sujet.
Mon environnement:
Red Hat Enterprise Linux Server version 5.8 (Tikanga)
Version du serveur: Apache / 2.2.3
PHP 5.1.6 (cli) (Construit: 22 juin 2012 06:20:25) droits d'auteur (c) 1997-2006 PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
Quelques journaux:
Il y a un magazine d'audit
type = SYSCALL msg = audit (1345834208.027: 963): arch = c000003e syscall = 4 success = no exit = -13 a0 = 2aaf1543e390 a1 = 7fff393c9510 a2 = 7fff393c9510 a3 = 2aaf1543bd58 items = 0 ppid = 27519 pid = 27519 pid = 27519 pid = 27519 pid = 27519 pid = 48 gid = 48 euid = 48 suid = 48 fsuid = 48 egid = 48 sgid = 48 fsgid = 48 tty = (none) ses = 4 comm = "httpd" exe = "/ usr / sbin / httpd" subj = user_u: system_r: httpd_t: s0 key = (zéro)
type = AVC msg = audit (1345834208.027: 964): avc: denied {getattr} for pid = 27523 comm = "httpd" path = "/ home / loemsera / public_html / index.php" dev = sda2 ino = 4593912 scontext = user_u : system_r: httpd_t: s0 tcontext = user_u: object_r: user_home_t: s0 tclass = file
type = SYSCALL msg = audit (1345834208.027: 964): arch = c000003e syscall = 6 success = no exit = -13 a0 = 2aaf1543e470 a1 = 7fff393c9510 a2 = 7fff393c9510 a3 = 0 items = 0 ppid = 27519 pid = 27523 uid = 48 gid = 48 euid = 48 suid = 48 fsuid = 48 egid = 48 sgid = 48 fsgid = 48 tty = (none) ses = 4 comm = "httpd" exe = "/ usr / sbin / httpd" subj = user_u: system_r: httpd_t: s0 key = (zéro)
type = AVC msg = audit (1345834208.028: 965): avc: denied {getattr} for pid = 27523 comm = "httpd" path = "/ home / loemsera / public_html / index.php" dev = sda2 ino = 4593912 scontext = user_u : system_r: httpd_t: s0 tcontext = user_u: object_r: user_home_t: s0 tclass = file
Les hôtes indiquent sur / home /
/ public_html.
et fastcgi Maisons /
/cgi-bin/php.fcgi
Réglage public_html de selinux Était:
/usr/sbin/setsebool -P httpd_enable_homedirs 1
chcon -R -t httpd_sys_content_t /home/someuser/public_html
Propriétaire et groupe - Ceci est un utilisateur, tel qu'un utilisateur someuser:
ls -all /home/someuser/cgi-bin/
drwxr-xr-x 2 someuser someuser 4096 Sep 7 13:14 .
drwx--x--x 6 someuser someuser 4096 Sep 6 18:17 ..
-rwxr-xr-x 1 someuser someuser 308 Sep 7 13:14 php.fcgi
ls -all /home/someuser/public_html/ | greep info.php
-rw-r--r-- 1 someuser someuser 24 Sep 3 16:24 info.php
Quand il visite le site, je reçois un message "interdit ...», Et dans le journal, il est écrit:
[PT, 7 Septembre, 12:02:51 2012] [Erreur] [Client x.x.x.x] (13) Accès refusé: accès à /cgi-bin/php.fcgi/info.php Interdit
Mon selinux conf:
SELINUX=enforcing
SELINUXTYPE=targeted
SETLOCALDEFS=0
Alors je tue Selinux (SELINUX = disabled), Redémarrez le système et tout fonctionne !!!!!
Résumer Selinux, Je ne veux pas désactiver Selinux. J'ai essayé sans succès:
setsebool -P httpd_enable_cgi 1
chcon -t httpd_sys_script_exec_t /home/someuser/cgi-bin/php.fcgi
chcon -R -t httpd_sys_content_t /home/someuser/cgi-bin
Et ça peut mieux changer Selinux
SELINUX = Utilisation forcée SELINUX = résolu
Et désactiver selinux pour httpd?
(Je pense qu'il est préférable de trouver la configuration correcte.)
Merci pour toute suggestion à ce sujet.
Mon environnement:
Red Hat Enterprise Linux Server version 5.8 (Tikanga)
Version du serveur: Apache / 2.2.3
PHP 5.1.6 (cli) (Construit: 22 juin 2012 06:20:25) droits d'auteur (c) 1997-2006 PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
Quelques journaux:
ps -ZC httpd
LABEL PID TTY TIME CMD
system_u:system_r:httpd_t 2822 ? 00:00:00 httpd
system_u:system_r:httpd_t 2823 ? 00:00:00 httpd
system_u:system_r:httpd_t 2824 ? 00:00:00 httpd
system_u:system_r:httpd_t 2825 ? 00:00:00 httpd
system_u:system_r:httpd_t 2826 ? 00:00:00 httpd
system_u:system_r:httpd_t 2836 ? 00:00:00 httpd
system_u:system_r:httpd_t 2837 ? 00:00:00 httpd
system_u:system_r:httpd_t 2838 ? 00:00:00 httpd
system_u:system_r:httpd_t 2839 ? 00:00:00 httpd
system_u:system_r:httpd_t 2840 ? 00:00:00 httpd
getsebool -a | grep httpd
allow_httpd_anon_write --> off
allow_httpd_bugzilla_script_anon_write --> off
allow_httpd_cvs_script_anon_write --> off
allow_httpd_mod_auth_pam --> off
allow_httpd_nagios_script_anon_write --> off
allow_httpd_prewikka_script_anon_write --> off
allow_httpd_squid_script_anon_write --> off
allow_httpd_sys_script_anon_write --> off
httpd_builtin_scripting --> on
httpd_can_network_connect --> off
httpd_can_network_connect_db --> off
httpd_can_network_relay --> off
httpd_can_sendmail --> on
httpd_disable_trans --> off
httpd_enable_cgi --> on
httpd_enable_ftp_server --> off
httpd_enable_homedirs --> on
httpd_execmem --> off
httpd_read_user_content --> off
httpd_rotatelogs_disable_trans --> off
httpd_setrlimit --> off
httpd_ssi_exec --> off
httpd_suexec_disable_trans --> off
httpd_tty_comm --> on
httpd_unified --> on
httpd_use_cifs --> off
httpd_use_nfs --> off
Il y a un magazine d'audit
/var/log/audit/audit.log
type = SYSCALL msg = audit (1345834208.027: 963): arch = c000003e syscall = 4 success = no exit = -13 a0 = 2aaf1543e390 a1 = 7fff393c9510 a2 = 7fff393c9510 a3 = 2aaf1543bd58 items = 0 ppid = 27519 pid = 27519 pid = 27519 pid = 27519 pid = 27519 pid = 48 gid = 48 euid = 48 suid = 48 fsuid = 48 egid = 48 sgid = 48 fsgid = 48 tty = (none) ses = 4 comm = "httpd" exe = "/ usr / sbin / httpd" subj = user_u: system_r: httpd_t: s0 key = (zéro)
type = AVC msg = audit (1345834208.027: 964): avc: denied {getattr} for pid = 27523 comm = "httpd" path = "/ home / loemsera / public_html / index.php" dev = sda2 ino = 4593912 scontext = user_u : system_r: httpd_t: s0 tcontext = user_u: object_r: user_home_t: s0 tclass = file
type = SYSCALL msg = audit (1345834208.027: 964): arch = c000003e syscall = 6 success = no exit = -13 a0 = 2aaf1543e470 a1 = 7fff393c9510 a2 = 7fff393c9510 a3 = 0 items = 0 ppid = 27519 pid = 27523 uid = 48 gid = 48 euid = 48 suid = 48 fsuid = 48 egid = 48 sgid = 48 fsgid = 48 tty = (none) ses = 4 comm = "httpd" exe = "/ usr / sbin / httpd" subj = user_u: system_r: httpd_t: s0 key = (zéro)
type = AVC msg = audit (1345834208.028: 965): avc: denied {getattr} for pid = 27523 comm = "httpd" path = "/ home / loemsera / public_html / index.php" dev = sda2 ino = 4593912 scontext = user_u : system_r: httpd_t: s0 tcontext = user_u: object_r: user_home_t: s0 tclass = file
Aucun résultat connexe trouvé
Invité:
Pour répondre aux questions, connectez-vous ou registre
1 réponses
Hannah12
Confirmation de:
Nous avons un réglage de travail avec SELinux et PHP comme FastCGI ici, dans CentOS 6, Mais c'était
vraiment
Il est difficile de faire tout le travail.
Plusieurs conseils pour commencer:
Vous n'avez pas besoin de redémarrer pour désactiver / permettre selinux - Utilisez simplement la commande "setenforce 0" ou "setenforce 1" :)
toujours essayer de travailler avec SELinux
Désactivée
, Puis allumez-le et regardez audit.log
Comme ça:
permettre suexec
Changer le type SELinux pour php.fcgi sur
Votre démarreur FastCGI (php.fcgi) ne devrait pas être disponible pour enregistrer à l'utilisateur qui les possède (Sinon, il peut configurer de nombreux paramètres et restrictions). Attribuez le drapeau "immutabilité":
suexec a des problèmes avec FastCGI, Par conséquent, nous devons le faire autoriser:
Bonne chance!