我有一个Expect脚本工作正常,如果我手动运行,但失败时,作为从Fail2ban行动运行。 错误消息如下所示:
spawn /usr/bin/telnet 192.168.242.1 The system has no more ptys. Ask your system administrator to create more. while executing "spawn /usr/bin/telnet $hostname"
在audit.log中有相应的消息:
type=AVC msg=audit(1407894085.867:54862): avc: denied { read write } for pid=14748 comm="ciscoacl.exp" name="ptmx" dev=devtmpfs ino=5288 scontext=unconfined_u:system_r:fail2ban_t:s0 tcontext=system_u:object_r:ptmx_t:s0 tclass=chr_file
脚本以root身份运行(通过从脚本运行whoami确认),所以我预计不会有任何问题。 如果有的话,我能做些什么来解决这个问题? (不,我不想禁用SELinux!)
我不认为脚本本身在这里有所作为,但如果需要,我可以发布它。
您必须使用audit2allow制定自定义策略,以允许fail2ban读取写入到chr_file。 可能它看起来像这样:
require { type ptmx_t; type fail2ban_t; class chr_file { read write }; } #============= fail2ban_t ============== allow fail2ban_t ptmx_t:chr_file { read write };
你确定没有更多的否定吗?