2001-04-21 22:36:30 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# If there is a global system configuration file, suck it in.
|
|
|
|
#
|
|
|
|
if [ -r /etc/defaults/periodic.conf ]
|
|
|
|
then
|
|
|
|
. /etc/defaults/periodic.conf
|
|
|
|
source_periodic_confs
|
|
|
|
fi
|
|
|
|
|
2001-07-26 02:37:12 +00:00
|
|
|
catmsgs() {
|
|
|
|
find /var/log -name 'messages.*' -mtime -2 |
|
2002-09-24 18:53:46 +00:00
|
|
|
sort -t. -r -n -k 2,2 |
|
2003-01-05 21:32:50 +00:00
|
|
|
while read f
|
|
|
|
do
|
|
|
|
case $f in
|
|
|
|
*.gz) zcat -f $f;;
|
|
|
|
*.bz2) bzcat -f $f;;
|
|
|
|
esac
|
|
|
|
done
|
2001-07-26 02:37:12 +00:00
|
|
|
[ -f /var/log/messages ] && cat /var/log/messages
|
|
|
|
}
|
|
|
|
|
2001-04-21 22:36:30 +00:00
|
|
|
case "$daily_status_named_enable" in
|
|
|
|
[Yy][Ee][Ss])
|
2001-07-26 02:37:12 +00:00
|
|
|
echo
|
|
|
|
echo 'Checking for denied zone transfers (AXFR and IXFR):'
|
2001-04-21 22:36:30 +00:00
|
|
|
|
2001-07-26 02:37:12 +00:00
|
|
|
start=`date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/'`
|
|
|
|
rc=$(catmsgs |
|
2002-12-07 23:37:44 +00:00
|
|
|
fgrep '^'"$start"'.*named\[[[:digit:]]\+\]: denied [AI]XFR from \[.*\]\.[[:digit:]]\+ for' | \
|
|
|
|
sed -e 's/.*: denied [AI]XFR from \[\(.*\)\]\.[[:digit:]]* for "\(.*\)".*$/\2 from \1/'
|
|
|
|
sort -f | uniq -ic | (
|
|
|
|
usedns=0
|
|
|
|
if [ X"${daily_status_named_usedns}" != X"" ]; then
|
|
|
|
case $daily_status_named_usedns in
|
|
|
|
[yY][eE][sS]) usedns=1 ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
while read line ;do
|
|
|
|
ipaddr=`echo "$line" | sed -e 's/^.*from //'`
|
|
|
|
if [ $usedns -eq 1 ]; then
|
|
|
|
name=`host "${ipaddr}" 2>/dev/null | \
|
|
|
|
grep 'domain name pointer' | \
|
|
|
|
sed -e 's/^.* //'`
|
|
|
|
fi
|
|
|
|
if [ X"${name}" != X"" ]; then
|
|
|
|
echo "${line} (${name})"
|
|
|
|
else
|
|
|
|
echo "${line}"
|
|
|
|
fi
|
|
|
|
done ) | \
|
|
|
|
tee /dev/stderr | wc -l)
|
2001-07-26 02:37:12 +00:00
|
|
|
[ $rc -gt 0 ] && rc=1
|
|
|
|
;;
|
2001-04-21 22:36:30 +00:00
|
|
|
|
|
|
|
*) rc=0;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $rc
|