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

[cacerts] Feature Request: method to easily add additional certs to cabundle #1799

Open
qubitrenegade opened this issue Aug 17, 2018 · 1 comment

Comments

@qubitrenegade
Copy link
Contributor

Hello,

We use an internal CA for generating SSL certs. To enable an instance to trust SSL signed with our internal CA we generally update our /etc/ssl/certs/ca-bundle.crt with update-ca-trust.

However, since any package that include core/cacerts will use the bundled ca-bundle, any updates to the system ca-bundle will be ignored.

As a short-term work around, we've been adding our certs to the core/cabundle once it's been deployed, e.g.:

cat my_cert.pem >> $(hab pkg path core/cacerts)/ssl/cert.pem

Which works well, until cacerts is updated.

What would be really nice, is to be able to create a /hab/user/cacerts/config/user.toml and add my certs there, e.g.:

[cert]
name = "foobar.com"
data = """
-----BEGIN CERTIFICATE-----
jkljklhjkhjkhjkhkjk...
-----END CERTIFICATE-----
"""

[cert]
name = "bizbaz.com"
data = """
-----BEGIN CERTIFICATE-----
FDSafadsfadsfadsadfs
-----END CERTIFICATE-----
"""

But as cacerts is a binary package, I don't think it will honor any settings in default.toml/user.toml...?

So I'm really not sure how to approach this...

@HT154
Copy link

HT154 commented Mar 20, 2019

I think this is actually possible to accomplish with an install hook today without any rust feature development.

I need to run Habitat in an environment with an on-prem builder, custom CA certs, and no internet access. Here's what I imagine this would look like if core/cacerts implemented an install hook for patching the CA bundle:

# system CA trust is already updated
export SSL_CERT_FILE=path/to/system/trust.pem
export HAB_FEAT_INSTALL_HOOK=1
export HAB_BLDR_URL=https://bldr.me

export HAB_CORE_CACERTS_APPEND=path/to/my/ca1.pem,path/to/my/ca2.pem
# OR, potentially
export HAB_CORE_CACERTS_REPLACE=path/to/system/trust.pem

curl https://file.server.me/hab -o /tmp/hab
/tmp/hab pkg install -bf core/hab
hab pkg install core/hab-sup
hab pkg install core/hab-launcher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants