podman-desktop icon indicating copy to clipboard operation
podman-desktop copied to clipboard

Login to registry does not work for AWS ECR

Open oappicgi opened this issue 4 years ago • 9 comments

Is your enhancement related to a problem? Please describe

Not able to login to private registry:

Note that and have been removed from explanations:

I am able to login AWS ECR repositories with podman login --username AWS --password-stdin .dkr.ecr..amazonaws.com format, while Podman desktop says: "Not valid registry"

What I expected was that adding Server URL: .dkr.ecr..amazonaws.com as registry url Username: AWS Password: what ever i get from awc cli tool with command "aws ecr get-login-password --region <aws_region>" I would have been able to add said repository and use my own images from there. Instead I get "Not valid registry"

Describe the solution you'd like

I would like podman desktop to be able to login same repository than terminal podman is able to login

Describe alternatives you've considered

No response

Additional context

tried it with Version v0.8.0 using Fedora 36. Podman desktop says Podman is running version 4.2.1

oappicgi avatar Oct 17 '22 12:10 oappicgi

Hello,

is it possible to say what is returned when you do

curl -v -SsL https://<your-registry-url>dkr.ecr..amazonaws.com/v2/

for example: curl -v -SsL https://ghcr.io/v2/

we have some tests there https://github.com/benoitf/desktop/blob/429ba71d7f16c30f570d14d8e77f60d2e1211fa4/packages/main/src/plugin/image-registry.spec.ts

so wondering what is returned

benoitf avatar Oct 17 '22 13:10 benoitf

@oappicgi if you can provide what is returned when we go the v2/ endpoint on the registry API ? thanks

benoitf avatar Oct 17 '22 14:10 benoitf

Sorry for late reply:

here is the output. I left region in, but again removed accountid

curl -v -SsL https://<aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com
*   Trying 63.32.243.33:443...
* Connected to <aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com (63.32.243.33) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
*  CAfile: /etc/pki/tls/certs/ca-bundle.crt
*  CApath: none
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=*.dkr.ecr.eu-west-1.amazonaws.com
*  start date: Sep 23 00:00:00 2022 GMT
*  expire date: Sep 14 23:59:59 2023 GMT
*  subjectAltName: host "<aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com" matched cert's "*.dkr.ecr.eu-west-1.amazonaws.com"
*  issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
*  SSL certificate verify ok.
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> GET / HTTP/1.1
> Host: <aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com
> User-Agent: curl/7.82.0
> Accept: */*
> 
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Docker-Distribution-Api-Version: registry/2.0
< Sizes: 
< Www-Authenticate: Basic realm="https://<aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com/",service="ecr.amazonaws.com"
< Date: Tue, 18 Oct 2022 06:35:05 GMT
< Content-Length: 15
< Content-Type: text/plain; charset=utf-8
< 
Not Authorized
* Connection #0 to host <aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com left intact

oappicgi avatar Oct 18 '22 06:10 oappicgi

thanks @oappicgi

benoitf avatar Oct 18 '22 06:10 benoitf

@oappicgi it will be fixed by https://github.com/containers/podman-desktop/pull/647

benoitf avatar Oct 18 '22 12:10 benoitf

my apologizes again, accidentally copy pasted wrong output. Earlier one was with out /v2/

curl -v -SsL https://<aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com/v2/
*   Trying 63.32.243.33:443...
* Connected to <aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com (63.32.243.33) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
*  CAfile: /etc/pki/tls/certs/ca-bundle.crt
*  CApath: none
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=*.dkr.ecr.eu-west-1.amazonaws.com
*  start date: Sep 23 00:00:00 2022 GMT
*  expire date: Sep 14 23:59:59 2023 GMT
*  subjectAltName: host "<aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com" matched cert's "*.dkr.ecr.eu-west-1.amazonaws.com"
*  issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
*  SSL certificate verify ok.
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> GET /v2/ HTTP/1.1
> Host: <aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com
> User-Agent: curl/7.82.0
> Accept: */*
> 
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Docker-Distribution-Api-Version: registry/2.0
< Sizes: 
< Www-Authenticate: Basic realm="https://<aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com/",service="ecr.amazonaws.com"
< Date: Tue, 18 Oct 2022 12:40:41 GMT
< Content-Length: 15
< Content-Type: text/plain; charset=utf-8
< 
Not Authorized
* Connection #0 to host <aws_accountid>.dkr.ecr.eu-west-1.amazonaws.com left intact

oappicgi avatar Oct 18 '22 12:10 oappicgi

@benoitf Thanks! Really appreciate your work.

oappicgi avatar Oct 18 '22 12:10 oappicgi

I've setup a ECR registry to test. Basically we didn't implemented the Basic auth as it seems all registries switched to a token based/bearer algorithm but ECR is using Basic realm.

benoitf avatar Oct 18 '22 12:10 benoitf

@oappicgi if you can try https://github.com/containers/podman-desktop/actions/runs/3273442816#artifacts

benoitf avatar Oct 18 '22 13:10 benoitf