summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/installutils.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-04-17 17:17:31 -0400
committerRob Crittenden <rcritten@redhat.com>2009-05-04 16:54:42 -0400
commitdfe9db55484339a8a9f2ce3bd057bd9702bb9579 (patch)
treefb99b81da54e189d6ea08c47348b4e044990ecbc /ipaserver/install/installutils.py
parent36c239cda44c3e816a3ffd95957f2d49f434f62b (diff)
downloadfreeipa-dfe9db55484339a8a9f2ce3bd057bd9702bb9579.tar.gz
freeipa-dfe9db55484339a8a9f2ce3bd057bd9702bb9579.tar.xz
freeipa-dfe9db55484339a8a9f2ce3bd057bd9702bb9579.zip
Add signing profile to CA installation so we can sign the firefox jar file.
Use the requestId we get back from the CA when requesting the RA agent cert and use that to issue the certificate rather than hardcoding 7. This also adds some clean-up of file permissions and leaking fds
Diffstat (limited to 'ipaserver/install/installutils.py')
-rw-r--r--ipaserver/install/installutils.py29
1 files changed, 27 insertions, 2 deletions
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index f5e04636c..c12023719 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -210,24 +210,49 @@ def update_file(filename, orig, subst):
print "File %s doesn't exist." % filename
return 1
-def set_directive(filename, directive, value):
+def set_directive(filename, directive, value, quotes=True, separator=' '):
"""Set a name/value pair directive in a configuration file.
This has only been tested with nss.conf
"""
+ valueset = False
fd = open(filename)
file = []
for line in fd:
if directive in line:
- file.append('%s "%s"\n' % (directive, value))
+ valueset = True
+ if quotes:
+ file.append('%s%s"%s"\n' % (directive, separator, value))
+ else:
+ file.append('%s%s%s\n' % (directive, separator, value))
else:
file.append(line)
fd.close()
+ if not valueset:
+ if quotes:
+ file.append('%s%s"%s"\n' % (directive, separator, value))
+ else:
+ file.append('%s%s%s\n' % (directive, separator, value))
fd = open(filename, "w")
fd.write("".join(file))
fd.close()
+def get_directive(filename, directive, strip_quotes=True, separator=' '):
+ """
+ A rather inefficient way to get a configuration directive.
+ """
+ fd = open(filename, "r")
+ for line in fd:
+ if directive in line:
+ line = line.strip()
+ result = line.split(separator, 1)[1]
+ result = result.strip('"')
+ fd.close()
+ return result
+ fd.close()
+ return None
+
def kadmin(command):
ipautil.run(["/usr/kerberos/sbin/kadmin.local", "-q", command])