aboutsummaryrefslogtreecommitdiffstats
path: root/cron-sh
diff options
context:
space:
mode:
Diffstat (limited to 'cron-sh')
-rwxr-xr-xcron-sh/security.sh45
1 files changed, 30 insertions, 15 deletions
diff --git a/cron-sh/security.sh b/cron-sh/security.sh
index b949028..b6636b5 100755
--- a/cron-sh/security.sh
+++ b/cron-sh/security.sh
@@ -76,21 +76,36 @@ netstat -pvlA inet 2> /dev/null > ${OPEN_PORT_TODAY};
# Hard disk related file check; the less priority the better...
nice --adjustment=+19 /usr/bin/msec_find ${DIR}
-sort < ${SUID_ROOT_TODAY} > ${SUID_ROOT_TODAY}.tmp
-sort < ${SUID_GROUP_TODAY} > ${SUID_GROUP_TODAY}.tmp
-sort < ${WRITEABLE_TODAY} > ${WRITEABLE_TODAY}.tmp
-sort < ${UNOWNED_USER_TODAY} > ${UNOWNED_USER_TODAY}.tmp
-sort < ${UNOWNED_GROUP_TODAY} > ${UNOWNED_GROUP_TODAY}.tmp
-
-mv -f ${SUID_ROOT_TODAY}.tmp ${SUID_ROOT_TODAY}
-mv -f ${SUID_GROUP_TODAY}.tmp ${SUID_GROUP_TODAY}
-mv -f ${WRITEABLE_TODAY}.tmp ${WRITEABLE_TODAY}
-mv -f ${UNOWNED_USER_TODAY}.tmp ${UNOWNED_USER_TODAY}
-mv -f ${UNOWNED_GROUP_TODAY}.tmp ${UNOWNED_GROUP_TODAY}
-
-while read line; do
- md5sum ${line}
-done < ${SUID_ROOT_TODAY} > ${SUID_MD5_TODAY}
+if [[ -f ${SUID_ROOT_TODAY} ]]; then
+ sort < ${SUID_ROOT_TODAY} > ${SUID_ROOT_TODAY}.tmp
+ mv -f ${SUID_ROOT_TODAY}.tmp ${SUID_ROOT_TODAY}
+fi
+
+if [[ -f ${SUID_GROUP_TODAY} ]]; then
+ sort < ${SUID_GROUP_TODAY} > ${SUID_GROUP_TODAY}.tmp
+ mv -f ${SUID_GROUP_TODAY}.tmp ${SUID_GROUP_TODAY}
+fi
+
+if [[ -f ${WRITEABLE_TODAY} ]]; then
+ sort < ${WRITEABLE_TODAY} > ${WRITEABLE_TODAY}.tmp
+ mv -f ${WRITEABLE_TODAY}.tmp ${WRITEABLE_TODAY}
+fi
+
+if [[ -f ${UNOWNED_USER_TODAY} ]]; then
+ sort < ${UNOWNED_USER_TODAY} > ${UNOWNED_USER_TODAY}.tmp
+ mv -f ${UNOWNED_USER_TODAY}.tmp ${UNOWNED_USER_TODAY}
+fi
+
+if [[ -f ${UNOWNED_GROUP_TODAY} ]]; then
+ sort < ${UNOWNED_GROUP_TODAY} > ${UNOWNED_GROUP_TODAY}.tmp
+ mv -f ${UNOWNED_GROUP_TODAY}.tmp ${UNOWNED_GROUP_TODAY}
+fi
+
+if [[ -f ${SUID_ROOT_TODAY} ]]; then
+ while read line; do
+ md5sum ${line}
+ done < ${SUID_ROOT_TODAY} > ${SUID_MD5_TODAY}
+fi
### Functions ###