16.5. Setting up proxied internet access in image Mode for RHEL
If you are deploying to an environment that requires internet access by using a proxy, you need to configure services so that they can access resources as intended.
To do this, define a single file with required environment variables in your configuration, and reference this by using systemd drop-in unit files for all such services.
Procedure
- Defining common proxy environment variables
This common file has to be subsequently referenced explicitly by each service that requires internet access.
# /etc/example-proxy.env
https_proxy="http://example.com:8080"
all_proxy="http://example.com:8080"
http_proxy="http://example.com:8080"
HTTP_PROXY="http://example.com:8080"
HTTPS_PROXY="http://example.com:8080"
no_proxy="*.example.com,127.0.0.1,0.0.0.0,localhost"
- Defining drop-in units for core services
The bootc and podman tools commonly need proxy configuration. At the current time, bootc does not always run as a systemd unit.
# /usr/lib/systemd/system/bootc-fetch-apply-updates.service.d/99-proxy.conf
[Service]
EnvironmentFile=/etc/example-proxy.env
-
Defining proxy use for podman
systemdunits
Using the Podman systemd configuration, similarly add EnvironmentFile=/etc/example-proxy.env. You can set the configuration for proxy and environment settings of podman and containers in the /etc/containers/containers.conf configuration file as a root user or in the $HOME/.config/containers/containers.conf configuration file as a non-root user.