#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Check :include: aliases (in files configured in sendmail.cf) and .forward
# files to make sure the files and their parent directory paths all have
# proper permissions. And check the master alias file(s) too.
#
# See http://www.sendmail.org/vendor/sun/migration.html#Security for details.
#
#
# Check the group- and world-writable bits on the given file.
?????w??w?*)
bogus_dirs=true ;;
????????w?*)
bogus_dirs=true ;;
?????w????*)
bogus_dirs=true ;;
esac
}
# Break down the given file name into its components, and call analyze with
# analyze in turn with arguments:
# * /usr
for j in `echo $1 | \
awk '{
n = split($0, parts, "/");
for (i = n; i >= 2; i--){
string = "";
for (j = 2; j <= i; j++){
string = sprintf("%s/%s", string, parts[j]);
}
print string
}
}'` "/"
do
analyze $j $1
done
}
bogus_dirs=false
# These should be OK themselves, but other packages may have screwed up the
# alias paths are used.
# Find all valid :include: files used in alias files configured in sendmail.cf
do
break_down $i
done
# Check .forward files as well. If the argument "ALL" is given, do it for
# everyone. If no argument to the script is given, just do it for the current
# user. O/w, do it for all arguments.
if [ $# -eq 0 ] ; then
elif [ $1 = "ALL" ] ; then
arg=""
else
arg="$*"
fi
do
if [ -f $i/.forward ] ; then
break_down $i/.forward
fi
done
$bogus_dirs || echo "No unsafe directories found."