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 |
|
|
|
|
sort -t. -r -n +1 -2 |
|
|
|
|
xargs zcat -f
|
|
|
|
[ -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 |
|
|
|
|
perl -ne 'print "$2 from $1\n"
|
|
|
|
if (/^'"$start"'.*named\[\d+\]: denied [AI]XFR from \[(.*)\]\.\d+ for "(.*)"/);' |
|
|
|
|
sort -f | uniq -ic |
|
|
|
|
perl -e '
|
|
|
|
use Socket;
|
2001-04-21 22:36:30 +00:00
|
|
|
|
2001-07-26 02:37:12 +00:00
|
|
|
while (<STDIN>) {
|
|
|
|
if (/^.*from (.*)$/) {
|
|
|
|
$ip_addr = $1;
|
|
|
|
chomp;
|
|
|
|
if ($ARGV[0] =~ /^yes$/i) {
|
|
|
|
($host) = gethostbyaddr(inet_aton($ip_addr), AF_INET);
|
|
|
|
} else {
|
|
|
|
$host = "";
|
|
|
|
}
|
2001-04-21 22:36:30 +00:00
|
|
|
|
2001-07-26 02:37:12 +00:00
|
|
|
if ($host) {
|
|
|
|
print "$_ ($host)\n";
|
|
|
|
} else {
|
|
|
|
print "$_\n";
|
2001-04-21 22:36:30 +00:00
|
|
|
}
|
|
|
|
}
|
2001-07-26 02:37:12 +00:00
|
|
|
}
|
|
|
|
' $daily_status_named_usedns | tee /dev/stderr | wc -l)
|
|
|
|
[ $rc -gt 0 ] && rc=1
|
|
|
|
;;
|
2001-04-21 22:36:30 +00:00
|
|
|
|
|
|
|
*) rc=0;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $rc
|