Monitor all files in the Web site directory for malicious tampering

Source: Internet
Author: User

Monitor whether all files in the Web site directory have been tampered with (the contents of the file have been changed) and if so, print the changed file name

Scheduled tasks: Perform monitoring once every three minutes


Characteristics of files being tampered with:

    1. The size may change (why is it possible, if you change the value of 1 to 2 the size will not change)

    2. Modification time Changes (file test ot,nt)

    3. The contents of the file will change, judging by md5sum fingerprint

    4. Add or delete files


Problem:

    • Code release scenario: a large company or a regulated company, will not always pass code, 1-2 times a day

    • The script is not rigorous Ah, the work of the first to solve the file, and then solve the problem

#!/bin/shnum= ' cat site.log|wc-l ' md5num= ' md5sum-c/tmp/checkmd5.db|grep-i failed|wc-l ' filenum= ' ls-l/etc/|wc-l ' if [ $MD 5num-ne 0]then echo "md5sum-c/tmp/checkmd5.db|grep-i FAILED" Fiif [$filenum-ne $num]then echo "/etc/dir is C Hange "Fi ~

This article is from the "Little Rookie" blog, please be sure to keep this source http://baishuchao.blog.51cto.com/12918589/1942742

Monitor all files in the Web site directory for malicious tampering

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.