podman: PODMAN not able to tunnel thru Proxy in an Enterprise Proxy Environment
/kind bug
Description
PODMAN running in local MacOS is not able to honor Proxy Env setting in a corporate proxy setting.
Steps to reproduce the issue:
-
brew install qemu
-
brew install podman
-
podman machine init
-
podman machine start
-
podman pull nginx:alpine 6
Describe the results you received:
Resolving “nginx” using unqualified-search registries (/etc/containers/registries.conf.d/999-podman-machine.conf) Trying to pull docker.io/library/nginx:alpine… Error: initializing source docker://nginx:alpine: pinging container registry registry-1.docker.io: Get “https://registry-1.docker.io/v2/”: dial tcp 3.229.227.53:443: i/o timeout
Describe the results you expected:
I am expecting it to be able to pull the image from Docker Library. I am suspecting Image Pull is run at the local VM machine spin up as part of PODMAN machine, if so, how can we get the PROXY setting pushed to the VM. Are there any command for debug in VM ? I am new to PODMAN, sorry if i am asking some of the basic questions.
Additional information you deem important (e.g. issue happens only occasionally):
Output of podman version:
○ → podman version
Client:
Version: 3.4.0
API Version: 3.4.0
Go Version: go1.17.1
Built: Thu Sep 30 13:44:31 2021
OS/Arch: darwin/amd64
Server:
Version: 3.3.1
API Version: 3.3.1
Go Version: go1.16.6
Built: Mon Aug 30 15:46:36 2021
OS/Arch: linux/amd64
Output of podman info --debug:
podman info --debug
host:
arch: amd64
buildahVersion: 1.22.3
cgroupControllers: []
cgroupManager: systemd
cgroupVersion: v2
conmon:
package: conmon-2.0.29-2.fc34.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.0.29, commit: '
cpus: 1
distribution:
distribution: fedora
version: "34"
eventLogger: journald
hostname: localhost
idMappings:
gidmap:
- container_id: 0
host_id: 1000
size: 1
- container_id: 1
host_id: 100000
size: 65536
uidmap:
- container_id: 0
host_id: 1000
size: 1
- container_id: 1
host_id: 100000
size: 65536
kernel: 5.14.9-200.fc34.x86_64
linkmode: dynamic
logDriver: ""
memFree: 1629442048
memTotal: 2061860864
ociRuntime:
name: crun
package: crun-1.0-1.fc34.x86_64
path: /usr/bin/crun
version: |-
crun version 1.0
commit: 139dc6971e2f1d931af520188763e984d6cdfbf8
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
os: linux
remoteSocket:
exists: true
path: /run/user/1000/podman/podman.sock
security:
apparmorEnabled: false
capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
rootless: true
seccompEnabled: true
seccompProfilePath: /usr/share/containers/seccomp.json
selinuxEnabled: true
serviceIsRemote: true
slirp4netns:
executable: /usr/bin/slirp4netns
package: slirp4netns-1.1.12-2.fc34.x86_64
version: |-
slirp4netns version 1.1.12
commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
libslirp: 4.4.0
SLIRP_CONFIG_VERSION_MAX: 3
libseccomp: 2.5.0
swapFree: 0
swapTotal: 0
uptime: 19m 49.04s
plugins:
log: null
network: null
volume: null
registries:
search:
- docker.io
store:
configFile: /var/home/core/.config/containers/storage.conf
containerStore:
number: 0
paused: 0
running: 0
stopped: 0
graphDriverName: overlay
graphOptions: {}
graphRoot: /var/home/core/.local/share/containers/storage
graphStatus:
Backing Filesystem: xfs
Native Overlay Diff: "true"
Supports d_type: "true"
Using metacopy: "false"
imageStore:
number: 0
runRoot: /run/user/1000/containers
volumePath: /var/home/core/.local/share/containers/storage/volumes
version:
APIVersion: 3.3.1
Built: 1630356396
BuiltTime: Mon Aug 30 20:46:36 2021
GitCommit: ""
GoVersion: go1.16.6
OsArch: linux/amd64
Version: 3.3.1
Package info (e.g. output of rpm -q podman or apt list podman):
DOES NOT APPLY.
Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes. Does not information on local Podman execution.
Additional environment details (AWS, VirtualBox, physical, etc.):
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 33 (5 by maintainers)
We solved this in a corporate environment on MacOS that requires a secure proxy server to access all external resources. We use the podman managed machine via
podman machine. All configuration takes place on the VM. We have been using this successfully now for almost two months now.Requires: Podman 3.4.0 at a minimum on MacOS host and managed machine.
Configure Proxy Support Globally for All Systemd Services
Place in
/etc/systemd/system.conf.d/10-default-env.conf:Allow Interactive Login Sessions to VM to Use Proxy
Place in
/etc/profile.d/proxy.sh:Configure Trusted Certificates
/etc/pki/ca-trust/source/anchors/then update the certificate authority trust, for example:Restart Managed Machine
Unfortunately in order to have the Systemd configuration for proxy configuration to take effect you will have to restart the podman managed machine from the host:
Works on both Catalina and Big Sur.
Some thoughts on how podman can discover the proxy settings:
scutil --proxyor in Objective-C using the SystemConfiguration framework (I suspect the same is available in Go): https://developer.apple.com/documentation/systemconfiguration/1517088-scdynamicstorecopyproxiesAlso, PLEASE support no_proxy stuff. Most companies that use proxies need to access stuff that’s on the internal network and outside the network, but only outside requires proxy.
Ideally the
HTTP_PROXY/HTTPS_PROXY/NO_PROXYandSSL_CERT_FILEenv vars should be picked up by thepodman machine startcommand and automatically be passed into the ignition file. This is similar to how minikube operates (though I am unsure if it uses ignition):I think you can pass the proxy variables if you set up a custom ignition file, though it would be nice if podman auto-detected proxy settings and passed them through.
Some enterprise proxies also do SSL inspection, which requires loading a custom trusted CA into a user’s workstation trust store. I believe tools commonly use the
SSL_CERT_FILEenv var to do this, similar toHTTP_PROXY/HTTPS_PROXY/etc variables to detect the proxy.SSL_CERT_FILEis standard in openssl: https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_default_verify_paths.htmlI’m assuming that @cpolizzi 's solution was to modify those files inside the podman VM, not the mac. (Since my Mac doesn’t have that first directory, because systemd is not installed.)
I note that by default my proxy env vars were already present in the virtual machine, but all in one line, which I’m guessing is fine.
proxy.shdid not exist. I added that. It didn’t resolve my problem.@gclawes Can you point me to any readme that can help with the steps and syntax for creating custom ignition file?