一、是否入侵检查
1)检查系统日志
1 2 | 检查系统错误登陆日志,统计IP重试次数(last命令是查看系统登陆日志,比如系统被reboot或登陆情况) [root@bastion-IDC ~] # last |
2)检查系统用户
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 查看是否有异常的系统用户 [root@bastion-IDC ~] # cat /etc/passwd 查看是否产生了新用户,UID和GID为0的用户 [root@bastion-IDC ~] # grep "0" /etc/passwd 查看 passwd 的修改时间,判断是否在不知的情况下添加用户 [root@bastion-IDC ~] # ls -l /etc/passwd 查看是否存在特权用户 [root@bastion-IDC ~] # awk -F: '$3==0 {print $1}' /etc/passwd 查看是否存在空口令帐户 [root@bastion-IDC ~] # awk -F: 'length($2)==0 {print $1}' /etc/shadow |
3)检查异常进程
1 2 3 4 5 6 7 8 9 10 | 注意UID为0的进程 使用 ps -ef命令查看进程 察看该进程所打开的端口和文件 [root@bastion-IDC ~] # lsof -p pid命令查看 检查隐藏进程 [root@bastion-IDC ~] # ps -ef | awk '{print }' | sort -n | uniq >1 [root@bastion-IDC ~] # ls /porc |sort -n|uniq >2 [root@bastion-IDC ~] # diff 1 2 |
4)检查异常系统文件
1 2 3 4 5 6 | [root@bastion-IDC ~] # find / -uid 0 –perm -4000 –print [root@bastion-IDC ~] # find / -size +10000k –print [root@bastion-IDC ~] # find / -name "…" –print [root@bastion-IDC ~] # find / -name ".." –print [root@bastion-IDC ~] # find / -name "." –print [root@bastion-IDC ~] # find / -name " " –print |
5)检查系统文件完整性
1 2 3 4 | [root@bastion-IDC ~] # rpm –qf /bin/ls [root@bastion-IDC ~] # rpm -qf /bin/login [root@bastion-IDC ~] # md5sum –b 文件名 [root@bastion-IDC ~] # md5sum –t 文件名 |
6)检查RPM的完整性
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | [root@bastion-IDC ~] # rpm -Va #注意相关的/sbin,/bin,/usr/sbin,/usr/bin 输出格式说明: S – File size differs M – Mode differs (permissions) 5 – MD5 sum differs D – Device number mismatch L – readLink path mismatch U – user ownership differs G – group ownership differs T – modification time differs |
7)检查网络
1 2 3 4 | [root@bastion-IDC ~] # ip link | grep PROMISC(正常网卡不该在promisc模式,可能存在sniffer) [root@bastion-IDC ~] # lsof –i [root@bastion-IDC ~] # netstat –nap(察看不正常打开的TCP/UDP端口) [root@bastion-IDC ~] # arp –a |
8)检查系统计划任务
1 2 3 | [root@bastion-IDC ~] # crontab –u root –l [root@bastion-IDC ~] # cat /etc/crontab [root@bastion-IDC ~] # ls /etc/cron.* |
9)检查系统后门
1 2 3 4 5 | [root@bastion-IDC ~] # cat /etc/crontab [root@bastion-IDC ~] # ls /var/spool/cron/ [root@bastion-IDC ~] # cat /etc/rc.d/rc.local [root@bastion-IDC ~] # ls /etc/rc.d [root@bastion-IDC ~] # ls /etc/rc3.d |
10)检查系统服务
1 2 | [root@bastion-IDC ~] # chkconfig —list [root@bastion-IDC ~] # rpcinfo -p(查看RPC服务) |
11)检查rootkit
1 2 | [root@bastion-IDC ~] # rkhunter -c [root@bastion-IDC ~] # chkrootkit -q |