From 3a9bf59ac1e16b1c4a954488e7daa6804a0f7832 Mon Sep 17 00:00:00 2001 From: Eugeni Dodonov Date: Fri, 26 Jun 2009 19:20:26 +0000 Subject: Improved diff checks. --- cron-sh/functions.sh | 12 ++++++------ cron-sh/scripts/02_network.sh | 2 +- cron-sh/scripts/03_rpm.sh | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cron-sh/functions.sh b/cron-sh/functions.sh index 594d703..43d0820 100644 --- a/cron-sh/functions.sh +++ b/cron-sh/functions.sh @@ -40,16 +40,16 @@ FILTER="\(`echo $EXCLUDEDIR | sed -e 's/ /\\\|/g'`\)" Diffcheck() { TODAY="$1" YESTERDAY="$2" - DIFF="$3" + DAY_DIFF="$3" MESSAGE="$4" if [[ -f ${YESTERDAY} ]]; then - if ! diff -u ${YESTERDAY} ${TODAY} > ${DIFF}; then + if ! diff -u ${YESTERDAY} ${TODAY} > ${DAY_DIFF}; then printf "\nSecurity Warning: change in $MESSAGE found :\n" >> ${DIFF} - grep '^+' ${DIFF} | grep -vw "^+++ " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do - printf "\t\t- Newly added $MESSAGE : ${file}\n" + grep '^+' ${DAY_DIFF} | grep -vw "^+++ " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do + printf "\t\t- Added $MESSAGE : ${file}\n" done >> ${DIFF} - grep '^-' ${DIFF} | grep -vw "^--- " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do - printf "\t\t- No longer present $MESSAGE : ${file}\n" + grep '^-' ${DAY_DIFF} | grep -vw "^--- " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do + printf "\t\t- Removed $MESSAGE : ${file}\n" done >> ${DIFF} fi fi diff --git a/cron-sh/scripts/02_network.sh b/cron-sh/scripts/02_network.sh index f333b00..95228c2 100755 --- a/cron-sh/scripts/02_network.sh +++ b/cron-sh/scripts/02_network.sh @@ -34,7 +34,7 @@ fi ### Changed open port if [[ ${CHECK_OPEN_PORT} == yes ]]; then - Diffcheck ${OPEN_PORT_TODAY} ${OPEN_PORT_YESTERDAY} ${OPEN_PORT_DIFF} "network ports" + Diffcheck ${OPEN_PORT_TODAY} ${OPEN_PORT_YESTERDAY} ${OPEN_PORT_DIFF} "network listening ports" fi ### Changed firewall diff --git a/cron-sh/scripts/03_rpm.sh b/cron-sh/scripts/03_rpm.sh index 5eb1399..fcd3de8 100755 --- a/cron-sh/scripts/03_rpm.sh +++ b/cron-sh/scripts/03_rpm.sh @@ -39,7 +39,7 @@ fi # list of installed packages if [[ ${CHECK_RPM_PACKAGES} == yes ]]; then - rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\t%{INSTALLTIME}\n" | sort > ${RPM_QA_TODAY} + rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" | sort > ${RPM_QA_TODAY} Diffcheck ${RPM_QA_TODAY} ${RPM_QA_YESTERDAY} ${RPM_QA_DIFF} "installed packages" fi -- cgit v1.2.1