I'll have look at my pipe back end source code tomorrow to be sure, but two 
thing s come to mind - the fields in the "DATA" response have to be separated 
by single tabs, not spaces, and I believe the "-1" on the response is actually 
supposed to match the I'd field in the query.

It's also possible that the pipe backend will not get any other queries if it 
does not respond correctly to an SOA query.

--
Dan Campbell

On Aug 16, 2013, at 5:39 PM, p...@nodice.us wrote:

> Hello everyone. I'm having a problem using the Pipe backend.
> 
> What I'm trying to do is have all queries that come in get answered with a 
> specific ip. To do this, I'm trying out the Pipe backend using a basic perl 
> script.
> 
> pdns.conf (authritative server version 3.3):
> launch=pipe
> pipe-command=/etc/pdns/example.pl
> local-address=127.0.0.1
> default-soa-name=billy.com
> 
> -----------------------------
> perl script:
> #!/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    $qname    $qclass    A    3600    -1    
> 192.168.1.69\n";
>     }
> 
>     print STDERR "$$ End of data\n";
>     print "END\n";
> }
> 
> 
> -----------------------------
> pdns monitor:
> Aug 16 17:30:48 Remote 127.0.0.1 wants 'billy.com|A', do = 0, bufsize = 512: 
> packetcache MISS
> 29715 Received: Q    billy.com    IN    SOA    -1    127.0.0.1
> 29715 End of data
> 
> Looks like it queries for an SOA record first, doesn't find anything and just 
> returns an empty response. I tried adding default-soa-name in the conf, but 
> that doesn't seem to work as I anticipated either.
> 
> Any help would be appreciated.
> 
> Thanks,
> 
> Billy
> 
> _______________________________________________
> Pdns-users mailing list
> Pdns-users@mailman.powerdns.com
> http://mailman.powerdns.com/mailman/listinfo/pdns-users
_______________________________________________
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users

Reply via email to