-
Notifications
You must be signed in to change notification settings - Fork 98
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
need to support custom CA certificates and proxy settings #195
Comments
We have the same problem, but are not using a transparent proxy. ansible-builder does not use environmental variables for proxy settings, and without them, when attempting to build we get:
After viewing the proxy logs, it is clear that no attempt is being made to use the proxy. When the exact same command/config is run from a box with direct internet access it functions correctly. |
What environment variables would we need to forward into the container? The pattern we need is pretty off-the-shelf, we just apply it to the
then in the Containerfile
That doesn't address the cases where something needs to be mounted. For this issue, I would like some help pinning down exactly what would need to be passed. |
You can already pass HTTP Proxy environment variables with |
The issue isn’t just the proxy variables themselves, but also that some corporate proxies (even some transparent ones, which intercept traffic without being explicitly specified) will inspect and reencrypt traffic using an organization-specific certificate. This means that, in order to fully work in proxies environments, it’s necessary to allow custom CA roots to be added to the container’s trust store. Pip and ansible-galaxy would both need to be able to trust an organizational CA in order to work. It seems unlikely that podman’s flag would also inject the outer system’s trust settings as different container images would need them to be injected in different places and formats. |
Customizable |
I just got pointed to this issue. For the next ones running into this, I document here I went through the issue while working in such transparent firewall env at customer. Sorry I don't have access to files, but I try to describe the steps. If you work on tower host, use awx account so all images are visilbe and referencable as localhost:imagename:tag in tower configs. Naturally later on you want the images to be rebuilt automatically by OpenShift buildconfig triggering on any RH image update, and served from a corporate repository (Quay).
Problem is ansible-builder fails to download the EE images due https certs being wrong. For this I rebuilt the builder image and added CA certs in there. This is normal buildah/podman build using Containerfile. Now from top of my head the containerfile is about the following like:
build the container like:
Use the options you normally would use with ansible-builder, but add the reference to above image:
While you customize your EE images, it might help you to add the certs in there too. This is done by modifying the ansible-builder definition file additional steps, like e.g:
I don't have access to such system right now, but I recall it tries to copy those *.pem from relative path
At this point you can create a new reference to EE image into tower. Go to Execution environments, and either change an existing default EE or create a new one pointing to e.g. localhost/my-ee:latest. Now for you to know, I failed next due yum not trusting the given CA, as it only trusts RH CA. Then I realized I need to point yum to internal satellite or rpm repo for that to work Good luck, hopefully this saves someone's time in such an evil MITM environment :) . |
As a modification to step 2 above, we reference the customized images in execution-environment.yaml. This keeps the
|
I just ran into the same issue. I have a corporate proxy that needs to have environment variables set to access I can add this to the additional_build_steps but the ansible-builder process fails at the builder step when trying to install python requirements.txt and it has no knowledge of the proxy. The additional_build_steps additions don't happen until the next step in the build Manually adding the ENV line after the "FROM $EE_BUILDER_IMAGE as builder" line works as long as I manually call the container process (docker in my case) and if I re-run ansible-builder my changes are removed Having ansible-builder either have options to accept proxy settings, or support additional options in execution-environment.yml to allow for adding settings such as this to the builder step is needed to keep us from having to run ansible-builder, hand change the Dockerfile, and then run docker/podman |
same problem here when using ansible-builder from RedHat Automation Platform 2.1 repositories. |
We worked around this by defining environment variables before calling podman build: As for certificates, we use sed to edit the ContainerFile:
|
@rseabra can you give us more details about how you brought the *_proxy variables into the build container? Do you call |
Hi, @samweisgamdschie , I'm sorry, I only noticed the mention now. I gave up on ansible-builder build and indeed use podman login, podman build, podman push, podman logout. |
A new version of builder is due to be released within the next few weeks that will have new features that should allow you to accomplish what you need here (copy certs, run update-ca-trust command). This code has been merged to the The tl;dr of it is that the new version 3 of the execution environment file (docs here) has new sections to allow you to add any files to the build context, and new insertion points that allow you to add custom instructions before and after any of the build phases. |
Great news, it's not very easy for me to test the devel branch as we're running on a strict Red Hat Satellite based setup, but I'll keep an eye out for the new release! |
With Ansible Builder v3, you can use any base image, copy additional files, and set ENV variables. Please give it a try. Here is the link to the option documenation. Thanks. |
Closing due to no activity. |
We use a transparent proxy which does MITM inspection of some HTTPS traffic. This means that some HTTPS connections are re-signed by an organizational CA rather than the original CA.
This interferes with ansible-builder, as it's not clear how we would add the custom CA root(s) to the builder image, and it fails to validate the connection to Galaxy:
Full output follows.
Some of our sites require explicit HTTP/HTTPS proxy settings, so ideally it would be possible to set those as well.
I added lines to the generated Dockerfile to add the organizational certs and run update-ca-trust, and then ran the Docker build manually. The image build then succeeded. Ideally there would be a way to pass the organizational CA and proxy settings into ansible-builder for automatic inclusion in the build process.
The text was updated successfully, but these errors were encountered: