Articles of selinux

如何为Glassfish服务器构buildSELinux规则

我在CentOS 6解决scheme上运行Glassfish 3.1,默认启用SELinux。 我已经在服务器上安装了Sun的JDK 1.6.0_29版本,并将Glassfish 3.1.1 /opt/glassfish-3.1.1压缩到/opt/glassfish-3.1.1 ,同时指向最新的Glassfish版本的/opt/glassfish链接。 我还创build了一个名为glassfish的系统用户,其主目录为/home/glassfish 。 当启用SELinux运行时,我得到各种错误。 例如,我无法创build域。 我有点像SELinux的概念,并希望能够启用SELinux。 我对Glassfish服务器有以下要求: 聆听端口8080和8081 其他端口7676:JMS 8686:JMX监视,4848:pipe理控制台 通过mod_jk和端口8009从apache转发到Glassfish 启动OpenMQ作为一个单独的进程,它监听7676,它是JMX监控端口7776 能够读写指定区域的文件(与主目录不同) 能够使用/ tmp /临时文件 我知道在允许模式下运行audit2allow工具,但是我很难理解这个工具生成的规则,并且认为第一次手动设置这些规则会比单纯的例子更好地理解SELinux规则到目前为止我已经看到了。 具有SELinux经验的人能否帮助我形成这些SELinux规则,并说明规则的每个部分?

当启动lighttpd + fastcgi时,SELinux会导致“权限被拒绝”

我无法通过暴发户启动一个lighttpd fastcgi python应用程序。 我可以使用sudo lighttpd -D -f /path/to/lighttpd.conf并通过su -c "lighttpd -f /path/to/lighttpd.conf成功启动应用程序。 暴发户,我使用以下脚本: start on filesystem and started networking stop on runlevel [06] respawn exec lighttpd -f /path/to/lighttpd/lighttpd.conf -D 这会在/var/log/lighttpd/error.log中导致以下错误: 2011-11-28 15:35:25: (mod_fastcgi.c.978) bind failed for: unix:/var/lib/lighttpd/sockets/fastcgi.python.socket-0 Permission denied 2011-11-28 15:35:25: (mod_fastcgi.c.1399) [ERROR]: spawning fcgi failed. 2011-11-28 15:35:25: (server.c.938) Configuration of plugins failed. Going down. […]

SETroubleShoot“无法识别的服务”错误

我安装了这个软件包,但是我收到了一个“无法识别的服务”错误: [alexus@wcmisdlin02 ~]$ sudo yum install setroubleshoot Loaded plugins: refresh-packagekit Setting up Install Process Resolving Dependencies –> Running transaction check —> Package setroubleshoot.x86_64 0:2.2.94-1.el6 will be installed –> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================================================================================ Installing: setroubleshoot x86_64 2.2.94-1.el6 sl 138 k Transaction Summary ============================================================================================================================================================================================================================================ Install 1 Package(s) Total download […]

挂载的NFS目录不能被Apache / PHP写入

在这里需要一些NFS的帮助。 这就是我所拥有的(所有运行CentOS 5.6的服务器都使用SELinux): 172.17.20.1 – Primary server with static IP. Varnish redirects requests to the web servers. 172.17.20.2 – Web server 1 172.17.20.3 – Web server 2 驻留在Web服务器上的应用程序正在运行Drupal,我需要它们共享相同的文件目录。 我用root用户在172.17.20.1中创build了一个名为/ var / nfs的文件夹。 这里是我的/ etc / exports内容: /var/nfs 172.17.20.2(rw,sync,no_root_squash) 172.17.20.3(rw,sync,no_root_squash) 在这两个networking服务器(172.17.20.2/3),我已经安装如下: [root@web2 ~]# mount … 172.17.20.1:/var/nfs on /mnt/nfs/var/nfs type nfs (rw,sync,hard,intr,addr=172.17.20.1) 在所有服务器上,我已经将用户apache添加到根组以获得所需的写权限: [root@main ~]# cat /etc/group […]

如何运行selinux sanbdox访问/ dev / urandom

我试图在SELinux沙盒中运行我的应用程序。 我的应用程序需要访问/ dev / urandom,并且默认的沙箱策略不允许这样做。 什么是允许我的沙箱上下文访问/ dev / urandom的简单方法? 谢谢

selinux“这个政策可能不匹配…”

