X-Git-Url: https://pwan.org/git/?p=certmaster.git;a=blobdiff_plain;f=certmaster%2Fcerts.py;h=554822e702a2abde02b6c8383d55a18061657079;hp=8a1db3a8c6c75b91a9f5371b759a4dd3d3cce220;hb=1e64c312e159e604eb45a06036b5e2c9a0a149df;hpb=69d891253a0aed3a83f09c5d5b091fe6f42d421a diff --git a/certmaster/certs.py b/certmaster/certs.py index 8a1db3a..554822e 100644 --- a/certmaster/certs.py +++ b/certmaster/certs.py @@ -37,7 +37,7 @@ def make_keypair(dest=None): return pkey -def make_csr(pkey, dest=None, cn=None): +def make_csr(pkey, dest=None, cn=None, hostname=None): req = crypto.X509Req() req.get_subject() subj = req.get_subject() @@ -48,8 +48,11 @@ def make_csr(pkey, dest=None, cn=None): subj.OU = def_ou if cn: subj.CN = cn + elif hostname: + subj.CN = hostname else: - subj.CN = utils.get_hostname() + subj.CN = utils.gethostname() + subj.emailAddress = 'root@%s' % subj.CN req.set_pubkey(pkey)