> Что никому здесь CAP не нужны?Всем нужны, но все стесняются поднять этот вопрос.
У меня от root для ВСЕХ задач запускаются ~50 программ. Все необходимые и достаточные CAP для этих 50 прог собрал. Это всего ~50 строк простейшего кода, который выставит необходимые и достаточные привилегии для этих прог с битом наследования.
В /etc/security/capability.conf прописать:
перечень,необходимых,и,достаточных,прав root
# а остальным все запретить:
none *
Вот только дырявое ведро линукса согласно
man 7 capabilities https://man7.org/linux/man-pages/man7/capabilities.7.html
Не хочет обрабатывать права для root тупо в permitted и effective записывая все без фильтра.
Надо бы опцию какюто в .config и параметрах загрузки ядра иметь, чтобы для root CAP обрабатывались, как для обычного пользователя!
Есть еще вариантант СТРАШНЫЙ КОСТЫЛЬ:
https://man7.org/linux/man-pages/man7/capabilities.7.html
Set-user-ID-root programs that have file capabilities
There is one exception to the behavior described under
Capabilities and execution of programs by root. If (a) the
binary that is being executed has capabilities attached and (b)
the real user ID of the process is not 0 (root) and (c) the
effective user ID of the process is 0 (root), then the file
capability bits are honored (i.e., they are not notionally
considered to be all ones). The usual way in which this
situation can arise is when executing a set-UID-root program that
also has file capabilities. When such a program is executed, the
process gains just the capabilities granted by the program (i.e.,
not all capabilities, as would occur when executing a set-user-
ID-root program that does not have any associated file
capabilities).
Note that one can assign empty capability sets to a program file,
and thus it is possible to create a set-user-ID-root program that
changes the effective and saved set-user-ID of the process that
executes the program to 0, but confers no capabilities to that
process.
Надо кроме inhirit CAP ставить еще s-bit, и запускать процесс под обычным пользователем с прописанными возможными правами в: /etc/security/capability.conf
Кто что скажет по этому варианту?