Unix的日志文件系统(二)
messages文件
记录输出到系统主控台以及由syslog系统服务程序产生
的消息
先看看syslog问题
syslog采用可配置的、统一的系统登记程序,随时从系
统各处
接受log请求,然后根据/etc/syslog.conf中的预先设定
把log
信息写入相应文件中、邮寄给特定用户或者直接以消息
的方式
发往控制台。值得注意的是,为了防止入侵者修改、删
除messages
里的记录信息,可以采用用打印机记录或跨越网络登记
的方式
来挫败入侵者的企图。
syslog.conf的详细说明
以Sun Solaris operating system, version 2.5.1. 为
例
/etc/syslog.conf的一般格式如下:
设备.行为级别 [;设备.行为级别] 记录行为
设备 描述
auth used by authorization systems (login)
认证系统,即询问用户名和口令
cron used for the cron and at systems
系统定时系统
daemon system/netword daemon
其他系统的daemons
kern produced by kernel messages
内核
lpr printing system
打印机系统
mail mail system
邮件系统
mark internally used for time stamps
定时发送消息的时标程序
news reserved for the news system
新闻系统
user default facility, used for any program
正式用户处理程序
uucp reserved for the uucp system
uucp子系统
local0..7 reserved for local use
留做指定站点使用
行为级别 描述
debug normally used for debugging
调试程序时的消息
info informational messages
信息消息
notice conditions that may require attention
要注意的消息
warning any warnings
警告
err any errors
一般性错误
crit critical conditions like hardware
problems 严重情况
alert any condition that demand immediate
attention 应该立即被纠正的情况
emerg any emergency condition
紧急情况
none Do not send messages from the
indicated 指定的服务程序未给所选择的
facility to the selected file.
文件发送信息
记录归属(举例) 描述
/dev/console send messages to devices
控制台
/var/adm/messages write messages to files
写入/var/adm/messages
@loghost forward messages to a
loghost 其他的日志记录服务器
fred,user1 send messages to users
传送消息给用户
* send messages to all
logged-in users 传送消息给所有的在线用户
下面是一个/etc/syslog.conf的模式
*.notice;mail.info /var/log/notice
*.crit /var/log/critical
kern,mark.debug /dev/console
kern.err @server
*.emerg *
*.alert root,operator
*.alert;auth.warning /var/log/auth
如果用打印机来记录日志文件,可以采用如下方法:
把打印机连接到终端端口/dev/ttya上,在
/etc/syslog.conf中加入配置语句,例如:
auth.* dev/ttya
这样就可以记录如不正确口令等信息了。
如果采用跨越网络登记,可以在/etc/syslog.conf中加
入配置语句,例如:
auth.* @loghost
可以采用非unix主机来作为日志记录机,这样的话入侵
者就算是得到了root权限也没有办法修改日志文件。
在/var/adm/messages中的一些记录,可以找出入侵者的
痕迹,举例如下:
1。Jun 21 06:17:55 youserver
/usr/dt/bin/rpc.ttdbserverd[371]:
_Tt_file_system::findBestMount.
Jun 21 06:17:55 youserver inetd[146]:
/usr/dt/bin/rpc.ttdbserverd: Segmentation Fault -
cod
Jun 21 06:17:58 youserver inetd[146]:
/usr/dt/bin/rpc.ttdbserverd: Illegal Instruction
- cd
入侵者利用rpc.ttdbserverd漏洞进攻服务器
2。"Sep 8 09:08:03 xxx login: REPEATED LOGIN
FAILURES ON /dev/pts/3 FROM xxxxx "
入侵者采用暴力试口令命令失败
3。"Sep 8 09:08:03 xxx su: 'su root' failed for
xxxxx on /dev/pts/2"
入侵者想利用su命令成为root失败
关于messages可以利用tail -f /var/adm/messages命令
来查看