#!/bin/sh
# SYSTEMS: Solaris, Linux
# A script to check /etc/inetd.conf for 'named'
#
MSG="# Checking for the 'named' service..."
SYSTEM=`uname -s`
######Solaris######
if [ "$SYSTEM" = "SunOS" ]; then
  echo ""; echo "$MSG"
  #Check the rc directories...
  CHK=`ls /etc/rc*.d/S*named 2>/dev/null | tr "[\n]" " "`
  if [ "$CHK" != "" ]; then
    echo "--WARN-- [NAMED001w] The 'named' startup script was found indicating this system may be acting as a DNS server."
  fi
fi
######Linux######
if [ "$SYSTEM" = "Linux" ]; then
  echo ""; echo "$MSG"
  #Check the rc directories...
  CHK=`ls /etc/rc.d/rc*.d/S*named 2>/dev/null | tr "[\n]" " "`
  if [ "$CHK" != "" ]; then
    echo "--WARN-- [NAMED001w] The 'named' startup script was found indicating this system may be acting as a DNS server."
  fi
fi
######Common######
if [ "$SYSTEM" = "SunOS" -o "$SYSTEM" = "Linux" ]; then
  PS=`ps -ef | grep named | grep -v grep`
  if [ "$PS" != "" ]; then  #named daemon found running...
    echo "--FAIL-- [NAMED002f] The 'named' daemon was found indicating this system is acting as a DNS server."
  fi
fi
