home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / cu / port80log.txt < prev    next >
Text File  |  2020-01-01  |  3KB  |  63 lines

  1. OK, I consolidated my various logging and reporting scripts and packaged
  2. them so they can be used on any Unix-based computer that is not running
  3. a Web server (or any other process that listens on TCP port 80).  You
  4. have to be root to run it, since 80 is a privileged port.
  5.  
  6. The script is here:
  7.  
  8.   ftp://kermit.columbia.edu/kermit/cu/port80log
  9.  
  10. To run it, you'll need C-Kermit 8.0 Beta.03:
  11.  
  12.   http://www.columbia.edu/kermit/ck80.html
  13.  
  14. You'll find prebuilt binaries at the end of the page for every conceivable
  15. Unix platform (if you have a platform that's not covered, please let me
  16. know).  Copy the appropriate binary to your computer as:
  17.  
  18.   /usr/local/bin/wermit
  19.  
  20. or whatever ("wermit" instead of "kermit" to indicate it's a test version).
  21.  
  22. The script takes in and logs port 80 accesses, starting over again every hour
  23. with a new log.  Every hour or so (it blocks waiting for incoming connections
  24. so the timing is not exact) it summarizes the log, mails the summary to the
  25. desired address, uploads the log with FTP, and then starts a new log.
  26.  
  27. The tricky part is FTP, because of course this requires a destination host,
  28. a directory, and a password.  You'll need to edit the script to specify
  29. the FTP host, directory, and user (it prompts you for the password).  If you
  30. say "no" it skips the FTP part.
  31.  
  32. By default, the summary report is mailed to security@columbia.edu.  You can
  33. change that too if you want.  This stuff is all defined near the top,
  34. marked with (*).
  35.  
  36. After making the needed edits, you can run the script by starting Kermit
  37. (as root) and telling it to "take port80log".  Alternatively, you can edit
  38. the script to have a shebang (kerbang) line specifying the location of the
  39. Kermit executable, but since there is no standard location you'll have to
  40. go with the conventions used on your platform.  In this case, you also have
  41. to give the script execute permission.  (You still have to be root to run it.)
  42.  
  43. The first cut of the script does not sort the emailed report in the requested
  44. way, but that shouldn't be a big distraction since the report won't be very
  45. long.  Instead, it's sorted in descending order hits per site.
  46.  
  47. The script can be run on as many computers as desired simultaneously, but only
  48. one copy per computer.  Conceivably if you wanted to be sure never to miss any
  49. requests, you could run it under inetd but I haven't tried that.  If you do,
  50. be sure to redirect stdout and stderr to a file or /dev/null.
  51.  
  52. Log files contain the raw data: timestamp, IP name (if known), IP address,
  53. and (in doublequotes) the incoming request, which identifies the attack.
  54. Logfile names are <host>_<date>_<time>.log, where <host> is the name of
  55. computer that's running the script, <date> is numeric yyyymmdd, and <time>
  56. is secs since midnite.  The report file is created locally before mailing;
  57. it has the same name as the log, except .txt instead of .log.  New files
  58. are created each hour.
  59.  
  60. When you first start running the script, it probably won't attract too many
  61. hits.  But the word will spread quickly, and soon the hits will be pouring
  62. in.
  63.