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

Setting CREDHUB_SERVER environment variable causes successful logins to be ignored. #98

Open
1 task done
tjvman opened this issue Jun 5, 2020 · 4 comments
Open
1 task done
Labels

Comments

@tjvman
Copy link

tjvman commented Jun 5, 2020

What version of the credhub server you are using?
2.5.9

What version of the credhub cli you are using?
2.6.2

If you were attempting to accomplish a task, what was it you were attempting to do?
Log in to Credhub with credhub login and run auth-required commands with the CREDHUB_SERVER environment variable set.

What did you expect to happen?
Commands run successfully after logging in via credhub login, regardless of whether CREDHUB_SERVER is set or not..

What was the actual behavior?
Auth-required commands run after logging in failed with You are not currently authenticated. Please log in to continue.

Please confirm where necessary:

  • I have included steps for reproduction

Steps to Repro

  1. export CREDHUB_SERVER=<ip>. Don't set any of the other magic variables (CREDHUB_CLIENT, etc).
  2. credhub login -s <server> -u <user> -p <pass>
  3. Run any auth-required command and see that it fails with the aforementioned error. We used credhub find -n /.
  4. unset CREDHUB_SERVER
  5. Run the same command again and see that it works.
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/173204360

The labels on this github issue will be updated when the story is started.

@will-gant
Copy link

We're seeing this behaviour as well (also 2.6.2 of the Credhub CLI, in our case with 2.6.0 of the Credhub bosh release).

$ export CREDHUB_SERVER=https://XXXXXXXX:8844
$ credhub login -u '[email protected]' -p 'XXXXXXXX'
Setting the target url: https://XXXXXXX:8844
Login Successful
$ credhub find
You are not currently authenticated. Please log in to continue.
$ unset CREDHUB_SERVER
$ credhub login -u '[email protected]' -p 'XXXXXXXX' -s https://XXXXXXXX:8844
$ credhub find
credentials: []

@will-gant
Copy link

will-gant commented Jun 11, 2020

By contrast I have no problems at all when exporting CREDHUB_SERVER if I'm authenticating with a client.

@adobley
Copy link

adobley commented Sep 30, 2020

The CLI now returns warnings that two auth methods were detected when:

  1. attempting to login with any CREDHUB_ environment variables set to inform the user that it does not actually log in and they do not need to run that command.
  2. logged in already using credhub login --xxx and then set CREDHUB_SERVER env var, and then run subsequent authenticated commands like credhub find

It would still be valuable to resolve the case in the issue where the user only set the SERVER variable and used a username/password flow, but we have not addressed that in this yet.

We do plan to address this with a more comprehensive fix. It will likely wind up being a breaking change and are evaluating our options.

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

No branches or pull requests

4 participants