SELinux基础

1.概述

SECURE ENHANCED LINUX(SElinux)是一个内核级的安全机制,主流SELinux发行版本都会集成,CENTOS默认开启selinux

对SELinux的修改一般需要重新启动。


2.所有安全机制都是对进程和系统资源做出限制

SElinux针对这两种类型定义了两个基本概念:域(进程)和上下文(资源)


ps -Z 可以查看进程的域

ls -Z可以查看文件的上下文


[ming@localhost ~]$ ps -Z
LABEL                             PID TTY          TIME CMD
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 2415 pts/0 00:00:00 bash
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 2429 pts/0 00:00:00 ps
[ming@localhost ~]$ ls -Z
drwxr-xr-x. ming ming unconfined_u:object_r:user_home_t:s0 Desktop
drwxr-xr-x. ming ming unconfined_u:object_r:user_home_t:s0 Documents
drwxr-xr-x. ming ming unconfined_u:object_r:user_home_t:s0 Downloads
drwxr-xr-x. ming ming unconfined_u:object_r:audio_home_t:s0 Music
drwxr-xr-x. ming ming unconfined_u:object_r:user_home_t:s0 Pictures
drwxr-xr-x. ming ming unconfined_u:object_r:user_home_t:s0 Public
drwxr-xr-x. ming ming unconfined_u:object_r:user_home_t:s0 Templates
drwxr-xr-x. ming ming unconfined_u:object_r:user_home_t:s0 Videos
[ming@localhost ~]$ 


3.策略

通过定义策略来控制那些域可以访问那些上下文,通常不需要自定义策略。



4.SELinux的工作模式



5.格式解释



应用实例:



-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 index.html    ---------》》》引起错误

恢复上下文


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值