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: set HTTP proxy variable and SSL_CERT_FILE from host -> machine. #12748

Merged
merged 3 commits into from
Jan 11, 2022

Conversation

flouthoc
Copy link
Collaborator

@flouthoc flouthoc commented Jan 5, 2022

Podman often has to run behind an http/https proxy, often in corporate environments. This proxy may or may not include SSL inspection capabilities, requiring a trusted SSL CA certificate to be added to a system's trust store.

PR solves this by detecting the standard proxy variables (HTTP_PROXY HTTPS_PROXY NO_PROXY http_proxy https_proxy no_proxy) and injecting them into the machine at init.


Second Part is availability of SSL_CERT_FILE on remote machine.

PR solves this by reading the equivalent file on host and copying the file to remote machine and setting equivalent SSL_CERT_FILE on remote machine.

[NO NEW TESTS NEEDED]
I am not sure if there is a way to test ignition in CI. Please pull the tree and try running it.

Closes: #12739

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 5, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 5, 2022
@flouthoc flouthoc force-pushed the ign_add_proxy_vars branch from 60fd758 to 58aee65 Compare January 5, 2022 14:36
pkg/machine/ignition.go Outdated Show resolved Hide resolved
@flouthoc flouthoc force-pushed the ign_add_proxy_vars branch from 58aee65 to 89027e9 Compare January 5, 2022 15:56
@flouthoc flouthoc requested a review from rhatdan January 5, 2022 17:04
@flouthoc flouthoc force-pushed the ign_add_proxy_vars branch from 6f3eeaa to f476a46 Compare January 5, 2022 17:34
@@ -30,6 +30,9 @@ import (
"golang.org/x/crypto/ssh/terminal"
)

// ProxyVars is being used by different packages of podman
var ProxyVars = [...]string{"HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY", "http_proxy", "https_proxy", "no_proxy", "ftp_proxy", "FTP_PROXY"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do this as a map[string]bool and then use it in both places.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is better. I'll amend this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhatdan I am not sure what would be advantage though cause for podman we have to allow all of them anyways. Is intention to make them configurable ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No just sharing with the other code, which needs a map.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhatdan Oh i see. Only buildah is using a map for this do we intend to share this with buildah ? I don't see anywhere else

Although c/common is using a similar line https://github.com/containers/common/blob/main/pkg/config/config.go#L900
We could make this variable Global and use it.

The only small issue is then this PR would need vendor changes as well. But its not a big deal. Let me know what you feel fits best here.

Podman often has to run behind an http/https proxy, often in corporate environments.
This proxy may or may not include SSL inspection capabilities, requiring a trusted SSL CA certificate to be added to a system's trust store.

Solve this by reading standard proxy variables (HTTP_PROXY HTTPS_PROXY NO_PROXY http_proxy https_proxy no_proxy) and injecting them into the machine at init.

[NO NEW TESTS NEEDED]

Signed-off-by: Aditya Rajan <[email protected]>
Podman often has to run behind an http/https proxy, often in corporate environments.
This proxy may or may not include SSL inspection capabilities, requiring a trusted SSL CA certificate to be added to a system's trust store.

Copy the file referred to by SSL_CERT_FILE on the host into the podman machine's OS trust store, overriding the built-in single-file trust store certificate.

Also set the `SSL_FILE_CERT` on remote machine

[NO NEW TESTS NEEDED]

Signed-off-by: Aditya Rajan <[email protected]>
@flouthoc
Copy link
Collaborator Author

@rhatdan updated the PR after @vrothberg 's c/common sync. Thanks @vrothberg .

@rhatdan
Copy link
Member

rhatdan commented Jan 10, 2022

LGTM
@containers/podman-maintainers PTAL

@rhatdan
Copy link
Member

rhatdan commented Jan 10, 2022

@vrothberg PTAL

@flouthoc
Copy link
Collaborator Author

flouthoc commented Jan 11, 2022

@baude Could you review this as well since changes are related to ignition. No rush.

@baude
Copy link
Member

baude commented Jan 11, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 11, 2022
@openshift-merge-robot openshift-merge-robot merged commit 4db1aff into containers:main Jan 11, 2022
@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 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 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.

Pass proxy information into Podman Machine VMs
4 participants