AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 521078
Accepted
Yanko Hernández Álvarez
Yanko Hernández Álvarez
Asked: 2013-07-06 04:42:47 +0800 CST2013-07-06 04:42:47 +0800 CST 2013-07-06 04:42:47 +0800 CST

如何查询影响类型的所有 selinux 规则/默认文件上下文/等

  • 772

我需要了解与运行系统当前规则中的 selinux 类型相关的所有内容:

  • 允许、允许审计、不审计规则。
  • 使用该类型标有上下文的文件。
  • 过渡。

...以及任何其他信息。

是否有任何命令可以用来查询该信息,或者我应该下载所有与 selinux 相关的“src”包,过滤掉未使用的模块并 grep 每个文件以获取该信息?必须有一种更简单的方法来做到这一点。

linux
  • 1 1 个回答
  • 42082 Views

1 个回答

  • Voted
  1. Best Answer
    dawud
    2013-07-06T05:04:35+08:002013-07-06T05:04:35+08:00

    获取此信息的一些命令是(示例使用httpd_log_t):

    1. seinfo

      # seinfo -x --type=httpd_log_t /etc/selinux/default/policy/policy.26
         httpd_log_t
            file_type
            non_security_file_type
            logfile
      
    2. sesearch

      # sesearch --dontaudit -t httpd_log_t /etc/selinux/default/policy/policy.26 | head
      Found 35 semantic av rules:
          dontaudit run_init_t file_type : dir { getattr search open } ;
          dontaudit staff_t non_security_file_type : file getattr ;
          dontaudit staff_t non_security_file_type : dir { ioctl read getattr lock search open } ;
          dontaudit staff_t non_security_file_type : lnk_file getattr ;
          dontaudit staff_t non_security_file_type : sock_file getattr ;
          dontaudit staff_t non_security_file_type : fifo_file getattr ;
          dontaudit unconfined_t non_security_file_type : file getattr ;
          dontaudit unconfined_t non_security_file_type : dir { ioctl read getattr lock search open } ;
          dontaudit unconfined_t non_security_file_type : lnk_file getattr ;
      
    3. semanage

      # semanage fcontext -l | grep httpd_log_t
      /etc/httpd/logs                                    all files          system_u:object_r:httpd_log_t:s0
      /var/log/apache(2)?(/.*)?                          all files          system_u:object_r:httpd_log_t:s0
      /var/log/apache-ssl(2)?(/.*)?                      all files          system_u:object_r:httpd_log_t:s0
      /var/log/cacti(/.*)?                               all files          system_u:object_r:httpd_log_t:s0
      /var/log/cgiwrap\.log.*                            regular file       system_u:object_r:httpd_log_t:s0
      /var/log/horde2(/.*)?                              all files          system_u:object_r:httpd_log_t:s0
      /var/log/httpd(/.*)?                               all files          system_u:object_r:httpd_log_t:s0
      /var/log/lighttpd(/.*)?                            all files          system_u:object_r:httpd_log_t:s0
      /var/log/piranha(/.*)?                             all files          system_u:object_r:httpd_log_t:s0
      /var/www(/.*)?/logs(/.*)?                          all files          system_u:object_r:httpd_log_t:s0
      

    参考资料:RHEL6 SELinux 手册

    • 11

相关问题

  • Linux 主机到主机迁移

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 如何在 Linux 下监控每个进程的网络 I/O 使用情况?

  • 在 RHEL4 上修改 CUPS 中的现有打印机设置

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve