那么这三个字段如何利用呢?首先我们来瞧瞧主体½程在这三个字段的意义为何!透过身份识别与½
色字段的定义,
我们可以约略知道某个½程所代表的意义喔!先来动手瞧一瞧目前系统中的½程在
SELinux
底下的安全本文为何?
#
来观
察一下系
½
程的
SELinux
信息』
[root@study ~]#
ps
-
eZ
LABEL PID TTY TIME CMD
system_u:system_r:init_t:s0 1 . 00:00:03 systemd
system_u:system_r:kernel_t:s0 2 . 00:00:00 kthreadd
system_u:system_r
:kernel_t:s0 3 . 00:00:00 ksoftirqd/0
.....(
省略
).....
unconfined_u:unconfined_r:unconfined_t:s0
-
s0:c0.c1023 31513 . 00:00:00 sshd
unconfined_u:unconfined_r
:unconfined_t:s0
-
s0:c0.c1023 31535 pts/0 00:00:00 bash
#
基本上
½
程主要就分
为两
,一种是系
有受限的
system_u:system_r
,另一种
可能是用
自己的,
#
½
不受限的
½
(
通常是本机用
自己
行的程序
)
,亦即是
unconfined_u:unconfined_r
这两
种!
基本上,这些对应资料在
targeted
政策下的对应如下:
身份识别
½色
该对应在
targeted
的意义
unconfined_u
unconfined_r
一般可登入使用者的½程啰!比½没有受限的½程之意!大多数都是用户已经顺利
登入系统
(
不论是网络还是本机登入来取得可用的
shell)
后,
所用来操作系统的
½程!如
bash, X window
相关软件等。
system_u
system_r
由于为系统账号,因此是非½谈式的系统运作½程,大多数的系统½程均是这种类
型!
但就如上所述,在预设的
target
政策下,
其实最重要的字段是类型字段
(type)
主体与目标之间是
否具有可以读写的权限,与½程的
domain
及文件的
type
有关
!这两者的关系我们可以使用
crond
以及他的配置文件来说明!
亦即是
/usr/sbin/crond, /etc/crontab, /etc/cron.d
等文件来说明。
首先,看
看这几个咚咚的安全性本文内容先:
# 1.
先看看
crond
这个
½
程』的安全本文
容:
[root@study ~]#
ps
-
eZ | grep cron
system_u:system_r:
crond_t
:s0
-
s0:c0.c1023 1338 . 00:00:01 crond
system_u:system_r:crond_t:s0
-
s0:c0.c1023 1340 .
00:00:00 atd
#
这个
安全本文的
型名
称为
crond_t
格式!
# 2.
瞧瞧
、配置文件等等的安全本文
何!
[root@study ~]#
ll
-
Zd /usr/sbin/crond /etc/crontab /etc/cron.d
drwxr
-
xr
-
x. root root system_u:object_r:
system_cron_spool_t
:s0 /etc/cron.d
-
rw
-
r
--
r
--
. root root system_u:object_r:
system_cron_spool_t
:s0 /etc/crontab
-
rwxr
-
xr
-
x. root root system_u:object_r:
crond_exec_t
:s0 /usr/sbin/crond