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

Core: CLI imporvement VAULT_ADDR Warning message #17008

Closed
wants to merge 2 commits into from

Conversation

aphorise
Copy link
Contributor

@aphorise aphorise commented Sep 4, 2022

When VAULT_ADDR or -address is not set provide warning messages as below. Resolves #9684.

./vault status
  # WARNING: neither VAULT_ADDR nor the -address parameter is set. Defaulting to loopback address (https://127.0.0.1:8200).
  # Error checking seal status: Get "https://127.0.0.1:8200/v1/sys/seal-status": dial tcp 127.0.0.1:8200: connect: connection refused

Copy link
Contributor

@mpalmi mpalmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just one concern here. How often do deployments have VAULT_ADDR and -address both unset. Could this potentially cause alarm (or introduce noise)? If that's the case, maybe we could step this down to Info? Otherwise 👍

command/base.go Outdated Show resolved Hide resolved
command/base.go Outdated Show resolved Hide resolved
@aphorise
Copy link
Contributor Author

aphorise commented Sep 6, 2022

How often do deployments have VAULT_ADDR and -address both unset.

Great question - from my observation 99% (if not 100%) is operators on CLI or in an administration scenarios directly accessing a host / pod where defaults that might be set via some script / ENV setter, was not run or forgotten and to make it even more interesting ofc there is no explicit (127.0.0.1) loopback binding and especially not one with v3 SAN DNS + IP certificates which I am opinionated on 😄 (yes you need it! - 0 trust shouldn't mean we tls_disable loopback cause its fine)

Anyway I've generally observed operators do typically find their way back and recall the need to explicitly define something not right - however just a reminder that nothing is set and that defaults address are being used will hopefully prevent repeats of trying the same command and expecting a different outcome (I've seen that too) 🤣

Could this potentially cause alarm (or introduce noise)? If that's the case, maybe we could step this down to Info?

I agree I'd personally do it Info - but playing the devils advocate - other conflicts like in the case of ~/vault_token & TOKEN overlap are WARN - just based on that being a cautionary note then this could equally qualify with its YELLOW colour scheming which is actually why I thought it may be more fitting; also the fact that it's expected less commonly will over-time make it the lesser yet most common YELLOW which could actually be a good thing? 👺

@shaypepper @mr-fixit - do you folks have any opinions here - is WARN too much noise to be seeing each time and can INFO level messages suffice instead?

PS - @mpalmi on a separate topic related to -address I'd love to understand where there may be an absolute need for that as a client (discarding legacy). If there are more exceptions to it's use then it would be great if that could be eventually removed since we've also observed other strange behaviours or confusion where that's seen as directive address to something else - eg vault operator raft join -address=http://...leader:8200 (not correct). I also appreciate that some of these parameters are striving to provide multiple uses as a Vault Client, Vault Agent, Vault Server, etc - in the CLI client case excluding some of these would actually help - maybe one day if Vault gets a separate CLI.

@mr-fixit
Copy link

mr-fixit commented Sep 7, 2022

How often do deployments have VAULT_ADDR and -address both unset.

As a newbie, it's the first mistake I made.

@shaypepper @mr-fixit - do you folks have any opinions here - is WARN too much noise to be seeing each time and can INFO level messages suffice instead?

The reason I asked for this was to help the newbie. Will 'INFO' still show up to the newbie?

@aphorise
Copy link
Contributor Author

aphorise commented Sep 7, 2022

@mr-fixit - difference:
Screenshot 2022-09-07 at 20 51 41

@mr-fixit
Copy link

mr-fixit commented Sep 7, 2022

i'm happy either way.

@aphorise
Copy link
Contributor Author

aphorise commented Sep 7, 2022

@mpalmi I'm actually now inclined to the Yellow warning which also becomes the first note on dev mode too. WDYT should I move over to info to leave as is?

@aphorise
Copy link
Contributor Author

aphorise commented Sep 7, 2022

@mpalmi please recheck.
image

@mpalmi
Copy link
Contributor

mpalmi commented Sep 7, 2022

@mpalmi I'm actually now inclined to the Yellow warning which also becomes the first note on dev mode too. WDYT should I move over to info to leave as is?

I just looked through the existing c.UI.Warn() messages, and they seem to be generally related to failures of some kind. My 2c is that expected default behavior is more at home in the bucket of Info; however, I'm more than happy to let go of this opinion 😄.

I defer to your judgment on this @aphorise.

Copy link
Contributor

@mpalmi mpalmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I'm comfortable with the Warn if you'd prefer to keep it that way.

@aphorise
Copy link
Contributor Author

aphorise commented Sep 8, 2022

Hey @mpalmi do you know if this will make it into 1.12 - prior to it's code freeze?

@aphorise
Copy link
Contributor Author

Closing in favour of replacement: #17076

@aphorise aphorise closed this Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

request: improve vault login error message to help the newbie
3 participants