Linux用户操作审计记录方案
2014-02-18 11:44
393 查看
Linux用户操作审计记录方案
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。/article/4507290.html
【概述】:多人共同使用的服务器权限确实不好管理,误操作等造成故障,无法追究,最好的办法就是将用户操作实时记录到日志,并推送到远程日志服务器上。包括(用户登陆时间,目录,操作命令及时间戳等)。以便事后追查。
环境:centos5.5 X86_64 2台 #备注:把两台主机的防火墙和selinux关闭。在进行操作。
(一)日志服务器IP:10.0.2.164
(二)客户端服务器IP:10.0.2.165
1.先在日志服务器10.0.2.164主机上操作:
[root@MySQL-B ~]# echo "*.info /var/log/client" >> /etc/syslog.conf
#配置日志保存文件,把该文件第一行的*.info 提出来。单独放一行。
[root@MySQL-B ~]# service syslog restart #重启syslog日志服务。
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]
[root@MySQL-B ~]# vim /etc/sysconfig/syslog #接收客户端写入。
把SYSLOGD_OPTIONS="-m 0" 更改为:SYSLOGD_OPTIONS="-m 1 -r"
2.然后在客户端服务器10.0.2.165主机上操作:
[root@MySQL-A ~]# vim /etc/profile #添加如下行。
export PROMPT_COMMAND='{ msg=$(history 1 | { read x y; echo $y; });logger "[euid=$(whoami)]":$(who am i):[`pwd`]"$msg"; }'
[root@MySQL-A ~]# source /etc/profile #重新手动source更新。
2.1.客户机修改日志服务器10.0.2.165主机上操作:
[root@MySQL-A ~]# echo "10.0.2.164 logserver" >> /etc/hosts #日志服务器地址。
[root@MySQL-A ~]# echo "*.info @logserver" >> /etc/syslog.conf
#将info日志推送到日志服务器,把该文件第一行的*.info 提出来。单独放一行。
[root@MySQL-A ~]# /etc/init.d/syslog restart #重启syslog日志。
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]
3.测试,在客户端主机上10.0.2.165主机上测试并操作:
[root@MySQL-A ~]# test
[root@MySQL-A ~]# echo "this is a test 1"
this is a test 1
[root@MySQL-A ~]# echo "this is a test 2"
this is a test 2
[root@MySQL-A ~]# echo "this is a test 3"
this is a test 3
[root@MySQL-A ~]# echo "this is a test 4"
this is a test 4
[root@MySQL-A ~]# echo "this is a test 5"
this is a test 5
4.返回日志服务器10.0.2.164主机上看结果,是否记录下来客户端主机执行的操作?
[root@MySQL-B ~]# cat /var/log/client
Apr 6 10:37:55 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test1"
Apr 6 10:37:59 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test2"
Apr 6 10:38:01 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test3"
Apr 6 10:38:04 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test4"
Apr 6 10:38:06 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test5"
#操作时间 #操作IP #有效用户 #实际登陆时间 #路径 #使用的命令
本文出自 “IMySQL” 博客,请务必保留此出处/article/4507290.html
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。/article/4507290.html
【概述】:多人共同使用的服务器权限确实不好管理,误操作等造成故障,无法追究,最好的办法就是将用户操作实时记录到日志,并推送到远程日志服务器上。包括(用户登陆时间,目录,操作命令及时间戳等)。以便事后追查。
环境:centos5.5 X86_64 2台 #备注:把两台主机的防火墙和selinux关闭。在进行操作。
(一)日志服务器IP:10.0.2.164
(二)客户端服务器IP:10.0.2.165
1.先在日志服务器10.0.2.164主机上操作:
[root@MySQL-B ~]# echo "*.info /var/log/client" >> /etc/syslog.conf
#配置日志保存文件,把该文件第一行的*.info 提出来。单独放一行。
[root@MySQL-B ~]# service syslog restart #重启syslog日志服务。
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]
[root@MySQL-B ~]# vim /etc/sysconfig/syslog #接收客户端写入。
把SYSLOGD_OPTIONS="-m 0" 更改为:SYSLOGD_OPTIONS="-m 1 -r"
2.然后在客户端服务器10.0.2.165主机上操作:
[root@MySQL-A ~]# vim /etc/profile #添加如下行。
export PROMPT_COMMAND='{ msg=$(history 1 | { read x y; echo $y; });logger "[euid=$(whoami)]":$(who am i):[`pwd`]"$msg"; }'
[root@MySQL-A ~]# source /etc/profile #重新手动source更新。
2.1.客户机修改日志服务器10.0.2.165主机上操作:
[root@MySQL-A ~]# echo "10.0.2.164 logserver" >> /etc/hosts #日志服务器地址。
[root@MySQL-A ~]# echo "*.info @logserver" >> /etc/syslog.conf
#将info日志推送到日志服务器,把该文件第一行的*.info 提出来。单独放一行。
[root@MySQL-A ~]# /etc/init.d/syslog restart #重启syslog日志。
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]
3.测试,在客户端主机上10.0.2.165主机上测试并操作:
[root@MySQL-A ~]# test
[root@MySQL-A ~]# echo "this is a test 1"
this is a test 1
[root@MySQL-A ~]# echo "this is a test 2"
this is a test 2
[root@MySQL-A ~]# echo "this is a test 3"
this is a test 3
[root@MySQL-A ~]# echo "this is a test 4"
this is a test 4
[root@MySQL-A ~]# echo "this is a test 5"
this is a test 5
4.返回日志服务器10.0.2.164主机上看结果,是否记录下来客户端主机执行的操作?
[root@MySQL-B ~]# cat /var/log/client
Apr 6 10:37:55 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test1"
Apr 6 10:37:59 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test2"
Apr 6 10:38:01 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test3"
Apr 6 10:38:04 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test4"
Apr 6 10:38:06 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test5"
#操作时间 #操作IP #有效用户 #实际登陆时间 #路径 #使用的命令
本文出自 “IMySQL” 博客,请务必保留此出处/article/4507290.html
相关文章推荐
- Linux用户操作审计记录方案
- Linux用户操作审计记录方案
- linux下用户操作记录审计环境的部署记录
- Linux下的rsyslog系统日志梳理(用户操作记录审计)
- history用户操作审计记录方案_beta
- LINUX下用户操作记录审计-history
- Linux下 审计当前登录用户及用户操作历史记录 ERIKXUE 薛忠权
- 对Linux用户进行登录及操作进行记录(审计)
- Linux下记录所有用户的操作命令,以方便后期审计
- Linux下查看/管理当前登录用户及用户操作历史记录
- Linux 查看用户操作记录
- sudo配合syslog日志审计记录用户操作
- Linux下记录所有用户操作的脚本
- Linux下查看用户登陆后的操作记录
- Linux下查看用户登陆后的操作记录
- Linux下查看用户登陆后的操作记录及history命令显示时间
- Linux精确记录 用户ip及操作
- Linux下查看用户登陆后的操作记录
- linux远程ssh登陆用户的操作记录
- 按时按登录IP记录Linux所有用户操作日志的方法