# nsupdate and GSS API

## JadedDragoon

Ok... I've been on a compile-configure-research-hairpull-scream-research-compile-configure marathon for going on 3 weeks now.  So my brain is officially mush.  Bear with me.

Little background... trying to build myself a swanky new home server after 5+ years away from Gentoo (think 2005.1 was the livecd back then).  Always loved the idea of gentoo... ultimately didn't have time in my busy life to fight with some of it's eccentricities.

So instead my home server has been sitting quietly in a corner running Win 2003 Server for the last 5 years... think I've restarted it like twice... so not too shabby.  Logged into it maybe a dozen other times and the rest it has just done what i needed and done it quietly.

In the process though I set up Active Directory.  Well... now I'm spoiled.  The only problem I've had throughout with Win Server (the fact that my home server is literally made out of an 8 year old collection of spare parts and thus aint got any kind of power at all) has finally driven me back to it... and since I've got the time to tinker with gentoo again... I'm going to.

Other than the usual quirks everything has gone smoothly.  Lot of re-learning... lot of files that aren't where I remember them being (and that was still baselayout1) and lot of new toys and tools.  And more over a lot of fun learning and tinkering along with the occasional near-psychotic "WHY THE **** ISN'T IT WORKING.... oh... how'd I miss that?"

All of it has been building to one (hopefully) crowning achievement.  A Samba4 Active Directory installation to truly (at least for my level of needs) replace my Windows 2003 Server Active Directory and finnally integrate my *nix and Windows domains.  Well I had to download Samba4 from git (portage seems to think ill of samba4 users) but I got it and compiled it.  At this moment Samba4(.0.0alpha14-GIT-9f6f1b0) is installed, provisioned, running, and by all accounts working fine.

But I happened to look in samba's logs and noted this line:

```
/usr/local/samba/sbin/samba_dnsupdate: /usr/bin/nsupdate: cannot specify -g     or -o, program not linked with GSS API Library
```

before you say it... that's not a samba error... it's an nsupdate error.  Seen here the same error produced at the command line:

```
Damascus ~ # nsupdate -g

nsupdate: cannot specify -g     or -o, program not linked with GSS API Library
```

nsupdate works fine (as long as no -g or -o options are provided).  named is humming along fine (complete with dynamic dns).  and samba... despite clearly having an issue (with preforming dns updates)... has not complained.

but when i try to use nsupdate to publish dns updates via GSS, nsupdate curiously complains that it wasn't taught how.

Strange seeing as bind was compiled with the "gssapi" use flag... oh wait... that's right... nsupdate comes from bind-tools in gentoo... not bind.

Worse when I dutifully popped open firefox to google for the all-knowing linux communities thoughts on whatever I had done wrong this time I found NOTHING!  Not even a sideways mention of nsupdate and GSS on the same page.  If I were to go by the internet's responce to the last 3 hours of searches I would swear nsupdate doesnt have anything to do with GSS... except then what the hell is -g and -o switches for and why does the error output specifically mention it?

And there you have my problem.  Bind-tools does not support the "gssapi" use flag even though bind does and they are (in reality) compiled from the same tarball.  And apparently (as an occupational hazard of playing with alpha programs) I have managed to discover a problem all of the internets are completely unaware of.  

I suppose I could do with bind what I did with samba... --unmerge bind and bind-tools, preserving my conf and zone files,  emerge --fetchonly bind to get the tarball and then manually compile and configure it as needed followed by a little entry in /etc/portage/profile/package.provided.  But id rather not.  Samba4 is still so alpha it should cry "Let there be light!" to the console every time its launched... but bind?  Bind9 is what... 10 years old now?  Come on!

And so I find myself in need of an elegant solution to the final (for now) problem between me and the ultimate goal of 3 weeks worth of work.  Gentoo community don't fail me now!

So should I look at making a custom bind-tools ebuild and sticking it in an overlay for my personal use or? is there something better... or perhaps something I'm missing all together?Last edited by JadedDragoon on Tue Dec 07, 2010 5:02 am; edited 1 time in total

