-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Certificate enrollment: Fixes for LDAP searches and for some issues with multiple domain environments #1185
base: main
Are you sure you want to change the base?
Conversation
In the log output, there were several line breaks that were being escaped (i.e. '\\n'), which was preventing them from being properly printed. Fixing this allows for a better debugging experience and clearer output.
The previous implementation tried to autodiscover the CEPCES server to which it should connect to and fetch the templates for a specific CA. However, it was setup in a way which would always override what was configured in the cepces config file. This was problematic as it was always assuming that the CEPCES server was the same as the CA source, which isn't always the case. These changes now allow us to override this behavior through the cepces.conf file or keep it as is, provided that the configuration file is the default one. This also improves the output and error handling of the process, as it didn't return any kind of message when failing to parse the templates properly.
Some of the LDAP queries, although working on simple single-domain environments, were causing problems on more complex ones (multiple domains). This refines some of the queries to properly handle both cases using the values that they should be using.
a8a09cb
to
81549ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work on this daunting task! I only have few requests!
ext.enroll(guid, entries, trust_dir, private_dir) | ||
enrolled_cas = ext.enroll(guid, entries, trust_dir, private_dir) | ||
if enrolled_cas is None: | ||
log.warning('Could not enroll to any certificates') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"any certificate servers" (or service), rather?
@@ -191,14 +194,31 @@ def get_supported_templates(server): | |||
log.error('Failed to find cepces-submit') | |||
return [] | |||
|
|||
cepces_config = configparser.ConfigParser() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that brings me back some nostalgia :)
p = Popen(cepces_args, env=env, stdout=PIPE, stderr=PIPE) | ||
out, err = bytes(), bytes() | ||
try: | ||
out, err = p.communicate(timeout=3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a comment on the need for timeout. (could be stuck forever)
This PR handles some issues encountered during certificate auto-enrollment on environments with multiple domains. Specific details for the fixes are listed on their respective commit messages, so I highly recommend looking at those.
Closes #1108
UDENG-4835