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

As a developer, I can use a custom CA cert to verify SSL connections during builds #170

Closed
sclevine opened this issue May 2, 2019 · 15 comments
Assignees
Labels
type/research Issue intended to be exploratory.

Comments

@sclevine
Copy link
Member

sclevine commented May 2, 2019

Important for enterprise/corporate users with transparent mitm proxies

When I run pack build --cert /path/to/cert1.pem --cert /path/to/cert2.pem`
And A process in the container reaches out to website using TLS that requires cert1.pem and cert2.pem CA certificates to validate
Then The connection succeeds

Notes

  • /etc/ssl/certs
  • Need to run update-ca-certificates
  • Should we really do this? Poor cross-stack compat
@ekcasey
Copy link
Member

ekcasey commented May 2, 2019

@sclevine even if we don't prioritize fixing this in the general case (because of the problems with stack portability), we should probably handle the specific case of providing a custom ca for connections to a registry.

I imagine we could configure that through ggcr and avoid updating the trust store for the entire container.

@josegonzalez
Copy link

This is something that would be useful in my work - I work on a product that enterprise customers install and require their own random certs to be injected into the container.

One thing I thought of here was to "pre-prepare" a stack based on the generic stack. If I "detected" that I needed to inject files, I would simply to do so before actually calling pack/lifecycle, and then use the resulting image within the build process. I don't like that since it requires keeping track of an intermediate stack outside of the general tooling, but it could be useful if this isn't built into pack/lifecycle.

Semi-related was #169, which thankfully is implemented :)

@jromero jromero added the status/triage Issue or PR that requires contributor attention. label Feb 5, 2020
@natalieparellano natalieparellano added status/discussion-needed Issue or PR that requires in-depth discussion. and removed status/triage Issue or PR that requires contributor attention. labels Feb 5, 2020
@natalieparellano
Copy link
Member

Potentially related to #159

@yonkeltron
Copy link

Hey this is blocking my company's exploration of this technology due to our internal security policies and their expressions as crypto-cracking countermeasures at the edge. Since this is a non-negotiable thing for us, we are unable to proceed much further without this capability. How can we work to resolve this, knowing fully that we're willing to help test this in a corporate environment where Man-In-The-Middle proxies exist in force?

Anything we can do to help would be awesome.

@zmackie zmackie self-assigned this Mar 16, 2020
@zmackie
Copy link
Contributor

zmackie commented Apr 9, 2020

An API for this issue is being discussed in buildpacks/rfcs#69

@dfreilich
Copy link
Member

There's been recent movement on this (conversation in slack) - either to implement it as an experimental flag in pack, or to allow it via a new rfc for stackpacks (see more here: buildpacks/rfcs#87)

in the short term, can we implement a --cert like thing in Pack, even if it's super hacky. Then if the grand(iose) vision of stackpacks works out, the --cert could use it under the hood and we can rm -rf the hack (and it just becomes a convenience feature of the Pack platform)?

cc @nebhale @jkutner

@jromero jromero added type/research Issue intended to be exploratory. and removed status/discussion-needed Issue or PR that requires in-depth discussion. labels Jul 24, 2020
@jromero
Copy link
Member

jromero commented Jul 24, 2020

Following @dfreilich's update, the alignment during working group was to take the following steps:

  1. Research what capabilities are available during buildtime within the docker daemon
  2. Start early work on stack buildpacks
  3. Possible workaround (within pack) is to use R/W volume mounts

@jromero jromero assigned jromero and unassigned zmackie Jul 24, 2020
@jromero
Copy link
Member

jromero commented Aug 4, 2020

Did a bit of research on this recently. I've cataloged a few solutions on a separate repo. The lowest hanging solution with reasonable results would be the support the Read/Write volumes to enable mounting the docker VM certs. It would be analogous to the following command:

docker run \
    --volume="/etc/ssl/certs:/etc/ssl/certs:ro" \
    --volume="/usr/share/ca-certificates/:/usr/share/ca-certificates/:ro" \
    -it --rm \
    gcr.io/paketo-buildpacks/builder:base \
    /bin/bash

@nebhale
Copy link
Contributor

nebhale commented Aug 5, 2020

Love it!

@dfreilich dfreilich added this to the 0.14.0 milestone Aug 12, 2020
@dfreilich
Copy link
Member

@jromero Given that #778 was merged in, can we close this? Or should we keep it open to track in case we need other solutions?

@dfreilich dfreilich modified the milestone: 0.14.0 Aug 12, 2020
@nebhale
Copy link
Contributor

nebhale commented Aug 14, 2020

@dfreilich I'd like this left open until I've got a snapshot to test it with.

@noamichael
Copy link

Any update on this? I've tried mounting the certificate volume but I'm still getting SSL errors when running behind a corporate proxy. Don't we also need to run update-ca-certificates after mounting the certificate?

@jromero
Copy link
Member

jromero commented Sep 28, 2020

@noamichael I can help troubleshoot a little if you want to open a separate issue or reach out via slack.

FWIW, update-ca-certificates shouldn't be necessary but that would depend on the application. The application can be configured to look solely at ca-certificates.crt or the /etc/ssl/certs/ directory. The former is what gets updated via mount and it's by far the most common.

Here's a draft post that has a little more detail. It will likely be moved to buildpacks.io until a more permanent solution is available (such as stack buildpacks).

@jromero jromero modified the milestones: 0.14.0, 0.15.0 Sep 30, 2020
@jromero jromero removed this from the 0.15.0 milestone Nov 4, 2020
@jromero
Copy link
Member

jromero commented Dec 17, 2020

The Paketo buildpacks team have found a buildpack acceptable solution for this. You can find it here. We recommend other providers to do something similar.

Once stack buildpacks are available additional options for implementation would be available. That said at this point in time this issue has been satisfied.

@jromero jromero closed this as completed Dec 17, 2020
@fagiani
Copy link

fagiani commented Oct 27, 2021

@jromero @dfreilich

This combined with the #169 make it perfect for the use case where in order to improve build speed, additionally to the image caching, you can proxy with Squid with SSL Bump or others the most common packages/artifacts for several projects (like apt, npm, yarn, gem, pip, composer, tgz, etc) and locally cache them and avoid re-downloading GBs worth of data and even save some bucks down the road.

I've just tested it and works like a charm.

Keep Rocking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/research Issue intended to be exploratory.
Projects
None yet
Development

No branches or pull requests