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

feat(security): Create a Vault mgmt token for Consul Secrets API Operations #3192

Merged

Conversation

jim-wang-intel
Copy link
Contributor

@jim-wang-intel jim-wang-intel commented Feb 24, 2021

Part of Phase 1 Securing Consul stories: Create a Vault token to configure consul access

Changes in secretstore-setup:

  • add token file writer implementation for creating and writing Vault's Consul secrets admin token
  • add Consul ACL feature flag "ENABLE_REGISTRY_ACL"
  • add configuration setting for ConsulSecretAdminTokenPath for specifying token file location
  • refactor TokenMaintenance to share code with token file writer's implementation

Closes: #3155

Signed-off-by: Jim Wang [email protected]

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x ] Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-go/blob/master/.github/Contributing.md.

What is the current behavior?

N/A

Issue Number: #3155

What is the new behavior?

New Vault token created for special purpose of management Consul Secrets APIs operations policy: configure access / create update roles later on. This token will be later used by Consul's bootstrapper.

Does this PR introduce a breaking change?

  • Yes
  • [x ] No

New Imports

  • Yes
  • [x ] No

Specific Instructions

Are there any specific instructions or things that should be known prior to reviewing?

Other information

To verify this locally, one can git clone this PR and build a dev version of docker_secretstore_setup and then add the following environment variables to docker-compose file of secretstore-setup:

 environment:
      ENABLE_REGISTRY_ACL: "true"

so that the ACL feature is turned on. Run make run dev and then observe the following docker logs from edgex-secretstore-setup:
docker logs edgex-secretstore-setup | grep "edgex-consul/admin/token"


jim@jim-NUC7i5DNHE:~/go/src/github.com/edgexfoundry/edgex-compose/compose-builder$ docker logs edgex-secretstore-setup | grep "edgex-consul/admin/token"
level=INFO ts=2021-02-24T22:47:57.466345924Z app=edgex-security-secretstore-setup source=tokenfilewriter.go:110 msg="token's written to /tmp/edgex/secrets/edgex-consul/admin/token.json"
jim@jim-NUC7i5DNHE:~/go/src/github.com/edgexfoundry/edgex-compose/compose-builder$ 

And also list the file, too:
$ sudo ls -al /tmp/edgex/secrets/edgex-consul/admin/

[sudo] password for jim: 
total 12
drwx------ 2 2002 2001 4096 Feb 24 12:56 .
drwx------ 3 2002 2001 4096 Feb 24 12:56 ..
-rw------- 1 2002 2001  536 Feb 24 15:47 token.json

@jim-wang-intel jim-wang-intel added enhancement New feature or request security-services 3-high priority denoting release-blocking issues ireland labels Feb 24, 2021
@jim-wang-intel jim-wang-intel added this to the Ireland milestone Feb 24, 2021
@jim-wang-intel jim-wang-intel self-assigned this Feb 24, 2021
@jim-wang-intel jim-wang-intel force-pushed the create-special-vault-token branch 2 times, most recently from 123b826 to 5c6281c Compare February 25, 2021 14:45
Changes in secretstore-setup:
 - add token file writer implementation for creating and writing Vault's Consul secrets admin token
 - add Consul ACL feature flag "ENABLE_REGISTRY_ACL"
 - add configuration setting for ConsulSecretAdminTokenPath for specifying token file location
 - refactor TokenMaintenance to share code with token file writer's implementation

Closes: edgexfoundry#3155

Signed-off-by: Jim Wang <[email protected]>
Address feedbacks on tokenfile writer

Signed-off-by: Jim Wang <[email protected]>
@bnevis-i bnevis-i dismissed their stale review February 26, 2021 17:31

Withdrawing review.

PR comments addressed

Signed-off-by: Jim Wang <[email protected]>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM

@lenny-goodell lenny-goodell merged commit 257616a into edgexfoundry:master Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3-high priority denoting release-blocking issues enhancement New feature or request ireland security-services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Secure Consul Ph. 1] Implement the token creation of specific Vault token for Consul's ACL bootstrapping
4 participants