[Pdns-users] Help with Pipe Backend

flair0303 pdns at nodice.us
Tue Aug 20 20:45:08 UTC 2013


Thank guys. I finally got it working on pdns v3.3. For the curious, here's
the perl script that works:

#!/usr/bin/perl

use warnings;
use strict;

$|=1;					# no buffering

my $line=<>;
chomp($line);

unless($line eq "HELO\t1") {
	print "FAIL\n";
	print STDERR "Received '$line'\n";
	<>;
	exit;
}
print "OK	Pipe backend firing up\n";	# print our banner

while(<>)
{
	print STDERR "$$ Received: $_";
	chomp();
	my @arr=split(/\t/);
	if(@arr<6) {
		print "LOG	PowerDNS sent unparseable line\n";
		print "FAIL\n";
		next;
	}

	my ($type,$qname,$qclass,$qtype,$id,$ip)=split(/\t/);

	if ($qtype eq "A" || $qtype eq "ANY") {
		print STDERR "$$ Sent A records\n";
		print "DATA\t$qname\t$qclass\tA\t3600\t-1\t192.168.1.69\n";
	}
        elsif($qtype eq "SOA") {
		print
"DATA\t$qname\t$qtype\t86400\t-1\tns1.domain.com.\thostmaster.domain.com.\t0\t10800\t3600\t604800\t3600\n";
        }

	print STDERR "$$ End of data\n";
	print "END\n";
}



--
View this message in context: http://powerdns.13854.n7.nabble.com/Help-with-Pipe-Backend-tp10264p10283.html
Sent from the PowerDNS mailing list archive at Nabble.com.




More information about the Pdns-users mailing list