-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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
Enable basic auth username rotation for GCI #44590
Conversation
…to be able to rotate username in addition to password
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
(I signed the CLA as an employee of Google.) |
I don't think we want to delete whole file, as user might have added stuff to it. But I'll let @cjcullen do the review. |
/approve |
@cjcullen ptal. |
@@ -233,6 +233,7 @@ ENABLE_LEGACY_ABAC="${ENABLE_LEGACY_ABAC:-true}" # true, false | |||
# Kernel panic upon soft lockup issue | |||
SOFTLOCKUP_PANIC="${SOFTLOCKUP_PANIC:-false}" # true, false | |||
|
|||
# Indicates if the values (eg. kube password) in metadata should be treated as | |||
# canonical, and therefore disk copies ought to be recreated/clobbered. | |||
# Indicates if the values (i.e. KUBE_USER and KUBE_PASSWORD for basic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: e.g.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an intentional change; KUBE_USER and KUBE_PASSWORD aren't examples, they are actually the things that are overwritten. https://english.stackexchange.com/questions/1629/e-g-versus-i-e/1631
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh gotcha.
I'd say "Indicates if the KUBE_USER and KUBE_PASSWORD values..." because I won't be the only one who misunderstands this, and assumes this env var has wider scope than it does.
cluster/gce/gci/configure-helper.sh
Outdated
@@ -286,31 +286,30 @@ function create-master-auth { | |||
local -r auth_dir="/etc/srv/kubernetes" | |||
local -r basic_auth_csv="${auth_dir}/basic_auth.csv" | |||
if [[ -n "${KUBE_PASSWORD:-}" && -n "${KUBE_USER:-}" ]]; then | |||
# Remove basic_auth_csv because we will rewrite it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put this comment one line below and be a little more specific (because this bash is so gross).
Maybe:
When METADATA_CLOBBERS_CONFIG==true, just remove the basic auth file, because the append_or_replace calls below will regenerate the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@cheftako Can you take a quick look at this too? |
# completely, because if we're changing KUBE_USER and KUBE_PASSWORD, we | ||
# have nothing to match on. The file is replaced just below with | ||
# append_or_replace_prefixed_line. | ||
rm "${basic_auth_csv}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original sed nastiness was chosen rather than a file remove because there was a belief that in GCE a customer might have manually added their own users. This fix is clearly fine in GKE, but I'm not sure if our original concerns about additional GCE user accounts no longer applies. If it does still apply then this does not seem safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the exception of the file rm this seems good to me. If we believe the original extra user account in GCE issue no longer applies, then all good.
I wasn't part of that original discussion, but I'd give two arguments that this is okay (1) This defaults to false on GCE, so a user has to explicitly set it to true to clobber their existing config, and (2) if they're manually adding auth to the auth file, why would they use metadata to automatically edit that file anyway? Seems like a pretty unlikely use-case to me, but of course it's entirely possible. The alternative is to create a separate flag, ( |
/lgtm |
/assign @mikedanese for OWNERS approval. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cjcullen, gmarek, ihmccreery, mikedanese
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
@cjcullen Can you please add the appropriate release notes labels? "release-note-none," I guess? |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue (batch tested with PRs 44590, 44969, 45325, 45208, 44714) |
@cjcullen Can you please go through the motions of getting this cherrypicked (add the v1.6 milestone and |
Commit found in the "release-1.6" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked. |
When changing basic auth creds, just delete the whole file, in order to be able to rotate username in addition to password.