Changeset 1477 for trunk


Ignore:
Timestamp:
Nov 1, 2008, 12:53:20 AM (16 years ago)
Author:
broder
Message:

Add support for DNS zone files that take precedence over the database

Location:
trunk/packages/invirt-dns
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-dns/debian/changelog

    r1467 r1477  
     1invirt-dns (0.0.5) unstable; urgency=low
     2
     3  * Instead of hacking in support for prod.xvm.mit.edu, support zone files
     4    that override the database
     5
     6 -- Evan Broder <broder@mit.edu>  Sat, 01 Nov 2008 00:48:53 -0400
     7
    18invirt-dns (0.0.4) unstable; urgency=low
    29
  • trunk/packages/invirt-dns/invirt-dns

    r1464 r1477  
    44from twisted.names import dns
    55from twisted.names import common
     6from twisted.names import authority
    67from twisted.internet import defer
    78from twisted.python import failure
     
    5758        ttl = 900
    5859        name = name.lower()
    59 
    60         # XXX hack for the transition to two separate dev/prod clusters
    61         if 'dev.xvm.mit.edu' in self.domains and name.endswith('prod.xvm.mit.edu'):
    62             # import time, sys
    63             # print time.localtime(), 'handling prod request', name
    64             # sys.stdout.flush()
    65 
    66             # Point the client in the right direction for prod requests.
    67             authority = dns.RRHeader('prod.xvm.mit.edu', dns.NS, dns.IN, 3600,
    68                     dns.Record_NS(name='ns1.prod.xvm.mit.edu', ttl=3600), auth=True)
    69             additional = dns.RRHeader('ns1.prod.xvm.mit.edu', dns.A, dns.IN, 3600,
    70                     dns.Record_A(address='18.181.0.221', ttl=3600), auth=True)
    71             return defer.succeed(([], [authority], [additional]))
    7260
    7361        if name in self.domains:
     
    133121
    134122if '__main__' == __name__:
    135     resolver = DatabaseAuthority()
     123    resolvers = []
     124    for zone in config.dns.zone_files:
     125        for origin in config.dns.domains:
     126            r = authority.BindAuthority(zone)
     127            # This sucks, but if I want a generic zone file, I have to
     128            # reload the information by hand
     129            r.origin = origin
     130            lines = open(zone).readlines()
     131            lines = r.collapseContinuations(r.stripComments(lines))
     132            r.parseLines(lines)
     133           
     134            resolvers.append(r)
     135    resolvers.append(DatabaseAuthority())
    136136
    137137    verbosity = 0
    138     f = server.DNSServerFactory(authorities=[resolver], verbose=verbosity)
     138    f = server.DNSServerFactory(authorities=resolvers, verbose=verbosity)
    139139    p = dns.DNSDatagramProtocol(f)
    140140    f.noisy = p.noisy = verbosity
Note: See TracChangeset for help on using the changeset viewer.