Mail archive
alpine-devel

Re: [alpine-devel] how do I get axfrdns (djbdns) going in Alpine?

From: Timo Teräs <timo.teras_at_iki.fi>
Date: Sat, 14 Nov 2009 10:24:21 +0200

MarkSeymour_at_GuildAssociates.com wrote:
> Hello alpine-devel's, and thank you for Alpine Linux! I am a longtime
> user of LEAF and its predecessor LRP, so I was excited to find Alpine,
> as I've wanted to get away from floppy disk storage of configs for a
> long time now.
>
> I have Shorewall configured to my liking, as well as Tinydns, but now I
> want to be able to provide axfr responses to non - djb slave dns
> servers, and I would like to log queries. I have not found any
> documentation on how to do this with Alpine. Any help would be greatly
> appreciated.
>
> I have added the package djbdns-1.05-r32, which contains axfrdns, but I
> don't know where to go from there. Do I follow the Bernstein
> instructions at http://cr.yp.to/djbdns/axfrdns-conf.html , including
> creating 'acct' and 'logacct'? I assume not, since I don't see a
> daemontools package available to give me multilog. I'd be happy to rtfm
> if I could find the fm ;)
>
> Alternatively, I'll consider using BIND since you have it available....

I have axfrdns running on an Alpine 1.8 based box. It uses tcpserver from
ucspi-tcp package. I attached the init.d script I'm using. Something like
this should be added to djbdns package.

- Timo


#!/sbin/runscript
# control an instance of axfrdns
# written for alpine linux - NBA May 2009


# -- Statrup variables
UID=$( grep tinydns /etc/passwd | cut -f3 -d: )
GID=$( grep tinydns /etc/group | cut -f3 -d: )
PORT=${PORT:-53}
HOST=${HOST:$(hostname)}
DAEMON=/usr/bin/axfrdns
SUPERSERVER=/usr/bin/tcpserver

IFACE="${SVCNAME#*.}"
if [ -n "$IFACE" ] && [ "${SVCNAME}" != "tinydns" ]; then
        ROOT=${ROOT:-/var/cache/tinydns.$IFACE}
        VARRUN=${VARRUN:-/var/run/axfrdns.$IFACE}
else
        ROOT=${ROOT:-/var/cache/tinydns}
        VARRUN=${VARRUN:-/var/run/axfrdns}
fi


#-----------------------------------------------------------------
# Main program
start() {

        ebegin "Starting axfrdns"
        if [ -z "$UID" ] || [ -z "$GID" ]; then
                eend 1 "tinydns user or group missing"
                return 1
        fi
        
        # if its already running, just report it is
        if [ -e ${VARRUN}.pid ] && [ -d /proc/$( cat ${VARRUN}.pid ) ]; then
                eend 0
                return 0
        fi

        if [ -z "$IP" ]; then
                eend 1 "IP is not specified in /etc/conf.d/$SVCNAME"
                return 1
        fi
        
        (
                export UID GID ROOT AXFR
                echo $SUPERSERVER -HR -l $HOST $IP $PORT $DAEMON
                $SUPERSERVER -HR -l $HOST $IP $PORT $DAEMON >/dev/null 2>/dev/null &
                pid=$!
                sleep 1
                # Check if its still running
                if ! [ -d /proc/$pid ]; then
                # rm ${VARRUN}.pid
                # $SUPERSERVER -HR -l $HOST $IP $PORT $DAEMON >/dev/null 2>/dev/null &
                        return 1
                fi
                echo $pid > ${VARRUN}.pid
        )
        eend $?
        return 0
}

stop() {
        ebegin "Stopping axfrdns"
        start-stop-daemon --stop -m --pidfile ${VARRUN}.pid --oknodo \
                --exec $SUPERSERVER && rm ${VARRUN}.pid
        eend $?
}




---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Sat Nov 14 2009 - 10:24:21 UTC