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

Ensure auth metadata using port 5000 #26

Closed
wants to merge 2 commits into from
Closed

Conversation

vsoch
Copy link
Contributor

@vsoch vsoch commented May 18, 2022

For the examples, setting the realm to just localhost means we get a header that has "realm" set to "localhost" when we actually need to it be "localhost:5000" for the authentication flow to work.

Signed-off-by: vsoch vsoch@users.noreply.github.com

For the examples, setting the realm to just localhost means we get a header that has "realm" set to "localhost" when we actually need to it be "localhost:5000" for the authentication flow to work.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Copy link
Contributor

@sajayantony sajayantony left a comment

Choose a reason for hiding this comment

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

Thank @vsoch

@sajayantony
Copy link
Contributor

@jdolitsky do you know anything about the CI failures? Doesn't seem related to the change here.

@vsoch
Copy link
Contributor Author

vsoch commented May 18, 2022

I just ran locally and i don't see an error, so I suspect it's something to do with the version of something that has changed. If we look at the last working one (end of January) https://app.netlify.com/sites/oras-project/deploys/61f486cc0694b4000854e475 we can see the packages being installed, so it happens before that, with the command poetry install -v . The trace also seems to go into poetry. So either we can try pinning that to the working version, or updating pip (which weirdly sometimes works). let's see what @jdolitsky thinks!

@vsoch
Copy link
Contributor Author

vsoch commented May 18, 2022

Looks like maybe this python-poetry/poetry#4210 so we could try:

poetry config experimental.new-installer false

@vsoch
Copy link
Contributor Author

vsoch commented May 18, 2022

And don't merge this yet I'm not sure it's correct - the endpoint returns 200 but I don't have a token. Let me quickly read up on setting up auth for a registry I haven't done it this way before.

@vsoch
Copy link
Contributor Author

vsoch commented May 18, 2022

Yeah it looks like this setup only provides basic (not token) auth - @jdolitsky how did you get the examples here to work?

@vsoch
Copy link
Contributor Author

vsoch commented May 18, 2022

I'm going to try making my own certs.

@vsoch
Copy link
Contributor Author

vsoch commented May 18, 2022

Nope it doesn't like the self signed ones! I'm not sure what to do here.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
@sajayantony
Copy link
Contributor

@vsoch - For token auth how are you running distribution?

@vsoch
Copy link
Contributor Author

vsoch commented May 18, 2022

@sajayantony exactly as the instructions here specify. It works fine to do basic auth, but when you go through the process to ask for a token, the server returns 401, I then get the Www-Authenticate header, but there is no auth server actually running! I first thought it was just the wrong specification on my part, but I think we are required to deploy a separate server for tokens to work.

@vsoch
Copy link
Contributor Author

vsoch commented May 18, 2022

Here are my local notes (derived from the docs for oras)

Registry

You should see supported registries, or if you want to deploy a local testing registry (without auth), you can do:

$ docker run -it --rm -p 5000:5000 ghcr.io/oras-project/registry:latest

To test token authentication, you can either set up your own auth server or just use an actual registry. The most we can do here is set up an example that uses basic auth.

# This is an htpassword file, "b" means bcrypt
htpasswd -cB -b auth.htpasswd myuser mypass

The server below will work to login (using "basic" auth), but you won't be able to issue tokens.

# And start the registry with authentication
docker run -it --rm -p 5000:5000 \
    -v $(pwd)/auth.htpasswd:/etc/docker/registry/auth.htpasswd \
    -e REGISTRY_AUTH="{htpasswd: {realm: localhost, path: /etc/docker/registry/auth.htpasswd}}" \
    ghcr.io/oras-project/registry:latest

@vsoch
Copy link
Contributor Author

vsoch commented May 18, 2022

Huzzah! Worked out of the box with GitHub packages as the remote, so I can use that to develop 🥳

@vsoch
Copy link
Contributor Author

vsoch commented May 18, 2022

Woot!!

$ oras-py pull -a ghcr.io/pakages/linux-ubuntu22.04-x86_64-gcc-11.2.0-zlib-1.2.11.spack:latest
Successfully pulled /home/vanessa/Desktop/Code/oras-py/oras/main/linux-ubuntu22.04-x86_64-gcc-11.2.0-zlib-1.2.11-dltydx7vkppmgwyigktgabya6q7epz4n.spack.

(sorry excited)

@jdolitsky
Copy link
Contributor

sry not sure what exactly is going on w/ CI here..

@FeynmanZhou
Copy link
Member

Upgrade pip could be the solution. Have you tried it before?

image

@vsoch
Copy link
Contributor Author

vsoch commented May 27, 2022

That could work, but actually let's close this PR because I don't think the docs should be updated here - the auth server is meant for basic (and not token) auth.

@vsoch vsoch closed this May 27, 2022
@vsoch vsoch mentioned this pull request May 27, 2022
@shizhMSFT shizhMSFT deleted the update-auth-port-local branch April 12, 2023 16:29
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.

None yet

4 participants