summaryrefslogtreecommitdiff
path: root/localintegritupdate
blob: be1b3c8354a7d442abb14763d5c5806dcfd260f3 (plain)
  1. #!/bin/sh
  2. # /etc/cron.daily/localintegritupdate : update integrit db
  3. # initially written by Andras Bali (as a cron job)
  4. SAVECYCLE=3
  5. test -x /usr/sbin/integrit || exit 0
  6. test -x /usr/bin/savelog || exit 0
  7. test -f /etc/integrit/integrit.debian.conf || exit 0
  8. CONFIGS=""
  9. . /etc/integrit/integrit.debian.conf
  10. test -n "$CONFIGS" || exit 0
  11. for config in $CONFIGS; do
  12. known=$(egrep '^ *known *= *.+' $config | sed 's/^ *known *= *\(.\+\)$/\1/')
  13. current=$(egrep '^ *current *= *.+' $config | sed 's/^ *current *= *\(.\+\)$/\1/')
  14. options="-cu"
  15. if [ ! -f "$known" ]; then
  16. if [ -f "$current" ]; then
  17. mv "$current" "$known"
  18. else
  19. options="-u"
  20. fi
  21. else
  22. if [ -f "$current" ]; then
  23. savelog -m 640 -u root -g root -c $SAVECYCLE "$known" > /dev/null
  24. mv "$current" "$known"
  25. fi
  26. fi
  27. # nice integrit -C $config -cu 2>&1
  28. nice integrit -C $config $options
  29. done