日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

linux虚拟实验室关闭了,centos8禁用selinux临时关闭/永久关闭

發(fā)布時間:2025/4/5 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux虚拟实验室关闭了,centos8禁用selinux临时关闭/永久关闭 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

一,selinux的用途

1,什么是selinux

SELinux:即安全增強型 Linux(Security-Enhanced Linux)

它是一個 Linux 內(nèi)核模塊,也是 Linux 的一個安全子系統(tǒng)

它主要由美國國家安全局開發(fā),

它的主要作用:最大限度地減小系統(tǒng)中服務(wù)進程可訪問的資源(最小權(quán)限原則)

2,為什么要關(guān)閉selinux?

有的軟件對于selinux的安全規(guī)則支持不夠好,就會建議在安裝前把selinux先關(guān)閉,

例如:k8s:

附:k8s的相應(yīng)說明:

Setting SELinux in permissive mode by runningsetenforce 0andsed ...effectively disables it.

This is required to allow containers to access the host filesystem, which is needed by pod networks for example.

You have to do this until SELinux support is improved in the kubelet...

其目的在于允許容器訪問宿主機的文件系統(tǒng),

這種情況下只能先關(guān)閉selinux

說明:如果不是要運行的軟件有相應(yīng)需求,不建議關(guān)閉selinux

二,查看當前selinux的狀態(tài)?

1,selinux的三種運行模式:

enforcing:強制模式,SELinux 正在運行中,已經(jīng)在限制 domain/type

permissive:寬容模式:SELinux 正在運行中,但僅發(fā)出警告信息,并不會實際限制 domain/type 的存取

(permissive模式可以用在測試環(huán)境中供調(diào)試規(guī)則時使用)

disabled:關(guān)閉,SELinux 沒有實際運行。

2,用sestatus查看

[root@centos8 ~]$ sestatus -v

SELinux status: ? ? ? ? ? ? ? ? enabled

SELinuxfs mount: ? ? ? ? ? ? ? ?/sys/fs/selinux

SELinux root directory: ? ? ? ? /etc/selinux

Loaded policy name: ? ? ? ? ? ? targeted

Current mode: ? ? ? ? ? ? ? ? ? enforcing

Mode from config file: ? ? ? ? ?enforcing

Policy MLS status: ? ? ? ? ? ? ?enabled

Policy deny_unknown status: ? ? allowed

Memory protection checking: ? ? actual (secure)

Max kernel policy version: ? ? ?31

...

可以看到: Current mode: ? ? ? ? ? ? ? ? ? enforcing

3,用getenforce查看(常用)

[root@centos8 ~]$ getenforce

Enforcing

三,臨時關(guān)閉/開啟selinux

查看當前的運行模式

[root@centos8 liuhongdi]# getenforce

Enforcing

配置selinux運行模式為:Permissive

#0: Permissive

#1: Enforcing

[root@centos8 liuhongdi]# setenforce 0

查看效果:

[root@centos8 liuhongdi]# getenforce

Permissive

四,永久關(guān)閉selinux

1, 修改配置文件

[root@centos8 liuhongdi]# vi /etc/selinux/config

設(shè)置配置項為:

SELINUX=disabled

說明:默認值是: #SELINUX=enforcing

然后重啟機器

2,修改/etc/sysconfig/selinux 這個文件也可以生效

因為它其實就是/etc/selinux/config的符號鏈接

[root@centos8 liuhongdi]# ll /etc/sysconfig/selinux

lrwxrwxrwx. 1 root root 17 11月 11 2019 /etc/sysconfig/selinux -> ../selinux/config

五,selinux的相關(guān)知識:

1,selinux默認的審計日志位于:/var/log/audit/audit.log

[root@centos8 ~]# ll /var/log/audit/audit.log

-rw------- 1 root root 5093679 5月 ?29 13:57 /var/log/audit/audit.log

2,如何分析selinux的日志?

#-a:--analyze=FILE: ? 分析一個文件

[root@centos8 ~]# sealert -a /var/log/audit/audit.log

3,查詢系統(tǒng)中的布爾型規(guī)則及其狀態(tài)

[root@centos8 liuhongdi]# getsebool -a

六,查看linux的版本

[root@centos8 ~]$ cat /etc/redhat-release

CentOS Linux release 8.1.1911 (Core)

總結(jié)

以上是生活随笔為你收集整理的linux虚拟实验室关闭了,centos8禁用selinux临时关闭/永久关闭的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。