SELINUX策略创建有关内存和上下文结构的错误



我在RHEL 7上工作。我在此处存储了另一台计算机的日志文件。我使用以下命令来创建策略:

grep -inr "denied" audit.log* | audit2allow -M Policy_File_Name

使用此命令,我能够为许多日志文件创建策略。但是在某些情况下,我遇到了这个错误:

Traceback (most recent call last):
  File "/usr/bin/audit2allow", line 365, in <module>
    app.main()
  File "/usr/bin/audit2allow", line 352, in main
    self.__process_input()
  File "/usr/bin/audit2allow", line 180, in __process_input
    self.__avs = self.__parser.to_access()
  File "/usr/lib64/python2.7/site-packages/sepolgen/audit.py", line 591, in to_access
    avc.path = self.__restore_path(avc.name, avc.ino)
  File "/usr/lib64/python2.7/site-packages/sepolgen/audit.py", line 531, in __restore_path
    universal_newlines=True)
  File "/usr/lib64/python2.7/subprocess.py", line 568, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1224, in _execute_child
    self.pid = os.fork()
OSError: [Errno 12] Cannot allocate memory

,很少有我遇到此错误:

libsepol.context_from_record: type celery_t is not defined
libsepol.context_from_record: could not create context structure
libsepol.context_from_string: could not create context structure
libsepol.sepol_context_to_sid: could not convert system_u:system_r:celery_t:s0 to sid

此处"芹菜_t"在目标上下文方面发生了变化。

系统状况:

[root@selinux-policy-creation abhisheklog]# free -h
           total       used        free      shared  buff/cache   available
 Mem:      31G         261M        27G        8.4M        3.1G         30GB
 Swap:      0B          0B          0B

请提供原因和解决方案。谢谢。

这样的错误消息意味着文件系统中存在无效的SE模块,这可能是从以前的不良卸载脚本中剩下的。手动删除这些文件通常会删除这些错误消息;但是在这种情况下,这似乎是相反的。尽管存在这样的孤立的SE模块,但这可能会导致虚假错误消息 - 因此,我什至不太确定"不能分配内存"消息。得到了这种感觉,这可能与python2-celery有关(celery_t类型似乎来自(。问题是该类型celery_t将其输入了审核日志,但是运行audit2allow的计算机未知。

python2-celery-4.2.1-3.el7.noarch : Distributed Task Queue
Repo        : epel
Matched from:
Filename    : /usr/bin/celery

首先要尝试的事情可能是:

sudo yum install python2-celery

可能还原丢失的celery_t类型。我的意思是,如果此日志文件源自另一台计算机,则该计算机可能已安装python2-celery - 而运行audit2allow的计算机可能只是缺少它。希望这是有道理的。

最新更新