Articles of selinux

在freeIPA中授予sudo对SELinux受限用户的访问权限

我正在使用freeIPA来定义RBAC,HBAC和sudo规则,以及一百个虚拟机的域的SELinux用户映射,我需要为几个团队授予不同级别的访问权限(开发人员,数据库pipe理员,系统pipe理员,pipe理……)。 目前,这些机器上的SELinux策略被设置为targeted ,我正在考虑删除unconfined_u SELinux用户以使这些系统在strict策略下运行的可能性。 为了做到这一点,其中一个要求是让最终用户了解他/她已经从unconfined_u降级到staff_u 。 问题在于sudo与SELinux用户映射的交互方式。 一些事实: 如果你想使用一个受限制的SELinux用户,并且你还想使用sudo ,那么你需要使用staff_u ,因为这是可以访问SETUID可执行文件的SELinux用户。 当用户login系统时,他/她被分配一个SELinux用户映射。 即使在SELinux用户可以运行su ( unconfined_u )或sudo ( unconfined_u , staff_u )的情况下,映射也不会改变。 用于sudo的SELinux Spec目前包含用于以定义的types和roles运行命令的工具,但是缺less指定user的可能性。 进一步的参考可以在这里find。 参与这个部署的机器都是freeIPA客户端,他们的sudo策略是由freeIPApipe理的,但是他们也有一个puppetpipe理的,定制的/etc/sudoers文件,在freeIPA失败的情况下作为备用文件提供。 我第一次尝试解决这个问题涉及到一个包含所需规则的策略模块,以允许staff_u访问未修改的sudorules 。 这种方法已被certificate是错误的,因为政策可以无限制地增长,最终你所做的是在政策上打出一个漏洞。 所以到目前为止,我处理这些事实的方式是重写sudorules以显式地包含对runcon的调用以切换到相应的SELinux用户,因此现在需要运行一个典型的开发人员,例如: $ sudo -u jboss runcon -u sysadm_u jboss_cli.sh 这有一个缺点,就是不得不修改所有现有的sudorules并迫使用户改变通常运行的东西的方式。 所以问题是: 有一种方法可以在Runas_Spec定义中明确定义SELinux用户吗? 如果不能通过sudoers ,是否可以定义或绑定一个sudorule到sudorule中的SELinux用户映射? 考虑这种情况: # ipa sudorule-show services_4_operators_3 Rule name: services_4_operators_3 Description: Operator Level 3 access […]

只有当chroot时sftp才允许拒绝权限?

我已经在我的Centos框中configuration了sshd_conf,如下所示: Match group pilots ChrootDirectory /home/pilots ForceCommand internal-sftp X11Forwarding no AllowTcpForwarding no 和/ home / pilot这样的目录: # ls -al /home/pilots total 12 drwxr-x—. 3 root pilots 4096 Mar 10 14:20 . drwxr-xr-x. 7 root root 4096 Mar 10 14:10 .. drwxrwxr-x. 2 root pilots 4096 Mar 10 15:21 data -rwxrwxrwx. 1 root root 0 Mar […]

SELinux&ncsa_auth在鱿鱼

我正在尝试在CentOS 5.5服务器上启用SELinux,Squid 3.1.12通过ncsa_auth来处理身份validation。 当我closuresSElinux时一切正常,但是当我启用它时,Squid在authentication插件ncsa_auth上崩溃。 这是错误信息: May 29 19:12:21 us squid[1458]: Squid Parent: child process 1493 started May 29 19:12:21 us kernel: printk: 27 messages suppressed. May 29 19:12:21 us kernel: type=1400 audit(1306696341.922:74): avc: denied { execute } for pid=1494 comm="squid" name="ncsa_auth" dev=xvda1 ino=610563 scontext=root:system_r:squid_t:s0 tcontext=user_u:object_r:usr_t:s0 tclass=file May 29 19:12:22 us (squid): The basicauthenticator helpers are […]

SELinux:如何显示一个types的所有允许的规则?

对于任意的对象types,例如user_tmp_t ,我想知道哪些进程被允许访问这个标签。 如何查找引用user_tmp_t所有允许规则?

无法使SELinux上下文types变为永久的semanage

