1

I am trying to protect my zookeeper with credentials.

Until now i've used the following code in order to connect to zookeeper:

zk = KazooClient(hosts=HOSTS)
zk.start()

Now, in order to add credentials i've added an auth with addauth digest username:password command and set ACL to the znode with setAcl /znode auth:username:password:crdwa.

now when I try to connect to the zookeeper server via zkCli I get

kazoo.exceptions.NoAuthError

as excepted.

But how I can pass the auth credentials to the KazooClient?

I can create ACL credentials with

ACL = make_digest_acl("username", "password", all=True) 
CRED = make_digest_acl_credential("username", "password")

and add default_acl, auth_data like

zk = KazooClient(hosts=HOSTS, default_acl=ACL, auth_data=[CRED])

but i still cannot connect via python.

How I should authenticate the zookeeper server via kazoo client?

Thank you

Ami Hollander
  • 2,435
  • 3
  • 29
  • 47

1 Answers1

1

The auth_data should be pass as digest, for example:

KazooClient(hosts=HOSTS, auth_data=[("digest", "user:pass")])

Ami Hollander
  • 2,435
  • 3
  • 29
  • 47