whois&bind安装

whois安装:
whois xxxxxxx.com.cn
yum install -y jwhois
cp /etc/jwhois.conf /etc/jwhois-bk.conf
wget –no-check-certificate https://raw.githubusercontent.com/jonasob/jwhois/master/example/jwhois.conf -O /etc/jwhois.conf
whois xxxxxxx.com.cn

bind安装:
chattr -i /etc/passwd
chattr -i /etc/group
chattr -i /etc/shadow
chattr -i /etc/gshadow
useradd -r -m -d /var/named -s /sbin/nologin named
tar -xjvf bind-xxxxxxx.tar.bz2
cd bind-xxxxxxx
./configure && make && make install
rndc-confgen | tail -n10 | head -n5 | sed -e s/#\//g >/etc/rndc.key
mkdir /logs/bind
cat > /etc/named.conf << EOF
# Use with the following in named.conf, adjusting the allow list as needed:
include “/etc/rndc.key”;

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { “rndc-key”; };
};

options {
directory “/var/named”;
pid-file “/var/run/named.pid”;
tcp-clients 3500;
version “None”;
listen-on { 127.0.0.1; };
allow-recursion {any;};
serial-query-rate 10;
};

logging{
channel default_log {
file “/logs/bind/default.log” versions 3 size 64m; print-time yes;
severity info;
};

channel general_log {
file “/logs/bind/general.log” versions 3 size 64m; print-time yes;
severity info;
};

channel queries_log {
file “/logs/bind/queries.log” versions 3 size 64m; print-time yes;
severity info;
};

channel config_log {
file “/logs/bind/config.log” versions 3 size 64m; print-time yes;
severity info;
};

channel client_log {
file “/logs/bind/client.log” versions 3 size 64m; print-time yes;
severity info;
};

channel resolver_log {
file “/logs/bind/resolver.log” versions 3 size 64m; print-time yes;
severity info;
};

category default { default_log; };
category general { general_log; };
category queries { queries_log; };
category config { config_log; };
category client { client_log; };
category resolver { resolver_log; };
};

EOF
/usr/local/sbin/named &
echo ‘/usr/local/sbin/named &’ >> /etc/rc.local

dig www.xxxxxxxxx.net @127.0.0.1
tail -200 /logs/bind/queries.log

—————————————————————————————————
cat > /etc/init.d/named << EOF
#!/bin/bash
#
# description: named daemon
# chkconfig: – 25 80

pidFile=/var/run/named.pid
lockFile=/var/lock/subsys/named
confFile=/etc/named.conf
[ -r /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions
start() {
if [ -e $lockFile ]; then
echo “named is already running…”
exit 0
fi
echo -n “Starting named:”
daemon –pidfile “$pidFile” /usr/local/sbin/named -u named -c “$confFile”
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
touch $lockFile
return $RETVAL
else
rm -f $lockFile $pidFile
return 1
fi
}
stop() {
if [ ! -e $lockFile ]; then
echo “named is stopped.”
fi
echo -n “Stopping named:”
killproc named
RETVAL=$?
echo
if [ $RETVAL -eq 0 ];then
rm -f $lockFile $pidFile
return 0
else
echo “Cannot stop named.”
failure
return 1
fi
}
restart() {
stop
sleep 2
start
}
reload() {
echo -n “Reloading named: “
killproc named -HUP
RETVAL=$?
echo
return $RETVAL
}
status() {
if pidof named &> /dev/null; then
echo -n “named is running…”
success
echo
else
echo -n “named is stopped…”
success
echo
fi
}
usage() {
echo “Usage: named {start|stop|restart|status|reload}”
}
case $1 in
start)
start ;;
stop)
stop ;;
restart)
restart ;;
status)
status ;;
reload)
reload ;;
*)
usage
exit 4
;;
esac
EOF
chkconfig –add named
chkconfig named on

Print Friendly

发表评论

电子邮件地址不会被公开。 必填项已用*标注