Я хочу ограничить определенного пользователя, чтобы он мог привязать сервер node.js к определенному порту. Этот бит работает.
Что не работает, так это предоставление указанному пользователю доступа к его собственным файлам.
audit2allow сообщает мне следующее:
#============= user_t ============== #!!!! This avc is a constraint violation. You will need to add an attribute to either the source or target type to make it work. #Constraint rule: allow user_t user_home_t:dir { write remove_name add_name }; #!!!! This avc is a constraint violation. You will need to add an attribute to either the source or target type to make it work. #Constraint rule: allow user_t user_home_t:file { read write execute open };
Я понятия не имею, какой атрибут я мог бы добавить, чтобы было понятнее, что мой пользователь должен иметь доступ к своим собственным файлам.
Вот запись audit.log
type=AVC msg=audit(1396865445.876:184): avc: denied { write } for pid=20389 comm="node" name="hawkejs-client-side.js" dev=md2 ino=92144931 scontext=sandbox_u:user_r:user_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file
audit2why дает мне это:
type=AVC msg=audit(1396865445.876:184): avc: denied { write } for pid=20389 comm="node" name="hawkejs-client-side.js" dev=md2 ino=92144931 scontext=sandbox_u:user_r:user_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file Was caused by: Policy constraint violation. May require adding a type attribute to the domain or type to satisfy the constraint. Constraints are defined in the policy sources in policy/constraints (general), policy/mcs (MCS), and policy/mls (MLS).
Эта ссылка объясняет нарушение ограничений и как с этим справиться: http://cat.devtwo.org/post/An-SELinux-constraint-violation-(p-1-of-5)