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

feature addition: store cert/key in s3 #1

Open
tkellen opened this issue Dec 17, 2019 · 9 comments
Open

feature addition: store cert/key in s3 #1

tkellen opened this issue Dec 17, 2019 · 9 comments

Comments

@tkellen
Copy link

tkellen commented Dec 17, 2019

Hello! Thank you so much for making this tool, it does almost exactly what I need it to :)

I have a few use-cases in which I need access to the private key of a generated certificate. As this is not accessible once stored in ACM, would you accept a PR that introduces support for storing certs/private keys in s3 as an alternative destination?

@begmaroman
Copy link
Owner

begmaroman commented Dec 17, 2019

@tkellen Hello!
I like your idea, but I propose to do a little different. Since a private key is secret data, I propose to store a private key in the secrets manager. What do you think about this idea?

@tkellen
Copy link
Author

tkellen commented Dec 17, 2019

Ah yes, that makes more sense, I have no idea why I didn't suggest that from the outset!

Would you feel equally supportive of my implementing this to store the private key as an encrypted string parameter in SSM (and the cert as an unencrypted one) instead? I am in the process of migrating away from secrets manager because I don't use the secret rotation functionality.

@begmaroman
Copy link
Owner

@tkellen I think we can do the script more flexible and support multiple storages for private keys by passing an argument like --private-store s3

@tkellen
Copy link
Author

tkellen commented Dec 17, 2019

Sounds good to me! I can cover the secretsmanager and parameter store one as well. I'll try to take a look in the next week or so and open a simple WIP PR for your feedback on the implementation before I go too far.

@begmaroman
Copy link
Owner

@tkellen will glad to look at a PR, thanks :)

@RichardBradley
Copy link

Did anything come of this? I'm looking for the same thing.
I will create a PR, unless you have one that just hasn't been published yet and would be willing to publish it?

@RichardBradley
Copy link

RichardBradley commented Aug 27, 2020

Actually, I think it's going to be more work for me to adapt this tool to do what I want than to write my own script, so I won't make a PR. Thanks anyway.

It seems strange to me to store the certs in ACM, which doesn't allow exporting. If you need a cert in ACM for something like ALB where you don't need the private key, why not use the ACM provided certs directly?

@mkozjak
Copy link

mkozjak commented May 4, 2021

@tkellen Thoughts on this one? Decided to move to another solution? Any recommendations?

@tkellen
Copy link
Author

tkellen commented May 4, 2021

Wound up minting certs with terraform/letsencrypt thusly

provider "acme" {
  server_url = "https://acme-v02.api.letsencrypt.org/directory"
  # for testing server_url = "https://acme-staging-v02.api.letsencrypt.org/directory"
}

resource "tls_private_key" "account" {
  algorithm = "RSA"
}

resource "acme_registration" "main" {
  account_key_pem = tls_private_key.account.private_key_pem
  email_address   = local.config.admin_email
}

resource "acme_certificate" "certificate" {
  account_key_pem           = acme_registration.main.account_key_pem
  common_name               = "${local.config.env}.${local.config.domain}"
  subject_alternative_names = [
    "*.${local.config.env}.${local.config.domain}"
  ]
  dns_challenge {
    provider = "route53"
    config = {
      AWS_PROFILE = "training"
      AWS_DEFAULT_REGION = "us-east-1"
    }
  }
}

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

No branches or pull requests

4 participants