-
Notifications
You must be signed in to change notification settings - Fork 178
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
Replaced default auth configuration from 'none' to 'htpasswd'. #58
base: master
Are you sure you want to change the base?
Conversation
CC @dmcgowan |
Replaced the default registry auth configuration from 'none' to 'htpasswd'. Following the change in distribution/distribution#2362. Signed-off-by: Liron Levin <[email protected]>
ad98848
to
7361766
Compare
My main concern with changing the default like this is our potential to break production deployments behind load balancers who are making use of the Ping @tianon @yosifkit for any guidance on making major changes to the |
We've had a few instances when updating the Dockerization or configuration of an existing image:tag has broken some users, so we try to limit it. But sometimes we have to break things. My opinion on We have https://github.com/docker-library/repo-info which helps when we do break users. They can find a point-in-time sha256 of the version that works. |
@dmcgowan PTAL |
What is the user story for disabling this if they are running default config behind a proxy? |
@stevvooe the user sets their own config file that removes the |
Note, we expect to release this as a minor version bump too. Unless distribution operates differently to other projects, a minor version bump is generally expected to change some behaviours and possibly break some users. Edit: just confirmed specifics on semantic version numbers. Minor bump should be backwards compatible. This change is. Changing default behavior and offering a new feature (auto generation of htpasswd when not explicitly set as part of |
@endophage @stevvooe a user can set |
Most users don't replace the configuration and just use the default. This was surprising to me, as well, but we got a lot of early complaints about this when we first released. Most users either don't want to ship a registry image with the baked configuration or don't want to ship the configuration to the host for bind mounting. In practice, they either replace the storage by bind/volume mounting As far as versioning is concerned, this is clearly a compatibility break if existing user deployments need a change for an upgrade. I am not sure everyone sees it that way, but those running infrastructure will. Technically, this requires a major bump to version 3, if we are following semver but I am not necessarily opposed to doing this in a minor bump. Whatever escape hatch is provided, it should be on the distribution readme, the image readme, tweeted, blogged and a part of the release notes, at least. Re-iterating, we should have the following:
|
Thanks @stevvooe, just so it's clear, a simple way to disable auth after this change:
How do you suggest we processed (in terms of code and documentation updates)? |
I think this would be the plan going forward:
|
Thanks @stevvooe. Few questions: |
Does a more obvious value for "REGISTRY_AUTH" like "no" or "none" also work?
|
@tianon, no, only empty string. |
That's kind of a poor user experience. 😞 Any chance that could be updated to also allow |
@stevvooe, @dmcgowan, @endophage I've created the following script to verify that the override parameter works. Note that the validation below is actually more strict since it verifies that the AUTH environment variable overrides even when the registry is configured with authentication. Let me know where to put this script, and any further steps necessary. #!/bin/bash
set -e
# Validate ne registry settings are backward competitble
# Run baseline registry (latest) ith htpasswd enabled (with persistent volume for storage)
# Push sample image
# Re-run with new image with REGISTRY_AUTH set to empty (no htpasswd)
# Pull image (to validate data is persistent)
# Push image
# Re-run with default settings (with htpasswd)
# Ensure valid credential works, and push image
registry_baseline=registry
registry_new=registry:new
persistent_storage=/tmp/registry # Store all data in persistent location
mkdir -p /tmp/auth
# Cleanup previous runs
docker rm -vf registry || true
# Generate password
docker run --rm --entrypoint htpasswd registry:2 -Bbn testuser testpassword > /tmp/auth/htpasswd
# Run the baseline registry with authorization
docker run -d -p 5000:5000 --name registry -v ${persistent_storage}:/var/lib/registry -v /tmp/auth/htpasswd:/etc/registry -e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/etc/registry \
${registry_baseline}
# Pull some image
docker pull --disable-content-trust=false hello-world:latest
# Tag it
image_tag=localhost:5000/hello-world:latest
docker tag hello-world:latest ${image_tag}
# Push image to registry
docker login --username testuser --password testpassword localhost:5000
docker push ${image_tag}
# Build the new registry
docker build . -t ${registry_new}
# Remove old registry
docker rm -vf registry
# Run new registry
docker run -d -p 5000:5000 --name registry -v ${persistent_storage}:/var/lib/registry -v `pwd`/auth/htpasswd:/etc/registry -e "REGISTRY_AUTH=" ${registry_new}
# Sleep to ensure registry starts
sleep 1
# Login with fake password (no auth)
docker login --username fakeuser --password fakepassword localhost:5000
# Ensure data is persistent (pull existing image)
docker pull ${image_tag}
docker push ${image_tag}
# Remove old registry and
docker rm -vf registry
# Run with default htpasswd
docker run -d -p 5000:5000 --name registry -v ${persistent_storage}:/var/lib/registry -v `pwd`/auth/htpasswd:/etc/registry ${registry_new}
set +e
# Ensure registry authenticate user
docker login --username fakeuser --password fakepassword localhost:5000
if [[ $? == 0 ]];then
exit 1
fi
set -e
docker login --username testuser --password testpassword localhost:5000
docker push ${image_tag}
rm -rf /tmp/auth |
NP, @stevvooe updated distribution/distribution#2362. |
@tianon wdyt at this point? |
If this is something y'all want to move forward with, it should be reasonably safe to do so (assuming the docs are also updated, which currently assume the default will be authentication-less). Given that the implementation supports |
Replaced the default registry auth configuration from 'none' to
'htpasswd'.
Following the change in distribution/distribution#2362.
Signed-off-by: Liron Levin [email protected]