Chinaunix首页 | 论坛 | 博客
  • 博客访问: 376440
  • 博文数量: 166
  • 博客积分: 1972
  • 博客等级: 上尉
  • 技术积分: 1845
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-19 21:16
文章分类

全部博文(166)

文章存档

2013年(7)

2010年(159)

分类:

2010-10-26 09:52:07

今天为了查看公网线路的故障时间,尝试查看WWW服务器的访问日志统计。突然发现在访问日志的统计信息自1月14日开始就没有更新了。

手工执行访问日志统计程序,会返回拒绝访问的信息。进一步查看系统日志,可以看到如下信息:

Feb 15 01:26:10 web setroubleshoot: SELinux is preventing webalizer (webalizer_t) "read" to ./access_log (var_log_t). For complete SELinux messages. run sealert -l be6b4142-eb49-4889-8eb0-c5cdf36278d8

查看系统更新的日志,发现在2010年1月14日进行了系统更新,并且更新了SELinux的相关程序。由此推测可能在更新SELinux程序时传到文件权限发生了变化,使得不能日志统计程序不能访问WEB日志。系统日志中也确实从1月15日开始记录到拒绝访问的信息:

[root@web ~]# zcat /var/log/messages.5.gz |grep webalizer
Jan 15 04:02:39 web setroubleshoot: SELinux is preventing webalizer (webalizer_t) "read" to ./access_log (var_log_t). For complete SELinux messages. run sealert -l 598104cf-e0e8-482b-8dcf-bc852032d2d8
Jan 16 04:02:34 web setroubleshoot: SELinux is preventing webalizer (webalizer_t) "read" to ./access_log (var_log_t). For complete SELinux messages. run sealert -l 598104cf-e0e8-482b-8dcf-bc852032d2d8
Jan 17 04:02:45 web setroubleshoot: SELinux is preventing webalizer (webalizer_t) "read" to ./access_log (var_log_t). For complete SELinux messages. run sealert -l 598104cf-e0e8-482b-8dcf-bc852032d2d8

经过比较access_log日志文件的权限与系统默认日志文件的权限,发现存在区别:

[root@web ~]# ls -alZ /var/log/www_site/access_log
-rw-r--r--  root root system_u:object_r:var_log_t    /var/log/www_site/access_log
[root@web ~]# ls -alZ /var/log/httpd/access_log
-rw-r--r--  root root user_u:object_r:httpd_log_t      /var/log/httpd/access_log

原来更新SELinux程序时,自动将定制日志文件的属性恢复成其父目录的属性。继续手工修改相关文件属性,并重新统计日志:
[root@web ~]# chcon user_u:object_r:httpd_log_t /var/log/www_site/*
[root@web ~]# chcon user_u:object_r:httpd_log_t /var/log/www_site

当然这并不能彻底解决问题,下次更新程序时还会发生类似问题。正确做法是修改SELinux的策略,使得它符合定制日志文件统计的需求。待以后学习如何修改SELinux策略后再进一步完善。

阅读(686) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~