Skip to content

Commit 7ebfd8b

Browse files
author
Carlos Gonzalez Betancort
committed
MB-34361 Send content of CA Cert in setting-ldap
The setting command was sending the file path instead of the content to the endpoint, this commit fixes this. The commit also renames --ca-cert to --ldap-cacert so that is not confused with the --cacert flag that is used for verifying the connection to the couchbase cluster. Change-Id: I7e3ab65242f72633c97487104f0107bb0e955668 Reviewed-on: http://review.couchbase.org/111220 Tested-by: Build Bot <build@couchbase.com> Reviewed-by: Patrick Varley <patrick@couchbase.com>
1 parent fcb1dc0 commit 7ebfd8b

4 files changed

Lines changed: 75 additions & 80 deletions

File tree

cbmgr.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,7 +2676,7 @@ def __init__(self):
26762676
choices=["tls", "startTLS", "none"], default="none", help="Encryption used")
26772677
group.add_argument("--disable-cert-validation", dest="disable_cert_val", default=False, action="store_true",
26782678
help="Disable server certificate validation.")
2679-
group.add_argument("--ca-cert", dest="cacert", metavar="<path>",
2679+
group.add_argument("--ldap-cacert", dest="cacert_ldap", metavar="<path>",
26802680
help="CA certificate to be used for LDAP server certificate validation, required if" +
26812681
" certificate validation is not disabled")
26822682
group.add_argument("--user-dn-mapping", metavar="<mapping>", dest="user_dn_mapping",
@@ -2737,10 +2737,11 @@ def _set(self, opts, rest):
27372737
else:
27382738
opts.authorization_enabled = 'false'
27392739

2740-
if not opts.disable_cert_val:
2741-
if opts.cacert is None:
2742-
_exitIfErrors(['--ca-cert is required when server certificate verification is active.'])
2743-
opts.cacert = _exit_on_file_read_failure(opts.cacert)
2740+
if opts.disable_cert_val and opts.cacert_ldap is not None:
2741+
_exitIfErrors(['--disable-cert-validation and --ldap-cert can not be used together'])
2742+
2743+
if opts.cacert_ldap is not None:
2744+
opts.cacert_ldap = _exit_on_file_read_failure(opts.cacert_ldap)
27442745

27452746
if opts.encryption == "tls":
27462747
opts.encryption = "TLS"
@@ -2764,7 +2765,7 @@ def _set(self, opts, rest):
27642765
opts.encryption, opts.user_dn_mapping, opts.timeout, opts.max_parallel,
27652766
opts.max_cache_size, opts.cache_value_lifetime, opts.query_dn, opts.query_pass,
27662767
opts.group_query, opts.nested_groups, opts.nested_max_depth,
2767-
opts.disable_cert_val, opts.cacert)
2768+
opts.disable_cert_val, opts.cacert_ldap)
27682769

27692770
_exitIfErrors(errors)
27702771
_success("LDAP settings modified")

0 commit comments

Comments
 (0)