我在/ modevasive创build了一个新文件夹来保存我的mod_evasive脚本和日志目录。 我试图将上下文types更改为httpd_sys_content_t,以便Apache可以写入该文件夹。 我做了semanage fcontext -a -t "httpd_sys_content_t" /modevasive更改上下文,然后restorecon -v /modevasive以启用更改,但是restorecon没有执行任何操作。 所以我用chcon来手工改变它,做了restorecon来看看会发生什么,并把它改回到default_t。 semanage fcontext -l给出: /modevasive/ all files system_u:object_r:httpd_sys_content_t:s0` 看看/etc/selinux/targeted/contexts/files/file_contexts.local给出 /modevasive/ system_u:object_r:httpd_sys_content_t:s0 那么为什么restorecon保持设置回default_t?

SELinux与NFS共享的上下文

我正在尝试在2个CentOS服务器(filesrv和websrv)之间build立一个NFS共享,用于需要由Apache进程读写的文件夹。 我遇到了可写的一面,我已经缩小到SELinuxconfiguration的麻烦了:如果我在NFS客户端上setenforce 0 ,Apache可以写共享。 NFS服务器的导出文件中的相关行是: /data/files/sitefiles websrv(rw,sync,no_root_squash) NFS服务器上共享文件夹的SELinux上下文是: system_u:object_r:httpd_sys_rw_content_t:s0 我在NFS客户端上的fstab条目是: filesrv:/data/files/sitefiles /var/www/html/webroot/files nfs context="system_u:object_r:httpd_sys_rw_content_t:s0" 0 0 据我所知,这应该挂载与httpd_sys_rw_content_t上下文的NFS共享,但是当我检查它,实际上是: system_u:object_r:httpd_sys_content_t:s0 有什么可能导致它将更严格的背景应用于股票?

SELinux基于CentOS7的LXC?

有没有办法使用proxmox 4.2在基于LXC的容器上启用SELinux?

RHEL SELinux阻止Apache访问PostgreSQL

我正在运行使用PostgreSQL的Django应用程序。 服务器正在使用SELinux运行RHEL 6.5。 我遇到了Django应用程序无法连接到数据库的问题,我想这是因为SELinux阻止了它。 这是我在Django中看到的错误: could not connect to server: Permission denied Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? 我怎样才能解决这个问题? 我遇到这个post ,但我不知道如何应用解决scheme( chcon -t postgresql_exec_t /path/to/pgbouncer )到我的问题。 谢谢! [编辑] 当我尝试访问网站时,以下是/var/log/audit/audit.log样子: type=AVC msg=audit(1396289984.549:9245): avc: denied { write } for pid=16975 comm="httpd" name=".s.PGSQL.5432" dev=sda1 ino=2359354 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:tmp_t:s0 tclass=sock_file type=SYSCALL msg=audit(1396289984.549:9245): arch=c000003e […]

权限被拒绝:无法在Apache中创build/var/run/httpd.pid

我正在使用Apache和PHP在chroot jail环境中设置一个运行RedHat Enterprise 6的Web服务器。 Apache的chroot目录是/ chroot / httpd。 我跟着这个例子,当我去启动apache,我在/ var / log / httpd / error_log中看到以下内容。 [warn] ./mod_dnssd.c: No services found to register [Mon Jul 25 13:14:31 2011] [notice] core dump file size limit raised to 4294967295 bytes [Mon Jul 25 13:14:31 2011] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0 [Mon Jul 25 […]

无法用SELinux启动Mysql

我正尝试在CentOS 6上用SELinux启动MySQL,但是我收到以下错误。 131212 09:08:08 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 131212 09:08:58 mysqld_safe Starting mysqld daemon with databases from /u/mysql 131212 9:08:58 [Warning] Can't create test file /u/mysql/webserver.lower-test 131212 9:08:58 [Warning] Can't create test file /u/mysql/webserver.lower-test ^G/usr/libexec/mysqld: Can't change dir to '/u/mysql/' (Errcode: 13) 131212 9:08:58 [ERROR] Aborting 我们已经设置了许多其他服务器的MySQL,但是这里的区别在于mysql的datadir与标准的/vat/lib.mysql不在一个分区。 相反,它在/ u / mysql中。 这是/etc/my.cnf […]