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

Proxy support for podman machine on Windows #14589

Closed
Sebbiedu opened this issue Jun 14, 2022 · 5 comments · Fixed by #14806
Closed

Proxy support for podman machine on Windows #14589

Sebbiedu opened this issue Jun 14, 2022 · 5 comments · Fixed by #14806
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. machine windows issue/bug on Windows

Comments

@Sebbiedu
Copy link

Sebbiedu commented Jun 14, 2022

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind feature

Description

Description
I used the podman-v4.1.0.msi to install podman on windows.
I'm sitting behind a corporate proxy.
I open the terminal and set the environment variables

  • $env:http_proxy="<corporate-proxy"
  • $env:https_proxy="<corporate-proxy"

I type podman machine init

Describe the results you received:

It downloads the fedora image so initially proxy works but then in endless loop

Fedora 35 - x86_64 0.0 B/s | 0 B 03:21

So proxy isnt set for curl as it looks.

After ctrl+c

Curl error (7): Couldn't connect to server for https://mirrors.fedoraproject.org/metalink?repo=fedora-35&arch=x86_64 [Failed to connect to mirrors.fedoraproject.org port 443 after 20157 ms: Connection refused]

It seems there is no proxy set for installing updating packages

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 14, 2022
@Luap99 Luap99 added machine windows issue/bug on Windows labels Jun 14, 2022
@n1hility n1hility changed the title Proxy isnt propagated for Curl when using podman machine init from Windows Terminal Proxy support for podman machine on Windows Jun 15, 2022
@github-actions github-actions bot removed the windows issue/bug on Windows label Jun 15, 2022
@n1hility n1hility added kind/feature Categorizes issue or PR as related to a new feature. windows issue/bug on Windows and removed kind/bug Categorizes issue or PR as related to a bug. labels Jun 15, 2022
@n1hility n1hility self-assigned this Jun 15, 2022
@MissaouiChedy
Copy link

I am having the same issue/feature request:

  • Podman v4.1.1
  • Windows 10
  • Running behind a corporate proxy

After setting the HTTP_PROXY env var in Powershell podman machine init fails to download the packages.

@gbraad
Copy link
Member

gbraad commented Jul 6, 2022

using the version on current master (merged #14806)

To confirm the proxy is reachable and working I check the following from the podman VM.

PS> wsl -d podman-machine-default
# curl https://postman-echo.com/get\?foo\=bar -x 10.0.21.80:3213
{"args":{"foo":"bar"},"headers":{"x-forwarded-proto":"https","x-forwarded-port":"443","host":"postman-echo.com","x-amzn-trace-id":"Root=1-62c522eb-54dfd52477b4468531e323bf","user-agent":"curl/7.82.0","accept":"*/*"},"url":"https://postman-echo.com/get?foo=bar"}%
# exit
PS> podman machine stop

To setup the proxy variables and start the environment

PS> $env:http_proxy="10.0.21.80:3213"
PS> $env:https_proxy="10.0.21.80:3213"
PS> podman machine start
Starting machine "podman-machine-default"
Installing proxy support
...

Note that the message Installing proxy support is shown.

After which:

PS> wsl -d podman-machine-default
# cat /etc/profile.d/default-env.sh
export http_proxy="10.0.21.80:3213"
export https_proxy="10.0.21.80:3213"
export HTTP_PROXY="10.0.21.80:3213"
export HTTPS_PROXY="10.0.21.80:3213"
# curl https://postman-echo.com/get\?foo\=bar
# podman pull fedora

should work with proxy

@gbraad
Copy link
Member

gbraad commented Jul 6, 2022

@n1hility The message Installing proxy support is not shown on successive starts, even with new values. This is because the proxyConfigAttempt is passing. Perhaps change to log when writing the values?

PS> $env:http_proxy="10.0.21.80:3213"
PS> $env:https_proxy="10.0.21.80:3213"
PS> podman machine start
Starting machine "podman-machine-default"
Installing proxy support
...
Machine "podman-machine-default" started successfully
PS> wsl -d podman-machine-default cat /etc/profile.d/default-env.sh
export http_proxy="10.0.21.80:3213"
export https_proxy="10.0.21.80:3213"
export HTTP_PROXY="10.0.21.80:3213"
export HTTPS_PROXY="10.0.21.80:3213"
PS> podman machine stop
Machine "podman-machine-default" stopped successfully
PS> $env:https_proxy="10.0.21.120:3213"
PS> $env:http_proxy="10.0.21.120:3213"
PS>  .\podman.exe machine start
Starting machine "podman-machine-default"
...
Machine "podman-machine-default" started successfully
PS> wsl -d podman-machine-default cat /etc/profile.d/default-env.sh
export http_proxy="10.0.21.120:3213"
export https_proxy="10.0.21.120:3213"
export HTTP_PROXY="10.0.21.120:3213"
export HTTPS_PROXY="10.0.21.120:3213"

No intermediate message for the proxy values was shown. Though when someone is experimenting or trying to make it work, this information could be helpful.

@gbraad
Copy link
Member

gbraad commented Jul 6, 2022

On Windows you can quickly test this:

PS> git clone https://github.com/elazarl/goproxy
PS> go run .\examples\goproxy-basic\main.go -v

Open another terminal session

PS> $env:http_proxy="10.0.21.80:8080"
PS> $env:https_proxy="10.0.21.80:8080"
PS> podman machine start
PS> wsl -d podman-machine-default
# podman pull fedora:latest

You should see the incoming CONNECT request for HTTPS:

image

If you would break the proxy in the first session the connection should be interrupted.

@jolyons123
Copy link

using the version on current master (merged #14806)

To confirm the proxy is reachable and working I check the following from the podman VM.

PS> wsl -d podman-machine-default
# curl https://postman-echo.com/get\?foo\=bar -x 10.0.21.80:3213
{"args":{"foo":"bar"},"headers":{"x-forwarded-proto":"https","x-forwarded-port":"443","host":"postman-echo.com","x-amzn-trace-id":"Root=1-62c522eb-54dfd52477b4468531e323bf","user-agent":"curl/7.82.0","accept":"*/*"},"url":"https://postman-echo.com/get?foo=bar"}%
# exit
PS> podman machine stop

To setup the proxy variables and start the environment

PS> $env:http_proxy="10.0.21.80:3213"
PS> $env:https_proxy="10.0.21.80:3213"
PS> podman machine start
Starting machine "podman-machine-default"
Installing proxy support
...

Note that the message Installing proxy support is shown.

After which:

PS> wsl -d podman-machine-default
# cat /etc/profile.d/default-env.sh
export http_proxy="10.0.21.80:3213"
export https_proxy="10.0.21.80:3213"
export HTTP_PROXY="10.0.21.80:3213"
export HTTPS_PROXY="10.0.21.80:3213"
# curl https://postman-echo.com/get\?foo\=bar
# podman pull fedora

should work with proxy

Thanks! Do you have any advice on how to find out the Windows host IP within the podman VM? I am using cntlm on windows and it listens on localhost:3128 . I tried the command you posted but there is no response, I assume that the IP does not match in my case

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. machine windows issue/bug on Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants