aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2009-06-26 19:20:26 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2009-06-26 19:20:26 +0000
commit3a9bf59ac1e16b1c4a954488e7daa6804a0f7832 (patch)
treeb2284a9297a770bd9e181cd2d54e0597f16efd05
parentd9bf87b0e6b62b1aee9c2d2e89a7db7cd58a52d3 (diff)
downloadmsec-3a9bf59ac1e16b1c4a954488e7daa6804a0f7832.tar
msec-3a9bf59ac1e16b1c4a954488e7daa6804a0f7832.tar.gz
msec-3a9bf59ac1e16b1c4a954488e7daa6804a0f7832.tar.bz2
msec-3a9bf59ac1e16b1c4a954488e7daa6804a0f7832.tar.xz
msec-3a9bf59ac1e16b1c4a954488e7daa6804a0f7832.zip
Improved diff checks.
-rw-r--r--cron-sh/functions.sh12
-rwxr-xr-xcron-sh/scripts/02_network.sh2
-rwxr-xr-xcron-sh/scripts/03_rpm.sh2
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