Ejemplo n.º 1
0
    def __add_ipa_ca_record(self):
        self.__add_ipa_ca_records(self.fqdn, self.ip_addresses,
                                  self.ca_configured)

        if self.first_instance:
            ldap = self.api.Backend.ldap2
            try:
                entries = ldap.get_entries(
                    DN(('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'),
                       api.env.basedn),
                    ldap.SCOPE_SUBTREE, '(&(objectClass=ipaConfigObject)(cn=CA))',
                    ['dn'])
            except errors.NotFound:
                root_logger.debug('No server with CA found')
                entries = []

            for entry in entries:
                fqdn = entry.dn[1]['cn']
                if fqdn == self.fqdn:
                    continue

                host, zone = fqdn.split('.', 1)
                if dns_zone_exists(zone, self.api):
                    addrs = get_fwd_rr(zone, host, self.api)
                else:
                    addrs = installutils.resolve_host(fqdn)

                self.__add_ipa_ca_records(fqdn, addrs, True)
Ejemplo n.º 2
0
    def __add_ipa_ca_record(self):
        self.__add_ipa_ca_records(self.fqdn, self.ip_addresses,
                                  self.ca_configured)

        if self.first_instance:
            ldap = self.api.Backend.ldap2
            try:
                entries = ldap.get_entries(
                    DN(('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'),
                       api.env.basedn),
                    ldap.SCOPE_SUBTREE, '(&(objectClass=ipaConfigObject)(cn=CA))',
                    ['dn'])
            except errors.NotFound:
                root_logger.debug('No server with CA found')
                entries = []

            for entry in entries:
                fqdn = entry.dn[1]['cn']
                if fqdn == self.fqdn:
                    continue

                host, zone = fqdn.split('.', 1)
                if dns_zone_exists(zone, self.api):
                    addrs = get_fwd_rr(zone, host, self.api)
                else:
                    addrs = installutils.resolve_host(fqdn)

                self.__add_ipa_ca_records(fqdn, addrs, True)
Ejemplo n.º 3
0
    def remove_ipa_ca_dns_records(self, fqdn, domain_name):
        host, zone = fqdn.split(".", 1)
        if dns_zone_exists(zone):
            addrs = get_fwd_rr(zone, host)
        else:
            addrs = installutils.resolve_host(fqdn)

        for addr in addrs:
            del_fwd_rr(domain_name, IPA_CA_RECORD, addr)
Ejemplo n.º 4
0
    def remove_ipa_ca_dns_records(self, fqdn, domain_name):
        host, zone = fqdn.split(".", 1)
        if dns_zone_exists(zone):
            addrs = get_fwd_rr(zone, host)
        else:
            addrs = installutils.resolve_host(fqdn)

        for addr in addrs:
            del_fwd_rr(domain_name, IPA_CA_RECORD, addr)
Ejemplo n.º 5
0
    def add_ipa_ca_dns_records(self, fqdn, domain_name, ca_configured=True):
        host, zone = fqdn.split(".", 1)
        if dns_zone_exists(zone):
            addrs = get_fwd_rr(zone, host)
        else:
            addrs = installutils.resolve_host(fqdn)

        self.domain = domain_name

        self.__add_ipa_ca_records(fqdn, addrs, ca_configured)
Ejemplo n.º 6
0
    def add_ipa_ca_dns_records(self, fqdn, domain_name, ca_configured=True):
        host, zone = fqdn.split(".", 1)
        if dns_zone_exists(zone):
            addrs = get_fwd_rr(zone, host)
        else:
            addrs = installutils.resolve_host(fqdn)

        self.domain = domain_name

        self.__add_ipa_ca_records(fqdn, addrs, ca_configured)
Ejemplo n.º 7
0
    def __add_others(self):
        entries = self.admin_conn.get_entries(
            DN(('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'),
               self.suffix),
            self.admin_conn.SCOPE_ONELEVEL, None, ['dn'])

        for entry in entries:
            fqdn = entry.dn[0]['cn']
            if fqdn == self.fqdn:
                continue

            addrs = installutils.resolve_host(fqdn)

            root_logger.debug("Adding DNS records for master %s" % fqdn)
            self.__add_master_records(fqdn, addrs)
Ejemplo n.º 8
0
    def __add_others(self):
        entries = self.admin_conn.get_entries(
            DN(('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'),
               self.suffix),
            self.admin_conn.SCOPE_ONELEVEL, None, ['dn'])

        for entry in entries:
            fqdn = entry.dn[0]['cn']
            if fqdn == self.fqdn:
                continue

            addrs = installutils.resolve_host(fqdn)

            root_logger.debug("Adding DNS records for master %s" % fqdn)
            self.__add_master_records(fqdn, addrs)