Skip to content
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

Auth not working #28

Closed
jmreicha opened this issue Aug 1, 2017 · 6 comments
Closed

Auth not working #28

jmreicha opened this issue Aug 1, 2017 · 6 comments
Labels

Comments

@jmreicha
Copy link

jmreicha commented Aug 1, 2017

I'm attempting to read a value from a hosted etcd cluster with a proxy in front (compose.io), but it seems to hang and I'm not really sure what it's doing. I have tested with etcdctl and it works.

Here's the code I'm using to test. Any ideas?

const { Etcd3 } = require('etcd3')                                                                                                                                                                                                                                             const client = new Etcd3({
    hosts: 'https://etcd-proxy.domain.com:1234',
    auth: {
        username: 'user',
        password: 'password'
    }
})

console.log("getting...")
client.get('test/test1').string().then(value => {
    console.log(value)
})
@connor4312
Copy link
Member

connor4312 commented Aug 1, 2017

Thanks for the issue @jmreicha!

Auth should definitely work and we test it on our CI. Without more details/debugging it's hard to say what's wrong. Any chance you could email me details for a permission-less test account on your instance? My email is connor@xbox.com.

@jmreicha
Copy link
Author

jmreicha commented Aug 1, 2017

Just a quick update.

I was able to get the code working by removing the https:// from the hosts and adding in an empty credentials block (credentials: {}).

@shakefu
Copy link
Contributor

shakefu commented Aug 1, 2017

I'm working with @jmreicha on this, it looks like the affected code is here, where it simply checks for the existence of a credentials property of the options passed to the client to decide whether to use SSL or not, rather than parsing the hosts to look for an https prefix.

Would it be possible to add a simple ssl: true check in the options? Or update the buildAuthentication method to check the provided hosts for https://?

@connor4312
Copy link
Member

Checking for an https prefix on the hosts would be a good way to go about it. || hosts.some(h => h.startsWith('https:'), something like that. A PR is welcome, otherwise I'll get to it tonight

connor4312 added a commit to connor4312/grpc that referenced this issue Aug 2, 2017
It appears that omitting it causes grpc to use the hosts' default cert data.
This was brought up (as I had implemented this method incorrectly) in:
microsoft/etcd3#28 (comment)
@connor4312
Copy link
Member

Can you give #29 a spin?

@connor4312
Copy link
Member

Verified and published in 0.2.4. Thanks for your help resolving this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants