2016-02-04 59 views
0


我有一个托管Drupal 7站点的CentOS盒子。我试图在其上运行一个名为Tika的Java应用程序,以使用Apache Solr搜索来索引文件。与SELinux CentOS Java应用程序错误

我一直运行到一个问题,只有在启用SELinux的:

extract using tika: OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f1ed9000000, 2555904, 1) failed; error='Permission denied' (errno=13) 
# 
# There is insufficient memory for the Java Runtime Environment to continue. 
# Native memory allocation (malloc) failed to allocate 2555904 bytes for committing reserved memory. 
# An error report file with more information is saved as: 
# /tmp/jvm-2356/hs_error.log 

如果我禁用SELinux,这不会发生。如果我从SSH运行命令,它工作正常 - 但不是在浏览器中。这是它在运行命令:

java '-Dfile.encoding=UTF8' -cp '/var/www/drupal/sites/all/modules/contrib/apachesolr_attachments/tika' -jar '/var/www/drupal/sites/all/modules/contrib/apachesolr_attachments/tika/tika-app-1.11.jar' -t '/var/www/drupal/sites/all/modules/contrib/apachesolr_attachments/tests/test-tika.pdf' 

下面是SELinux的在/var/log/audit/audit.log日志:

type=AVC msg=audit(1454636072.494:3351): avc: denied { execmem } for pid=11285 comm="java" scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:system_r:httpd_t:s0 tclass=process 
type=SYSCALL msg=audit(1454636072.494:3351): arch=c000003e syscall=9 success=no exit=-13 a0=7fdfe5000000 a1=270000 a2=7 a3=32 items=0 ppid=2377 pid=11285 auid=506 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=1 comm="java" exe="/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.95.x86_64/jre/bin/java" subj=unconfined_u:system_r:httpd_t:s0 key=(null) 

有没有一种方法可以让我有SELinux的运行这个启用?我不知道蒂卡的策略名称(或者我应该使用Java?),所以我不能确定在哪里何去何从......

回答

0

您所有的情境消息中引用httpd_t,所以我会跑

/usr/sbin/getsebool -a | grep httpd 

并试验显示为off的启用属性。它已经有一段时间,因为我在CentOS跑了数据库支持的网站(Drupal的,WordPress的,等等),但我记得,要求这两个启用:

httpd_can_network_connect 
httpd_can_network_connect_db 

,使属性具有持久性,运行

setsebool -P httpd_can_network_connect on 

0

你要找的布尔是:

httpd_execmem 

httpd_read_user_content 

如何找到:

audit2why -i /var/log/audit/audit.log会告诉你这个。

包的一部分:policycoreutils-python-utils

0

这个工作对我来说... 我蒂卡在/var/apache-tika/tika-app-1.14.jar

setsebool -P httpd_execmem 1 
chcon -t httpd_exec_t /var/apache-tika/tika-app-1.14.jar 

使用sealert工具(https://wiki.centos.org/HowTos/SELinux)帮助追踪正确的selinux类型。

+0

没有工作,导致500错误没有任何日志输出 – MewX