Tengo un servidor Centos 7.9 ejecutándose con Apache y Git, sin embargo, si hago un
[root@a]# git status
fatal: Out of memory? mmap failed: Permission denied
Pero si deshabilita o permite el SE-Linux mediante los siguientes comandos, comenzará a funcionar bien.
setenforce Permissive
¿Alguna idea sobre cómo solucionar este problema de forma permanente con SELinux habilitado?
El registro de auditoría dice
node=a type=PROCTITLE msg=audit(1630636505.296:37076): proctitle=67697400737461747573
node=a type=MMAP msg=audit(1630636505.296:37076): fd=3 flags=0x2
node=a type=SYSCALL msg=audit(1630636505.296:37076): arch=c000003e syscall=9 success=no exit=-13 a0=0 a1=3ebd0 a2=3 a3=2 items=0 ppid=8008 pid=8156 auid=1001 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=570 comm="git" exe="/usr/bin/git" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null)
node=a type=AVC msg=audit(1630636505.296:37076): avc: denied { map } for pid=8156 comm="git" path="/www/site/.git/index" dev="sda2" ino=540400 scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:httpd_t:s0 tclass=file permissive=0
Respuesta1
El problema es este archivo que estás mapeando:
/www/site/.git/index
Sin embargo , este archivo tiene un tipo httpd_t
que en realidad no es un tipo de archivo legítimo, sino un proceso (o tipo de dominio, como se le conoce).
Probablemente debería establecer el contexto de /www
como httpd_sys_content_t
o si desea permitir que el servidor web escriba en él httpd_sys_content_rw_t
.
Si tuviera que adivinar, asumiría que lo hiciste chcon -t httpd_t
por /www
error.
El mejor enfoque para solucionar este problema correctamente será restablecer y restaurar los contextos del archivo:
# semanage fcontext -a -t httpd_sys_content_t '/www(/.*)?'
# restorecon -rv /www
Esto debería establecer el contexto correcto y evitar futuros contratiempos.
Luego pruebe git status
nuevamente para comprobar que funcionó.