summaryrefslogtreecommitdiffstats
path: root/func/certs.py
diff options
context:
space:
mode:
Diffstat (limited to 'func/certs.py')
-rw-r--r--func/certs.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/func/certs.py b/func/certs.py
index 22af866..810d17c 100644
--- a/func/certs.py
+++ b/func/certs.py
@@ -48,7 +48,12 @@ def make_csr(pkey, dest=None, cn=None):
if cn:
subj.CN = cn
else:
- subj.CN = socket.getfqdn()
+ fqdn = socket.getfqdn()
+ host = socket.gethostname()
+ if fdqn.find(host) != -1:
+ subj.CN = fqdn
+ else:
+ subj.CN = host
subj.emailAddress = 'root@%s' % subj.CN
req.set_pubkey(pkey)