将audit2allow生成的SElinux策略放在哪里?

基本的

我正在最小使用CentOS7。我已经安装acpid并且守护程序正在运行。

当我按下电源按钮时,我得到以下信息 /var/log/messages

May  2 18:52:53 localhost systemd-logind: Power key pressed.
May  2 18:52:53 localhost systemd: SELinux policy denies access.

并在/var/log/audit/audit.log

type=USER_AVC msg=audit(1430589539.562:468): pid=815 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for msgtype=method_call interface=org.freedesktop.DBus.Properties member=Get dest=org.freedesktop.systemd1 spid=4177 tpid=1 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=dbus  exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'
type=USER_AVC msg=audit(1430589539.571:469): pid=815 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for msgtype=method_call interface=org.freedesktop.DBus.Properties member=Get dest=org.freedesktop.systemd1 spid=4182 tpid=1 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=dbus  exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'
type=USER_AVC msg=audit(1430589539.586:470): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { start } for auid=-1 uid=0 gid=0 path="/usr/lib/systemd/system/poweroff.target" scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:power_unit_file_t:s0 tclass=service  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

通过管道传递audit2why以下输出:

type=USER_AVC msg=audit(1430589539.562:468): pid=815 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for msgtype=method_call interface=org.freedesktop.DBus.Properties member=Get dest=org.freedesktop.systemd1 spid=4177 tpid=1 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=dbus  exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'

        Was caused by:
                Missing type enforcement (TE) allow rule.

                You can use audit2allow to generate a loadable module to allow this access.

type=USER_AVC msg=audit(1430589539.571:469): pid=815 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for msgtype=method_call interface=org.freedesktop.DBus.Properties member=Get dest=org.freedesktop.systemd1 spid=4182 tpid=1 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=dbus  exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'

        Was caused by:
                Missing type enforcement (TE) allow rule.

                You can use audit2allow to generate a loadable module to allow this access.

type=USER_AVC msg=audit(1430589539.586:470): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { start } for auid=-1 uid=0 gid=0 path="/usr/lib/systemd/system/poweroff.target" scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:power_unit_file_t:s0 tclass=service  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

        Was caused by:
                Missing type enforcement (TE) allow rule.

                You can use audit2allow to generate a loadable module to allow this access.

最后,将日志传递audit2allow -lar给我:

require {
        type power_unit_file_t;
        type init_t;
        type apmd_t;
        class dbus send_msg;
        class service start;
}

#============= apmd_t ==============
allow apmd_t init_t:dbus send_msg;
allow apmd_t power_unit_file_t:service start;

我不确定下一步该怎么做。如何从上面的输出中获取有效的SELinux策略?

塞巴斯

audit2allow-M <name>使用option时可以直接生成策略模块

然后可以使用加载该模块semodule -i <name>.pp

该模块也可以手动编译。当您修改自动生成的模块时,这很有用。手册页上有一个示例,列出了步骤:

# Compile the module
$ checkmodule -M -m -o local.mod local.te

# Create the package
$ semodule_package -o local.pp -m local.mod

# Load the module into the kernel
$ semodule -i local.pp

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何使用audit2allow的现有输出创建SELinux策略模块?

来自分类Dev

我将生成的Javdoc html文件放在哪里?

来自分类Dev

将容器放在哪里?

来自分类Dev

Rails 4验证:进行包含时,将allow_nil放在哪里?

来自分类Dev

如何在Alpine Linux 3.5上安装audit2allow?

来自分类Dev

android上的unix套接字的audit2allow给出空白输出

来自分类Dev

curl将下载放在哪里?

来自分类Dev

我将PDO放在哪里?

来自分类Dev

我将存根放在哪里?

来自分类Dev

将printf放在哪里输出

来自分类Dev

“ make install”将文件放在哪里?

来自分类Dev

我将图像资源放在哪里?

来自分类Dev

gdb将日志文件放在哪里?

来自分类Dev

将包含的 JQuery 文件放在哪里

来自分类Dev

哪里将联接多个表的SQL查询放在哪里?

来自分类Dev

在Symphony2系统中,将普通的PHP库(例如Google API库)放在哪里?

来自分类Dev

@EnableBatchProcessing放在哪里?

来自分类Dev

把`await`放在哪里?

来自分类Dev

我将自动生成的类放在哪里?

来自分类Dev

将for_each调用的函数放在哪里?

来自分类Dev

聚合物:我到底将Javascript放在哪里?

来自分类Dev

我将noRollbackFor放在哪里有关系吗?

来自分类Dev

在哪里将sortBy('name')放在控制器中?

来自分类Dev

我应该将Junit @Category的接口类放在哪里?

来自分类Dev

如果不在仓库中,将大文件放在哪里?

来自分类Dev

在哪里将sortBy('name')放在控制器中?

来自分类Dev

如何将Elasticsearch的映射文件放在哪里?

来自分类Dev

MSBuild和Jenkins:将凭证放在哪里?

来自分类Dev

我应该将Ensembles uniqueIdentifier放在哪里?