[Pdns-users] Pipe backend problems with MX NS and SOA

Shawn Moore smmoore at stormpoint.com
Thu Dec 14 14:02:51 UTC 2006


Bert,

    Here is the whole script.  I did get the soa working I believe
last night.  The only things that don't seem to work is NS and MX.  If
you query the MX for test.test.com instead of test.com it works fine
though.  It did need the tab after the prio or it would terminate.

Regards,

Shawn

----- START SCRIPT -----
#!/usr/bin/perl -w

use strict;

$|=1;           # no buffering

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

unless($line eq "HELO\t1") {
        print "FAIL\n";
        <>;
        exit;
}

print "OK       Sample backend firing up\n";    # print our banner

while(<>)
{
        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($ip eq "127.0.0.1") {
                if(($qtype eq "SOA") && $qname eq "test.com") {
                        print "DATA     $qname  $qclass SOA     3600
 -1      dns.test.com. help.test.com. 1 10800 3600 604800 3600\n";
                }
                elsif(($qtype eq "A" || $qtype eq "ANY") && $qname eq
"test.com") {
                        print "DATA     $qname  $qclass A       3600
 -1      1.2.3.1\n";
                }
                elsif(($qtype eq "A" || $qtype eq "ANY") && $qname eq
"a.test.com") {
                        print "DATA     $qname  $qclass A       3600
 -1      1.2.3.1\n";
                }
                elsif(($qtype eq "A" || $qtype eq "ANY") && $qname eq
"b.test.com") {
                        print "DATA     $qname  $qclass A       3600
 -1      1.2.3.2\n";
                }
                elsif(($qtype eq "A" || $qtype eq "ANY") && $qname eq
"c.test.com") {
                        print "DATA     $qname  $qclass A       3600
 -1      1.2.3.3\n";
                }
                elsif(($qtype eq "CNAME" || $qtype eq "ANY") && $qname
eq "aa.test.com") {
                        print "DATA     $qname  $qclass CNAME   3600
 -1      a.test.com\n";
                }
                elsif(($qtype eq "CNAME" || $qtype eq "ANY") && $qname
eq "bb.test.com") {
                        print "DATA     $qname  $qclass CNAME   3600
 -1      b.test.com\n";
                }
                elsif(($qtype eq "CNAME" || $qtype eq "ANY") && $qname
eq "cc.test.com") {
                        print "DATA     $qname  $qclass CNAME   3600
 -1      c.test.com\n";
                }
                elsif(($qtype eq "CNAME" || $qtype eq "ANY") && $qname
eq "dns.test.com") {
                        print "DATA     $qname  $qclass CNAME   3600
 -1      a.test.com\n";
                }
                elsif(($qtype eq "PTR" || $qtype eq "ANY") && $qname
eq "1.3.2.1.in-addr.arpa") {
                        print "DATA     $qname  $qclass PTR     3600
 -1      a.test.com\n";
                }
                elsif(($qtype eq "NS" || $qtype eq "ANY") && $qname eq
"test.com") {
                        print "DATA     $qname  $qclass NS      3600
 -1      dns.test.com\n";
                }
                elsif(($qtype eq "MX" || $qtype eq "ANY") && $qname eq
"test.com") {
                        print "DATA     $qname  $qclass MX      3600
 -1      5       a.test.com\n";
                }
                elsif(($qtype eq "MX" || $qtype eq "ANY") && $qname eq
"test.test.com") {
                        print "DATA     $qname  $qclass MX      3600
 -1      5       c.test.com\n";
                }
        }
        print "END\n";
}
----- STOP  SCRIPT -----

On 12/14/06, bert hubert <bert.hubert at netherlabs.nl> wrote:
> On Wed, Dec 13, 2006 at 05:13:30PM -0500, Shawn Moore wrote:
> > can't seem to get MX and NS working for just the domain test.com.
> > A/PTR/CNAME all work.  MX works if you query x.test.com, but not
> > test.com.  NS does not seem to work at all.  I'm wondering if it has
> > something to do with not having SOA, but I can't seem to find any
> > examples on getting SOA in the perl file so any help on that would be
> > appreciated as well.
>
> Shawn,
>
> The script below is not complete, so I can't test. Can you check without a
> tab character between the MX priority. Also, you really to need to implement
> a SOA record (somewhere)!
>
> Bert
>
> >
> > Regards,
> >
> > Shawn
> >
> > ----- START SCRIPT -----
> >                if(($qtype eq "A" || $qtype eq "ANY") && $qname eq
> >                "test.com") {
> >                        print "DATA     $qname  $qclass A       3600
> > -1      1.2.3.4\n";
> >                }
> >                elsif(($qtype eq "PTR" || $qtype eq "ANY") && $qname
> > eq "4.3.2.1.in-addr.arpa") {
> >                        print "DATA     $qname  $qclass PTR     3600
> > -1      test.com\n";
> >                }
> >                elsif(($qtype eq "MX" || $qtype eq "ANY") && $qname eq
> > "test.com") {
> >                        print "DATA     $qname  $qclass MX      3600
> > -1      15      mail1.test.com\n";
> >                }
> >                elsif(($qtype eq "MX" || $qtype eq "ANY") && $qname eq
> > "x.test.com") {
> >                        print "DATA     $qname  $qclass MX      3600
> > -1      5       x.test.com\n";
> >                }
> >                elsif($qtype eq "NS") {
> >                        print "DATA     $qname  $qclass NS      3600
> > -1      dns.test.com\n";
> >                }
> > ----- STOP SCRIPT -----
> > _______________________________________________
> > Pdns-users mailing list
> > Pdns-users at mailman.powerdns.com
> > http://mailman.powerdns.com/mailman/listinfo/pdns-users
> >
> >
> > !DSPAM:45807b1b225241410093335!
>
> --
> http://www.PowerDNS.com      Open source, database driven DNS Software
> http://netherlabs.nl              Open and Closed source services
>


More information about the Pdns-users mailing list