mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Don't assume local directory is valid or writable.
certutil writes to the local directory when issuing a certificate. Change to the security database directory when issuing the self-signed CA. Also handle the case where a user is in a non-existent directory when doing the install.
This commit is contained in:
parent
4e6373cf95
commit
33a30fef12
@ -190,7 +190,10 @@ class CertDB(object):
|
|||||||
self.certreq_fname = None
|
self.certreq_fname = None
|
||||||
self.certder_fname = None
|
self.certder_fname = None
|
||||||
self.host_name = host_name
|
self.host_name = host_name
|
||||||
|
try:
|
||||||
self.cwd = os.getcwd()
|
self.cwd = os.getcwd()
|
||||||
|
except OSError, e:
|
||||||
|
raise RuntimeError("Unable to determine the current directory: %s" % str(e))
|
||||||
|
|
||||||
self.self_signed_ca = ipa_self_signed()
|
self.self_signed_ca = ipa_self_signed()
|
||||||
|
|
||||||
@ -352,6 +355,7 @@ class CertDB(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def create_ca_cert(self):
|
def create_ca_cert(self):
|
||||||
|
os.chdir(self.secdir)
|
||||||
p = subprocess.Popen(["/usr/bin/certutil",
|
p = subprocess.Popen(["/usr/bin/certutil",
|
||||||
"-d", self.secdir,
|
"-d", self.secdir,
|
||||||
"-S", "-n", self.cacert_name,
|
"-S", "-n", self.cacert_name,
|
||||||
@ -382,6 +386,7 @@ class CertDB(object):
|
|||||||
p.stdin.write("y\n\ny\n")
|
p.stdin.write("y\n\ny\n")
|
||||||
p.stdin.write("5\n6\n7\n9\nn\n")
|
p.stdin.write("5\n6\n7\n9\nn\n")
|
||||||
p.wait()
|
p.wait()
|
||||||
|
os.chdir(self.cwd)
|
||||||
|
|
||||||
def export_ca_cert(self, nickname, create_pkcs12=False):
|
def export_ca_cert(self, nickname, create_pkcs12=False):
|
||||||
"""create_pkcs12 tells us whether we should create a PKCS#12 file
|
"""create_pkcs12 tells us whether we should create a PKCS#12 file
|
||||||
|
Loading…
Reference in New Issue
Block a user