hdknr@mailjail:~$ sudo ps ax | grep dns
sudo: unable to resolve host mailjail
1754 ? Ss 0:00 /usr/sbin/pdns_recursor
2360 pts/1 S<+ 0:00 grep dns
hdknr@mailjail:~$ sudo lsof -c pdns_recursor
sudo: unable to resolve host mailjail
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
pdns_recu 1754 pdns cwd DIR 3,1 4096 2 /
pdns_recu 1754 pdns rtd DIR 3,1 4096 2 /
pdns_recu 1754 pdns txt REG 3,1 891980 73653 /usr/sbin/pdns_recursor
pdns_recu 1754 pdns mem REG 3,1 42564 25195 /lib/i686/cmov/libnss_files-2.9.so
pdns_recu 1754 pdns mem REG 3,1 38504 25201 /lib/i686/cmov/libnss_nis-2.9.so
pdns_recu 1754 pdns mem REG 3,1 87864 25197 /lib/i686/cmov/libnsl-2.9.so
pdns_recu 1754 pdns mem REG 3,1 30496 25191 /lib/i686/cmov/libnss_compat-2.9.so
pdns_recu 1754 pdns mem REG 3,1 1425856 25184 /lib/i686/cmov/libc-2.9.so
pdns_recu 1754 pdns mem REG 3,1 171216 16356 /lib/libgcc_s.so.1
pdns_recu 1754 pdns mem REG 3,1 149388 25189 /lib/i686/cmov/libm-2.9.so
pdns_recu 1754 pdns mem REG 3,1 954532 98117 /usr/lib/libstdc++.so.6.0.12
pdns_recu 1754 pdns mem REG 3,1 117408 18648 /lib/ld-2.9.so
pdns_recu 1754 pdns 0u CHR 1,3 0t0 757 /dev/null
pdns_recu 1754 pdns 1u CHR 1,3 0t0 757 /dev/null
pdns_recu 1754 pdns 2u CHR 1,3 0t0 757 /dev/null
pdns_recu 1754 pdns 3u unix 0xcf840240 0t0 5923 socket
pdns_recu 1754 pdns 4u IPv4 4508 0t0 UDP localhost:domain
pdns_recu 1754 pdns 5u IPv4 4509 0t0 TCP localhost:domain (LISTEN)
pdns_recu 1754 pdns 6u unix 0xcf840040 0t0 4511 /var/run//pdns_recursor.controlsocket
pdns_recu 1754 pdns 7u 0000 0,7 0 56 anon_inode
/etc/powerdns/pdns.conf
mailjail:/etc/powerdns# grep -v "#" pdns.conf | grep -v "^$"
allow-recursion=127.0.0.1
config-dir=/etc/powerdns
daemon=yes
disable-axfr=yes
guardian=yes
lazy-recursion=yes
local-address=0.0.0.0
local-port=53
module-dir=/usr/lib/powerdns
setgid=pdns
setuid=pdns
socket-dir=/var/run
version-string=powerdns
include=/etc/powerdns/pdns.d
/etc/powerdns/pdns.d/pdns.local
mailjail:/etc/powerdns/pdns.d# more pdns.local
# Here come the local changes the user made, like configuration of
# the several backends that exist.
/etc/init.d/pdns-recursor
mailjail:/etc/powerdns/pdns.d# more /etc/init.d/pdns-recursor
#!/bin/sh
### BEGIN INIT INFO
# Provides: pdns-recursor
# Required-Start: networking
# Required-Stop: networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 6
# Short-Description: Start the recursor at boot time.
### END INIT INFO
#
# Authors: Matthijs Mohlmann
<matthijs@cacholong.nl> # Christoph Haas
<haas@debian.org> #
# Thanks to:
# Thomas Hood
<jdthood@aglu.demon.nl> #
# initscript for PowerDNS recursor
set -e
. /lib/lsb/init-functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DESC="PowerDNS recursor"
NAME=pdns_recursor
DAEMON=/usr/sbin/$NAME
# Derive the socket-dir setting from /etc/powerdns/recursor.conf
# or fall back to the default /var/run if not specified there.
PIDDIR=$(awk -F= '/^socket-dir=/ {print $2}' /etc/powerdns/recursor.conf)
if [ -z "$PIDDIR" ]; then PIDDIR=/var/run; fi
PIDFILE=$PIDDIR/$NAME.pid
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
# Read config file if it is present.
if [ -r /etc/default/pdns-recursor ]; then
. /etc/default/pdns-recursor
fi
start() {
# Return
# 0 if daemon has been started / was already running
# >0 if daemon could not be started
start-stop-daemon --start --oknodo --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null || return 0
start-stop-daemon --start --oknodo --quiet --pidfile $PIDFILE --exec $DAEMON || return 2
}
start_resolvconf() {
if [ -x /sbin/resolvconf ]; then
echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.pdns-recursor
fi
return 0
}
stop() {
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occured
set +e
start-stop-daemon --stop --quiet --retry=HUP/30/TERM/5/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
rm -f $PIDFILE
return "$RETVAL"
}
stop_resolvconf() {
if [ -x /sbin/resolvconf ]; then
/sbin/resolvconf -d lo.pdns-recursor
fi
return 0
}
case "$1" in
start)
if [ "$START" != "yes" ]; then
log_begin_msg "Not starting $DESC -- disabled."
log_end_msg 0
exit 0
fi
log_daemon_msg "Starting $DESC" "pdns-recursor"
start
case "$?" in
0)
start_resolvconf
break
;;
1)
log_progress_msg "(already running)"
break
;;
*)
log_progress_msg " (failed)."
log_end_msg 1
exit 1
;;
esac
log_end_msg 0
;;
stop)
stop_resolvconf
log_daemon_msg "Stopping $DESC" "pdns-recursor"
stop
case "$?" in
0)
break
;;
1)
log_progress_msg "(not running)"
break
;;
*)
log_progress_msg "(failed)"
log_end_msg 1
exit 1
;;
esac
log_end_msg 0
;;
restart|force-reload)
if [ "$START" != "yes" ]; then
$0 stop
exit 0
fi
log_daemon_msg "Restarting $DESC" "pdns-recursor"
stop
case "$?" in
0|1)
start
case "$?" in
0)
log_end_msg 0
exit 0
;;
1)
log_progress_msg "(failed -- old process still running)"
log_end_msg 1
exit 1
;;
*)
log_progress_msg "(failed to start)"
log_end_msg 1
exit 1
;;
esac
;;
*)
log_progress_msg "(failed to stop)"
log_end_msg 1
exit 1
;;
esac
;;
force-stop)
killall -v -9 pdns_recursor
echo "killed"
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|force-stop}" >&2
exit 3
;;
esac
exit 0
/etc/default/pdns-recursor
mailjail:/etc/powerdns/pdns.d# cat /etc/default/pdns-recursor
# Variables for PowerDNS recursor
#
# Set START to yes to start the pdns-recursor
START=yes
/etc/init.d/pdns
mailjail:/etc/powerdns/pdns.d# cat /etc/init.d/pdns
#!/bin/sh
### BEGIN INIT INFO
# Provides: pdns
# Required-Start: networking
# Required-Stop: networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 6
# Short-Description: PDNS is a versatile high performance authoritative nameserver.
### END INIT INFO
PATH=/bin:/sbin:/usr/bin:/usr/sbin
BINARYPATH=/usr/bin
SBINARYPATH=/usr/sbin
SOCKETPATH=/var/run
NAME=pdns-server
[ -f "$SBINARYPATH/pdns_server" ] || exit 0
if [ -r /etc/default/pdns ]; then
. /etc/default/pdns
fi
cd $SOCKETPATH
suffix=`basename $0 | awk -F- '{print $2}'`
if [ $suffix ]; then
EXTRAOPTS=--config-name=$suffix
PROGNAME=pdns-$suffix
else
PROGNAME=pdns
fi
pdns_server="$SBINARYPATH/pdns_server $EXTRAOPTS"
doPC()
{
ret=$($BINARYPATH/pdns_control $EXTRAOPTS $1 $2 2> /dev/null)
}
doPC ping
NOTRUNNING=$?
case "$1" in
status)
if test "$NOTRUNNING" = "0"; then
doPC status
echo $ret
else
echo "not running"
fi
;;
stop)
echo -n "Stopping PowerDNS authoritative nameserver: "
if test "$NOTRUNNING" = "0"; then
doPC quit
echo $ret
else
echo "not running"
fi
;;
force-stop)
echo -n "Stopping PowerDNS authoritative nameserver: "
killall -v -9 pdns_server
echo "killed"
;;
start)
echo -n "Starting PowerDNS authoritative nameserver: "
if [ "$NOTRUNNING" = "0" ] || [ "$START" = "no" ]; then
echo "already running or disabled"
else
$pdns_server --daemon --guardian=yes
if test "$?" = "0"; then
echo "started"
fi
fi
;;
force-reload | restart)
echo -n "Restarting PowerDNS authoritative nameserver: "
echo -n stopping and waiting..
doPC quit
sleep 3
echo done
$0 start
;;
reload)
echo -n "Reloading PowerDNS authoritative nameserver: "
if test "$NOTRUNNING" = "0"; then
doPC cycle
echo requested reload
else
echo not running yet
$0 start
fi
;;
monitor)
if test "$NOTRUNNING" = "0"; then
echo "already running"
else
$pdns_server --daemon=no --guardian=no --control-console --loglevel=9
fi
;;
dump)
if test "$NOTRUNNING" = "0"; then
doPC list
echo $ret
else
echo "not running"
fi
;;
show)
if [ $# -lt 2 ]; then
echo Insufficient parameters
exit
fi
if test "$NOTRUNNING" = "0"; then
echo -n "$2="
doPC show $2 ; echo $ret
else
echo "not running"
fi
;;
mrtg)
if [ $# -lt 2 ]; then
echo Insufficient parameters
exit
fi
if test "$NOTRUNNING" = "0"; then
doPC show $2 ; echo $ret
if [ "$3x" != "x" ]; then
doPC show $3 ; echo $ret
else
echo 0
fi
doPC uptime ; echo $ret
echo PowerDNS daemon
else
echo "not running"
fi
;;
cricket)
if [ $# -lt 2 ]; then
echo Insufficient parameters
exit
fi
if test "$NOTRUNNING" = "0"; then
doPC show $2 ; echo $ret
else
echo "not running"
fi
;;
*)
echo pdns [start\|stop\|force-reload\|restart\|status\|dump\|show\|mrtg\|cricket\|monitor]
;;
esac
exit 0
/etc/default/pdns
mailjail:/etc/powerdns/pdns.d# more /etc/default/pdns
# Variables for PowerDNS
#
# Whether you want to start PowerDNS automatically.
START=yes
# If you have resolvconf installed, you can enable the following to have
# resolvconf update an recursor line in the pdns config, as determined by
# resolvconf.
RESOLVCONF_UPDATE_FORWARDERS=no
Comments [0]