SELinux: 如何让selinux对某些命令放行,自定义selinux规则。

1.setting selinux to permissive mode

暂时关闭selinux,让操作进行下去,这个时候selinux还是会将记录log到audit.log里的

setenforce 0

2.disabling selinux dontaudit

这样可以让selinux没有遗漏的记录所有permission denied message,同样写入audit.log

semodule --disable_dontaudit --build

检验dontaudit有没有被禁用,运行下面的命令看结果是否为空

research --dontaudit

3.back up audit.log and create new empty audit.log

cp -p /var/log/audit/audit.log /var/log/audit/audit.log.sav
echo "" > /var/log/audit/audit.log

4.run the target command

5.generate policy package file of the target command

cat /var/log/audit/audit.log | audit2allow -M Targeted-command

6.load the policy package

cd /root
semodule -i Targeted-command.pp

安装过后系统就可以允许相关命令运行了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值