diff options
author | brian <brian@FreeBSD.org> | 2001-07-26 02:37:12 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2001-07-26 02:37:12 +0000 |
commit | f3c04d92b858a04996d5dd13956c612c49d55bca (patch) | |
tree | 971b4171db1907d3abb9a747a734ce289555abd6 | |
parent | caf5c05b79711b1b2d2f2cae3b997a9e2b7dad5b (diff) | |
download | FreeBSD-src-f3c04d92b858a04996d5dd13956c612c49d55bca.zip FreeBSD-src-f3c04d92b858a04996d5dd13956c612c49d55bca.tar.gz |
Remove $daily_status_named_logs and figure out which /var/log/messages*
files to look an (in the same way that /etc/security does).
Don't single-quote $start, reducing it to an empty string.
MFC after: 3 days
-rw-r--r-- | etc/defaults/periodic.conf | 1 | ||||
-rwxr-xr-x | etc/periodic/daily/470.status-named | 79 | ||||
-rw-r--r-- | share/man/man5/periodic.conf.5 | 4 |
3 files changed, 33 insertions, 51 deletions
diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf index 8780ba5..f4b2ff7 100644 --- a/etc/defaults/periodic.conf +++ b/etc/defaults/periodic.conf @@ -121,7 +121,6 @@ daily_status_mail_rejects_logs=3 # How many logs to check # 470.status-named daily_status_named_enable="YES" -daily_status_named_logs=3 # How many logs to check daily_status_named_usedns="YES" # DNS lookups are ok # 500.queuerun diff --git a/etc/periodic/daily/470.status-named b/etc/periodic/daily/470.status-named index d3396fa..e8e1365 100755 --- a/etc/periodic/daily/470.status-named +++ b/etc/periodic/daily/470.status-named @@ -11,59 +11,46 @@ then source_periodic_confs fi +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 +} + case "$daily_status_named_enable" in [Yy][Ee][Ss]) - if [ "$daily_status_named_logs" -le 0 ] - then - echo '$daily_status_named_enable is set but ' \ - '$daily_status_named_logs is not greater than zero' - rc=2 - else - echo - echo 'Checking for denied zone transfers (AXFR and IXFR):' + echo + echo 'Checking for denied zone transfers (AXFR and IXFR):' - start=`date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/'` - n=$(($daily_status_named_logs - 2)) - rc=$({ - while [ $n -ge 0 ] - do - if [ -f /var/log/messages.$n ] - then - cat /var/log/messages.$n - elif [ -f /var/log/messages.$n.gz ] - then - zcat -fc /var/log/messages.$n.gz - fi - n=$(($n - 1)) - done - cat /var/log/messages - } | - 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; + 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; - while (<STDIN>) { - if (/^.*from (.*)$/) { - $ip_addr = $1; - chomp; - if ($ARGV[0] =~ /^yes$/i) { - ($host) = gethostbyaddr(inet_aton($ip_addr), AF_INET); - } else { - $host = ""; - } + while (<STDIN>) { + if (/^.*from (.*)$/) { + $ip_addr = $1; + chomp; + if ($ARGV[0] =~ /^yes$/i) { + ($host) = gethostbyaddr(inet_aton($ip_addr), AF_INET); + } else { + $host = ""; + } - if ($host) { - print "$_ ($host)\n"; - } else { - print "$_\n"; - } + if ($host) { + print "$_ ($host)\n"; + } else { + print "$_\n"; } } - ' $daily_status_named_usedns | tee /dev/stderr | wc -l) - [ $rc -gt 0 ] && rc=1 - fi;; + } + ' $daily_status_named_usedns | tee /dev/stderr | wc -l) + [ $rc -gt 0 ] && rc=1 + ;; *) rc=0;; esac diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5 index 8f211f7..b30ad8f 100644 --- a/share/man/man5/periodic.conf.5 +++ b/share/man/man5/periodic.conf.5 @@ -462,10 +462,6 @@ Set to .Dq YES if you want to summarise denied zone transfers (AXFR and IXFR) for the previious day. -.It Va daily_status_named_logs -.Pq Vt num -Set to the number of log files that should be checked for -yesterday's rejected zone transfers. .It Va daily_status_named_usedns .Pq Vt bool Set to |