Xc0@@sR ddklZddkZddkZddkZddklZddklZl Z l Z ddkl Z ddk l Z lZlZlZlZlZlZddkTddklZlZdd klZlZlZlZlZlZlZlZl Z l!Z!l"Z"dd k#l$Z$l%Z%l&Z&ed Z'd d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-f"Z(d.Z)d/d0fZ*d1fZ+d2d3d4fZ,gZ-e(D]Z.e-e/d5e.i0q[-Z1d6d7d8d9fZ2d:Z3d;Z4d<Z5e6d=Z7d>Z8d?Z9d@Z:dAZ;dBZ<e=dCZ>dDZ?dEZ@dFZAdGZBdHZCdIZDdJZEdKZFe6dLZGeHeHdMZIeHeHdNZJdOefdPYZKdQeKfdRYZLdSeLfdTYZMdUeKfdVYZNdWeLfdXYZOdYeKfdZYZPd[eKfd\YZQd]eKfd^YZRd_eKfd`YZSdaeKfdbYZTdceKfddYZUdeeKfdfYZVdgeKfdhYZWdieKfdjYZXdkeKfdlYZYdmeKfdnYZZdoeKfdpYZ[dqeKfdrYZ\dseKfdtYZ]dueKfdvYZ^dweKfdxYZ_dyeKfdzYZ`d{eKfd|YZad}eKfd~YZbdZcdeKfdYZddeKfdYZedeKfdYZfdZgdeKfdYZhdZideKfdYZjdeKfdYZkdejfdYZldeKfdYZmdeKfdYZndeKfdYZodeKfdYZpdeKfdYZqeMeOeNePeQeReSeTeUeVeWeXeYe[eZe\e]e^ede_e`eaebeeelefejekehemeneoepeqf"ZrdZsetesZuetderDZvdZwdZxdZyeddedfZzde{fdYZ|ei}e|de~fdYZei}edefdYZei}edefdYZei}edefdYZei}edefdYZei}edefdYZei}edefdYZei}edefdYZei}edefdYZei}ede{fdYZei}ede~fdYZei}edefdYZei}edefdYZei}edefdYZei}edefdYZei}edefdYZei}ede fdYZei}ede fdYZei}ede{fdYZei}edefdYZei}edefdYZei}edS(i(tabsolute_importN(tcontext(tapiterrorstoutput(tCommand(tFlagtBooltInttDecimaltStrtStrEnumtAny(t*(t_tngettext( tvalidate_zonemgrtnormalize_zonemgrtnormalize_zonetvalidate_hostnametvalidate_dns_labeltvalidate_domain_namet"get_dns_forward_zone_update_policyt"get_dns_reverse_zone_update_policytget_reverse_zone_defaulttzone_is_reversetREVERSE_DNS_ZONES(tvalid_iptCheckedIPAddresstis_host_resolvables Domain Name System (DNS) Manage DNS zone and resource records. USING STRUCTURED PER-TYPE OPTIONS There are many structured DNS RR types where DNS data stored in LDAP server is not just a scalar value, for example an IP address or a domain name, but a data structure which may be often complex. A good example is a LOC record [RFC1876] which consists of many mandatory and optional parts (degrees, minutes, seconds of latitude and longitude, altitude or precision). It may be difficult to manipulate such DNS records without making a mistake and entering an invalid value. DNS module provides an abstraction over these raw records and allows to manipulate each RR type with specific options. For each supported RR type, DNS module provides a standard option to manipulate a raw records with format ---rec, e.g. --mx-rec, and special options for every part of the RR structure with format ---, e.g. --mx-preference and --mx-exchanger. When adding a record, either RR specific options or standard option for a raw value can be used, they just should not be combined in one add operation. When modifying an existing entry, new RR specific options can be used to change one part of a DNS record, where the standard option for raw value is used to specify the modified value. The following example demonstrates a modification of MX record preference from 0 to 1 in a record without modifying the exchanger: ipa dnsrecord-mod --mx-rec="0 mx.example.com." --mx-preference=1 EXAMPLES: Add new zone: ipa dnszone-add example.com --name-server=ns \ --admin-email=admin@example.com \ --ip-address=10.0.0.1 Add system permission that can be used for per-zone privilege delegation: ipa dnszone-add-permission example.com Modify the zone to allow dynamic updates for hosts own records in realm EXAMPLE.COM: ipa dnszone-mod example.com --dynamic-update=TRUE This is the equivalent of: ipa dnszone-mod example.com --dynamic-update=TRUE \ --update-policy="grant EXAMPLE.COM krb5-self * A; grant EXAMPLE.COM krb5-self * AAAA; grant EXAMPLE.COM krb5-self * SSHFP;" Modify the zone to allow zone transfers for local network only: ipa dnszone-mod example.com --allow-transfer=10.0.0.0/8 Add new reverse zone specified by network IP address: ipa dnszone-add --name-from-ip=80.142.15.0/24 \ --name-server=ns.example.com. Add second nameserver for example.com: ipa dnsrecord-add example.com @ --ns-rec=nameserver2.example.com Add a mail server for example.com: ipa dnsrecord-add example.com @ --mx-rec="10 mail1" Add another record using MX record specific options: ipa dnsrecord-add example.com @ --mx-preference=20 --mx-exchanger=mail2 Add another record using interactive mode (started when dnsrecord-add, dnsrecord-mod, or dnsrecord-del are executed with no options): ipa dnsrecord-add example.com @ Please choose a type of DNS resource record to be added The most common types for this type of zone are: NS, MX, LOC DNS resource record type: MX MX Preference: 30 MX Exchanger: mail3 Record name: example.com MX record: 10 mail1, 20 mail2, 30 mail3 NS record: nameserver.example.com., nameserver2.example.com. Delete previously added nameserver from example.com: ipa dnsrecord-del example.com @ --ns-rec=nameserver2.example.com. Add LOC record for example.com: ipa dnsrecord-add example.com @ --loc-rec="49 11 42.4 N 16 36 29.6 E 227.64m" Add new A record for www.example.com. Create a reverse record in appropriate reverse zone as well. In this case a PTR record "2" pointing to www.example.com will be created in zone 15.142.80.in-addr.arpa. ipa dnsrecord-add example.com www --a-rec=80.142.15.2 --a-create-reverse Add new PTR record for www.example.com ipa dnsrecord-add 15.142.80.in-addr.arpa. 2 --ptr-rec=www.example.com. Add new SRV records for LDAP servers. Three quarters of the requests should go to fast.example.com, one quarter to slow.example.com. If neither is available, switch to backup.example.com. ipa dnsrecord-add example.com _ldap._tcp --srv-rec="0 3 389 fast.example.com" ipa dnsrecord-add example.com _ldap._tcp --srv-rec="0 1 389 slow.example.com" ipa dnsrecord-add example.com _ldap._tcp --srv-rec="1 1 389 backup.example.com" The interactive mode can be used for easy modification: ipa dnsrecord-mod example.com _ldap._tcp No option to modify specific record provided. Current DNS record contents: SRV record: 0 3 389 fast.example.com, 0 1 389 slow.example.com, 1 1 389 backup.example.com Modify SRV record '0 3 389 fast.example.com'? Yes/No (default No): Modify SRV record '0 1 389 slow.example.com'? Yes/No (default No): y SRV Priority [0]: (keep the default value) SRV Weight [1]: 2 (modified value) SRV Port [389]: (keep the default value) SRV Target [slow.example.com]: (keep the default value) 1 SRV record skipped. Only one value per DNS record type can be modified at one time. Record name: _ldap._tcp SRV record: 0 3 389 fast.example.com, 1 1 389 backup.example.com, 0 2 389 slow.example.com After this modification, three fifths of the requests should go to fast.example.com and two fifths to slow.example.com. An example of the interactive mode for dnsrecord-del command: ipa dnsrecord-del example.com www No option to delete specific record provided. Delete all? Yes/No (default No): (do not delete all records) Current DNS record contents: A record: 1.2.3.4, 11.22.33.44 Delete A record '1.2.3.4'? Yes/No (default No): Delete A record '11.22.33.44'? Yes/No (default No): y Record name: www A record: 1.2.3.4 (A record 11.22.33.44 has been deleted) Show zone example.com: ipa dnszone-show example.com Find zone with "example" in its domain name: ipa dnszone-find example Find records for resources with "www" in their name in zone example.com: ipa dnsrecord-find example.com www Find A records with value 10.10.0.1 in zone example.com ipa dnsrecord-find example.com --a-rec=10.10.0.1 Show records for resource www in zone example.com ipa dnsrecord-show example.com www Delegate zone sub.example to another nameserver: ipa dnsrecord-add example.com ns.sub --a-rec=10.0.100.5 ipa dnsrecord-add example.com sub --ns-rec=ns.sub.example.com. If global forwarder is configured, all requests to sub.example.com will be routed through the global forwarder. To change the behavior for example.com zone only and forward the request directly to ns.sub.example.com., global forwarding may be disabled per-zone: ipa dnszone-mod example.com --forward-policy=none Forward all requests for the zone external.com to another nameserver using a "first" policy (it will send the queries to the selected forwarder and if not answered it will use global resolvers): ipa dnszone-add external.com ipa dnszone-mod external.com --forwarder=10.20.0.1 \ --forward-policy=first Delete zone example.com with all resource records: ipa dnszone-del example.com Resolve a host name to see if it exists (will add default IPA domain if one is not included): ipa dns-resolve www.example.com ipa dns-resolve www GLOBAL DNS CONFIGURATION DNS configuration passed to command line install script is stored in a local configuration file on each IPA server where DNS service is configured. These local settings can be overridden with a common configuration stored in LDAP server: Show global DNS configuration: ipa dnsconfig-show Modify global DNS configuration and set a list of global forwarders: ipa dnsconfig-mod --forwarder=10.0.0.1 uAuAAAAuA6uAFSDBuAPLuCERTuCNAMEuDHCIDuDLVuDNAMEuDNSKEYuDSuHIPuIPSECKEYuKEYuKXuLOCuMXuNAPTRuNSuNSECuNSEC3u NSEC3PARAMuPTRuRRSIGuRPuSIGuSPFuSRVuSSHFPuTAuTKEYuTSIGuTXTu@tAtAAAAtPTRtNStMXtLOCs%srecorduINuCSuCHuHScC@s1yt|Wntj o}t|SXdS(N(Rt ValueErrortunicodetNone(tugettexttzonemgrte((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_rname_validators  cC@sttiS(s1 Generate serial number for zones. bind-dyndb-ldap expects unix time in to be used for SOA serial. SOA serial in a date format would also work, but it may be set to far future when many DNS updates are done per day (more than 100). Unix timestamp is more resilient to this issue. (tintttime(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_create_zone_serials cC@syti|Wntitfj onXtt|Sti|}|iii d}|i djodi |d|i dS|i djodi |d|i dSdSdS(Nt.iu.iii (tnetaddrt IPAddresstAddrFormatErrorR$R%Rt IPNetworktipt reverse_dnstsplittversiontjoint prefixlenR&(tnetstrtnettitems((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_reverse_zone_name sc C@sy^ti|dti}|dj o5|i|jo!tdtd|id|SnWn#titfj otdSXdS(NtflagssFinvalid IP address version (is %(value)d, must be %(required_value)d)!tvaluetrequired_valuesinvalid IP address format( R/R0t INET_PTONR&R6RtdictR1R$(R'tipaddrt ip_versionR3((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_validate_ipaddrs    cC@st||dS(Ni(RD(R'RB((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_validate_ip4addr)scC@st||dS(Ni(RD(R'RB((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_validate_ip6addr,scC@s@yti|}Wn&tittfj otdSXdS(Nsinvalid IP network format(R/R2R1R$tUnboundLocalErrorRR&(R'tipnetR:((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_validate_ipnet/s  c C@s|pdS|id}|do tdS|idx|D]}|djoqEn|ido|d }ny"t|d td td t}WqEtitfj o}t |St j otd SXqEWdS(Nt;is4each ACL element must be terminated with a semicolontanytnonet localhostt localnetst!it parse_netmaskt allow_networktallow_loopbackuinvalid address format(sanyRLRMRN( R5Rtpopt startswithRtTrueR/R1R$R%RG(R't bind_acistbind_aciR3R)((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_validate_bind_aci6s&     c C@s+|pdS|id}g}x|D]}|pq(n|djo|i|q(nd}|ido|d}d}nyit|d td td t}d |jod |i}nd}|id|t||fw(Wq(|i|q(q(Xq(Wdi|}|d7}|S(NRJRKRLRMRNtROiRPRQRRt/s/%su%s%s%su;(sanysnones localhosts localnets(R5tappendRTRRUR8tstrR7(RVt normalizedRWtprefixR3tnetmasktacis((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_normalize_bind_aciOs:         c C@s_|tjodSy t|dtdtd|Wn&tj o}tdt|SXdS(Nt check_fqdntallow_underscoret allow_slashsinvalid domain-name: %s(t_dns_zone_recordRtFalseRUR$RR%R&(R'R>RdR)((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_bind_hostname_validatorqs    cC@st||dtS(sU Validator for CNAME allows classless domain names (25/0.0.10.in-addr.arpa.) Rd(RgRU(R'R>((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_bind_cname_hostname_validator~scC@sR|tjodSytd|idWntj o}t|SXdS(NcS@st|dtdtS(RcRd(RRU(tlabel((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytsu.(RetmapR5R$R%(R'R>R)((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_dns_record_name_validators  cC@s|id\}}}t||}|dj o|S|oey7t|}|djp |djo tnWqtj otdtd|SXndS(Nu port iis%(port)s is not a valid porttport(t partitionRDR&R+R$RRA(R't forwardert ip_addresstsepRmtip_address_validation((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_validate_bind_forwarders  cC@sIy&t|}t|dt|Wntj o}t|SXdS(NRd(RRRR$R%(R'R>tnormalized_zoneR)((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_domain_name_validators  cC@s;yt|Wn&tj o}tdt|SXdS(Nsinvalid domain-name: %s(RR$RR%R&(R'R>R)((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_hostname_validators   cC@s"|ddjo |dS|SdS(sMake it fully-qualifiediR.N((t domain_name((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_normalize_hostnames cC@sti|}|idjotid|d|}n:|idjotid|d|}n td|ddjS( Nitdnsrecord_findtarecordit aaaarecordsInvalid address familytcounti(R/R0R6RRR$(tzonet str_addresstaddrtresult((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytis_forward_records cC@sti|}yl|idjotid||d|n;|idjotid||d|n tdWntij onXdS(Nit dnsrecord_addRziR{sInvalid address family(R/R0R6RRR$Rt EmptyModlist(R}tnameR~R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytadd_forward_recordsc C@sti|}t|i}|djopd}tidd}x|D]G}|dd}|i|o#t|t|jo |}qLqLWn|i djod|d}n#|i djod |d}n|ii d } d i | |}ytid |Wnt i j o d}nXt|djo)t i d tdtd|n|t| d } || fS(Nut dnszone_findRtidnsnameiiiii R.u.t dnszone_showtreasons2DNS reverse zone for IP address %(addr)s not foundRi(R/R0R%R4R&RRtendswithtlenR6R5R7RtNotFoundRRA( RBR8R3trevdnstrevzoneRR}tzonenametposR;trevname((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytget_reverse_zones2 )   c C@sytid|dWn;tij o,tidtdtd|nXt|ttfp |g}nxi|D]a}yt |dt }Wn3t j o'}ti d|dt |nX|oOt|t |o5tid td td t|d |q)n|oyd} |ip |i} nt|| \} } tid | d| } | ddjo5tid tdtd t|d| nWqtij oqXqqWdS(NRRRsDNS zone %(zone)s not foundR}t match_localRterrortmessageu;IP address %(ip)s is already assigned in domain %(domain)s.R3tdomainRyRR|iuMReverse record for IP address %(ip)s already exists in reverse zone %(zone)s.(RRRRRRAt isinstancettupletlistRRft ExceptiontValidationErrorR%RtDuplicateEntryR\R&t defaultnetR8R( t option_namethostRt ip_addressest check_forwardt check_reverseRpR3R)R8RRtreverse((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytadd_records_for_host_validations> ! #  '    'c C@st|ttfp |g}nx|D]}t|dt}|ot||t|n|oybd}|ip |i }nt ||\}} h|d|d6} t i d|| | Wqt ij oqXq*q*WdS(NRR.t ptrrecordR(RRRRRfRR%R&RR8RRRRR( RRRt add_forwardt add_reverseRpR3R8RRtaddkw((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytadd_records_for_hosts"   t DNSRecordcB@sMeZdZdZeZedZdZ edZ edZ edZ dZ dZdZdZeideefd eeffZdZdZdd Zd Zd Zed ZdZddZdZdZdZdZdZ dZ!dZ"ddZ#ddZ$e%dZ&dZ'dZ(RS(s %s records%s %ss&Comma-separated list of raw %s recordss %s Records(see RFC %s for details)s %s_part_%ss %s_extra_%ss%s_%st validatednst normalizednscO@s|itjo,tdt|iditfn|pd|ii}n|idd|ii|id|i|i|id|i|i|id|i |it |d <|i pd |d tvalues((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_get_part_values[s c@s-i|difd|DS(Nu c3@s?x8|]1}|dj otti|VqqWdS(N(R&RRt_convert_scalar(t.0tv(tindexR(s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys cs (t_validate_partsR7(RRR((RRs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_part_values_to_stringas c @stfdiD}tfd|D}td|DodS|oxt|D]y\}}|djo`i|ioOiiii|i f}t i di dt d|qkqkWn|S(Nc3@s2x+|]$}iii|ifVqWdS(N(tpart_name_formatRRR(Rtpart(R(s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys gs c3@s"x|]}i|VqWdS(N(tget(Rt part_name(R(s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys is cs@sx|]}|djVqWdS(N(R&(Rtval((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys ks RRs%'%s' is a required part of DNS record( RRtallt enumerateR&trequiredtcli_name_formatRRRRtConversionErrorR(RRt raise_on_nonet part_namestvalstval_idRR((RRs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytget_parts_from_kwfs &cC@sEt|t|ijo%tid|idtdndS(NRRsInvalid number of parts!(RRRRRR(RR((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRwscC@s@t|ttfo|i||Stt|i||S(N(RRRRRRR(RR>R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR|sc@s}io]t|ttfo tfd|D}qg|dj oi|f}qgntti|S(Nc3@s3x,|]%}|dj oi|VqqWdS(N(R&t_normalize_parts(RR(R(s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s ( RRRRR&RRRt normalize(RR>((Rs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs  c C@s|idjo|Sy|i|}|p|Sg}t|iD]8\}}|||dj o|i||ndqG~}g}t|iD] \}}||i||q~}|i|}Wntj onX|S(sO Normalize a DNS record value using normalizers for its parts. N(RR&RRRRR( RR>Rt_[1]tpart_idRtconverted_valuest_[2]t new_values((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRsN6c C@s^|ipdS|djodS|djodS|ip|d|iS|idjodS|i|}|p|ip|g}|iD]}||iiq~}|i od|i |i }nd}|dt ddi |d|S|iSnxLt |iD];\}}|i||} |i| } |i| qWdS(Ns;DNS RR type "%s" is not supported by bind-dyndb-ldap plugint RYs1format must be specified as "%(format)s" %(rfcs)stformattrfcs(RR&RRRRtformat_error_msgRtuppertrfct see_rfc_msgRAR7RRtconverttvalidate( RRR>RRRRRRR((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_rule_validatednss6       -    cC@s|i|ii|if}|i|ii|if}|i|it|if}|i|i}t |i ddg}|i p|i dn|i |d|d|dtd|d|d |iS( s All parts of DNSRecord need to be processed and modified before they can be added to global DNS API. For example a prefix need to be added before part name so that the name is unique in the global namespace. tdnsrecord_parttvirtual_attributetdnsrecord_optionalRRiRRR=thint(RRRRRtpart_label_formatR%RiRRR=RR[t clone_renameRf(RRRRRiRR=((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_convert_dnsrecord_parts  cC@s|i|ii|if}|i|ii|if}|i|it|if}|i|i}t |i ddg}|i |d|d|dt d|d|d|iS( s Parameters for special per-type behavior need to be processed in the same way as record parts in _convert_dnsrecord_part(). tdnsrecord_extraRRRiRRR=R( textra_name_formatRRRRRR%RiRRR=RRf(RtextraRRRiRR=((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_convert_dnsrecord_extras c@s5idjotStfdiDS(Nc3@s"x|]}i|VqWdS(N(R(RR(R(s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s (RR&R(R((Rs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt get_partssc@s5idjotStfdiDS(Nc3@s"x|]}i|VqWdS(N(R(RR(R(s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s (RR&R(R((Rs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt get_extrasc C@s|i|ii|if}|i|it|if}|i }xtoyJ|i i |d|d|}|i p |}n||||texc( tgetattrRRtdelattrRRfRURRt NonFatalErrorRRAR%( RRRR R R t rev_recordsRR)((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR^s  (RRRRRR R(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyREs     tARecordcB@s2eZdZdZedededfZRS(Ri RpRis IP Address(RRRRR RERR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRos tA6RecordcB@s8eZdZdZeddedfZdZRS(tA6i tdataRis Record datacC@s|fS(N((RR>((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs(RRRRR RRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR ys  t AAAARecordcB@s2eZdZdZedededfZRS(Ri RpRis IP Address(RRRRR RFRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR#s t AFSDBRecordcB@sSeZdZdZeddeddddded eded fZRS( tAFSDBissubtype?RitSubtypetminvalueitmaxvalueithostnametHostname( RRRRRRR RgR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR$s  t APLRecordcB@seZdZdZeZRS(tAPLi3 (RRRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR+st CERTRecordc B@seZdZdZeddeddddded ded dddded ded dddd eddedfZRS(tCERTi.ttypeRisCertificate TypeR'iR(itkey_tagsKey Tagt algorithmt Algorithmitcertificate_or_crlsCertificate/CRL(RRRRRRR R(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR-s        t CNAMERecordcB@s>eZdZdZedededdedfZRS(tCNAMEi R)RiR*Rs.A hostname which this alias hostname points to(RRRRR RhRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR4s  t DHCIDRecordcB@seZdZdZeZRS(tDHCIDi](RRRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR6st DLVRecordcB@seZdZdZeZRS(tDLViO(RRRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR8st DNAMERecordcB@s2eZdZdZedededfZRS(tDNAMEip ttargetRitTarget(RRRRR RhRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR:s t DNSKEYRecordcB@seZdZdZeZRS(tDNSKEYi(RRRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR>stDSRecordc B@seZdZdZeddeddddded ded dddd ed ded dddd eddedfZRS(tDSiR0RisKey TagR'iR(iR1R2it digest_types Digest TypetdigesttDigest(RRRRRRR R(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR@s        t HIPRecordcB@seZdZdZeZRS(tHIPiU(RRRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyREst KEYRecordc B@seZdZdZeddeddddded ded dddd ed ded dddd eddedfZRS(tKEYi R=RitFlagsR'iR(itprotocoltProtocoliR1R2t public_keys Public Key(RRRRRRR R(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRGs        tIPSECKEYRecordcB@seZdZdZeZRS(tIPSECKEYi(RRRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRMstKXRecordc B@skeZdZdZeddeddedddd d ed eded ded fZRS(tKXit preferenceRit PreferenceRsCPreference given to this exchanger. Lower values are more preferredR'iR(it exchangert Exchangers(A host willing to act as a key exchanger( RRRRRRR RgR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyROs    t LOCRecordcB@seZdZdZeddeddddded ded dddd ed ded ddddddeddeddd1eddedddddeddeddddd eddedddddddeddeddd2ed"ded#dd$dd%dd&ed'ded(dddd)dd&ed*ded+dddd)dd&ed,ded-dddd)dd&f Zed.Z d/Z d0Z RS(3R#iTtlat_degRisDegrees LatitudeR'iR(iZslat_min?sMinutes Latitudei;slat_sec?sSeconds Latitudes0.0s59.999t precisionitlat_dirsDirection LatitudeRuNuStlon_degsDegrees Longitudeislon_min?sMinutes Longitudeslon_sec?sSeconds Longitudetlon_dirsDirection LongitudeuEuWtaltitudetAltitudes -100000.00s 42849672.95issize?tSizes 90000000.00s h_precision?sHorizontal Precisions v_precision?sVertical Precisionsformat must be specified as "d1 [m1 [s1]] {"N"|"S"} d2 [m2 [s2]] {"E"|"W"} alt["m"] [siz["m"] [hp["m"] [vp["m"]]]]" where: d1: [0 .. 90] (degrees latitude) d2: [0 .. 180] (degrees longitude) m1, m2: [0 .. 59] (minutes latitude/longitude) s1, s2: [0 .. 59.999] (seconds latitude/longitude) alt: [-100000.00 .. 42849672.95] BY .01 (altitude in meters) siz, hp, vp: [0 .. 90000000.00] (size/precision in meters) See RFC 1876 for detailscC@sJtid}|i|}|djodStd|iDS(Ns.(?P\d{1,2}\s+)(?P\d{1,2}\s+)?(?P\d{1,2}\.?\d{1,3}?\s+)?(?P[N|S])\s+(?P\d{1,3}\s+)(?P\d{1,2}\s+)?(?P\d{1,2}\.?\d{1,3}?\s+)?(?P[W|E])\s+(?P-?\d{1,8}\.?\d{1,2}?)m?\s*(?P\d{1,8}\.?\d{1,2}?)?m?\s*(?P\d{1,8}\.?\d{1,2}?)?m?\s*(?P\d{1,8}\.?\d{1,2}?)?m?\s*$cs@s3x,|]%}|dj o |in|VqWdS(N(R&R(Rtx((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s (tretcompiletmatchR&Rtgroups(RR>tregextm((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR|s   c @sKtt|itdt|iDddddf}x|D]}|d }|dj o|d }tfd |Do|i|i i |d f}g}|d D]#}||i|i i |fq~} t d td di | d|} t id|id| qCqNqNWdS(Ncs@s(x!|]\}}|i|fVqWdS(N(R(RRR((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s tlat_sectlat_mintlon_sectlon_mint h_precisiontsizet v_precisioniic3@s'x |]}|djVqWdS(N(R&(RR(Rt part_name_map(s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s s7'%(required)s' must not be empty when '%(name)s' is setRs, RR(ReRf(RgRh(Rissize(RkRissize(RRURRARRR&RKRRRRR7RRR( RRt requirementstreqt target_parttrequired_partsttarget_cli_nameRRtrequired_cli_namesR((RlRs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs(      4  (uNuS(uEuW( RRRRRRR R RRRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRU+st                           tMXRecordc B@skeZdZdZeddeddedddd d ed eded ded fZRS(R"i RQRiRRRsCPreference given to this exchanger. Lower values are more preferredR'iR(iRSRTs)A host willing to act as a mail exchanger( RRRRRRR RgR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRss    tNSRecordcB@s2eZdZdZedededfZRS(R!i R)RiR*(RRRRR RgRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRts t NSECRecordc B@s{eZdZdZedZd eZede dede ddedd ed e fZ d Z d ZRS(tNSECisYformat must be specified as "NEXT TYPE1 [TYPE2 [TYPE3 [...]]]" (see RFC 4034 for details)uSOAtnextRisNext Domain Namestypes+sType MapRRcC@s<|i}t|djodS|dt|dfS(Niii(R5RR&R(RR>R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs c@sti||dg}|d}t|ttfp |g}n|i|difd|DS(Niiu c3@s9x2|]+}|dj oti|VqqWdS(N(R&R R(RR(RR(s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s (RRRRtextendR7(RRRt values_flatttypes((RRs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs     (uSOA(RRRRRRRt_allowed_typesR RgR RURRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRus       t NSEC3RecordcB@seZdZdZeZRS(tNSEC3i#(RRRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR|stNSEC3PARAMRecordcB@seZdZdZeZRS(t NSEC3PARAMi#(RRRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR~scC@sQd}|iddidd}x&|D]}||jo tdSq+WdS(NuSAUPt"RYs's*flags must be one of "S", "A", "U", or "P"(treplaceR(R'R=t allowed_flagstflag((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_validate_naptr_flagss  t NAPTRRecordc B@seZdZdZeddeddddded ded dddded eded d deddededdededdedfZRS(tNAPTRic torderRitOrderR'iR(iRQRRR=RIt normalizercC@s |iS((R(R^((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRj stservicetServicetregexpsRegular Expressiont replacementt Replacement( RRRRRRR RR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs(           t PTRRecordc B@sDeZdZdZededededdedfZRS(R i R)RRiR*Rs*The hostname this reverse record points to( RRRRR RvRxRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs tRPRecordcB@seZdZdZeZRS(tRPi(RRRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR%scC@s|djodSt||S(Nu.(Rg(R'R>((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_srv_target_validator*s t SRVRecordc B@seZdZdZeddeddddded ded dddded ded dddded ededdedfZRS(tSRVi tpriorityRitPriorityR'iR(itweighttWeightRmtPortR<R=RsbThe domain name of the target host or '.' if the service is decidedly not available at this domain( RRRRRRR RR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR0s$       cC@s;d}yti||Wntj otdSXdS(Ns %Y%m%d%H%M%Ss6the value does not follow "YYYYMMDDHHMMSS" time format(R,tstrptimeR$R(R'R>t time_format((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_sig_time_validatorJs t SIGRecordcB@sLeZdZdZedggZeD]Zedjo eeq&q&[Ze dde ddee dde d d d d d e dde dd d d d e dde dd d e de de de de de de dde dd d d de dde de dde df ZRS(tSIGi uSOAuSIGt type_coveredRis Type CoveredRR1R2R'iR(itlabelstLabelst original_ttls Original TTLtsignature_expirationsSignature Expirationtsignature_inceptionsSignature InceptionR0sKey Tagit signers_names Signer's Namet signaturet Signature(RRRRRRRR^R{R RRR RR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRRs>?               t SPFRecordcB@seZdZdZeZRS(tSPFi8(RRRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRst RRSIGRecordcB@seZdZdZRS(tRRSIGi(RRRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRst SSHFPRecordc B@sqeZdZdZeddeddddded ded dddded ded fZRS( tSSHFPiR1RiR2R'iR(itfp_typesFingerprint Typet fingerprintt Fingerprint(RRRRRRR R(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs     tTARecordcB@seZdZeZRS(tTA(RRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRst TKEYRecordcB@seZdZeZRS(tTKEY(RRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRst TSIGRecordcB@seZdZeZRS(tTSIG(RRRRfR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRst TXTRecordcB@s8eZdZdZeddedfZdZRS(tTXTi R"Ris Text DatacC@s|fS(N((RR>((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs(RRRRR RRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs  c c@sxtddtdddddgtddtd ddddgtd dtd ddddgfD] }|VqsWxKtD]C}|Vx|iD] }|VqWx|iD] }|VqWqWdS( Ns dnsrecords?RitRecordsR=t no_createt no_searchRsdnstype?s Record typesdnsdata?s Record data(R RR t _dns_recordsRR(topttoptionRR((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt__dns_record_options_iters(          cc@s*x#|]}|io |iVqqWdS(N(RR(RR((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s cC@s|tjot|}nC|idp2|idp|d7}nd||f}nytid|SWn9tij o*tidtdh|d6nXdS(NR.s%s.%st dns_resolveRsANameserver '%(host)s' does not have a corresponding A/AAAA recordR(ReRRRRRRR(R}R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytcheck_ns_rec_resolvables  cC@s8y|itiigWntij otSXtS(N(t get_entryRtenvt container_dnsRRRfRU(R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytdns_container_existss cC@s5t|ottii|SttiiSdS(N(RRRRtrealmR(R}((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytdefault_zone_update_policy s t managedbyRisManagedby permissiontdnszonecB@seZdZeiiZedZedZ dddgZ dgZ ddd d d d d ddddddg e Z edZedZededddeddedddddd eed!eded"ded#d$d|ed dd&ded'ded(dd)ed edd*ded+ded+dd,deed dd-ded.ded/d0d1d2d3ded4eed dd5ded6ded7d0d8d2d9d:d;d4eed dd<ded=ded>d0d8d2d9d:d?d4eeddd@dedAdedBd:dCd0d8d2d9d4eedddDdedEdedFd:d;d0d8d2d9d4eedGddHdedIdedJd0d8d2d9edKddLdedMdedNdOeedPddQdedRdedRddSd4eedTddUdedVdedWd$dXdYgdZeed[dd\ded]ded^dZed:ed4eed_ededd`dedadedbd:dcd4eeddededdededfdedgd:dhd4eedieddjdedkdedldmeednddodedpdedqdOd}eduddvdedwdedxfZdyZ dzZ!d{Z"RS(~s3 DNS Zone, container for resource records. sDNS zones DNS zonesttopt idnsrecordtidnszonet ipadnszoneRtidnszoneactivet idnssoamnamet idnssoarnamet idnssoaserialtidnssoarefresht idnssoaretryt idnssoaexpiretidnssoaminimumtidnsallowquerytidnsallowtransfertidnsforwarderstidnsforwardpolicys DNS ZonessDNS ZoneRRRis Zone nameRsZone name (FQDN)t default_fromcC@s t|S((R<(t name_from_ip((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRj.sRcC@s |iS((R(R>((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRj/st primary_keys name_from_ip?sReverse zone IP networks+IP network to create reverse zone name fromR=Rt name_serversAuthoritative nameservers$Authoritative nameserver domain namecC@s |iS((R(R>((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRj;st admin_emailsAdministrator e-mail addresscC@sd|S(s hostmaster.%s((R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRjBstserials SOA serialsSOA record serial numberR'iR(ltautofilltrefreshs SOA refreshsSOA record refresh timeiiRitretrys SOA retrysSOA record retry timeitexpires SOA expiresSOA record expire timeiutminimums SOA minimums,How long should negative responses be cachedsdnsttl?tttlsSOA time to livesSOA record time to lives dnsclass?tclasss SOA classsSOA record classRsidnsupdatepolicy?t update_policysBIND update policycC@s t|S((R(R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRjssidnszoneactive?t zone_actives Active zonesIs zone active?RRt attributesidnsallowdynupdate?tdynamic_updatesDynamic updatesAllow dynamic updates.sidnsallowquery?t allow_querys Allow querysWSemicolon separated list of IP addresses or networks which are allowed to issue queriesuany;sidnsallowtransfer?tallow_transfersAllow transfers[Semicolon separated list of IP addresses or networks which are allowed to transfer the zoneunone;sidnsforwarders*RosZone forwarderssA list of per-zone forwarders. A custom port can be specified for each forwarder using a standard format "IP_ADDRESS port PORT"Rsidnsforwardpolicy?tforward_policysForward policysPer-zone conditional forwarding policy. Set to "none" to disable forwarding to global forwarder for this zone. In that case, conditional zone forwarders are disregarded.uonlyufirstunonesidnsallowsyncptr?tallow_sync_ptrsAllow PTR syncsPAllow synchronization of forward (A, AAAA) and reverse (PTR) records in the zonecO@s|d}tt|i||}y|ii|dgWntij o|ido|d }n |d}tt|i||}y"|ii|dg\}}Wqtij oqXnX|S(NiRYu.(RRtget_dnRRRRR(RR R R}Rttest_dnR ((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs  " cC@sd|S(NuManage DNS zone %s((RR}((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytpermission_namescC@s|tjo|S|ido|d }n|ido|d }n|id}|id}t|}xEtt|t|D](\}}||jodS|iqW|ptSdi|S(s  Get name of a record that is to be added to a new zone. I.e. when we want to add record "ipa.lab.example.com" in a zone "example.com", this function should return "ipa.lab". Returns None when record cannot be added to a zone u.iN( ReRR5RtziptreversedR&RSR7(RR}R)thostname_partst zone_partstdns_namet host_partt zone_part((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytget_name_in_zones$    (svirtual_attribute(uonlyufirstunone(#RRt__doc__RRRt container_dnRt object_nametobject_name_pluralt object_classtpossible_objectclassest_record_attributestdefault_attributesRitlabel_singularR RuRURIR*RRR-R t_record_classesRRfRXRaRst takes_paramsRRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs                                                                     t dnszone_addcB@syeZedZeieZeieddeddede de dedfZdZ d Z RS( s!Create new DNS zone (SOA record).tforceRitForceRs=Force DNS zone creation even if nameserver is not resolvable.s ip_address?s=Add forward record for nameserver located in the created zonec O@st|iiiptidtdnd|d<|d}t|o"tidddtd n|i d }t |d } |i d o|i i |d |} n|} t| o_|i d p"tidddtd qt|o"tidd dtdqtnB|o:|i d o*| o"tidd dtdn| o!|d ot|d|n||d<||d<|S(NRsDNS is not configuredtTRUERRRs name-serverRs'Nameserver address is not a domain nameRpiR.s9Nameserver for reverse zone cannot be a relative DNS names;Nameserver DNS record is created for for forward zones onlysENameserver DNS record is created only for nameservers in current zoneRitnsrecord(RRtBackendtldap2RRRRRRRRtobjRRR( RRRR R R R t nameservertnameserver_ip_addressRttrecord_in_zone((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt pre_callbacks6      c O@ss|id}|oY|dd}|ido|ii|d|}n|}t|d||n|S(NRpRiR.i(RRR RR( RRRR R R RR t dns_record((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt post_callback1s  ( RRRRt LDAPCreatethas_output_paramstdnszone_output_paramst takes_optionsRR RDRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRs       ,t dnszone_delcB@seZedZdZRS(sDelete DNS zone (SOA record).cO@sHy+tid|ii|ddtWntij onXtS(Ntpermission_deliR(RRR RRURR(RRRR R ((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRFs   (RRRRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRCs t dnszone_modcB@sXeZedZeieddeddedfZeieZdZ RS(sModify DNS zone (SOA record).RRiRRs5Force nameserver change even if nameserver not in DNScO@sH|id}|o.|tjo!|d ot|d|n|S(NRRi(RReR(RRRR R R R R ((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR]s ( RRRRt LDAPUpdateRRRRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRQs    Rc B@speZedZeieZdZdZei e ddeddddedfZ d Z RS( s#Search for DNS zones (SOA records).cO@sHd|jo"|iidt|dntt|i||S(NR(R tparamsR%RRtargs_options_2_params(RtargsR ((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRls "cO@s_d|jo9d|jo!|iidi||di(R RRt update_entryRRRARU(RR R RR((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytexecutes ( RRRRRtstandard_valuet has_outputt msg_summaryR0(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR-s   tdnszone_enablecB@s2eZedZeiZedZdZRS(sEnable DNS Zone.sEnabled DNS zone "%(value)s"c O@sl|ii}|ii||}y|i|hdd6Wntij onXtdtd|dS(NRRRR>i(R RRR/RRRARU(RR R RR((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR0s ( RRRRRR1R2R3R0(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR4s   tdnszone_add_permissioncB@s2eZedZeiZedZdZRS(s0Add a permission for per-zone access delegation.s#Added system permission "%(value)s"c O@s|ii}|ii||}y|i|dg\}}Wn&tij o|ii|nX|ii|d}ti d|ddd}h} |i d} | o'| i dt t | | d(R RRRRRthandle_not_foundRRRRR[RtsetR/RARU( RR R RRtdn_R Rt permissiontupdatet dnszone_ocs((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR0s(  ( RRRRRR1R2R3R0(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR5s   tdnszone_remove_permissioncB@s2eZedZeiZedZdZRS(s3Remove a permission for per-zone access delegation.s%Removed system permission "%(value)s"cO@s|ii}|ii||}y|i|hdd6Wn;tij o|ii|ntij onX|ii |d}t i d|dt t dt d|S(NRiRRRR>(R RRR/R&RRR9RRRRRURA(RR R RRR((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR0s ( RRRRRR1R2R3R0(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR?s   t dnsrecordc B@seZdZdZeiiZedZ edZ ddgZ dge Z eZedZedZeded d d ed d ed deedd dd edd ededd dd edd eddefeZedd edd edZdZdZdZdZdZdZ d Z!d!Z"e#d"Z$d#Z%d$Z&d%Z'e#d&Z(d'Z)RS((s DNS record. RsDNS resource recordsDNS resource recordsRRRsDNS Resource RecordssDNS Resource RecordRRRis Record nameRRsdnsttl?Rs Time to lives dnsclass?RtClasss DNS classRt structuredt Structureds=Parse all raw DNS records and return them in a structured wayc O@s|i|put|d|d}}y t|dtdt|Wqtj o'}tidddt|qXndS(NiiRcRdRRR( tis_pkey_zone_recordRRRURR$RRR%( RRRR R R R}RR)((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_idnsname_pre_callback0s  cO@sZ|id}|idtp |djodSx|D]}t|d|q;WdS(NR Ri(RRfR&R(RRRR R R t nsrecordsR ((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_nsrecord_pre_callback8s  cO@s|id}|djodS|d}|i|o d}n |d}d} xDtD]<} |i| o&|i| d}| } t| } q\q\W| p;dit} tiddd t t d | n|ot |i d nd} d |jod |jod |joxd |jok| t |i d }|| joAtiddd t t dt d| d| d|qndS(NRiuiiRYs, RRsaReverse zone for PTR record should be a sub-zone of one the following fully qualified domains: %sR.RZt-s\Reverse zone %(name)s requires exactly %(count)d IP address components, %(user_count)d givenR|t user_count(RR&RDRRRR7RRR%RRR5RA(RRRR R R t ptrrecordsR}Rtzone_lent valid_zonet zone_namet allowed_zonestaddr_lentip_addr_comp_count((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt_ptrrecord_pre_callback@s4    #  cO@s[|iii}xE|D]=}t|d|d}|o||||||qqWdS(Ns_%s_pre_callback(RR R RR&(RRR R R Rtrtypetrtype_cb((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytrun_precallback_validatorscs cG@s;|d}|ttjp|d|djotStS(Nis%s.i(R\ReRURf(RR R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRDls (cO@s|i|o|ii|ii|d |}|iii}y|i|g\}}Wn1ti j o"|iidi |dnX|ii|ii|d |St t |i||S(NiRi( RDRtObjectt parent_objectRR R RRRR9RR@(RR R RRR;R}((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRrs# "cC@s;y|td i}Wntj o |}nX|S(NR(RRt IndexError(Rtattrtcliname((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt attr_to_cli~s  c C@s|iii}td d d |iii}d}g}yv|id|d|d}xS|D]K}|d}y|d d}|i|Wq_tt fj oq_Xq_WWnt i j ogSX|S( Ntcntmasterstipatetcs((&(objectClass=ipaConfigObject)(cn=DNS))R&R'ii(R[R\(R[R](R[R^( RR R tDNRtbasednt find_entriesR[RWtKeyErrorRR( RRR't ldap_filtert dns_masterstentriestentryt master_dntmaster((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytget_dns_masterss"  c@stfddDodSt}xWiD]I}||ijo3|i|i o!|p|o t}Pq~q5q5W|pti|ndS(Nc3@sx|]}|jVqWdS(N((Rtk(R (s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s RtaddattrRtrename(ssetattrRksdelattrsrename(RKRfR RRRURt OptionError(RR t no_option_msgtallow_empty_attrst has_optionsRX((R s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pythas_cli_optionss " c@s tfd|iDS(Nc3@sKxD|]=\}}|ijo!i|i o||fVqqWdS(N(RR(RRXR(R(s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s (RAt iteritems(RR ((Rs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytget_record_entry_attrssc K@s3|idtox|iD]}y|i|}Wntj o q nXt|tpq n|i}x||D]}ht|i d6|d6}|i |}|djoq~nx<t |D].\} } | dj o| ||| i s RR(sdnsrecord_partsdnsrecord_extraN(RRKR&RRbtAttributeError(RRtrrparam((Rus6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytget_rrparam_from_parts cc@sg}x|D]w}|i|}|djoq n|od|i|ijoq n|i|jo|i|i|Vq q WdS(s Iterates through all DNSRecord instances that has at least one of its parts or extra options in given dictionary. It returns the DNSRecord instance only for the first occurence of part/extra option. :param kw Dictionary with DNS record parts or extra options :param skip_extra Skip DNS record extra options, yield only DNS records with a real record part RN(R|R&RR=RR[(RRt skip_extrat processedRR{((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytiterate_rrparams_by_partss  c @stfdD}|ifd|Dy|idWntj o t}nXt}|id|otnt}|o)|o"tidddt dndS(Nc3@s5x.|]'}|tjo|o |VqqWdS(N(R(RRX(R (s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s c3@s*x#|]}|jo |VqqWdS(N((RRX(R (s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s t cnamerecordRRRsHCNAME record is not allowed to coexist with any other records except PTR( R:R=tremoveRbRfRUtdiscardRRR(Rt old_entryR tattrst rec_has_cnametrec_has_other_types((R s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytcheck_record_type_collisionss  (*RRRRVRRRRRRRRRRRUtrdn_is_primary_keyRiRR RlRR Rt_dns_record_optionsRRtstructured_flagRERGRQRTRDRRZRiRfRqRsRyR|RR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR@sV                     #        Rc B@seZedZdZeieddeddddgded ei fZd Z d Z d Z d Z dZRS(sAdd new DNS resource record.skNo options to add a specific record provided. Command help may be consulted for all supported record types.RRiRR=Rt no_outputRs;force NS record creation even if its hostname is not in DNScO@s/|ii||itt|i||S(N(R RqRnRRR(RR R ((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR sc C@s-y||ii||ih}xH|ii|dtD].}|i|i|dt}|i|q8W|i|dSWnt i j onX|dt jodi t }n4t|dodi t}ndi t}|iiitd|iiitd|t}x|p|iiitd}|djodSyUd |i}|i|} t| tp tn| ip tnWnHttfj o6di t} |iiitd | q+nXt}q+W| i|i}|i|dS( NR}RRu, tdnszoneidnsnameu7Please choose a type of DNS resource record to be addedu4The most common types for this type of zone are: %s uDNS resource record types%srecordu3Invalid or unsupported type. Allowed values are: %s(R RqRnRRURR RfR=RRmReR7t_zone_top_record_typesRt_rev_top_record_typest_top_record_typesRt print_plainRRR&RRRRR$RRbt_dns_supported_record_typesR( RRtnew_kwR{Rt common_typestokRRRut all_types((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytinteractive_prompt_callback sP       cO@sgg}g}xj|D]b} y|i| } Wntj o qnX|ii| } | djoqnd| ijo| i|joqn| i|joItid| i p| idt dt d| i p| in| i |} | i | g} | || i<|i| iqnd| ijo7t| to||  oqn|i| iqqW|ii||||x\|D]T}y|i|} Wntj o qnXt| tpqn|i|qWtt|}xT|D]L}y|i|} Wntj o q nX| i||||||q Wttd|y(|i|td|ii\}}Wntij onXx|D]}|tjoqn||djog||Raw value of a DNS record was already set by "%(name)s" optionRtdnsrecord_precallback_attrsR(RRbR R|R&R=RRRRRRARRR[RRRTRRR:R RRRRt normalize_dnRRRR(RRRR R R R tprecallback_attrstprocessed_attrsRRuR{RRwRXR;RR((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRV s  $    *c O@su|idjo[t|tioD|ii}|d}|ii|d} |i|| |dSn|dS(Nt add_entryii(t func_nameRRRR RRsR/( RR R Rt call_funct call_argst call_kwargsRRR ((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt exc_callback s   cO@sx@ttdgD],}|i|}|i|||||qW|ii|otg||iiic3@s7x0|])\}}|dj o|n|VqWdS(N(R&(RRR(t old_parts(s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s (!RR RDRRRRRURRfR&RRRRRRRTRRRRR9RR%RitAttrValueNotFoundRRRRR:R(RRRR R R R t updated_attrsRuRt old_valueR;RRXt old_dnsvaluet new_partst attr_nametmodified_partst new_dnsvalue((Rs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR sR#   &c O@stt|i||}|ii|p|id}|dj o|d |f}n|ii||}|ii}|i |t d|ii \}}t } x$|D]} || o t } PqqW| o|iii|Sn|S(NRliR(RRR0R RDRR&RRRRRRURftmethodstdelentry( RR R RRlRRR;Rtdel_allRX((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR0 s&     cO@sD|ii|otg||iiiRRub%(count)d %(type)s record skipped. Only one value per DNS record type can be modified at one time.uc%(count)d %(type)s records skipped. Only one value per DNS record type can be modified at one time.iR|R/(R RqRnRURRmRRRR RRRRRbRRR[R7RRiRRt prompt_yesnoRARfRR=RRR(RRRRtrec_typet rec_typest record_paramsRXRutrec_type_contentt rec_valuest rec_valuet mod_valueR((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR4 sP"2 $  +  &(RRRRRnRRR@RRRR0RR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR s    <  tdnsrecord_delentrycB@s eZdZedZeZRS(s" Delete DNS record entry. sDeleted record "%(value)s"(RRRRR3RUtNO_CLI(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRk s t dnsrecord_delcB@s}eZedZedZeddededeifZ dZ dZ dZ d Z d Zd ZRS( sDelete DNS resource record.sNeither --del-all nor options to delete a specific record provided. Command help may be consulted for all supported record types.RRRisDelete all associated recordsc#@sxtt|iD]ntfddDoqn@idjoqn)ttoiddVqnVqWdS(Nc3@s"x|]}|ijVqWdS(N(R=(RR(R(s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pys s RRRlR(sdnsrecord_partsdnsrecord_extra(srename( RRt get_optionsRKRRRtcloneR&(R((Rs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR sc O@sy(|i|td|ii\}}Wn&tij o|ii|nXx |iD]} | tjoq^nt|| t t fp|| g} n || } x| D]} y|| i | Wqt t fj oYy*|i| } t| ip| i} Wn | } nXtid| d| qXqWt t|| || R(RRR RRRR9R RRRRRbR$RR%RiRRR:RfRDRURR(RRRR R R R R;RRXRRRuRRt record_found((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR sH      !   cO@s|idtoM|ii|o&tidddtdtn|iii |St t |i ||}t tdto(|ii| o|iii |S|S(NRRRs"Zone record '%s' cannot be deleted(RRfR RDRRRReRRRRR0RR(RR R R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR0 s  cO@sD|ii|otg||iii(RRfR RqRnRRmRRRR RRRRRURRbRRR[R7RRiRAR(RRRRRRt user_del_alltpresent_paramsRXRuRtdeleted_valuesRtuser_del_value((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR sP"2!   $  " (RRRRRnRRfR@RRRRR0RRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRu s      -   RcB@s0eZedZeieifZdZRS(sDisplay DNS resource.cO@sD|ii|otg||iii* s RRR(sdnsrecord_partsdnsrecord_extra(RRyRRKRRRR&(R((Rs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR( scO@s|||ifS(N(t SCOPE_SUBTREE(RRR&R R'R(RR ((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR2 sc O@s|o|ii|ii}|i|d}|dd|jotg|dd|ii( tfindRRRRRRRRARU(RRR tquery((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR0P s 2  ( RRRRRR1R2R3R t takes_argsR0(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRD s     tdns_is_enabledcB@sGeZdZeZeiZeddd e i i Z dZ dZRS( sC Checks if any of the servers has the DNS service enabled. R[R\R]R^s((&(objectClass=ipaConfigObject)(cn=DNS))cO@sy|iii}t}y9|id|id|i}t|o t}nWnt j o }nXt d|ddS(NR&R'RR>u( RR R RfRaR&R'RRURRA(RRR Rt dns_enabledtentR)((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR0j s (scnsmasters(scnsipa(scnsetc(RRRRURRR1R2R_RRR`R'R&R0(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR` s  t dnsconfigc B@seZdZedZddddgZedZedZede dd d ed d ed de e dddd edd eddd$e dddd edd ede dddd edd eddd fZd!Zd"Zd#ZRS(%s) DNS global configuration object sDNS configuration optionsRRtidnsallowsyncptrtidnszonerefreshsDNS Global Configurationsidnsforwarders*RRoRisGlobal forwardersRs}A list of global forwarders. A custom port can be specified for each forwarder using a standard format "IP_ADDRESS port PORT"Rsidnsforwardpolicy?RsForward policysTGlobal forwarding policy. Set to "none" to disable any configured global forwarders.Ruonlyufirstunonesidnsallowsyncptr?RsAllow PTR syncsDAllow synchronization of forward (A, AAAA) and reverse (PTR) recordssidnszonerefresh?t zone_refreshsZone refresh intervalsFAn interval between regular polls of the name server for new DNS zonesR'icO@s tiiS(N(RRR(RR R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR scC@s+|i|idd|i\}}|S(NR(RRR&R(RRRRf((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyt get_dnsconfig sc@s>tfd|iDpttdd s s!Global DNS configuration is emptytsummary(RKRR%R(RR((Rs6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytpostprocess_result s (uonlyufirstunone(RRRRRRRiRR RsRUR RRRRRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyRz s:                   t dnsconfig_modcB@seZedZdZRS(s Modify global DNS configuration.cO@s/tt|i||}|ii||S(N(RRR0R R(RR R R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR0 s(RRRRR0(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR s tdnsconfig_showcB@seZedZdZRS(s*Show the current global DNS configuration.cO@s/tt|i||}|ii||S(N(RRR0R R(RR R R((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR0 s(RRRRR0(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pyR s (t __future__RR/R,R_tipalib.requestRtipalibRRRRtipalib.parametersRRRR R R R tipalib.plugins.baseldapRRt ipalib.utilRRRRRRRRRRRtipapython.ipautilRRRRRReRRRRttR\RRRR*R-R<R&RDRERFRIRXRaRfRgRhRlRsRuRvRxRRRRURRRRRR R#R$R+R-R4R6R8R:R>R@RERGRMRORURsRtRuR|R~RRRRRRRRRRRRRRRRRRRRRRRRt LDAPObjectRtregisterRRt LDAPDeleteRRRR+RR,Rt LDAPQueryR-R4R5R?R@RRRRRRyRRRRR(((s6/usr/lib/python2.6/site-packages/ipalib/plugins/dns.pytsX   4 L    1       "    "&*     | %    -       I   +    "        !   7