Exemple #1
0
 def remove(self):
     if not self.enable_deploy:
         raise I.KadminException(-1, "Failed to create new database",
                                 "This function was disabled")
     command = ["kdb5_util", "destroy", "-f"]
     if self.realm:
         command += ["-r", self.realm]
     _run_command(command, "Failed to destroy existing database")
Exemple #2
0
 def __call__(self, code, where, message):
     if code in _ALREADYEXISTS_ERRORS:
         raise C.AlreadyExistsError(message, where)
     if code in _AUTH_ERRORS:
         raise C.PermissionError(message, where, self.princ)
     if code in _NOTFOUND_ERRORS:
         raise C.NotFoundError(message, where)
     raise I.KadminError(message, where, code)
Exemple #3
0
 def kill(self):
     if not self.enable_deploy:
         raise I.KadminException(-1, "Failed to create new database",
                                 "This function was disabled")
     path = '/var/lib/kerberos/krb5kdc'
     for f in os.listdir(path):
         if f.startswith('principal') or f.startswith('.'):
             os.remove(os.path.join(path, f))
     self.realm = None
Exemple #4
0
    def reGenerate(self, opts, template_path):
        if not self.enable_deploy:
            raise I.KadminException(-1, "Failed to create new database",
                                    "This function was disabled")

        password = opts.get('password')
        if not password:
            raise C.ConfigError('Mandatory parameter not supplied', 'password')

        _reset_configuration(opts, template_path)
        _run_command(["kdb5_util", "create", "-s", "-P", password],
                     "Failed to create database")
        self.realm = None
Exemple #5
0
 def randomizeServicePrincKeys(self, adm, service, host, current):
     princ = "%s/%s" % (service, host)
     adm.randkey_princ(princ)
     keys = adm.get_princ_keys(princ)
     return I.PrincKeys("%s@%s" % (princ, adm.get_realm()),
                        [I.Key(*i) for i in keys])
Exemple #6
0
 def createServicePrincipal(self, adm, service, host, current):
     princ = adm.create_service_princ(service, host)
     keys = adm.get_princ_keys(princ)
     return I.PrincKeys(princ, [I.Key(*i) for i in keys])
Exemple #7
0
 def getPrincKeys(self, adm, name, current):
     keys = adm.get_princ_keys(name)
     return I.PrincKeys(name, [I.Key(*i) for i in keys])