Skip to content

Commit

Permalink
Ticket 4350 - dsrc should warn when tls_cacertdir is invalid (#4353)
Browse files Browse the repository at this point in the history
Bug Description: When the cacertdir is not a directory
or does not exist we should warn that this is not valid
and provide recification steps.

Fix Description: Check if the path exists or is a directory
and report this, along with steps on how to run c_rehash

fixes: #4350

Author: William Brown <william@blackhats.net.au>

Review by: spichugi (Thanks!)
  • Loading branch information
Firstyear committed Oct 29, 2020
1 parent 2b944b1 commit c42521d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib389/lib389/cli_base/dsrc.py
Expand Up @@ -137,6 +137,12 @@ def dsrc_to_ldap(path, instance_name, log):
raise Exception("%s [%s] saslmech must be one of EXTERNAL or PLAIN" % (path, instance_name))

dsrc_inst['tls_cacertdir'] = config.get(instance_name, 'tls_cacertdir', fallback=None)
# At this point, we should check if the provided cacertdir is indeed, a dir. This can be a cause
# of basic failures and confusion.
if os.path.exists(dsrc_inst['tls_cacertdir']) == False or os.path.isdir(dsrc_inst['tls_cacertdir']) == False:
log.warning("Warning: dsrc tls_cacertdir path may not exist, or is not a directory")
log.warning("Warning: This should be a directory, and you must run '/usr/bin/c_rehash path' for it to be a valid CA store")

dsrc_inst['tls_cert'] = config.get(instance_name, 'tls_cert', fallback=None)
dsrc_inst['tls_key'] = config.get(instance_name, 'tls_key', fallback=None)
dsrc_inst['tls_reqcert'] = config.get(instance_name, 'tls_reqcert', fallback='hard')
Expand Down

0 comments on commit c42521d

Please sign in to comment.