add emailaddr option to the make_csr routine so we can identify a cert/key via
authorSeth Vidal <skvidal@fedoraproject.org>
Wed, 5 May 2010 04:14:31 +0000 (00:14 -0400)
committerSeth Vidal <skvidal@fedoraproject.org>
Wed, 5 May 2010 04:14:31 +0000 (00:14 -0400)
email - not just assuming a hostname.

default still works the same as before root@cn

certmaster/certs.py

index 81409f3..da0942f 100644 (file)
@@ -37,7 +37,7 @@ def make_keypair(dest=None):
     return pkey
 
 
-def make_csr(pkey, dest=None, cn=None, hostname=None):
+def make_csr(pkey, dest=None, cn=None, hostname=None, emailaddr=None):
     req = crypto.X509Req()
     req.get_subject()
     subj  = req.get_subject()
@@ -53,7 +53,10 @@ def make_csr(pkey, dest=None, cn=None, hostname=None):
     else:
         subj.CN = utils.gethostname()
 
-    subj.emailAddress = 'root@%s' % subj.CN       
+    if emailaddr:
+        subj.emailAddress = emailaddr
+    else:
+        subj.emailAddress = 'root@%s' % subj.CN       
         
     req.set_pubkey(pkey)
     req.sign(pkey, 'md5')