概述

由于生产安全需要开放指定端口,在执行自动初始化环境脚本时发现semanage命令无法使用并且报错。

[root@localhost ~]# semanage port -l
Traceback (most recent call last):
  File "/sbin/semanage", line 1074, in <module>
    do_parser()
  File "/sbin/semanage", line 1053, in do_parser
    args.func(args)
  File "/sbin/semanage", line 524, in handlePort
    OBJECT = object_dict['port']()
  File "/sbin/semanage", line 167, in port_ini
    from seobject import portRecords
  File "/usr/lib64/python2.7/site-packages/seobject/__init__.py", line 106, in <module>
    import audit
  File "/usr/lib64/python2.7/site-packages/audit.py", line 26, in <module>
    _audit = swig_import_helper()
  File "/usr/lib64/python2.7/site-packages/audit.py", line 22, in swig_import_helper
    _mod = imp.load_module('_audit', fp, pathname, description)
ImportError: /usr/lib64/python2.7/site-packages/_audit.so: undefined symbol: audit_can_read

处理办法

查询并卸载

查询所有的audit软件包并进行卸载

[root@localhost ~]# rpm -qa|grep audit
audit-libs-2.3.3-4.el7.x86_64
audit-libs-python-2.3.3-4.el7.x86_64
audit-2.3.3-4.el7.x86_64
[root@localhost ~]# rpm -e audit-libs audit-libs-python audit --nodeps
安装服务

重新安装已经卸载的rpm包

[root@localhost ~]# yum -y install audit-libs audit-libs-python audit
验证
[root@GZ-tongren-DX yum.repos.d]# semanage port -l
SELinux 端口类型                   协议       端口号

afs3_callback_port_t           tcp      7001
......

分类: Linux