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

ignition: propagate proxy settings from a host into a vm #13209

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

esendjer
Copy link
Contributor

@esendjer esendjer commented Feb 10, 2022

PR solves the need of setting proxy for systemd and the whole guest system.

Set proxy settings (such as HTTP_PROXY, and others) for the whole guest OS with setting up DefaultEnvironment with a systemd configuration file default-env.conf, a profile.d scenario file - default-env.sh and a environment.d configuration file default-env.conf.

The actual environment variables are read by podman at a start, then they are encrypted with base64 into a single string and after are provided into a VM through QEMU Firmware Configuration (fw_cfg) Device

Inside a VM a systemd service envset-fwcfg.service reads the providead encrypted string from fw_cfg, decrypts and then adds to the files:

  • /etc/systemd/system.conf.d/default-env.conf
  • /etc/profile.d/default-env.sh
  • /etc/environment.d/default-env.conf

At the end, this service execute systemctl daemon-reload to propagate new variables for systemd manager

[NO NEW TESTS NEEDED]

Closes #13168

Also related to #11941 #12739

@esendjer esendjer changed the title ignition: propagate proxy settings from a host into a vm [WIP] ignition: propagate proxy settings from a host into a vm Feb 11, 2022
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 11, 2022
pkg/machine/ignition.go Outdated Show resolved Hide resolved
@esendjer esendjer force-pushed the main branch 2 times, most recently from a907561 to 18656a9 Compare February 12, 2022 08:23
@esendjer esendjer changed the title [WIP] ignition: propagate proxy settings from a host into a vm ignition: propagate proxy settings from a host into a vm Feb 12, 2022
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 12, 2022
Set proxy settings (such as `HTTP_PROXY`, and others)
for the whole guest OS with setting up `DefaultEnvironment`
with a `systemd` configuration file `default-env.conf`,
a `profile.d` scenario file - `default-env.sh` and
a `environment.d` configuration file `default-env.conf`

The **actual** environment variables are read by podman
at a start, then they are encrypted with base64 into
a single string and after are provided into a VM through
QEMU Firmware Configuration (fw_cfg) Device

Inside a VM a systemd service `envset-fwcfg.service`
reads the providead encrypted string from fw_cfg, decrypts
and then adds to the files
 - `/etc/systemd/system.conf.d/default-env.conf`
 - `/etc/profile.d/default-env.sh`
 - `/etc/environment.d/default-env.conf`
At the end this service execute  `systemctl daemon-reload`
to propagate new variables for systemd manager

[NO NEW TESTS NEEDED]

Closes containers#13168

Signed-off-by: esendjer <[email protected]>
@baude
Copy link
Member

baude commented Feb 14, 2022

LGTM

@rhatdan
Copy link
Member

rhatdan commented Feb 14, 2022

/lgtm
/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 14, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: esendjer, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 14, 2022
@openshift-merge-robot openshift-merge-robot merged commit 5977fd5 into containers:main Feb 14, 2022
@ctml91
Copy link

ctml91 commented Mar 29, 2022

Any trick to making this work on a mac?

podman version 4.0.2
$ podman machine stop
$ podman machine rm
$ env | grep -i proxy
HTTPS_PROXY=myproxy
HTTP_PROXY=myproxy
https_proxy=myproxy
http_proxy=myproxy
$ podman machine init
$ podman machine start
$ podman machine list
NAME                     VM TYPE     CREATED         LAST UP            CPUS        MEMORY      DISK SIZE
podman-machine-default*  qemu        2 minutes ago  Currently running  1           2.147GB     107.4GB
$ podman build -t test:latest ./
Error: error creating build container: initializing source docker://registry.access.redhat.com/ubi8/ubi-minimal:latest: pinging container registry registry.access.redhat.com: Get "https://registry.access.redhat.com/v2/": x509: certificate signed by unknown authority

This is the error when requests do not go to proxy and go to our honeypot instead, so it is not using the host proxy.

@amilanoski
Copy link

amilanoski commented May 29, 2023

This is still an issue with MacOS Ventura 13.3.1 with fresh installation and Corporate proxies set in my zsh shell.

The only thing that worked was having to manually run

  1. podman machine ssh then run the configuration setup found here. PODMAN not able to tunnel thru Proxy in an Enterprise Proxy Environment #11941 (comment)

I have not found any other documentation around that can solve this with out having users manually go in and configure this. Keeping the scope only with proxies these should be pulled into the podman machine init or better yet podman machine start.

podman -v podman version 4.5.1

@esendjer
Copy link
Contributor Author

@amilanoski
I see. Let me check it on my Macs.
But until I've done, could you please share how do you set proxies in your zsh shell. Here, I'm wondering commands and variable names, it allows me to repeat this on my side.

@esendjer
Copy link
Contributor Author

The check is done, and unfortunately the problem has come back.
A brief research led me to the next:

I want to dive deeper to understand how it could be solved.

@esendjer
Copy link
Contributor Author

@amilanoski FYI
PR that fixes the issue #18759 has just been opened

@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 Aug 30, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Leak the HTTP*PROXY environment variables into the VM when doing a podman machine start.
7 participants