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
    • 最新
    • 标签
主页 / computer / 问题

问题[selinux](computer)

Martin Hope
meolic
Asked: 2021-06-24 10:08:15 +0800 CST

SELinux 可以让你的服务器变砖吗?

  • 6

我在 CentOS Stream 上启用了 SELinux(之前它处于禁用状态,不知道确切的历史记录)。/etc/selinux/config我只是在(disabled之前)中更改了以下行:

SELINUX=enforcing

然后我重新启动,现在我完全退出了。我无法登录控制台,不能以用户身份登录,也不能以 root 身份登录,即使在我在重启期间选择的恢复模式下也不能。任何登录尝试都会被拒绝,恕不另行通知。

我在https://stackoverflow.com/questions/21873341/cannot-login-to-server-after-disabling-selinux中作为用户做了相反的事情,他在 IP 上使用 ssh 的技巧也不起作用。

这是一台虚拟计算机。也许我在编辑该配置文件时出错了,例如一些拼写错误或意外更改了某些内容(不太可能,但这很奇怪)。任何想法,我现在可以尝试什么?

centos selinux
  • 1 个回答
  • 70 Views
Martin Hope
Mareq
Asked: 2020-12-11 06:54:52 +0800 CST

如何让“su”在带有 SELinux 的 Red Hat 8 中的 init 脚本中工作?

  • 5

在初始化脚本中,我试图运行一个命令:

su - user -c "/home/user/bin/command”

但 SELinux 阻止了这一点:

systemd[1]: Starting LSB: Start the my_script at boot...
su[5941]: pam_unix(su-l:auth): auth could not identify password for [user]
su[5941]: FAILED SU (to user) root on none
my_script[5939]: Password: Password: su: Authentication has failed

我已经应用setsebool -P domain_can_mmap_files 1,并且还生成并应用了以下策略ausearch -c 'su' --raw | audit2allow -M my-su:

module my-su 1.0;

require {
    type init_t;
    type su_exec_t;
    class file map;
}

#============= init_t ==============

allow init_t su_exec_t:file map;

我收到一条消息/var/log/audit.log:

type=USER_AVC msg=audit(1607611267.156:176): pid=6376 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { rootok } for  scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=passwd permissive=0  exe="/usr/bin/su" sauid=0 hostname=? addr=? terminal=?'UID="root" AUID="unset" SAUID="root"

并且后续使用ausearch […]不会生成适当的策略。

有没有人设法解决类似的问题?

selinux redhat-enterprise-linux
  • 1 个回答
  • 525 Views
Martin Hope
cfiske
Asked: 2019-08-14 10:56:46 +0800 CST

SELinux 阻止 procmail 执行 dspam 但没有 AVC 消息

  • 5

我有一个 CentOS 7 系统,我在其中使用 postfix 作为 MTA。某些用户.forward在他们的主目录中使用 procmail via:

# cat .forward
"|exec /usr/bin/procmail -f- || exit 75"

在这种情况下,我很难弄清楚为什么 SELinux 不允许 procmail 从以下位置执行 dspam .procmailrc:

:0fw: dspam.lock
| /usr/bin/dspam --client --stdout --deliver=spam,innocent

在 procmail 日志中,我得到:

procmail: Locking "dspam.lock"
procmail: Executing "/usr/bin/dspam,--client,--stdout,--deliver=spam,innocent"
/bin/sh: /usr/bin/dspam: Permission denied
procmail: Program failure (126) of "/usr/bin/dspam"
procmail: Rescue of unfiltered data succeeded
procmail: Unlocking "dspam.lock"

但是,如果我将 SELinux 设置为宽容模式,它就可以正常工作。

问题是它没有记录任何关于被拒绝内容的 AVC 消息。当我第一次设置时,我发现了一些差距audit2why并ausearch修复了它们。现在我什么也得不到,即使它显然是 SELinux 阻止它工作。

编辑:这是 dspam 二进制文件:

# ls -lZ /usr/bin/dspam
-r-x--s--x. dspam mail system_u:object_r:dspam_exec_t:s0 /usr/bin/dspam
selinux procmail
  • 2 个回答
  • 128 Views
Martin Hope
cfiske
Asked: 2019-06-30 19:34:19 +0800 CST

如何在 SELinux 中授予“搜索”权限

  • 5

我正在尝试让 dspam 在 SELinux (CentOS 7) 下工作。我毫无问题地添加了以下内容:

allow dspam_t dspam_rw_content_t:dir getattr;
allow dspam_t dspam_rw_content_t:file { append getattr lock open write };

然而 dspam 仍然无法通过 procmail 工作:

/bin/sh: /usr/bin/dspam: Permission denied
procmail: Program failure (126) of "/usr/bin/dspam"

当我将 SELinux 设置为宽容时,它工作正常。我尝试使用audit2allow来确定缺少的内容:

[root@opus ~]# audit2allow -i /var/log/audit/audit.log
#============= dspam_t ==============
allow dspam_t dspam_rw_content_t:dir search;

但是将其添加到我的政策中会导致checkmodule错误:

checkmodule:  loading policy configuration from OPUS.te
OPUS.te:19:ERROR 'permission search is not defined for class dir' at token ';' on line 19:
allow dspam_t dspam_rw_content_t:dir getattr;
allow dspam_t dspam_rw_content_t:dir search;
checkmodule:  error(s) encountered while parsing configuration

我搜索了一下,但找不到解决方案。我将如何添加或定义search指示的权限?

selinux
  • 1 个回答
  • 337 Views

Sidebar

Stats

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

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve