#!/bin/bash
# lsla - LOGZip Secure Logfile Archiver (c) April 1999 by Mixter
# http://members.xoom.com/i0wnu
# This will archive and encrypt your logfiles in a secure way.
# Compatible linux platforms: RedHat, Debian, Slackware, Caldera
# REQUIRES: pkzip (ftp://ftp.pkware.com), srm (http://r3wt.base.org)
# Tip: "30 4 * * * root /path/to/lsla >/dev/null 2>/dev/null" into /etc/crontab

# Change the password
pass=fubar
logfile=/var/lib/logarchive.status

echo "archiving log files..."|logger
cd /var/log
mkdir zip >/dev/null 2>/dev/null
logzip=logs-`date|awk '{print $1$2$3}'`
echo `date` >> $logfile

for z in . `echo */` ; do
 cd /var/log
 cd $z
 # This can procude some file not found's, but it works
 for a in `ls *.?`
 do
  x=$a`stat $a|tail -1|awk '{print "-"$2$3$4}'`
  mv $a /var/log/zip/$x
  echo $a >> $logfile
 done
done

cd /var/log/zip
pkzip -add -pass=$pass $logzip
chattr +i *.zip
echo "wiping log files..."|logger
srm /var/log/zip/*.* >/dev/null 2>/dev/null
echo "archiving done, created $logzip"|logger

# Gr33tz to: all lame feds out there :P
