univention.admin.handlers.dns package#
UDM module for DNS records
- univention.admin.handlers.dns.is_dns(attr: dict[str, list[bytes]]) bool[source]#
Are the given LDAP attributes a DNS entry?
- univention.admin.handlers.dns.is_zone(attr: dict[str, list[bytes]]) bool[source]#
Are the given LDAP attributes a DNS zone entry?
- univention.admin.handlers.dns.is_reverse_zone(attr: dict[str, list[bytes]]) bool[source]#
Are the given LDAP attributes a DNS entry in a forward zone?
- univention.admin.handlers.dns.is_forward_zone(attr: dict[str, list[bytes]]) bool[source]#
Are the given LDAP attributes a DNS entry in a reverse zone?
- univention.admin.handlers.dns.has_any(attr: dict[str, list[bytes]], *attrs: str) bool[source]#
Are any of the named LDAP attributes present?
- univention.admin.handlers.dns.is_not_handled_by_other_module_than(attr: dict[str, list[bytes]], module: str) bool[source]#
Are the given LDAP attributes handled by the specified UDM module?
- class univention.admin.handlers.dns.DNSBase(co: None, lo: access, position: position | None, dn: str = '', superordinate: simpleLdap | None = None, attributes: dict[str, list[bytes]] | None = None, update_zone: bool = True)[source]#
Bases:
simpleLdapBase class for dns/* modules
- classmethod lookup_filter_superordinate(filter: conjunction, superordinate: simpleLdap) conjunction[source]#
- univention.admin.handlers.dns.makeContactPerson(obj: simpleLdap, arg: Any) str[source]#
Create contact Email-address for domain.
- univention.admin.handlers.dns.unescapeSOAemail(email: str) str[source]#
Un-escape Email-address from DNS SOA record. >>> unescapeSOAemail(r’first.last.domain.tld’) ‘first.last@domain.tld’
- univention.admin.handlers.dns.escapeSOAemail(email: str) str[source]#
Escape Email-address for DNS SOA record. >>> escapeSOAemail(‘first.last@domain.tld’) ‘first\.last.domain.tld’
- univention.admin.handlers.dns.stripDot(old: list[str] | str | None, encoding: tuple[str, ...] = ()) str | None[source]#
>>> stripDot(['example.com.', 'example.com']) ['example.com', 'example.com'] >>> stripDot('example.com.') 'example.com' >>> stripDot([]) [] >>> stripDot('') '' >>> stripDot(None)
Submodules#
univention.admin.handlers.dns.alias module#
UDM module for DNS aliases (CNAME)
- class univention.admin.handlers.dns.alias.object(co: None, lo: access, position: position | None, dn: str = '', superordinate: simpleLdap | None = None, attributes: dict[str, list[bytes]] | None = None, update_zone: bool = True)[source]#
Bases:
DNSBase- module = 'dns/alias'#
- classmethod unmapped_lookup_filter() conjunction[source]#
Return a LDAP filter UDM filter expression.
- Returns:
A LDAP filter expression.
See
lookup_filter().
univention.admin.handlers.dns.dns module#
UDM module for all DNS objects
- class univention.admin.handlers.dns.dns.object(co: None, lo: access, position: position | None, dn: str = '', superordinate: Self | None = None, attributes: dict[str, list[bytes]] | None = None)[source]#
Bases:
simpleLdap- module = 'dns/dns'#
univention.admin.handlers.dns.forward_zone module#
UDM module for DNS forward zones
- univention.admin.handlers.dns.forward_zone.mapMX(old: list[list[str]], encoding: tuple[str, ...] = ()) list[bytes][source]#
- univention.admin.handlers.dns.forward_zone.unmapMX(old: list[bytes], encoding: tuple[str, ...] = ()) list[list[str]][source]#
- class univention.admin.handlers.dns.forward_zone.object(co: None, lo: access, position: position | None, dn: str = '', superordinate: simpleLdap | None = None, attributes: dict[str, list[bytes]] | None = None)[source]#
Bases:
simpleLdap- module = 'dns/forward_zone'#
- open() None[source]#
Opens this object.
During the initialization of this object the current set LDAP attributes are mapped into
info. This method makes it possible to e.g. resolve external references to other objects which are not represented in the raw LDAP attributes of this object, for example the group memberships of a user.By default only the open hook for extended attributes is called. This method can be subclassed.
Warning
If this method changes anything in self.info it must call
save()afterwards.Warning
If your are going to do any modifications (such as creating, modifying, moving, removing this object) this method must be called directly after the constructor and before modifying any property.
- classmethod unmapped_lookup_filter() conjunction[source]#
Return a LDAP filter UDM filter expression.
- Returns:
A LDAP filter expression.
See
lookup_filter().
univention.admin.handlers.dns.host_record module#
UDM module for DNS host records
- univention.admin.handlers.dns.host_record.unmapMX(old: list[bytes], encoding: tuple[str, ...] = ()) list[list[str]][source]#
- univention.admin.handlers.dns.host_record.mapMX(old: list[list[str]], encoding: tuple[str, ...] = ()) list[bytes][source]#
- univention.admin.handlers.dns.host_record.unmapIPAddresses(values: dict[str, list[bytes]], encoding: tuple[str, ...] = ()) list[str][source]#
- class univention.admin.handlers.dns.host_record.object(co: None, lo: access, position: position | None, dn: str = '', superordinate: simpleLdap | None = None, attributes: dict[str, list[bytes]] | None = None, update_zone: bool = True)[source]#
Bases:
DNSBase- module = 'dns/host_record'#
- classmethod unmapped_lookup_filter() conjunction[source]#
Return a LDAP filter UDM filter expression.
- Returns:
A LDAP filter expression.
See
lookup_filter().
- classmethod rewrite_filter(filter: expression, mapping: mapping) None[source]#
univention.admin.handlers.dns.ns_record module#
UDM module for DNS Name Server records
- class univention.admin.handlers.dns.ns_record.object(co: None, lo: access, position: position | None, dn: str = '', superordinate: simpleLdap | None = None, attributes: dict[str, list[bytes]] | None = None, update_zone: bool = True)[source]#
Bases:
DNSBase- module = 'dns/ns_record'#
- classmethod unmapped_lookup_filter() conjunction[source]#
Return a LDAP filter UDM filter expression.
- Returns:
A LDAP filter expression.
See
lookup_filter().
univention.admin.handlers.dns.ptr_record module#
UDM module for DNS reverse pointer records (PTR)
- univention.admin.handlers.dns.ptr_record.ipv6(string: str) str[source]#
>>> ipv6('0123456789abcdef0123456789abcdef') '0123:4567:89ab:cdef:0123:4567:89ab:cdef'
- univention.admin.handlers.dns.ptr_record.calc_ip(rev: str, subnet: str) IPv4Address | IPv6Address[source]#
>>> calc_ip(rev='8.0.0.0.7.0.0.0.6.0.0.0.5.0.0.0.4.0.0', subnet='0001:0002:0003:0').exploded '0001:0002:0003:0004:0005:0006:0007:0008' >>> calc_ip(rev='4.3', subnet='1.2').exploded '1.2.3.4'
- univention.admin.handlers.dns.ptr_record.calc_rev(ip: str, subnet: str) str[source]#
>>> calc_rev(ip='1.2.3.4', subnet='1.2') '4.3' >>> calc_rev(ip='0001:0002:0003:0004:0005:0006:0007:0008', subnet='0001:0002:0003:0') '8.0.0.0.7.0.0.0.6.0.0.0.5.0.0.0.4.0.0' >>> calc_rev(ip='1:2:3:4:5:6:7:8', subnet='0001:0002:0003:0') '8.0.0.0.7.0.0.0.6.0.0.0.5.0.0.0.4.0.0'
- class univention.admin.handlers.dns.ptr_record.object(co: None, lo: access, position: position | None, dn: str = '', superordinate: simpleLdap | None = None, attributes: dict[str, list[bytes]] | None = None, update_zone: bool = True)[source]#
Bases:
DNSBase- module = 'dns/ptr_record'#
- description() str[source]#
Return a descriptive string for the object. By default the relative distinguished name is returned.
- Returns:
A descriptive string or none as fallback.
- open() None[source]#
Opens this object.
During the initialization of this object the current set LDAP attributes are mapped into
info. This method makes it possible to e.g. resolve external references to other objects which are not represented in the raw LDAP attributes of this object, for example the group memberships of a user.By default only the open hook for extended attributes is called. This method can be subclassed.
Warning
If this method changes anything in self.info it must call
save()afterwards.Warning
If your are going to do any modifications (such as creating, modifying, moving, removing this object) this method must be called directly after the constructor and before modifying any property.
- ready() None[source]#
Makes sure all preconditions are met before creating or modifying this object.
It checks if all properties marked required are set. It checks if the superordinate is valid.
- classmethod lookup_filter_superordinate(filter: conjunction, superordinate: simpleLdap) conjunction[source]#
- classmethod unmapped_lookup_filter() conjunction[source]#
Return a LDAP filter UDM filter expression.
- Returns:
A LDAP filter expression.
See
lookup_filter().
- univention.admin.handlers.dns.ptr_record.rewrite_rev(filter: conjunction | expression, subnet: str) conjunction | expression[source]#
Rewrite LDAP filter expression and convert (ip) -> (zone,reversed)
>>> rewrite_rev(expression('ip', '1.2.3.4'), subnet='1.2') conjunction('&', [expression('zoneName', '2.1.in-addr.arpa', '='), expression('relativeDomainName', '4.3', '=')]) >>> rewrite_rev(expression('ip', '1.2.3.*', escape=False), subnet='1.2') conjunction('&', [expression('zoneName', '2.1.in-addr.arpa', '='), expression('relativeDomainName', '*.3', '=')]) >>> rewrite_rev(expression('ip', '1.2.*.*', escape=False), subnet='1.2') conjunction('&', [expression('zoneName', '2.1.in-addr.arpa', '='), expression('relativeDomainName', '*.*', '=')]) >>> rewrite_rev(expression('ip', '1.2.*.4', escape=False), subnet='1.2') conjunction('&', [expression('zoneName', '2.1.in-addr.arpa', '='), expression('relativeDomainName', '4.*', '=')]) >>> rewrite_rev(expression('ip', '1.2.*', escape=False), subnet='1.2') conjunction('&', [expression('zoneName', '2.1.in-addr.arpa', '='), expression('relativeDomainName', '', '=*')]) >>> rewrite_rev(expression('ip', '1:2:3:4:5:6:7:8'), subnet='0001:0002') conjunction('&', [expression('zoneName', '2.0.0.0.1.0.0.0.ip6.arpa', '='), expression('relativeDomainName', '8.0.0.0.7.0.0.0.6.0.0.0.5.0.0.0.4.0.0.0.3.0.0.0', '=')]) >>> rewrite_rev(expression('ip', '1:2:3:4:5:6:7:*', escape=False), subnet='0001:0002') conjunction('&', [expression('zoneName', '2.0.0.0.1.0.0.0.ip6.arpa', '='), expression('relativeDomainName', '*.7.0.0.0.6.0.0.0.5.0.0.0.4.0.0.0.3.0.0.0', '=')]) >>> rewrite_rev(expression('ip', '1:2:3:4:5:6:*:8', escape=False), subnet='0001:0002') conjunction('&', [expression('zoneName', '2.0.0.0.1.0.0.0.ip6.arpa', '='), expression('relativeDomainName', '8.0.0.0.*.6.0.0.0.5.0.0.0.4.0.0.0.3.0.0.0', '=')]) >>> rewrite_rev(expression('ip', '1:2:3:*', escape=False), subnet='0001:0002') conjunction('&', [expression('zoneName', '2.0.0.0.1.0.0.0.ip6.arpa', '='), expression('relativeDomainName', '*.3.0.0.0', '=')])
univention.admin.handlers.dns.reverse_zone module#
UDM module for DNS reverse zones
- univention.admin.handlers.dns.reverse_zone.mapSubnet(subnet, encoding=())[source]#
Map subnet to reverse zone. >>> mapSubnet(‘0123:4567:89ab:cdef’) ‘f.e.d.c.b.a.9.8.7.6.5.4.3.2.1.0.ip6.arpa’ >>> mapSubnet(‘0123:4567:89ab:cd’) ‘d.c.b.a.9.8.7.6.5.4.3.2.1.0.ip6.arpa’ >>> mapSubnet(‘1.2.3’) ‘3.2.1.in-addr.arpa’
- univention.admin.handlers.dns.reverse_zone.unmapSubnet(zone, encoding=())[source]#
Map reverse zone to subnet. >>> unmapSubnet([b’f.e.d.c.b.a.9.8.7.6.5.4.3.2.1.0.ip6.arpa’]) ‘0123:4567:89ab:cdef’ >>> unmapSubnet([b’d.c.b.a.9.8.7.6.5.4.3.2.1.0.ip6.arpa’]) ‘0123:4567:89ab:cd’ >>> unmapSubnet([b’3.2.1.in-addr.arpa’]) ‘1.2.3’
- class univention.admin.handlers.dns.reverse_zone.object(co: None, lo: access, position: position | None, dn: str = '', superordinate: simpleLdap | None = None, attributes: dict[str, list[bytes]] | None = None)[source]#
Bases:
simpleLdap- module = 'dns/reverse_zone'#
- open() None[source]#
Opens this object.
During the initialization of this object the current set LDAP attributes are mapped into
info. This method makes it possible to e.g. resolve external references to other objects which are not represented in the raw LDAP attributes of this object, for example the group memberships of a user.By default only the open hook for extended attributes is called. This method can be subclassed.
Warning
If this method changes anything in self.info it must call
save()afterwards.Warning
If your are going to do any modifications (such as creating, modifying, moving, removing this object) this method must be called directly after the constructor and before modifying any property.
- description() str[source]#
Return a descriptive string for the object. By default the relative distinguished name is returned.
- Returns:
A descriptive string or none as fallback.
- classmethod unmapped_lookup_filter() conjunction[source]#
Return a LDAP filter UDM filter expression.
- Returns:
A LDAP filter expression.
See
lookup_filter().
univention.admin.handlers.dns.srv_record module#
UDM module for DNS service records (SRV)
- univention.admin.handlers.dns.srv_record.unmapName(old: list[bytes], encoding: tuple[str, ...] = ()) list[str][source]#
- univention.admin.handlers.dns.srv_record.mapName(old: list[str], encoding: tuple[str, ...] = ()) bytes[source]#
- univention.admin.handlers.dns.srv_record.unmapLocation(old: list[bytes], encoding: tuple[str, ...] = ()) list[list[str]][source]#
- univention.admin.handlers.dns.srv_record.mapLocation(old: list[list[str]], encoding: tuple[str, ...] = ()) list[bytes][source]#
- class univention.admin.handlers.dns.srv_record.object(co: None, lo: access, position: position | None, dn: str = '', superordinate: simpleLdap | None = None, attributes: dict[str, list[bytes]] | None = None, update_zone: bool = True)[source]#
Bases:
DNSBase- module = 'dns/srv_record'#
- classmethod unmapped_lookup_filter() conjunction[source]#
Return a LDAP filter UDM filter expression.
- Returns:
A LDAP filter expression.
See
lookup_filter().
univention.admin.handlers.dns.txt_record module#
UDM module for DNS text records (TXT)
- class univention.admin.handlers.dns.txt_record.object(co: None, lo: access, position: position | None, dn: str = '', superordinate: simpleLdap | None = None, attributes: dict[str, list[bytes]] | None = None, update_zone: bool = True)[source]#
Bases:
DNSBase- module = 'dns/txt_record'#
- classmethod unmapped_lookup_filter() conjunction[source]#
Return a LDAP filter UDM filter expression.
- Returns:
A LDAP filter expression.
See
lookup_filter().