I daily download the following logs from my /var/log directory:
bfd_log
exim_rejectlog
messages
secure
Plus /usr/local/apache/logs/error_log.
I then run a perl script that searches for instances where someone has tried to get in using various methods or tries to use my mail server without authority. It also reads in a file that contains previously discovered 'attacks' and IP addresses that have been determined to be 'bad' by this script. It generates an updated attack list (with IP address, entry target type, date, first and last times for that date), updates the bad ip list and creates the base for a new hosts.deny file, with e-mail notification when one of the IPs tries to get back in (this worked well today, a hacker who was caught by the script yesterday tried to get in, was rejected and I got the e-mail notification).
For cases where the source of the attack is named instead of an IP address, the script does an nslookup in an attempt to get the IP address. For ones that it can't, it reports that problem and it is up to me to try to find the IP address.
Ideally, I will get the script to ftp the logs by itself. Then all I would need to do is kick off the script and check the results. I've done automagic FTPing from PHP, but not from perl, yet. This is the first I've needed to.
The next step will be to us the IP address to get the details from one or more whois source and set up e-mails to report abuse. That one will take some more research. Plus, we wouldn't want to automagically send the e-mails. The script should just create the text files including the e-mail address to send to, the abuse warning and the relevant log entries.
Perling can be fun! (I've been doing it for more than 15 years and it just gets better.)
I will gladly share this file, with the proviso that you need to make your own mods to make sure it does what you want, if there is any interest.
Time for some of our VPs fine home-brewed brew.![]()


LinkBack URL
About LinkBacks
)




Reply With Quote

Bookmarks