如何解决以下错误: type=AVC msg=audit(1365523330.609:4846): avc: denied { append } for pid=12542 comm="FTPMan.pl" name="user_list" dev=dm-0 ino=2884237 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=file Was caused by: Unknown – would be allowed by active policy Possible mismatch between this policy and the one under which the audit message was generated. Possible mismatch between current in-memory boolean settings vs. permanent ones. 关于这个特定的错误没有太多的文档。

CentOS6上的Httpd没有列出目录内容

我在Centos6.4服务器上有一个文件夹(不是传统的/ var / www / html文件夹!)/ Server / Websites / Default。 只有一个文件,phpinfo.php(其中有明显的代码)。 在Firefox中运行http://localhost/Default/phpinfo.php ,显示正确的PHP信息页面。 当我访问http://localhost/Default/页面时,它显示了一个禁止的'你没有权限访问/在这个服务器上。 页。 我想要它列出目录内容。 在我的/etc/httpd/conf/httpd.conf文件中,(显示时间太长,所以我粘贴了一些我认为重要的关键代码): DocumentRoot "/Server/Websites" <Directory /Server/Websites> Options +Indexes Includes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> SELinux聪明,我也为# getsebool -a | grep httpd # getsebool -a | grep httpd : allow_httpd_anon_write –> off allow_httpd_mod_auth_ntlm_winbind –> off allow_httpd_mod_auth_pam –> […]

如何使木偶修复主目录的SELinuxtypes?

我们使用pam_mkhomedir.so来自动创build用SSHlogin的用户的主目录。 pam_mkhomedir中有一个错误,它将SELinux上下文设置为home_root_t而不是user_home_dir_t。 解决scheme是使用我们已经实现的pam_oddjob_mkhomedir。 然而,我们仍然有许多主目录与无效的SELinux上下文。 drwxr-xr-x. jdoe users unconfined_u:object_r:home_root_t:s0 jdoe 我们如何devise一个Puppet模块来纠正所有用户主目录下的SELinux上下文? 我正在考虑这样的解决scheme: file { '/home/*': ensure => "directory", seltype => "user_home_dir_t" } 不幸的是,通配符不起作用。

Apache不会停止/正常启动

CentOs 6 64bit运行apache 2.2.15-29.el6.centos。 当我尝试停止/启动或重新启动httpd时,出现错误,说明它失败了。 错误日志的尾部在下面。 我还注意到,即使在主要的conf文件中configuration了httpd.pid文件,它也不会被创build。 如果我将selinux设置为宽容,那么它工作得很好。 我不想在禁用selinux的情况下运行它。 如果我删除SSL_Mutex文件,它将启动。 HTTPD运行良好,直到我试图添加sslconfiguration。 我将ssl.conf文件从工作服务器复制到conf.d文件夹中。 我也复制了一个sslcert文件夹到conf文件夹。 它包含证书,密钥,csr和密码文件。 我认为这个问题与sslcert文件夹的selinux上下文有关,但我不确定如何解决这个问题。 执行restorecon -R sslcert之后,下面是sslcert文件夹的安全上下文 ls -Z -rw-r–r–. root root system_u:object_r:httpd_config_t:s0 httpd.conf -rw-r–r–. root root system_u:object_r:httpd_config_t:s0 magic **drwxr-xr-x. root root system_u:object_r:httpd_config_t:s0 sslcert** tail -f /var/log/httpd/error_log [Thu Oct 17 13:33:19 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Thu Oct 17 13:33:20 2013] [notice] […]

在matchpathcon和restorecon之间,RHEL SELinux上下文不同

我正在使用RHEL 6.3,并用matchpathcon和restorecon SELinux命令试验了一个奇怪的行为。 对于一个特定的文件,我用semanage fcontext定义了一个上下文。 然后, matchpathcon告诉我该文件应该有我定义的上下文,但是restorecon使这个文件有另一个上下文。 我无法理解这种行为,我认为我做错了一些事情。 这里是一个重现这个行为的例子(我是一个root用户): $ cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.3 (Santiago) $ sestatus SELinux status: enabled SELinuxfs mount: /selinux Current mode: enforcing Mode from config file: enforcing Policy version: 24 Policy from config file: targeted 我会创build一个特定的init.d脚本来启动一个HTTPD守护进程。 $ touch /etc/init.d/my-httpd $ ls -Z /etc/init.d/my-httpd -rw——-. root root […]