SELINUX(Security-Enhanced Linux 安全增强型Linux)(Enforcing、Permissive、Disabled)

SELinux Policies(SELinux策略)

Two main types of policies are used in SELinux: targeted and strict. The targeted policy, which is the default, targets(针对) and confines(限制) selected system processes. The strict policy confines all processes on the system.

SELinux主要使用两种类型的策略:目标和严格。默认的是目标策略,它针对并限制了选定的系统进程。严格策略限制了系统上的所有进程。

sestatus

The above command will display the current SELinux status, including the policy being loaded.

以上命令将显示当前的SELinux状态,包括正在加载的策略。

在这里插入图片描述

Configuring SELinux(配置SELinux)(targeted针对的、minimum最小化的、mls多级保护)

System administrators can manipulate(操作) the SELinux settings via the /etc/selinux/config file. Here, you can set the SELinux mode and choose the policy to load at boot time.

系统管理员可以通过/etc/selinux/config文件操作SELinux设置。在这里,您可以设置SELinux模式并选择在启动时加载的策略。

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected. 
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

在这里插入图片描述

The settings in this file will take effect after a system reboot.
这个文件中的设置将在系统重启后生效。

这三种SELinux策略的范围从小到大可以理解为 “minimum” < “targeted” < “mls”。

  1. Minimum:这是最小的范围,只保护选定的进程。这是对"targeted"策略的一种修改,比"targeted"策略有更少的受保护的进程。
  2. Targeted:这个策略的范围比"minimum"大。它针对特定的系统进程进行保护,而其它进程则运行在传统的Discretionary
    Access Control(DAC)环境下。这是默认的SELinux策略。
  3. MLS (Multi Level Security):这是范围最大的策略,它为所有的系统进程提供了多级别的安全保护。

注意:

在这里,“targeted”和“minimum”是两种不同的SELinux策略类型。

  1. Targeted:这种策略只针对特定的系统进程进行保护,而其它进程则运行在传统的Discretionary Access Control(DAC)环境下。这是默认的SELinux策略。
  2. Minimum:这种策略是对"targeted"策略的修改。它只保护选定的进程,但比"targeted"策略有更少的受限制的进程。

所以说,“Targeted processes are protected”和“Only selected processes are protected”虽然看起来很像,但是它们所指的保护范围和级别是不同的。

Working with SELinux Booleans(使用SELinux布尔值)

SELinux booleans allow the administrator to modify SELinux settings on the fly(即时) without any need for policy recompilation(重编译). To get a list of all available SELinux booleans, you can use:

SELinux布尔值允许管理员即时修改SELinux设置,无需重新编译策略。要获取所有可用的SELinux布尔值列表,您可以使用:

getsebool -a

在这里插入图片描述

To set a particular boolean value, use the setsebool command:

要设置特定的布尔值,请使用setsebool命令:

setsebool -P httpd_can_network_connect 1

In this example, we’re allowing the HTTPD daemon to make(建立) network connections.

在此示例中,我们允许HTTPD守护进程进行网络连接。

getsebool -a

setsebool -P httpd_can_network_connect 1

在这里插入图片描述

Conclusion

结论

While it might seem complex at first, SELinux is an extremely powerful tool that allows system administrators to have fine-grained(细粒的) control over their systems’ security. It offers a higher level of access control and process separation(进程隔离) than traditional Unix permissions models. Understanding how to work with SELinux can significantly enhance your system’s security posture.

虽然一开始可能看起来很复杂,但SELinux是一个非常强大的工具,它允许系统管理员对他们的系统安全性进行精细控制。它提供了比传统Unix权限模型更高级别的访问控制和进程分离。理解如何使用SELinux可以显著增强您的系统的安全态势。

为了做好运维面试路上的助攻手,特整理了上百道 【运维技术栈面试题集锦】 ,让你面试不慌心不跳,高薪offer怀里抱!

这次整理的面试题,小到shell、MySQL,大到K8s等云原生技术栈,不仅适合运维新人入行面试需要,还适用于想提升进阶跳槽加薪的运维朋友。

本份面试集锦涵盖了

  • 174 道运维工程师面试题
  • 128道k8s面试题
  • 108道shell脚本面试题
  • 200道Linux面试题
  • 51道docker面试题
  • 35道Jenkis面试题
  • 78道MongoDB面试题
  • 17道ansible面试题
  • 60道dubbo面试题
  • 53道kafka面试
  • 18道mysql面试题
  • 40道nginx面试题
  • 77道redis面试题
  • 28道zookeeper

总计 1000+ 道面试题, 内容 又全含金量又高

  • 174道运维工程师面试题

1、什么是运维?

2、在工作中,运维人员经常需要跟运营人员打交道,请问运营人员是做什么工作的?

3、现在给你三百台服务器,你怎么对他们进行管理?

4、简述raid0 raid1raid5二种工作模式的工作原理及特点

5、LVS、Nginx、HAproxy有什么区别?工作中你怎么选择?

6、Squid、Varinsh和Nginx有什么区别,工作中你怎么选择?

7、Tomcat和Resin有什么区别,工作中你怎么选择?

8、什么是中间件?什么是jdk?

9、讲述一下Tomcat8005、8009、8080三个端口的含义?

10、什么叫CDN?

11、什么叫网站灰度发布?

12、简述DNS进行域名解析的过程?

13、RabbitMQ是什么东西?

14、讲一下Keepalived的工作原理?

15、讲述一下LVS三种模式的工作过程?

16、mysql的innodb如何定位锁问题,mysql如何减少主从复制延迟?

Tomcat8005、8009、8080三个端口的含义?

10、什么叫CDN?

11、什么叫网站灰度发布?

12、简述DNS进行域名解析的过程?

13、RabbitMQ是什么东西?

14、讲一下Keepalived的工作原理?

15、讲述一下LVS三种模式的工作过程?

16、mysql的innodb如何定位锁问题,mysql如何减少主从复制延迟?

17、如何重置mysql root密码?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值