----------

## JadedDragoon

?SOLUTION? (for now):

I created a local portage overlay and copied /usr/portage/net-dns/bind-tools/* to it, removed all the ebuilds except the latest one (I have bind-tools-9.7.2_p2-r2 unmasked), modified it to match /usr/portage/net-dns/bind/bind-9.7.2_p3-r1.ebuild in respects to the gssapi use flag (three small edits... both ebuilds use the same tarbal and ./configure script and so take the same flags in the same way... basically needed the --with-gssapi flag), rebuilt the digest for the modified ebuild, and then re-emerged bind-utils.

no errors during build... and appears to have solved the (then-current) problem.

```
Damascus ~ # nsupdate -g

>
```

As you can see that problem is now gone.  

However, a new one has arisen...

```
Damascus sbin # ./samba_dnsupdate

/usr/bin/nsupdate: cannot specify -g    or -o, program not linked with GSS API Library

/usr/bin/nsupdate: cannot specify -g    or -o, program not linked with GSS API Library

Failed update of 2 entries
```

has now become:

```
Damascus sbin # ./samba_dnsupdate

nsupdate: Failed to generate random block

nsupdate: Failed to generate random block

Failed update of 2 entries
```

seems I jinxed myself with that "for now" crack... but as this is a different problem I'd say that the original problem is most likely solved.

I'll do research to confirm this new problem is truely unrelated... and not a result of my modifications... if true in both cases I'll be looking to post a bug report...

relevant portions of modified ebuild... with double-commented changes:

```
# Copyright 1999-2010 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/net-dns/bind-tools/bind-tools-9.7.2_p2-r2.ebuild,v 1.1 2010/11/14 19:07:03 idl0r Exp $

EAPI="3"

inherit eutils autotools flag-o-matic

MY_PN=${PN//-tools}

MY_PV=${PV/_p/-P}

MY_P="${MY_PN}-${MY_PV}"

DESCRIPTION="bind tools: dig, nslookup, host, nsupdate, dnssec-keygen"

HOMEPAGE="http://www.isc.org/software/bind"

SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz"

LICENSE="as-is"

SLOT="0"

KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"

## Added gssapi use flag

IUSE="doc idn ipv6 ssl urandom xml gssapi"

## Added "gssapi? ( virtual/krb5 )" to cover dependancies for gssapi use flag

DEPEND="ssl? ( dev-libs/openssl )

        xml? ( dev-libs/libxml2 )

        idn? (

                || ( sys-libs/glibc dev-libs/libiconv )

                net-dns/idnkit

                )

        gssapi? ( virtual/krb5 )"

RDEPEND="${DEPEND}"

S="${WORKDIR}/${MY_P}"

src_prepare() {

        # bug 122597

        use idn && {

                cd "${S}"/contrib/idn/idnkit-1.0-src

                epatch "${FILESDIR}"/${PN}-configure.patch

                cd "${S}"

        }

        # bug 231247

        epatch "${FILESDIR}"/${PN}-9.5.0_p1-lwconfig.patch

        eautoreconf

}

src_configure() {

        local myconf=

        has_version sys-libs/glibc || myconf="${myconf} --with-iconv"

        if use urandom; then

                myconf="${myconf} --with-randomdev=/dev/urandom"

        else

                myconf="${myconf} --with-randomdev=/dev/random"

        fi

        # bug 344029

        append-cflags "-DDIG_SIGCHASE"

## Added the business end of the use flag "$(use_with gssapi)"... passes --with-gssapi to ./configure

        econf \

                $(use_enable ipv6) \

                $(use_with idn) \

                $(use_with ssl openssl) \

                $(use_with xml libxml2) \

                $(use_with gssapi) \

                ${myconf}

        # bug #151839

        echo '#undef SO_BSDCOMPAT' >> config.h

}

## The rest of the file is the same

```

----------

