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

Introduce env. variable NOTARY_AUTH for setting username & password #1246

Merged
merged 1 commit into from
Oct 25, 2017

Conversation

stefanberger
Copy link

In case of automation it may not be possible to prompt the user
for username and password. To provide a way to pass username and
password we introduce the NOTARY_AUTH environment variable through
which username and password can be passed. Username and password
must be separated by ':' and base64 encoded.

The following example shows how to set username and password:

export NOTARY_AUTH="$(echo -n "me:mysecretpassword" | base64)"

Decoding:

echo $NOTARY_AUTH | base64 -d
me:mysecretpassword

Signed-off-by: Stefan Berger stefanb@linux.vnet.ibm.com

@docker-jenkins
Copy link

Can one of the admins verify this patch?

@stefanberger stefanberger force-pushed the basic_auth_envvar branch 6 times, most recently from a0a8ef4 to 21ee339 Compare October 14, 2017 00:17
In case of automation it may not be possible to prompt the user
for username and password. To provide a way to pass username and
password we introduce the NOTARY_AUTH environment variable through
which username and password can be passed. Username and password
must be separated by ':' and base64 encoded.

The following example shows how to set username and password:

> export NOTARY_AUTH="$(echo -n "me:mysecretpassword" | base64)"

Decoding:

> echo $NOTARY_AUTH | base64 -d
me:mysecretpassword

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Copy link
Contributor

@riyazdf riyazdf left a comment

Choose a reason for hiding this comment

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

thank you @stefanberger this is very useful, LGTM!

return username, password
}

logrus.Error("Malformatted authentication string; format must be <username>:<password>")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm debating whether it makes sense for this to be a fatal error here. This is only used in the CLI so it seems like it would be desirable to exit ASAP if we've made the decision the inputs are bad. Thoughts?

Copy link
Author

Choose a reason for hiding this comment

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

Would be fine by me. I followed the existing pattern where we don't exit with fatal error on timeout from keyboard input, either. Maybe that should then be changed as well in either a preceding patch or one on top of this here...

Copy link
Author

Choose a reason for hiding this comment

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

The test cases would not be able to test false inputs, though. Running into failures would exit the test case...

Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm yeah, definitely prefer having the tests work properly. We'll leave this as is 👍

Copy link
Contributor

@endophage endophage left a comment

Choose a reason for hiding this comment

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

LGTM

@endophage endophage merged commit 78c6068 into notaryproject:master Oct 25, 2017
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.

4 participants