1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

gpo: Improve Certificate Auto Enroll Debug messages

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr  5 01:44:33 UTC 2022 on sn-devel-184
This commit is contained in:
David Mulder 2022-04-04 10:42:40 -06:00 committed by Jeremy Allison
parent 157d2dd77f
commit 63bbdbae19

View File

@ -86,8 +86,8 @@ def get_supported_templates(server):
env=env, stdout=PIPE, stderr=PIPE)
out, err = p.communicate()
if p.returncode != 0:
log.warn('Failed to fetch the list of supported templates.')
log.debug(err.decode())
data = { 'Error': err.decode() }
log.error('Failed to fetch the list of supported templates.', data)
return out.strip().split()
return []
@ -142,7 +142,8 @@ def cert_enroll(ca, trust_dir, private_dir):
out, err = p.communicate()
log.debug(out.decode())
if p.returncode != 0:
log.debug(err.decode())
data = { 'Error': err.decode(), 'CA': ca['cn'][0] }
log.error('Failed to add Certificate Authority', data)
supported_templates = get_supported_templates(ca['dNSHostName'][0])
for template, attrs in ca['certificateTemplates'].items():
if template not in supported_templates:
@ -158,7 +159,8 @@ def cert_enroll(ca, trust_dir, private_dir):
out, err = p.communicate()
log.debug(out.decode())
if p.returncode != 0:
log.debug(err.decode())
data = { 'Error': err.decode(), 'Certificate': nickname }
log.error('Failed to request certificate', data)
data['files'].extend([keyfile, certfile])
data['templates'].append(nickname)
if update is not None: