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
|
#!/bin/sh
#
# tiger - A UN*X security checking system
# Copyright (C) 1993 Douglas Lee Schales, David K. Hess, David R. Safford
#
# Please see the file `COPYING' for the complete copyright notice.
#
# installsig - 10/22/93
#
#-----------------------------------------------------------------------------
#
# Usage: ./installsig sigfile [sigfile [sigfile...]]
#
# This script must be run from the top level of the tiger directory.
# sigfiles must use names of the form:
# os:major_release:release:[optional_arch][--optional_identifyinginfo]
#
# Example:
#
# SunOS:5:5.2:sun4
#
# For SunOS 5.2 running on a sun4
#
findcmd()
{
CMD=$1
SRCH=/usr/ucb:/usr/bin:/bin:/etc:/usr/etc:/usr/sbin
SAVEIFS=$IFS
IFS=:
set $SRCH
IFS=$SAVEIFS
for dir
do
[ $TESTEXEC $dir/$CMD ] && {
echo $dir/$CMD
return
}
done
}
getreldiff()
{
$AWK 'BEGIN {
start="'"$1"'";
dest="'"$2"'";
m=split(start, src, "/");
n=split(dest, dst, "/");
for(i=n;i<m;i++)
printf("../");
}' < /dev/null
}
shcat()
{
while read line
do
echo "$line"
done < "$1"
}
catcp()
{
$CAT $1 > $2
}
TESTEXEC=-x
( [ $TESTEXEC /bin/sh ] ) 2> $WORKDIR/te.$$
[ -s $WORKDIR/te.$$ ] && TESTEXEC=-f
export TESTEXEC
RM=`findcmd rm`
[ -n "$RM" ] && $RM $WORKDIR/te.$$
CAT="`findcmd cat`"
SED="`findcmd sed`"
MV="`findcmd mv`"
CP="`findcmd cp`"
CHMOD="`findcmd chmod`"
GREP="`findcmd grep`"
MKDIR="`findcmd mkdir`"
LN="`findcmd ln`"
AWK="`findcmd awk`"
[ ! -n "$SED" ] && {
echo "Can't find 'sed' anywhere... sorry."
exit 1
}
[ ! -n "$GREP" ] && {
echo "Can't find 'grep' anywhere... sorry."
exit 1
}
[ ! -n "$AWK" ] && {
echo "Can't find 'awk' anywhere... sorry."
exit 1
}
[ ! -n "$CAT" ] && CAT=shcat
[ ! -n "$CP" ] && CP="catcp"
[ ! -n "$MV" ] && MV="$CP"
[ ! -n "$LN" ] && LN="$CP"
for sigfile
do
eval `
$GREP '^#@' $sigfile |
$SED -e 's/^#@//'`
echo "Target directory: $DEST"
echo "Configuration: $CONFIG"
dir="systems/$DEST"
if [ -f "systems/$CONFIG/config" ]; then
dir="systems/$DEST"
target="`getreldiff $DEST $CONFIG`"
if [ ! -d "$dir" ]; then
echo "Creating directory $dir..."
if [ -n "$MKDIR" ]; then
if $MKDIR -p $dir; then
echo "Configuring directory $dir..."
[ -d $dir ] && $LN -s "${target}config" "$dir/config"
else
echo "mkdir -p $dir failed... sorry."
fi
else
echo "Don't have 'mkdir' command... sorry."
fi
fi
if [ -d "$dir" ]; then
[ -f $dir/signatures ] && $MV "$dir/signatures" "$dir/signatures.orig"
$CP $sigfile "$dir/signatures"
[ -n "$CHMOD" ] && $CHMOD 644 "$dir/signatures"
echo "Installed $sigfile in $dir."
else
echo "Can't locate directory $dir for $sigfile... something went wrong."
fi
else
echo "Don't have required config files ($CONFIG/config) for this"
echo "platform. You might need a TIGER upgrade."
fi
done
|