mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-27 16:46:42 -06:00
Write KRB5REALM to /etc/sysconfig/krb5kdc and make use of common backup_config_and_replace_variables() tool
systemd service unit for krb5kdc in Fedora 16 uses KRB5REALM variable of /etc/sysconfig/krb5kdc to start krb5kdc for the default realm. Thus, we need to make sure it is always existing and pointing to our realm. Partial fix for: https://fedorahosted.org/freeipa/ticket/1192
This commit is contained in:
parent
8badce286f
commit
498311d2ef
@ -320,28 +320,16 @@ class KrbInstance(service.Service):
|
||||
min = version.LooseVersion(MIN_KRB5KDC_WITH_WORKERS)
|
||||
if ver >= min:
|
||||
workers = True
|
||||
# Write down config file
|
||||
# We write realm and also number of workers (for multi-CPU systems)
|
||||
replacevars = {'KRB5REALM':self.realm}
|
||||
appendvars = {}
|
||||
if workers and cpus > 1:
|
||||
#read in memory, find KRB5KDC_ARGS, check/change it, then overwrite file
|
||||
self.fstore.backup_file("/etc/sysconfig/krb5kdc")
|
||||
|
||||
need_w = True
|
||||
fd = open("/etc/sysconfig/krb5kdc", "r")
|
||||
lines = fd.readlines()
|
||||
fd.close()
|
||||
for line in lines:
|
||||
sline = line.strip()
|
||||
if not sline.startswith('KRB5KDC_ARGS'):
|
||||
continue
|
||||
sline = sline.replace('"', '')
|
||||
if sline.find("-w") != -1:
|
||||
need_w = False
|
||||
|
||||
if need_w:
|
||||
fd = open("/etc/sysconfig/krb5kdc", "w")
|
||||
for line in lines:
|
||||
fd.write(line)
|
||||
fd.write('KRB5KDC_ARGS="${KRB5KDC_ARGS} -w %s"\n' % str(cpus))
|
||||
fd.close()
|
||||
appendvars = {'KRB5KDC_ARGS': "-w %s" % str(cpus)}
|
||||
ipautil.backup_config_and_replace_variables(self.fstore, "/etc/sysconfig/krb5kdc",
|
||||
replacevars=replacevars,
|
||||
appendvars=appendvars)
|
||||
ipaservices.restore_context("/etc/sysconfig/krb5kdc")
|
||||
|
||||
def __write_stash_from_ds(self):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user