Changeset 2197 for trunk/packages


Ignore:
Timestamp:
Feb 27, 2009, 2:41:51 AM (15 years ago)
Author:
quentin
Message:

Reverse-resolution support in invirt-dns

Location:
trunk/packages
Files:
4 edited

Legend:

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

    r2037 r2197  
     1invirt-dns (0.0.10) unstable; urgency=low
     2
     3  * Add support for resolving PTR records in the in-addr.arpa zone
     4
     5 -- Quentin Smith <quentin@mit.edu>  Fri, 27 Feb 2009 02:39:25 -0500
     6
    17invirt-dns (0.0.9) unstable; urgency=low
    28
  • trunk/packages/invirt-dns/invirt-dns

    r2037 r2197  
    9494                                                ttl, self.soa, auth=True))
    9595            else: # Request for a subdomain.
    96                 value = invirt.database.NIC.query.filter_by(hostname=host).first()
    97                 if value:
    98                     ip = value.ip
    99                 else:
    100                     value = invirt.database.Machine.query().filter_by(name=host).first()
     96                if name.endswith(".in-addr.arpa"): # Reverse resolution here
     97                    if type in (dns.PTR, dns.ALL_RECORDS):
     98                        ip = '.'.join(reversed(name.split('.')[:-2]))
     99                        value = invirt.database.NIC.query.filter_by(ip=ip).first()
     100                        if value and value.hostname:
     101                            hostname = value.hostname
     102                            if '.' not in hostname:
     103                                hostname = hostname + "." + config.dns.domains[0]
     104                            record = dns.Record_PTR(hostname, ttl)
     105                            results.append(dns.RRHeader(name, dns.PTR, dns.IN,
     106                                                        ttl, record, auth=True))
     107                        else: # IP address doesn't point to an active host
     108                            return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
     109                    # FIXME: Should only return success with no records if the name actually exists
     110                else: # Forward resolution here
     111                    value = invirt.database.NIC.query.filter_by(hostname=host).first()
    101112                    if value:
    102                         ip = value.nics[0].ip
     113                        ip = value.ip
    103114                    else:
     115                        value = invirt.database.Machine.query().filter_by(name=host).first()
     116                        if value:
     117                            ip = value.nics[0].ip
     118                        else:
     119                            return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
     120               
     121                    if ip is None:
    104122                        return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
    105                
    106                 if ip is None:
    107                     return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
    108 
    109                 if type in (dns.A, dns.ALL_RECORDS):
    110                     record = dns.Record_A(ip, ttl)
    111                     results.append(dns.RRHeader(name, dns.A, dns.IN,
    112                                                 ttl, record, auth=True))
    113                 elif type == dns.SOA:
    114                     results.append(dns.RRHeader(domain, dns.SOA, dns.IN,
    115                                                 ttl, self.soa, auth=True))
     123
     124                    if type in (dns.A, dns.ALL_RECORDS):
     125                        record = dns.Record_A(ip, ttl)
     126                        results.append(dns.RRHeader(name, dns.A, dns.IN,
     127                                                    ttl, record, auth=True))
     128                    elif type == dns.SOA:
     129                        results.append(dns.RRHeader(domain, dns.SOA, dns.IN,
     130                                                    ttl, self.soa, auth=True))
    116131            if len(results) == 0:
    117132                authority = []
  • trunk/packages/xvm-devconfig/debian/changelog

    r2195 r2197  
    11xvm-devconfig (0.29) unstable; urgency=low
    22
    3   * Act authoritative for 2.181.18.in-addr.arpa
     3  * Act authoritative for {1,2}.181.18.in-addr.arpa
    44
    55 -- Quentin Smith <quentin@mit.edu>  Fri, 27 Feb 2009 02:20:58 -0500
  • trunk/packages/xvm-devconfig/master.yaml

    r2195 r2197  
    3737  - dev.xvm.mit.edu
    3838  - 2.181.18.in-addr.arpa
     39  - 1.181.18.in-addr.arpa
    3940 nameservers:
    4041  - hostname: xvm-dev.mit.edu
Note: See TracChangeset for help on using the changeset viewer.