update bind via net::dns

update bind via net::dns

am 31.08.2010 12:19:27 von Andreas Moroder

Hello,

I would like to update the bind nameserver via a perl script.
Named is running on the same machine I start the script.
I copied the key from

named.conf
key DHCP_UPDATER {
algorithm HMAC-MD5.SIG-ALG.REG.INT;
secret mykeyishere;
};

inserted it into my script and run it.
I always get
"Update error code: REFUSED"

Can anyone please tell me what is wrong with this script ?

Thanks
Andreas

# -----------------------------------

use Net::DNS;

$key_name = "tsig-key";
$key = 'mykeyishere';
$tsig = Net::DNS::RR->new("$key_name TSIG $key");

#$tsig->fudge(60);


$update = new Net::DNS::Update('sb-brixen.it');
$update->push(update => rr_add('testserver.sb-brixen.it A 10.53.4.2'));

$update->sign_tsig($key_name, $key);

$res = new Net::DNS::Resolver;

$reply = $res->send($update);

$reply || die ("Update failed: " . $res->errorstring);

if ($reply->header->rcode eq "NOERROR") {
print "Update successful\n";
} else {
print "Update error code: " . $reply->header->rcode . "\n";
}


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: update bind via net::dns ( NOT resolved )

am 31.08.2010 12:29:58 von Andreas Moroder

Hello,

I made the following modification to the script

$res = new Net::DNS::Resolver(nameservers => [qw(127.0.0.1)]);

and now I get

Update error code: NOTAUTH.

This now looks really like a authorization problem, but, as I wrote, I
got the key from named.conf.

Bye
Andreas


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: update bind via net::dns

am 31.08.2010 13:23:39 von Jeff Peng

2010/8/31 Andreas Moroder :
> Hello,
>
> I would like to update the bind nameserver via a perl script.
> Named is running on the same machine I start the script.
> I copied the key from
>
> named.conf
> key DHCP_UPDATER {
> =A0algorithm HMAC-MD5.SIG-ALG.REG.INT;
> =A0secret mykeyishere;
> };
>
> inserted it into my script and run it.
> I always get
> "Update error code: REFUSED"
>

This is most likely a DNS updating problem rather than the perl problem.
Please send the question to Bind's mailing list.
https://lists.isc.org/mailman/listinfo

--=20
Jeff Peng
Web: http://home.arcor.de/pangj/
Blog: http://squidcn.spaces.live.com/

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/