Bug 1682970

Summary: [RFE] Default location of setting up HTTP_Proxy for podman
Product: Red Hat Enterprise Linux 8 Reporter: Suhaas Bhat <subhat>
Component: podmanAssignee: Jindrich Novy <jnovy>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.3CC: bsawyers, bward, dornelas, dwalsh, dwoodruf, fedoraproject, fkluknav, igreen, jhunsaker, jligon, jnovy, lsm5, mheon, subhat, tsweeney, vrothber, ypu
Target Milestone: rcKeywords: FutureFeature, Reopened
Target Release: 8.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 03:05:10 UTC Type: Enhancement
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1186913, 1804543    

Description Suhaas Bhat 2019-02-26 01:08:46 UTC
Description of problem:
There is no default file location in which we can add the HTTP Proxy variables.
Currently we access them only through systemd environment variables.

Version-Release number of selected component (if applicable):
RHEL 8
podman-1.0.0-1.git82e8011.module+el8+2696+e59f0461.x86_64


Actual results:


Expected results:

Default location to add proxy variables as in case of docker

Comment 1 Daniel Walsh 2019-02-26 13:56:24 UTC
Where do you think they should be added?  These needed to be added to the environment of the user running podman.

/etc/profiles.d 

Might be the location?

Do you think we should document this in the man pages?

Comment 2 Daniel Walsh 2019-03-01 10:18:08 UTC
Suhaas, Ideas on /etc/profiles.d?

Comment 5 Daniel Walsh 2019-08-14 13:07:54 UTC
We have talked about this internally and have discussed creating a containers.conf that could be shared between all container engines. 

The other choice would be to extend registries.conf to include proxy settings.

Comment 6 Valentin Rothberg 2019-08-14 14:50:44 UTC
For pulling, we should use `registries.conf`. For injecting it into containers, we should use another config.

Comment 8 Daniel Walsh 2019-08-15 11:32:46 UTC
Containers.conf seems the logical spot for this.  In crio.conf we currently have

Comment 11 Daniel Walsh 2019-11-08 18:48:18 UTC
It is still being worked on under 
https://github.com/containers/common/tree/master/pkg/config

And 

https://github.com/containers/buildah/pull/1858

I don't think it will show up until RHEL8.2.1 release.  We are holding off for 8.2 because it is a big change, and 8.2 is going to be a stable release. 
Which means we would need to back port for 2 years.  Once we have it in, we should iterate quickly. 

We are hoping to finalize on the format for the config file next week.

Comment 15 Daniel Walsh 2020-02-11 13:59:25 UTC
So you want these environment variables set not for the containers but for Podman itself to use.

I think we should still use this through containers_conf.  Something like:

# Set Proxy environment variables to be used by container runtimes when working with the registries.
# http_proxy_env=[ "HTTP_PROXY=proxy.company.com", "https_proxy=proxy.company.com" ]

Comment 16 Derrick Ornelas 2020-02-12 17:03:45 UTC
It may be confusing that "http_proxy" doesn't actually take a proxy location.  Maybe something like "pass_proxy_env = true" or "pass_http_proxy_env = true" instead would be more user-friendly?   Then they can fill out this http_proxy_env list, if needed.  


Also, will a non-root user get their own $HOME/.config/containers/containers.conf by default, or will it just be an optional file that a user can create for overrides?

Comment 17 Daniel Walsh 2020-02-13 10:56:20 UTC
All containers.conf files are optional and really we are just merging them together.  So you only need to replace the one or two options you want.

I thought customers wanted to specify environment variables that apply to the container engine.

Something like

#
# Additional environment variables to apply to the container engine.  For example "http_proxy=internal.proxy.company.com"
#
# container_engine_env []

Then when the container engine starts up it modifies it's environment to include these environment variables.  The question
then would be should these environment variables leak through to the containers.  I would guess no, but this would mean
that the callers would need to set them twice, it they wanted them in both places.

Comment 22 Daniel Walsh 2020-06-03 14:09:55 UTC
This is in podman2.0

Comment 23 Derrick Ornelas 2020-06-05 01:35:02 UTC
Dan, could you confirm where this change was made?  From https://github.com/containers/libpod/tree/v2.0.0-rc4/vendor/github.com/containers/common/pkg/config I still don't see where we can define the proxy variables themselves.

Comment 24 Daniel Walsh 2020-06-05 09:58:27 UTC
You would set them in the Env block.

# Environment variable list for the conmon process; used for passing necessary
# environment variables to conmon or the runtime.
#
# env = [
#    "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
# ]

man containers.conf
...
       env=["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"]
         Environment variable list for the container process, used for passing environment variables to the container.

Comment 25 Derrick Ornelas 2020-06-05 14:44:00 UTC
Got it, thanks!

Comment 26 Tom Sweeney 2020-06-08 21:44:42 UTC
Fixed in https://github.com/containers/buildah/pull/2011 and possibly other PR's.  Assigning to Jindrich in case there's any packaging needs.

Comment 27 Jindrich Novy 2020-06-09 07:40:12 UTC
Tom, I'm confused, the bug is reported against podman but PR you refer to is against buildah?

Dan, is the support for this already in podman-2.0.0-rc4 so I can switch this to MODIFIED?

Comment 28 Daniel Walsh 2020-06-09 14:54:29 UTC
Yes this is supported in podman 2.0

Comment 30 Tom Sweeney 2020-06-09 15:31:30 UTC
Jindrich,
My bad, that was the Buildah one, I'm not sure exactly which one for Podman but certainly with this one: https://github.com/containers/libpod/pull/6428 and probably with https://github.com/containers/libpod/pull/6333.  Regardless, in v2.0 of Podman for sure.

Comment 37 Joy Pu 2020-07-27 12:26:52 UTC
Test with podman-2.0.0-0.9.rc7.module+el8.3.0+7084+c16098dd.x86_64, and seems it works as expect. So set this to verified. Details:

in /usr/share/containers/containers.conf:

...
env = [
   "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
   "http_proxy=fake.check.value",
   "https_proxy=fake.check.value",
]
...

# podman run -it busybox 
/ # echo $http_proxy
fake.check.value
/ # echo $https_proxy
fake.check.value
/ # exit

Comment 40 errata-xmlrpc 2020-11-04 03:05:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: container-tools:rhel8 security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:4694