SELinux đang ngăn apachengười dùng ghi vào tệp nhật ký mà nó sở hữu. Khi tôi làm setenforce 0nó hoạt động. Nếu không, nó hiển thị lỗi này
IOError: [Errno 13] Permission denied: '/var/www/webapp/k/site/k.log'
Bối cảnh bảo mật của tập tin:
$ ll -Z k.log
-rw-r--r--. apache apache system_u:object_r:httpd_sys_content_t:s0 k.log
Tập tin được tạo khi chế độ SELinux được đặt thành cho phép.
Làm thế nào để thiết lập bối cảnh bảo mật để apachengười dùng có thể viết trong thư mục đó? Tôi đã thiết lập bối cảnh bảo mật thư mục bằng cách sử dụng chconnhưng tôi không thể tìm thấy loại tệp phù hợp.
Từ audit.log:
type=AVC msg=audit(1409945481.163:1561): avc: denied { append } for pid=16862 comm="httpd" name="k.log" dev="dm-1" ino=201614333 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=file
type=SYSCALL msg=audit(1409945481.163:1561): arch=c000003e syscall=2 success=no exit=-13 a0=7fa8080847a0 a1=441 a2=1b6 a3=3 items=0 ppid=15256 pid=16862 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="httpd" exe="/usr/sbin/httpd" subj=system_u:system_r:httpd_t:s0 key=(null)