selinux 下snmp 报错问题解决

2008-05-14 | 2:22 pm分类:工作日志 | 67 views

如下:

Dec 27 08:00:05 web kernel: audit(1198713605.145:11287): avc:  denied  { getattr } for  pid=9022 comm=”snmpd” name=”/” dev=dm-1 ino=2 scontext=root:system_r:snmpd_t tcontext=system_u:object_r:file_t tclass=dir
Dec 27 08:00:05 web kernel: audit(1198713605.172:11288): avc:  denied  { getattr } for  pid=9022 comm=”snmpd” name=”/” dev=dm-1 ino=2 scontext=root:system_r:snmpd_t tcontext=system_u:object_r:file_t tclass=dir
Dec 27 08:00:05 web kernel: audit(1198713605.251:11289): avc:  denied  { getattr } for  pid=9022 comm=”snmpd” name=”/” dev=dm-3 ino=2 scontext=root:system_r:snmpd_t tcontext=system_u:object_r:tmp_t tclass=dir
Dec 27 08:00:05 web kernel: audit(1198713605.277:11290): avc:  denied  { getattr } for  pid=9022 comm=”snmpd” name=”/” dev=dm-3 ino=2 scontext=root:system_r:snmpd_t tcontext=system_u:object_r:tmp_t tclass=dir
Dec 27 08:05:04 web kernel: audit(1198713904.989:11291): avc:  denied  { getattr } for  pid=9022 comm=”snmpd” name=”/” dev=dm-1 ino=2 scontext=root:system_r:snmpd_t tcontext=system_u:object_r:file_t tclass=dir
Dec 27 08:05:05 web kernel: audit(1198713905.015:11292): avc:  denied  { getattr } for  pid=9022 comm=”snmpd” name=”/” dev=dm-1 ino=2 scontext=root:system_r:snmpd_t tcontext=system_u:object_r:file_t tclass=dir
Dec 27 08:05:05 web kernel: audit(1198713905.093:11293): avc:  denied  { getattr } for  pid=9022 comm=”snmpd” name=”/” dev=dm-3 ino=2 scontext=root:system_r:snmpd_t tcontext=system_u:object_r:tmp_t tclass=dir

系统更新后发现上面错误,困扰了我几个月的时间,都没有办法解决,结果最近在一个老外的文章,然后受到启发后结果把问题给搞定了,不容易啊。

#audit2allow -d    //查看selinux拒绝了那些snmp正常的操作

allow snmpd_t file_t:dir getattr;
allow snmpd_t tmp_t:dir getattr;

把上面两行输出加入到文件

/etc/selinux/targeted/src/policy/domains/program/snmpd.te中。

#cd  /etc/selinux/targeted/src/policy

#make load

#setfiles file_contexts/file_contexts /usr/share/snmp

第二天再也没有报错,其他的应用程序也可以通过类似的方式解决。

Sorry, comments for this entry are closed at this time.