【问题标题】:SELinux - how do I call my custom interface?SELinux - 如何调用我的自定义界面?
【发布时间】:2020-10-21 14:45:11
【问题描述】:

我写了一个包含新类型定义(.te)和接口方法(.if)的新策略:

.te 文件:

policy_module(dummy, 1.0.0)

type dummy_t;

files_type(dummy_t)

.if 文件:

## <summary>
##  Do Bla bla
## </summary>
## <param name="domain">
##  <summary>
##  Domain allowed to read files.
##  </summary>
## </param>

interface(`dummy_int',`
    gen_require(`
        type dummy_t;
      ')

    allow $1 dummy_t:file read;
')

现在我正在编写一个新策略并想调用 dummy_int 宏:

.te 文件:

policy_module(callinterface, 1.0.0)

type callinterface_t;

dummy_int(callinterface_t)

但是 - 编译此策略会产生以下错误:

[root@localhost callinterface]# make -f /usr/share/selinux/devel/Makefile 
Compiling targeted callinterface module
callinterface.te:5:ERROR 'syntax error' at token 'dummy_int' on line 3329:

dummy_int(callinterface_t)
/usr/bin/checkmodule:  error(s) encountered while parsing configuration
make: *** [/usr/share/selinux/devel/include/Makefile:157: tmp/callinterface.mod] Error 1

“虚拟”策略已正确编译和安装。

我做错了什么?如何让编译器知道这个宏?

我尝试使用 ifndef 语句包装宏实现,如下所述: fedoraproject.org/wiki/SELinux/IndependentPolicy

向后兼容性部分 - 没有变化。

谢谢

【问题讨论】:

    标签: linux linux-kernel selinux libselinux linux-security-module


    【解决方案1】:

    知道了。接口文件应存储在 /usr/share/selinux/mcs/include/* 或 /usr/share/selinux/devel/include/* 中(取决于 Linux 发行版)。

    creating-our-own-interface

    当我将 .if 复制到此文件夹中时,策略已成功编译。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-21
      • 1970-01-01
      • 2020-03-06
      • 1970-01-01
      • 1970-01-01
      • 2017-07-11
      相关资源
      最近更新 更多