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")
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)
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
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
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])
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])
def getPrincKeys(self, adm, name, current): keys = adm.get_princ_keys(name) return I.PrincKeys(name, [I.Key(*i) for i in keys])