3.2.6 boolean及条件描述语句
1.booleans是策略中声明的参数,值是true或false,在运行时可以改变的。
语法:bool name default_value;
例:bool user_ping false;
2.条件描述语句:
if (conditional expression) {
#有效的策略描述
} else {
#有效的策略描述
}
|
例:允许用户使用ping
bool user_ping false;
if (user_ping) {
domain_auto_trans(unpriv_userdomain, ping_exec_t, ping_t)
# allow access to the terminal
allow ping_t { ttyfileptyfile} : chr_file rw_file_perms;
}
|
3.查看和设置boolean
通过selinuxfs文件系统在/selinux/booleans和 /selinux/commit_pending_bools中人工设置。
用show_bools命令显示策略boolean的当前值。
用set_bools命令设置boolean的值。
| 回书目 上一节 下一节 |