Linux 2.6.32 Centos 6.4 setuid()失败/安全更改?

在最近更新到CentOS 6.4之后,两台机器有setuid()限制,它们的function或者是selinux,但是都是禁用的。 例如下面的失败:

[root@host statd]# perl -e 'use POSIX; POSIX::setuid(99);system("id")' [root@host statd]# echo $? 0 

当它应该返回像这样的东西:

 host:~# perl -e 'use POSIX; POSIX::setuid(99);system("id")' uid=99(nobody) gid=0(root) groups=99(nobody),0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 

为了调用perl,setuid()调用成功,然而system()子立即退出,就像selinux或类似的终止一样。 但是,在/var/log/audit/audit.log中没有日志条目,即使在semodule -DB之后。

 setuid32(99) = 0 getuid32() = 99 geteuid32() = 99 pipe([3, 4]) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7705728) = 10073 close(4) = 0 rt_sigaction(SIGINT, {SIG_IGN, [], 0}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_IGN, [], 0}, {SIG_DFL, [], 0}, 8) = 0 waitpid(10073, [{WIFEXITED(s) && WEXITSTATUS(s) == 255}], 0) = 10073 --- SIGCHLD (Child exited) @ 0 (0) --- rt_sigaction(SIGINT, {SIG_DFL, [], 0}, NULL, 8) = 0 rt_sigaction(SIGQUIT, {SIG_DFL, [], 0}, NULL, 8) = 0 read(3, "\r\0\0\0", 4) = 4 close(3) = 0 exit_group(0) 

由于nfs.statd失败,“无法访问本地netconfig数据库:Netconfig数据库未find”,第一次重新启动后,此问题变得明显。 而rpc.rquotasd失败,因为“RPC:服务器本地主机需要更强的身份validation”。

nfs.statd问题可以通过以root身份运行来解决(chown root:root / var / lib / nfs / statd)。 以root身份在机器上运行所有东西似乎不是一个很好的解决方法。 ;)

试图su到另一个帐户也不起作用:

 [root@host ~]# su - jboss su: warning: cannot change directory to /opt/jboss: Permission denied su: /bin/bash: Permission denied [root@host ~]# su jboss su: /bin/bash: Permission denied 

基本的系统信息如下:

 [root@host statd]# getenforce Permissive [root@host statd]# uname -a Linux host.example.com 2.6.32-358.14.1.el6.i686 #1 SMP Tue Jul 16 21:12:30 UTC 2013 i686 i686 i386 GNU/Linux [root@host statd]# cat /etc/redhat-release CentOS release 6.4 (Final) [root@host statd]# getcap /usr/bin/perl /usr/bin/perl = 

当它显然不是selinux或linuxfunction时,可能会造成这种情况?

不知何故,升级过程改变了烫发:

 [root@host ~]# ls -alZ / drw-r--r--. 42374 5031 system_u:object_r:root_t:s0 . drw-r--r--. 42374 5031 system_u:object_r:root_t:s0 .. 

哪一个被修复了

 chown root:root / && chmod 755 / 

缩小错误空间的一大帮助是运行

 strace perl -e 'use POSIX; POSIX::setuid(99);exec("id")' 

其中显示perl的execve()调用失败每次与EACCES,因为它尝试所有的$ PATH dirs。