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

allow externalizing/encrypting config secret values #7608

Merged
merged 3 commits into from
Mar 1, 2016
Merged

allow externalizing/encrypting config secret values #7608

merged 3 commits into from
Mar 1, 2016

Conversation

liggitt
Copy link
Contributor

@liggitt liggitt commented Feb 25, 2016

This PR allows externalizing/encrypting secret fields in the config. Previously, something like LDAP config had to do this:

  ...
  bindPassword: "Passw0rd!"
  ...

With this PR, it can do that, or do any of these:

$ export BIND_PASSWORD_ENV_VAR_NAME=Passw0rd!
$ echo -n "Passw0rd!" > bindPassword.txt
$ oadm ca encrypt --genkey=bindPassword.key --out=bindPassword.encrypted
> Data to encrypt: Passw0rd!
  bindPassword:
    env: BIND_PASSWORD_ENV_VAR_NAME
  bindPassword:
    file: bindPassword.txt
  bindPassword:
    file: bindPassword.encrypted
    keyFile: bindPassword.key

This PR adds support for these formats to the bindPassword and clientSecret fields in the master and LDAP group sync config files.

Docs in openshift/openshift-docs#1669

@liggitt
Copy link
Contributor Author

liggitt commented Feb 25, 2016

[test][extended:ldap_groups]

@liggitt
Copy link
Contributor Author

liggitt commented Feb 25, 2016

@deads2k for config/serialization

@sgallagher for encrypt/decrypt commands and output (encrypted using https://golang.org/pkg/crypto/x509/#EncryptPEMBlock)

@detiber / @sdodson for interactions with ansible... not sure how the bindPassword (for LDAP) and clientSecret (OAuth/OpenID) fields are handled by ansible if they could be either a string or a struct.

@liggitt liggitt changed the title WIP - allow externalizing/encrypting config secret values allow externalizing/encrypting config secret values Feb 25, 2016
}
}

func GetExternalizableStringValue(s ExternalizableString) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bad name. I like GetClearText better. An ExternalizableString isn't very helpful to me reading it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to better names for the type as well. StringSource? ResolveStringSource()? I could see using these for env-specific things in combination with an etcd-stored config as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to better names for the type as well. StringSource? ResolveStringSource()? I could see using these for env-specific things in combination with an etcd-stored config as well

Those are better.

@deads2k
Copy link
Contributor

deads2k commented Feb 25, 2016

I'd feel a lot better about this with an extended test using an actual master-config.yaml on disk with an encrypted value. Gitlab in a container could be generally useful, so could a secured ldap. I could see this as a followup issue for someone who wants to get to know the config and authentication integration scenarios.

@sdodson
Copy link
Member

sdodson commented Feb 25, 2016

Just curious, is there a card or something that outlines the intention here?

@liggitt
Copy link
Contributor Author

liggitt commented Feb 26, 2016

@deads2k
Copy link
Contributor

deads2k commented Feb 26, 2016

Need docs for the types, but otherwise I'm happy with them.

I'd still a test or issue for a test that actually makes use of this from a yaml file.

@sgallagher I didn't look at the command in any detail.

@liggitt
Copy link
Contributor Author

liggitt commented Feb 26, 2016

@deads2k not quite from yaml on disk, but this is close: https://github.com/openshift/origin/pull/7608/files#diff-7e8d11670ba88f9227b91aeea7c786ba

did I miss an easy way to make the integration stuff persist/read the master config from disk?

@liggitt
Copy link
Contributor Author

liggitt commented Feb 26, 2016

nevermind, got it round-tripping in the integration test at https://github.com/openshift/origin/pull/7608/files#diff-7e8d11670ba88f9227b91aeea7c786baR135

@liggitt
Copy link
Contributor Author

liggitt commented Feb 26, 2016

tests and doc added, any last comments from @deads2k or @sgallagher?

@liggitt
Copy link
Contributor Author

liggitt commented Feb 26, 2016

will open a docs PR separately

@liggitt
Copy link
Contributor Author

liggitt commented Feb 27, 2016

open questions:

  1. when reading cleartext data from stdin or from a file, should we strip a trailing newline? echo foo > secret.txt leaves a trailing newline in the file, which is unfortunate added warnings
  2. Are there better names for the PEM blocks than what I used ("ENCRYPTED STRING" / "ENCRYPTING KEY")?
  3. Will ansible tolerate idp config snippets that have structured data for bindPassword or clientSecret? looks like it just plumbs the value through, whatever it is

@deads2k
Copy link
Contributor

deads2k commented Feb 29, 2016

two open questions:

Three or is one of those just a test? Oh, you need the trailing whitespace/newline to support entering usernames, don't you? :)

I don't see any of those problems as blockers for this pull.

@deads2k
Copy link
Contributor

deads2k commented Feb 29, 2016

@sgallagher you going to go through the command?

The types looked fine to me.

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test Running (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/1733/) (Extended Tests: ldap_groups)

@sgallagher
Copy link
Contributor

LGTM

@liggitt
Copy link
Contributor Author

liggitt commented Feb 29, 2016

[merge]

@liggitt
Copy link
Contributor Author

liggitt commented Mar 1, 2016

flake #7706
re[merge]

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5148/) (Image: devenv-rhel7_3575)

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 70fd4c7

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 70fd4c7

openshift-bot pushed a commit that referenced this pull request Mar 1, 2016
@openshift-bot openshift-bot merged commit 7ba70f0 into openshift:master Mar 1, 2016
@liggitt liggitt deleted the aes-encrypt branch March 2, 2016 15:28
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

Successfully merging this pull request may close these issues.

5 participants