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

Nomad /Secrets For Docker #2800

Closed
mqasim1983 opened this issue Jul 7, 2017 · 10 comments
Closed

Nomad /Secrets For Docker #2800

mqasim1983 opened this issue Jul 7, 2017 · 10 comments

Comments

@mqasim1983
Copy link

Hi,

I need add public and private key inside containers. I looked into /secrets . Is there any possibility to use it in Docker.
tmpfs 1.0M 0 1.0M 0% /secrets

Is there any possibility to pass text file in Nomad to mount /secrets/PublicKey.txt ? without Vault
Just like Docker secrets

@jippi
Copy link
Contributor

jippi commented Jul 7, 2017

you could use template{} + vault to read the keys and write them to /secrets ?

@mqasim1983
Copy link
Author

Thanks for the reply.
I need to add config in Nomad for the vault one of the main reason.

@mqasim1983
Copy link
Author

@jippi

    vault {
    policies = ["default"]

    change_mode   = "signal"
    change_signal = "SIGUSR1"
  }

   template {
    data = <<EOF
    {{ with secret “secret/hello" }}
    {{ .Data.value }}{{ end }}
    EOF
    destination   = "secrets/hello-world.tx"
    change_mode   = "signal"
    change_signal = "SIGINT"
  }



  ERROR : consul-template: (dynamic): parse: template: :1: unrecognized character in action: U+201C '“'

--

@mlehner616
Copy link

The quotes here destination = “secrets don't look right. Are you sure those are in fact "?

@mlehner616
Copy link

Sorry I meant here {{ with secret “secret ...

@dadgar
Copy link
Contributor

dadgar commented Jul 17, 2017

@mqasim1983 The /secrets dir is mounted into the container and is backed by a tmpfs so it is a good place to store your secrets. If you are trying to inject the value without using vault you essentially have two options.

  1. Hard code the value in the template:
task "foo" {
  template {
    data = <<EOF
<LITERAL DATA>
    EOF
    destination   = "secrets/hello-world.txt"
  }
...
}
  1. Store the secret data in Consul:
task "foo" {
  template {
    data = <<EOF
{{ key "my-secret-key" }}
    EOF
    destination   = "secrets/hello-world.txt"
  }
...
}

@dadgar dadgar closed this as completed Jul 17, 2017
@shantanugadgil
Copy link
Contributor

shantanugadgil commented Jul 17, 2017

@dadgar I plan to use S3 as source for and artifact and the destination file will be inside secrets.
The access to S3 is locked down using IAM roles within AWS, so it should be considered safe, right?

The problem with an inline template would be that it would reveal the entire contents of the file when this .nomad file would get committed to sources.

Regards,
Shantanu

@dadgar
Copy link
Contributor

dadgar commented Jul 18, 2017

@shantanugadgil Yes, choice #1 is definitely not recommended but given the original constraints those would be the two choices.

The way you are doing it is great!

@mqasim1983
Copy link
Author

@dadgar @shantanugadgil @mlehner616
Thanks it really helped me.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants