Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 02 May 1998 14:16:25 -0400 (EDT)
From:      Stunt Pope <markjr@shmOOze.net>
To:        "freebsd-isp@FreeBSD.org" <freebsd-isp@FreeBSD.ORG>
Subject:   RE: Named disappeared (chk script enclosed)
Message-ID:  <XFMail.980502141625.markjr@shmOOze.net>
In-Reply-To: <98May1.134318edt.6218@netgate.iectech.com>

next in thread | previous in thread | raw e-mail | index | archive | help

There's been at least one other "chk named" script posted here to the list
since I memtioned the one I coded for a solaris box. Since then I've
gotten numerous requests for the script, so I'm posting it here.

Also, a program which checks for the bind "fake inverse query overflow 
problem" recently came across Bugtraq, which you can find at:

http://www.geek-girl.com/bugtraq/1998_2/0057.html

(I've tested it on several freeBSD 2.2.2-current boxes and they all report
"not vulnerable")

here's that script:
keep in mind it was coded on solaris 2.5.1, and may need tweaking for
other o/s's. Also, it uses syslog, so if your perl is < 5.004_04, you're
Syslog.pm is broken. Comment out line 92:

#$host = hostname() unless $host;       # set $Syslog::host to change


-mark

#!/bin/perl
#
# chkdns.pl v1.0
# no-brainer to make sure named is still working
# Mark Jeftovic <markjr@shmOOze.net>
# Oct/15/97

$PS="/bin/ps";
$PID_FILE="/etc/named.pid";
$NAMED="/usr/sbin/in.named";
$CAT="/bin/cat";
$SENDMAIL="/usr/lib/sendmail";
$VERBOSE=0;
$USE_SYSLOG=1;

if($USE_SYSLOG) {
        require 5.001;
        use Sys::Hostname;
        use Sys::Syslog;
        }

$NOW=localtime(time());

# comma seperate multiple emails
$NOTIFY='';

# subject for email
$SUBJECT="chkdns";

chomp($PID=`$CAT $PID_FILE`);
print "named is: $PID\n" if($VERBOSE);
`$PS -p $PID`;
if($?!=0) { 
        print "ps -p $PID = $?\n" if($VERBOSE);
        `$NAMED`;
        print "running $NAMED\n" if($VERBOSE);
        openlog("chkdns", 'pid', 'daemon');
        syslog('notice', "restarted $NAMED");
        closelog();
        &notify($NOTIFY,$?) if($NOTIFY);
        }

sub notify {
my($list,$val)=@_;
open(MAIL, "| $SENDMAIL $list") || die $!;
print MAIL <<"EOF";
Subject: $SUBJECT

Just ran $NAMED at $NOW.
Exit value was: $val.
.

EOF
close(MAIL);
}

---
Mark Jeftovic                   aka: mark jeff or vic, stunt pope. 
markjr@shmOOze.net              http://www.shmOOze.net/~markjr
Private World's BOFH            http://www.PrivateWorld.com
irc: L-bOMb                     Keep `em Guessing


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.980502141625.markjr>