Logcheck no es un programa que funcione contínuamente, sino que es llamado cada que el administrador lo vea adecuado. Como cada reporte será enviado por correo, lo más común es hacerlo cada hora. Para ello es necesario crear una entrada en el crontab de root o de algún usuario que tenga permiso de leer los archivos localizados en /var/log y crear o, por lo menos, modificar los archivos que indiquen la posición. Éstos son <archivo>.offset -- típicamente messages.offset, secure.offset y maillog.offset.
La línea a ser agregada en el crontab será similar a la siguiente:
0 * * * * /bin/sh /usr/local/etc/logcheck.sh
Con esto, cada hora el administrador recibirá un mensaje similar al siguiente:
From root@hostname.dominio.com Wed Sep 27 21:46:33 2000 Date: Wed, 27 Sep 2000 19:00:04 -0500 From: root <root@hostname.dominio.com> To: root@hostname.dominio.com Subject: hostname.dominio.com 09/27/00:19.00 system check Security Violations =-=-=-=-=-=-=-=-=-= Sep 27 18:23:07 hostname PAM_pwdb[14075]: authentication failure; (uid=0) -> root for ssh service Sep 27 18:23:11 hostname PAM_pwdb[14075]: (ssh) session opened for user root by (uid=0) Sep 27 18:23:11 hostname sshd[14075]: log: Password authentication for root accepted. Sep 27 18:23:11 hostname sshd[14075]: log: ROOT LOGIN as 'root' from hostname2.dominio.com Sep 27 18:23:43 hostname PAM_pwdb[14075]: (ssh) session closed for user root Unusual System Events =-=-=-=-=-=-=-=-=-=-= Sep 27 18:02:26 hostname proftpd[13963]: hostname.dominio.com (lab1-15.dominio.com [192.168.1.16]) - FTP no transfer timeout, disconnected. Sep 27 18:14:40 hostname proftpd[14030]: hostname.dominio.com (lab1-15.dominio.com [192.168.1.16]) - FTP no transfer timeout, disconnected. Sep 27 18:22:19 hostname proftpd[13875]: hostname.dominio.com (lab2-21.dominio.com [192.168.2.21]) - FTP no transfer timeout, disconnected. Sep 27 18:23:07 hostname PAM_pwdb[14075]: authentication failure; (uid=0) -> root for ssh service Sep 27 18:23:11 hostname PAM_pwdb[14075]: (ssh) session opened for user root by (uid=0) Sep 27 18:23:11 hostname sshd[14075]: log: ROOT LOGIN as 'root' from dir-03.dominio.com Sep 27 18:00:12 hostname sendmail[13610]: RAB13605: SAA13610: DSN: Host unknown (Name server: mail.internet.com: host not found)
En caso de haberse registrado algún evento que concuerde con alguna línea de logcheck.hacking, para que el reporte sea visto más rápidamente por el administrador cambiarán los encabezados, quedando así:
From root@hostname.dominio.com Wed Sep 27 21:52:58 2000 Date: Wed, 27 Sep 2000 21:00:05 -0500 From: root <root@hostname.dominio.com> To: root@hostname.dominio.com Subject: hostname.dominio.com 09/27/00:21.00 ACTIVE SYSTEM ATTACK! Active System Attack Alerts =-=-=-=-=-=-=-=-=-=-=-=-=-= Sep 27 20:10:48 hostname portsentry[14722]: attackalert: SYN/Normal scan from host: ejemplo.dominio.com/192.168.0.111 to TCP port: 1019 Sep 27 20:10:48 hostname portsentry[14722]: attackalert: Host 192.168.0.111 has been blocked via wrappers with string: "ALL: 192.168.0.111" Sep 27 20:10:48 hostname portsentry[14722]: attackalert: Host 192.168.0.111 has been blocked via dropped route using command: "/sbin/ipchains -I input -s 192.168.0.111 -j DENY -l" (...) Security Violations =-=-=-=-=-=-=-=-=-= Sep 27 20:09:19 hostname PAM_pwdb[14589]: authentication failure; (uid=0) -> root for ssh service Sep 27 20:09:22 hostname PAM_pwdb[14589]: (ssh) session opened for user root by (uid=0) Sep 27 20:09:22 hostname sshd[14589]: log: Password authentication for root accepted. (...) Unusual System Events =-=-=-=-=-=-=-=-=-=-= Sep 27 20:10:47 hostname sshd[14624]: fatal: Did not receive ident string. Sep 27 20:19:43 hostname PAM_pwdb[14985]: authentication failure; (uid=0) -> llec for ssh service Sep 27 20:09:34 hostname in.telnetd[14610]: connect from 192.168.0.111 (...)