Semanage是 用于配置SELinux策略某些元素而无需修改或重新编译策略源的工具。

 

这包括将Linux用户名映射到SELinux 用户身份以及对象(如网络端口,接口和主机)的安全上下文映射。

Semanage是 用于配置SELinux 策略某些元素而无需修改或重新编译策略源的工具。

如果没有 Semanage,你要对 SELinux 配置的话就比较麻烦,但是 SELinux 又是现在 Linux 的标配了,所以这个包也就变得很重要了。

检查要安装的包

有时候,你可能不知道要安装的包是什么。

运行下面的命令:

dnf provides semanage

然后你可以看到下面的输出,在下面的输出中,你会看到一个名为:

policycoreutils-python-utils-3.2-1.fc34.noarch 的包名称以及版本号。

在安装的时候是不需要提供版本号的。



Fedora/REHL 安装 semanage_版本号


安装

当你找到包的名称后,运行命令:

sudo dnf install policycoreutils-python-utils

就可以了,在这里你不需要提供版本号。

dnf 会自动帮你安装最新的包。

校验安装

输入命令

semanage -h

如果你能够看到下面的输出的话,就说明你的安装已经成功了。

[fedora@src conf.d]$ semanage -h
usage: semanage [-h] {import,export,login,user,port,ibpkey,ibendport,interface,module,node,fcontext,boolean,permissive,dontaudit} ...

semanage is used to configure certain elements of SELinux policy with-out requiring modification to or recompilation from policy source.

positional arguments:
{import,export,login,user,port,ibpkey,ibendport,interface,module,node,fcontext,boolean,permissive,dontaudit}
import Import local customizations
export Output local customizations
login Manage login mappings between linux users and SELinux confined users
user Manage SELinux confined users (Roles and levels for an SELinux user)
port Manage network port type definitions
ibpkey Manage infiniband ibpkey type definitions
ibendport Manage infiniband end port type definitions
interface Manage network interface type definitions
module Manage SELinux policy modules
node Manage network node type definitions
fcontext Manage file context mapping definitions
boolean Manage booleans to selectively enable functionality
permissive Manage process type enforcement mode
dontaudit Disable/Enable dontaudit rules in policy

options:
-h, --help show this help message and exit

上面提供了这个命令可以使用的帮助。



Fedora/REHL 安装 semanage_版本号_02


至此,配置已经完成了。