Centos

如何在 CentOS 中刪除 SELinux 模組?

  • January 10, 2017

我試過但它給出了一個錯誤。

# ls -l opendkim.pp
-rw-r--r--. 1 root root 1569 Jan  8 01:20 opendkim.pp

# ls -l /etc/selinux/targeted/modules/active/modules/opendkim.pp
-rw-r--r--. 1 root root 344 Jan  8 01:33 /etc/selinux/targeted/modules/active/modules/opendkim.pp

# semodule -r opendkim.pp
SELinux:  Could not load policy file /etc/selinux/targeted/policy/policy.24:  Invalid argument
/sbin/load_policy:  Can't load policy:  Invalid argument
libsemanage.semanage_reload_policy: load_policy returned error code 2.
SELinux:  Could not load policy file /etc/selinux/targeted/policy/policy.24:  Invalid argument
/sbin/load_policy:  Can't load policy:  Invalid argument
libsemanage.semanage_reload_policy: load_policy returned error code 2.
semodule:  Failed!

# ls -lZ /etc/selinux/targeted/policy/policy.24
-rw-r--r--. root root unconfined_u:object_r:semanage_store_t:s0 /etc/selinux/targeted/policy/policy.24

為什麼需要 5m+ 才能失敗?

CentOS 6.8 版(最終版)

semodule -r需要模組名稱,而不是文件名。

所以它會是這樣的:

semodule -r opendkim

或者你在定義模組時給它起的任何名字。

引用自:https://serverfault.com/questions/825430