【问题标题】:SELinux: command output printed on serial but not on sshSELinux:命令输出打印在串行而不是 ssh
【发布时间】:2021-10-07 17:13:31
【问题描述】:

我正在尝试在 Poky Linux 发行版上配置 SELinux。

我正在通过串口和 ssh 连接到开发板。

在 ssh 上启动 ping 和 ifconfig 不会打印任何内容,而串行上的相同命令正在打印正确的命令。

起初,ping 被完全禁用,所以我不得不修补 netutils SELinux 策略(现在可以正常工作)。

命令journalctl -xe | grep "denied" 显示没有“拒绝” ping ifconfig。

我该如何解决这个问题?或者我应该在哪里进一步看?可能是 /dev/pts 错误?

【问题讨论】:

    标签: ssh ping selinux ifconfig


    【解决方案1】:

    我想我找到了一些东西。

    之后

    semodule --disable_dontaudit --build
    

    就像描述的here

    然后:

    ~# journalctl -xe | grep "denied" | grep "ping"
    Aug 04 13:04:42  audit[2510]: AVC avc:  denied  { use } for  pid=2510 comm="ping" path="/dev/pts/0" dev="devpts" ino=3 scontext=root:sysadm_r:ping_t:s0 tcontext=system_u:system_r:init_t:s0-s15:c0.c1023 tclass=fd                                                                                                                      permissive=0
    Aug 04 13:04:42 audit[2510]: AVC avc:  denied  { use } for  pid=2510 comm="ping" path="/dev/pts/0" dev="devpts" ino=3 scontext=root:sysadm_r:ping_t:s0 tcontext=system_u:system_r:init_t:s0-s15:c0.c1023 tclass=fd                                                                                                                      permissive=0
    Aug 04 13:04:42  audit[2510]: AVC avc:  denied  { use } for  pid=2510 comm="ping" path="/dev/pts/0" dev="devpts" ino=3 scontext=root:sysadm_r:ping_t:s0 tcontext=system_u:system_r:init_t:s0-s15:c0.c1023 tclass=fd                                                                                                                      permissive=0
    Aug 04 13:04:42  audit[2510]: AVC avc:  denied  { rlimitinh } for  pid=2510 comm="ping" scontext=root:sysadm_r:sysadm_t:s0 tcontext=root:sysadm_r:ping_t:s0 tclass=process permissive=0
    Aug 04 13:04:42 audit[2510]: AVC avc:  denied  { siginh } for  pid=2510 comm="ping" scontext=root:sysadm_r:sysadm_t:s0 tcontext=root:sysadm_r:ping_t:s0 tclass=process permissive=0
    Aug 04 13:04:42  audit[2510]: AVC avc:  denied  { noatsecure } for  pid=2510 comm="ping" scontext=root:sysadm_r:sysadm_t:s0 tcontext=root:sysadm_r:ping_t:s0 tclass=process permissive=0
    Aug 04 13:04:49  audit[2511]: AVC avc:  denied  { use } for  pid=2511 comm="ping" path="/dev/pts/0" dev="devpts" ino=3 scontext=root:sysadm_r:ping_t:s0 tcontext=system_u:system_r:init_t:s0-s15:c0.c1023 tclass=fd                                                                                                                      permissive=0
    Aug 04 13:04:49  audit[2511]: AVC avc:  denied  { use } for  pid=2511 comm="ping" path="/dev/pts/0"dev="devpts" ino=3 scontext=root:sysadm_r:ping_t:s0 tcontext=system_u:system_r:init_t:s0-s15:c0.c1023 tclass=fd                                                                                                                      permissive=0
    Aug 04 13:04:49  audit[2511]: AVC avc:  denied  { use } for  pid=2511 comm="ping" path="/dev/pts/0" dev="devpts" ino=3 scontext=root:sysadm_r:ping_t:s0 tcontext=system_u:system_r:init_t:s0-s15:c0.c1023 tclass=fd                                                                                                                      permissive=0
    Aug 04 13:04:49  audit[2511]: AVC avc:  denied  { rlimitinh } for  pid=2511 comm="ping" scontext=root:sysadm_r:sysadm_t:s0 tcontext=root:sysadm_r:ping_t:s0 tclass=process permissive=0
    Aug 04 13:04:49  audit[2511]: AVC avc:  denied  { siginh } for  pid=2511 comm="ping" scontext=root:sysadm_r:sysadm_t:s0 tcontext=root:sysadm_r:ping_t:s0 tclass=process permissive=0
    Aug 04 13:04:49  audit[2511]: AVC avc:  denied  { noatsecure } for  pid=2511 comm="ping" scontext=root:sysadm_r:sysadm_t:s0 tcontext=root:sysadm_r:ping_t:s0 tclass=process permissive=0
    

    还有:

    ~# cat /var/audit/audit.log | audit2allow -m fix_ping_ifconfig.te
    

    必须添加的行是

    policy/modules/admin/netutils.te
    
    +allow ping_t devpts_t:chr_file { getattr ioctl };
    +allow ping_t init_t:fd use;
    
    policy/modules/system/sysnetwork.te
    +allow ifconfig_t devpts_t:chr_file { read write getattr };
    

    所以这是一个devpts 问题,但发现解决它的过程禁用了dountaudit 规则

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-25
      • 1970-01-01
      • 1970-01-01
      • 2017-09-21
      • 1970-01-01
      • 2012-09-12
      • 2018-01-16
      • 1970-01-01
      相关资源
      最近更新 更多