Skip to content

Commit 94b21f9

Browse files
authored
feat: configure zookeeper c client for Kerberos authentication when KDC is configured with "rdns = false" (#1864) (#1867)
issue: #1863
1 parent 4aaa41d commit 94b21f9

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/zookeeper/zookeeper_session.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <utility>
3939

4040
#include "runtime/app_model.h"
41+
#include "runtime/rpc/rpc_address.h"
4142
#include "utils/flags.h"
4243
#include "utils/fmt_logging.h"
4344
#include "zookeeper/proto.h"
@@ -51,6 +52,10 @@ DSN_DEFINE_string(security,
5152
zookeeper_kerberos_service_name,
5253
"zookeeper",
5354
"zookeeper kerberos service name");
55+
DSN_DEFINE_string(security,
56+
zookeeper_sasl_service_fqdn,
57+
"",
58+
"The FQDN of a Zookeeper server, used in Kerberos Principal");
5459
} // namespace security
5560
} // namespace dsn
5661

@@ -169,6 +174,11 @@ int zookeeper_session::attach(void *callback_owner, const state_callback &cb)
169174
zoo_sasl_params_t sasl_params = {0};
170175
sasl_params.service = dsn::security::FLAGS_zookeeper_kerberos_service_name;
171176
sasl_params.mechlist = "GSSAPI";
177+
rpc_address addr;
178+
CHECK(addr.from_string_ipv4(dsn::security::FLAGS_zookeeper_sasl_service_fqdn),
179+
"zookeeper_sasl_service_fqdn {} is invalid",
180+
dsn::security::FLAGS_zookeeper_sasl_service_fqdn);
181+
sasl_params.host = dsn::security::FLAGS_zookeeper_sasl_service_fqdn;
172182
_handle = zookeeper_init_sasl(FLAGS_hosts_list,
173183
global_watcher,
174184
FLAGS_timeout_ms,

0 commit comments

Comments
 (0)