仅在可继承集中具有能力意味着什么?
What does it means to have a capability only in the inheritable set?
我的程序正在 运行 和 cap_sys_admin,cap_setgid+i
。
当然,我知道它们可以跨 execve 继承,但除此之外:它们的行为方式是否与我根本没有它们一样,因为它们既无效也不允许?
是的,inherited 会一直休眠,直到您设置有效的能力。如手册中所述,继承的意思是:"when execve, copy inherited to child inherited and permitted":
This is a set of capabilities preserved across an execve(2). Inheritable capa‐
bilities remain inheritable when executing any program, and inheritable capa‐
bilities are added to the permitted set when executing a program that has the
corresponding bits set in the file inheritable set.
好的,所以您的流程是 运行 一些可继承的功能。这对您的流程意味着什么?几乎没有。您无法调用 setcap()
使这些功能中的任何一个生效,因为它们不在您的允许集中,并且无法将它们放入您的有效集中,您的流程无法使用这些功能本身。
但是它们在您的 Inheritable 集中的存在可能会对您启动的 other 进程产生影响。例如。如果您要 exec()
一个二进制文件,其文件的有效集和可继承集都具有 cap_setgid
,则该子进程的有效集将从 cap_setgid
开始。
如果 cap_setgid
在上例中进程的 Inheritable 集中 不是 ,那么文件具有 cap_setgid+ie
的事实变得无关紧要,并且子进程将不具有规定的能力。
我的程序正在 运行 和 cap_sys_admin,cap_setgid+i
。
当然,我知道它们可以跨 execve 继承,但除此之外:它们的行为方式是否与我根本没有它们一样,因为它们既无效也不允许?
是的,inherited 会一直休眠,直到您设置有效的能力。如手册中所述,继承的意思是:"when execve, copy inherited to child inherited and permitted":
This is a set of capabilities preserved across an execve(2). Inheritable capa‐
bilities remain inheritable when executing any program, and inheritable capa‐
bilities are added to the permitted set when executing a program that has the
corresponding bits set in the file inheritable set.
好的,所以您的流程是 运行 一些可继承的功能。这对您的流程意味着什么?几乎没有。您无法调用 setcap()
使这些功能中的任何一个生效,因为它们不在您的允许集中,并且无法将它们放入您的有效集中,您的流程无法使用这些功能本身。
但是它们在您的 Inheritable 集中的存在可能会对您启动的 other 进程产生影响。例如。如果您要 exec()
一个二进制文件,其文件的有效集和可继承集都具有 cap_setgid
,则该子进程的有效集将从 cap_setgid
开始。
如果 cap_setgid
在上例中进程的 Inheritable 集中 不是 ,那么文件具有 cap_setgid+ie
的事实变得无关紧要,并且子进程将不具有规定的能力。