在Redhat上,“kernel.suid_dumpable = 1”是什么意思?

我正在运行一个bash脚本来复制一些日志文件,然后在Red Hat盒子上重启一个服务。 每次执行脚本时,我都会在控制台上看到以下内容:

[root@servername ~]# sh /bin/restart _nss.sh
kernel.suid
_dumpable = 1
Stopping Service: [ OK ]
Starting Service: [ OK ]
[root@servername ~]#

在这种情况下,“kernel.suid_dumpable = 1”是什么意思?

谢谢,IVR复仇者

一些背景:

setuid位:
可执行文件上的setuid位使得它是由任何用户运行的可执行文件,如同它们由可执行文件的所有者运行一样运行。 因此,如果将setuid设置为由root拥有的程序,则无论是谁运行它,它都将以root权限运行。 这当然不是那么简单,请参阅这篇维基百科的文章,或者在Unix环境下获得Steven的程序devise副本。

核心转储:
核心转储是程序工作内存转储到文件的转储。 看到这个维基百科的文章 。

suid_dumpable
如上所述,这可以控制核心是否可以从setuid程序转储。 见下文。 这是一个内核可调参数,可以通过以下方式进行更改:

 sudo sysctl -w kernel.suid_dumpable=2 

你可以在你的sourcode的文档中find这个可调参数,如果你安装了这个参数,你可以在/usr/src/linux-source-2.6.27/Documentation/sysctl/目录下find。 在这种情况下,下面的引用在该目录中的fs.txt中。 使用uname -a命令找出你的内核版本。

为什么重要:

这可能是一个安全风险:
所以这个想法是,如果有核心转储,一个普通的用户可以阅读,他们可能会发现特权信息。 如果程序转储得很好,它在内存中拥有特权信息,用户可以读取转储,他们可能会发现这些特权信息。

参考:

 This value can be used to query and set the core dump mode for setuid or otherwise protected/tainted binaries. The modes are 0 - (default) - traditional behaviour. Any process which has changed privilege levels or is execute only will not be dumped 1 - (debug) - all processes dump core when possible. The core dump is owned by the current user and no security is applied. This is intended for system debugging situations only. 2 - (suidsafe) - any binary which normally not be dumped is dumped readable by root only. This allows the end user to remove such a dump but not access it directly. For security reasons core dumps in this mode will not overwrite one another or other files. This mode is appropriate when adminstrators are attempting to debug problems in a normal environment. 

它决定了你是否可以从setuid进程获得核心转储。

来自原始补丁的一些信息

 +suid_dumpable: + +This value can be used to query and set the core dump mode for setuid +or otherwise protected/tainted binaries. The modes are + +0 - (default) - traditional behaviour. Any process which has changed + privilege levels or is execute only will not be dumped +1 - (debug) - all processes dump core when possible. The core dump is + owned by the current user and no security is applied. This is + intended for system debugging situations only. +2 - (suidsafe) - any binary which normally not be dumped is dumped + readable by root only. This allows the end user to remove + such a dump but not access it directly. For security reasons + core dumps in this mode will not overwrite one another or + other files. This mode is appropriate when adminstrators are + attempting to debug problems in a normal environment.