利用SELinux增强Linux安全性
1. 查看进程安全上下文
要查看进程的安全上下文,需要在ps命令中使用-Z选项。以下示例使用ps -eZ命令,然后通过管道将结果传递给grep,以仅搜索运行bashshell的进程:
# ps -eZ | grep bash unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 1589 pts/ 0 00:00:00 bash unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 5289 pts/ 1 00:00:00 bash unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 5350 pts/ 1 00:00:00 bash进程上下文列表显示以下内容:
-用户(user):进程映射到SELinux的unconfined_u用户。
-角色(role):进程以unconfined_r角色运行。
-类型(type):进程在unconfined_t域中运行。