-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- tidy via linting
- Loading branch information
idcmp
committed
Jun 7, 2020
1 parent
4e83c86
commit f873920
Showing
13 changed files
with
137 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,41 @@ | ||
# Vault Mock Secrets Plugin | ||
# Vault Artifactory Secrets Plugin | ||
|
||
Mock is an example secrets engine plugin for [HashiCorp Vault](https://www.vaultproject.io/). It is meant for demonstration purposes only and should never be used in production. | ||
This is a [HashiCorp Vault](https://www.vaultproject.io/) plugin which talks to JFrog Artifactory server (5.0.0 or later) and will | ||
dynamically provision access tokens with specified scopes. This backend can be mounted multiple times | ||
to provide access to multiple Artifactory servers. | ||
|
||
## Usage | ||
|
||
All commands can be run using the provided [Makefile](./Makefile). However, it may be instructive to look at the commands to gain a greater understanding of how Vault registers plugins. Using the Makefile will result in running the Vault server in `dev` mode. Do not run Vault in `dev` mode in production. The `dev` server allows you to configure the plugin directory as a flag, and automatically registers plugin binaries in that directory. In production, plugin binaries must be manually registered. | ||
|
||
This will build the plugin binary and start the Vault dev server: | ||
``` | ||
# Build Mock plugin and start Vault dev server with plugin automatically registered | ||
$ make | ||
``` | ||
Using this plugin, you limit the accidental exposure window of Artifactory tokens; useful for continuous | ||
integration servers. | ||
|
||
Now open a new terminal window and run the following commands: | ||
``` | ||
# Open a new terminal window and export Vault dev server http address | ||
$ export VAULT_ADDR='http://127.0.0.1:8200' | ||
# Enable the Mock plugin | ||
$ make enable | ||
# Write a secret to the Mock secrets engine | ||
$ vault write mock/test hello="world" | ||
Success! Data written to: mock/test | ||
## Usage | ||
|
||
# Retrieve secret from Mock secrets engine | ||
$ vault read mock/test | ||
Key Value | ||
--- ----- | ||
hello world | ||
```bash | ||
$ vault secrets enable artifactory | ||
|
||
# Also supports max_ttl= and default_ttl= | ||
$ vault write artifactory/config/admin \ | ||
url=https://artifactory.example.org \ | ||
access_token=0ab31978246345871028973fbcdeabcfadecbadef | ||
|
||
# Also supports grant_type=, and audience= (see JFrog documentation) | ||
$ vault write artifactory/roles/jenkins \ | ||
username="example-service-jenkins" \ | ||
scope="api:* member-of-groups:ci-server" \ | ||
refreshable=true \ | ||
default_ttl=1h max_ttl=3h | ||
|
||
$ vault list artifactory/roles | ||
Keys | ||
---- | ||
jenkins | ||
|
||
$ vault write -force artifactory/token/jenkins | ||
Key Value | ||
--- ----- | ||
lease_id artifactory/token/jenkins/25jYH8DjUU548323zPWiSakh | ||
access_token adsdgbtybbeeyh... | ||
refreshable true | ||
role jenkins | ||
scope api:* member-of-groups:ci-server | ||
``` | ||
|
||
## License | ||
|
||
Mock was contributed to the HashiCorp community by [hasheddan](https://github.com/hasheddan/vault-plugin-secrets-covert). In doing so, the original license has been removed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.