/usr/lib/tiger/scripts/check_crontabs is in tiger 1:3.2.3-12.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | #!/bin/sh
#
# tiger - A UN*X security checking system
# Copyright (C) 1993 Douglas Lee Schales, David K. Hess, David R. Safford
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# Please see the file `COPYING' for the complete copyright notice.
#
# check_crontabs - 06/14/93
#
# Ideas from Dan Farmer's 'cron.chk' from COPS 1.04.
#
# check_crontabs - 11/08/2007 - jfs Change message calls so that they can be
# filtered (Debian bug #411534)
# check_crontabs - 01/15/2004 - jfs Will only warn if neither cron.allow
# nor cron.deny exists (Debian bug #226362)
# check_crontabs - 11/19/2003 - jfs Introduce some more information on
# allow/deny checks as suggested by unspawn.
# check_crontabs - 08/19/2003 - jfs Renamed to check_crontabs
# check_crontabs - 08/14/2003 - jfs Added OUTPUTMETHOD to dependancies
# incorporated changes from ARSC tara version 3.0.3
# check_crontabs - 08/13/2003 - jfs Fixed a call to grep and added lost changes
# made by ARSC
# check_crontabs - 08/08/2003 - jfs Avoided race conditions in temporary file
# usage.
# check_crontabs - 08/12/2002 - jfs Fixed to use CRONSPOOL
# check_crontabs - 04/25/2002 - jfs Fixed dependancies
# check_crontabs - 04/28/1999 Modified by Advanced Research Corp (R) to
# correct errors
# check_crontabs - 04/20/1999 Modified by Advanced Research Corp (R) to
# correct errors
#
#-----------------------------------------------------------------------------
#
TigerInstallDir="/usr/lib/tiger"
#
# Set default base directory.
# Order or preference:
# -B option
# TIGERHOMEDIR environment variable
# TigerInstallDir installed location
#
basedir=${TIGERHOMEDIR:=$TigerInstallDir}
for parm
do
case $parm in
-B) basedir=$2; break;;
esac
done
#
# Verify that a config file exists there, and if it does
# source it.
#
[ ! -r "$basedir/config" ] && {
echo "--ERROR-- [init002e] No 'config' file in \`$basedir'."
exit 1
}
. $basedir/config
. $BASEDIR/initdefs
#
# If run in test mode (-t) this will verify that all required
# elements are set.
#
[ "$Tiger_TESTMODE" = 'Y' ] && {
haveallcmds AWK BASENAME CAT GEN_CRON_FILES LS RM TR SED GREP OUTPUTMETHOD || exit 1
haveallfiles BASEDIR WORKDIR || exit 1
echo "--CONFIG-- [init003c] $0: Configuration ok..."
exit 0
}
#------------------------------------------------------------------------
echo
echo "# Performing check of \`cron' entries..."
haveallcmds AWK BASENAME CAT GEN_CRON_FILES LS RM TR SED GREP OUTPUTMETHOD || exit 1
haveallfiles BASEDIR WORKDIR || exit 1
safe_temp "$WORKDIR/cron.in.$$"
trap 'delete $WORKDIR/cron.in.$$ ; exit 1' 1 2 3 15
realpath="$REALPATH -d"
[ ! -n "$REALPATH" -o ! $TESTEXEC "$REALPATH" ] && realpath=echo
lowner=
{
$GEN_CRON_FILES $WORKDIR/cron.in.$$
#
# Be careful if you muck around in this loop. Since we are reading
# commands from these cron entries, they can have shell meta-characters
# in them. We try to eliminate some of them, but there is no guarantee.
# dls
#
while read owner command
do
com="`echo \"$command\" | $SED -e 's/[0-9]*>//g' | $TR -d '()\;\`&!|'`"
# Can't 'set' this because of shell meta-characters.
cmd="`echo \"$com\" | $AWK '{print $1}'`"
base=`$BASENAME -- "$cmd"`
case "$base" in
sh|csh|ksh|tcsh|zsh|bash|if|cd)
[ "$2" != "-c" ] && cmd="`echo \"$com\" | $AWK '{print $2}'`";;
esac
[ -n "$TigerCheckEmbedded" -a -f "$cmd" -a "$owner" = 'root' ] && {
echo "$cmd root.crontab" >> $TigerCheckEmbedded
}
# This is removed from tara's version 3.0.3
# case "$cmd" in
# |cd|echo|if|else|then) ;;
# *)
# if [ -z "`echo $cmd | $GREP \"^\/\"`" ] ; then
# message WARN cron001w "command = $command" "cron entry for $owner does not use full pathname"
# fi ;;
# esac
# And subsituted by this:
if [ -z "`echo $cmd | $GREP \"^[\/\[]\"`" -a "$cmd" != "umask" ]; then
message WARN cron001w "" "cron entry for $owner does not use full pathname ($cmd):"
fi
[ "$owner" != "$lowner" ] && {
curdir=/
[ -n "$GETUSERHOME" ] && curdir=`$GETUSERHOME $owner`
lowner=$owner
}
setcurdir=0
for comp in $com
do
[ $setcurdir -eq 1 ] && {
curdir="$comp"
setcurdir=0
}
case "$comp" in
*/*) {
case "$comp" in
/*) ;;
*) comp="$curdir/$comp";;
esac
[ ! -c "$comp" -a ! -b "$comp" ] && {
lgetpermit "$comp" |
pathmsg cron002 cron003 "$comp" $owner "cron entry for $owner uses" "$command"
}
}
;;
cd) setcurdir=1;;
esac
done
done < $WORKDIR/cron.in.$$
} |
$OUTPUTMETHOD
delete $WORKDIR/cron.in.$$
# Check for existence of root crontab
[ ! -r $CRONSPOOL/root ] &&
message WARN cron004w "" "Root crontab does not exist"
# Check for existence of root cron.allow
[ -z "$CRONALLOW" ] && CRONALLOW=/etc/cron.allow
[ -z "$CRONDENY" ] && CRONDENY=/etc/cron.deny
if [ -f "$CRONALLOW" ]
then
$CAT $CRONALLOW |
$GREP -v "^#" |
while read user
do
message WARN cron006w "" "User $user is allowed cron usage."
done
fi
if [ -f "$CRONDENY" ]
then
$CAT $CRONDENY |
$GREP -v "^#" |
while read user
do
message INFO cron007i "" "User $user is denied cron usage."
done
fi
if [ ! -f "$CRONALLOW" -a ! -f "$CRONDENY" ]
then
message WARN cron005w "" "Use of cron is not restricted"
fi
exit 0
|