containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
22.4k stars 2.31k forks source link

Podman automatically maps any https port to 443 #21955

Open alyashraf97 opened 4 months ago

alyashraf97 commented 4 months ago

Issue Description

Podman defaults to port 443 for https regardless of which port is specified in the connection.

Steps to reproduce the issue

Steps to reproduce the issue

  1. Deploy a registry container (lets say on port 5000:5000)
  2. deploy an nginx pod 1234:443 -> backend :5000
  3. try to push an image tagged by :/image:tag

Describe the results you received

image

Describe the results you expected

Not to default to port 443 if the https port is specified

podman info output

# podman --version
podman version 4.6.1

Podman in a container

No

Privileged Or Rootless

Privileged

Upstream Latest Release

No

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

Luap99 commented 4 months ago

Please do not post screenshots of text, please copy paste the output properly here.

baude commented 4 months ago

@vrothberg there has to be a reason for this?

vrothberg commented 4 months ago

Looks like a misconfiguration of nginx to me.

alyashraf97 commented 4 months ago

@vrothberg Why do you think so?

vrothberg commented 4 months ago

Podman does not map any port to 443. Try running without nginx in between.

alyashraf97 commented 4 months ago

@vrothberg do you think I haven't tried that already?

vrothberg commented 4 months ago

Your example shows it with nginx. Please share a reproducer without.

github-actions[bot] commented 3 months ago

A friendly reminder that this issue had no activity for 30 days.

martialblog commented 1 week ago

Hi, I think I just ran into the same issue.

Context:

I'm running Quay on port 8080 (http) and port 8843 (https) with a self-signed cert.

# Verifying the ports
curl -i http://quay.example.com:8080/v2/
HTTP/1.1 301 Moved Permanently
curl -ik https://quay.example.com:8443/v2/
HTTP/2 401 

When I'm using podman login with a specific port to reach the HTTP endpoint. Everything works as expected. The port is used in the connection and can be seen in the errors:

podman login --username example --password example quay.example.com:8080

Error: authenticating creds for "quay.example.com:8080": pinging container registry quay.example.com:8080: 
Get "https://quay.example.com:8080/v2/": http: server gave HTTP response to HTTPS client

odman login --username example --password example quay.example.com:9999

Error: authenticating creds for "quay.example.com:9999": pinging container registry quay.example.com:9999: 
Get "https://quay.example.com:9999/v2/": dial tcp 127.0.0.1:9999: connect: connection refuse

When I'm using the HTTPS port (8443 in my case) without the --tls-verify flag it works as expected:

podman login --username example --password example quay.example.com:8443

Error: authenticating creds for "quay.example.com:8443": pinging container registry quay.example.com:8443: 
Get "https://quay.example.com:8443/v2/": x509: certificate signed by unknown authority

With --tls-verify flag set to false podman login uses the port 443 instead however:

podman login --username example --password example --tls-verify=false  quay.example.com:8443
Error: authenticating creds for "quay.example.com:8443": 
Get "https://quay.example.com/v2/auth?account=example&service=quay.example.com%3A8080": 
dial tcp 127.0.0.1:443: connect: connection refused

I dont' yet know where the "8080" in "quay.example.com%3A8080" comes from.

Tested with podman version 3.4.4 and version 5.1.1, same issue. No special config in registries.conf.

Let me know if I should provide further information.

EDIT: Ok I guess nevermind. My Quay's SERVER_HOSTNAME included the port 8080... once I removed it, everythings seems nominal. :facepalm:

podman login -u='example' -p='example' --tls-verify=false quay.example.com:8443
Error: error logging into "quay.example.com:8443": invalid username/password