检查备份目录的备份数据完整性
程序检查备份目录的备份数据完整性,并把检查结果于每日早晨7点发给管理员及老大信箱;
完整性检查是HIDS的重要组成部分之一,linux下做完整性检查的思路有3个 1、哈希对比 2、签名校验 3、inotify 方法有2个: A、定期检测,例如通过cron或程序内置计时器 B、实时检测,inotify 1、2一般和A,3一般和B。用inotify做完整性检查的程序现在貌似还没现成比较好用的,谁推荐一个。 http://www.2cto.com/os/201101/82861.html (参考) |
MD5算法验证网络文件传输的完整性
[[email protected] ~]# vim /server/scripts/md5sum.sh
#!/bin/sh #print for md5sum *.tar.gz files in /backup to check files and send mail by yvonne 2015-7-8 14:07:29. md5sum $(find /backup/ -type f -name "*.tar.gz")>md5sumtar.md5 && md5sum -c md5sumtar.md5 "/server/scripts/md5sum.sh" 6L, 206C written
[[email protected] ~]# /bin/sh /server/scripts/md5sum.sh
/backup/data/var_spool_cron/192.168.10.104_var_spool_cron_2015-07-06.tar.gz: OK
/backup/data/etc_sysconfig_iptables/192.168.10.104_etc_sysconfig_iptables_2015-07-06.tar.gz: OK
/backup/data/server_scripts/192.168.10.104_server_scripts_2015-07-06.tar.gz: OK
/backup/data/www/bbs/192.168.10.104_app_logs_bbs_logs_2015-07-06.tar.gz: OK
/backup/data/www/blog/192.168.10.104_app_logs_blog_logs_2015-07-06.tar.gz: OK
/backup/data/www/html/192.168.10.104_application_nginx_html_2015-07-06.tar.gz: OK
/backup/data/www/www/192.168.10.104_app_logs_www_logs_2015-07-06.tar.gz: OK
/backup/data/etc_rc.local/192.168.10.104_etc_rc.local_2015-07-06.tar.gz: OK
[[email protected] ~]# crontab -e
#print for md5sum *.tar.gz files in /backup to check files and send mail by yvonne 2015-7-8 14:07:29.
00 07 * * * /bin/sh /server/scripts/send_mail.sh >/dev/null 2>&1