Skip to content

Auth registry for authenticated pull - #112

Merged
alicefr merged 5 commits into
bootc-dev:mainfrom
HarshwardhanPatil07:auth-registry
Sep 11, 2026
Merged

Auth registry for authenticated pull#112
alicefr merged 5 commits into
bootc-dev:mainfrom
HarshwardhanPatil07:auth-registry

Conversation

@HarshwardhanPatil07

@HarshwardhanPatil07 HarshwardhanPatil07 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Adds a second registry instance (bink-auth-registry) configured with htpasswd authentication. This registry shares the same storage volume as the existing unauthenticated registry, ensuring that images pushed to localhost:5000 are immediately available on localhost:5001 with credentials, without any data duplication.

Verification steps:

1. Build and start

make build-bink
./bink cluster start --cluster-name test --api-port 0

2. Push an image to the unauthenticated registry

podman pull quay.io/libpod/busybox:latest
podman tag quay.io/libpod/busybox:latest localhost:5000/busybox:test
podman push --tls-verify=false localhost:5000/busybox:test

3. Verify auth works

curl -s http://localhost:5001/v2/_catalog # → 401 (blocked)
curl -s -u testuser:testpassword http://localhost:5001/v2/_catalog # → {"repositories":["busybox"]}

4. Clean up

./bink cluster stop --cluster-name test --remove-data

closes #101

@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

cc @alicefr @Johan-Liebert1

@Johan-Liebert1 Johan-Liebert1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall looks sane

Comment thread internal/cli/registry/stop.go Outdated
Comment thread internal/cli/registry/stop.go Outdated
Comment thread internal/node/cloudinit_test.go Outdated
Comment thread internal/node/cloudinit_test.go Outdated
Comment thread internal/node/cloudinit_test.go
Comment thread internal/registry/registry.go
Comment thread internal/registry/registry.go Outdated
Comment thread internal/registry/registry.go
Comment thread internal/registry/registry.go Outdated
@alicefr

alicefr commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

@HarshwardhanPatil07 thanks for the work, would you mind to add an integration test. Like push an image and try to pull it using the secret registry and authentication. Thanks!

@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

Thank you very much for the amazing reviews @alicefr @Johan-Liebert1. If you have more questions please do let me know

@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

Yes @alicefr, I will create test in follow up PR to keep it clean

@alicefr

alicefr commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Yes @alicefr, I will create test in follow up PR to keep it clean

Please, include it in this PR so we can check if the code is correct

@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

@alicefr Yes

@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

cc @ptalgulk01

@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

cc @Johan-Liebert1 @alicefr PTAL

Comment thread internal/config/defaults.go Outdated
@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

cc @alicefr

Comment thread internal/registry/registry.go Outdated
Comment thread test/integration/registry_test.go Outdated
Comment thread test/integration/registry_test.go
@alicefr

alicefr commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

@HarshwardhanPatil07 can you also please add some documentation in the README how to use the registry with authentication, and the limits? Like we can only pull from it but not pushing. Additionally, the user and password are still hardcoded, do you plan to address this comment: #112 (comment)

@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

@alicefr hardcoded credentials are now removed.

@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

rebase

@alicefr

alicefr commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

@HarshwardhanPatil07 I would rather simplify this PR. I think the user should simply create the registry with their credentials. I wouldn't store them. If they forgot the password, they can always restart the registry.

This PR adds too much logic for less gain imo.

Comment thread internal/cli/registry/info.go Outdated
Comment thread internal/registry/registry.go Outdated
Comment thread internal/config/defaults.go Outdated
@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

Simplified as suggested. Thank you!

@alicefr

alicefr commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

@HarshwardhanPatil07 please squash the commits that remove the logic of setting the password with the label and similarly. Otherwise, it becomes quite hard to review the code that is removed in the following up commits and we need to try to preserve a clean git history

Comment thread internal/cli/registry/info.go Outdated
Comment thread test/integration/registry_test.go Outdated
Comment thread test/integration/registry_test.go Outdated
Comment thread test/integration/registry_test.go Outdated
@alicefr

alicefr commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

@HarshwardhanPatil07 we overall code looks good, some minor stuff, but the git history needs to be fix as I highlighted in the previous comment. Once done, it looks good and it is ready to be merged

@HarshwardhanPatil07
HarshwardhanPatil07 force-pushed the auth-registry branch 3 times, most recently from 7fad038 to d0bf8cc Compare September 9, 2026 11:30
@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

@alicefr sorry for having all the commits and not cleaning the history

Comment thread internal/registry/registry.go Outdated
@alicefr

alicefr commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

One minor comment and this PR requires a rebase, but then it can be merged. Thanks for this work!

@HarshwardhanPatil07
HarshwardhanPatil07 force-pushed the auth-registry branch 2 times, most recently from 3dfe271 to 0e367fc Compare September 11, 2026 07:06
Add a second registry instance, bink-auth-registry, protected by htpasswd
basic auth. It shares the storage volume with the existing unauthenticated
registry, so images pushed to localhost:5000 are immediately pullable from
localhost:5001 with credentials, without duplicating any data.

Sharing storage between two registry processes requires both to agree on
REGISTRY_HTTP_SECRET, so the existing registry is given the same shared
secret.

Credentials are supplied by the caller and are never persisted anywhere
inspectable: the bcrypt htpasswd entry is generated at start time and no
username or password hash is recorded as a container label. Because there
is nothing to compare against, an existing authenticated registry is only
started, not recreated; to change credentials, stop the registry and start
it again.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Add a cluster-hosts entry for the authenticated registry and register it as
an insecure registry in the VM container runtime configuration, so that
pods can pull from it over plain HTTP using imagePullSecrets.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Start and stop the authenticated registry alongside the unauthenticated one
during the cluster lifecycle, and report both in "bink registry info".

Add --registry-user and --registry-password flags to "bink cluster start"
and "bink registry start". Credentials must be provided explicitly; there
is no default password, and neither the username nor the password is ever
printed back to the user.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Start an authenticated registry with test-specific credentials, push an
image through the shared storage via the unauthenticated registry, verify
anonymous access is rejected, and confirm a pod can pull the image using
imagePullSecrets.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Cached or pre-pulled images currently replace the cluster and DNS images built from the pull request under the same tags. Build checkout-owned images last so integration tests consistently exercise the submitted source on both cache hits and misses.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

Thank you!

@alicefr
alicefr merged commit 70c4553 into bootc-dev:main Sep 11, 2026
14 checks passed
alicefr added a commit to alicefr/bootc-operator that referenced this pull request Sep 11, 2026
Include the auth registry for bink introduced by
  bootc-dev/bink#112

Signed-off-by: Alice Frosi <afrosi@redhat.com>
alicefr added a commit to alicefr/bootc-operator that referenced this pull request Sep 11, 2026
Include the auth registry for bink introduced by
  bootc-dev/bink#112

Signed-off-by: Alice Frosi <afrosi@redhat.com>
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.

Configure the registry with a secret

3 participants