update bind via net::dns
am 31.08.2010 12:19:27 von Andreas MoroderHello,
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/