It's a secret.
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
"shush" is a small tool that can be used to encrypt and decrypt secrets, using the AWS "Key Management Service" (KMS).
Encrypt secrets like this:
shush encrypt KEY-ID-OR-ALIAS < secret.txt > secret.encrypted
The output of
encryptis Base64-encoded ciphertext.
KEY-ID-OR-ALIAS can be the id or ARN of a KMS master key, or alias prefixed by "alias/", or simply just the alias.
Plaintext input can also be provided on the command-line, e.g.
shush encrypt KEY-ID 'this is a secret' > secret.encrypted
encryptwill automatically remove leading and trailing whitespace from the plaintext. This can be especially useful when piping input from commands which always leave a trailing newline.
shush encrypt -t KEY_ID ' I don't really need this whitespace ' > secret.encrypted
Encrypted secrets are easy to decrypt, like this:
shush decrypt < secret.encrypted > secret.txt
There's no need to specify a KEY-ID here, as it's encoded in the ciphertext.
If you want to see the ARN of the key used to encrypt the secret, add the
shush decrypt --print-key < secret.encrypted
Appropriate AWS credentials must be provided by one of the mechanisms supported by aws-sdk-go, e.g. environment variables, or EC2 instance profile.
When used within EC2,
shushselects the appropriate region automatically. Outside EC2, you'll need to specify it, via
--regionor by setting
"shush" supports KMS encryption contexts, which may be used to scope use of a key. The same encryption context must be provided when encrypting and decrypting.
shush --context app=myapp encrypt KEY-ID secret.txt > secret.encrypted shush --context app=myapp decrypt < secret.encrypted > secret.txt
"shush" can only encrypt small amounts of data; up to 4 KB.
"shush exec" is a command shim that makes it easy to use secrets transported via the (Unix) process environment. It decrypts any environment variables prefixed by "
KMS_ENCRYPTED_", and executes a specified command.
$ export KMS_ENCRYPTED_DB_PASSWORD=$(shush encrypt alias/app-secrets 'seasame') $ shush exec -- env | grep PASSWORD KMS_ENCRYPTED_DB_PASSWORD=CiAbQLOo2VC4QTV/Ng986wsDSJ0srAe6oZnLyzRT6pDFWRKOAQEBAgB4G0CzqNlQuEE1fzYPfOsLA0idLKwHuqGZy8s0U+qQxVkAAABlMGMGCSqGSIb3DQEHBqBWMFQCAQAwTwYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAzfFR0tsHRq18JUhMcCARCAImvuMNYuHUut3BT7sZs9a31qWcmOBUBXYEsD+kx2GxUxBPE= DB_PASSWORD=seasame
In this example, "shush exec":
$KMS_ENCRYPTED_DB_PASSWORDin the environment
"shush exec" works well as an entrypoint for Docker images, e.g.
# Include "shush" to decode KMS_ENCRYPTED_STUFF RUN curl -sL -o /usr/local/bin/shush \ https://github.com/realestate-com-au/shush/releases/download/v1.4.0/shush_linux_amd64 \ && chmod +x /usr/local/bin/shush ENTRYPOINT ["/usr/local/bin/shush", "exec", "--"]
Binaries for official releases may be downloaded from the releases page on GitHub.
If you want to compile it from source, try:
$ go get github.com/realestate-com-au/shush
For Unix/Linux users, you can install
shushusing the following command. You may want to change the version number in the command below from
v1.4.0to whichever version you want:
curl -sL -o /usr/local/bin/shush \ https://github.com/realestate-com-au/shush/releases/download/v1.4.0/shush_linux_amd64 \ && chmod +x /usr/local/bin/shush
Encrypt user input:
echo -n "Enter password: " ENCRYPTED_PASSWORD=$(shush encrypt alias/app-secrets)
some-command --password $(shush decrypt "$ENCRYPTED_PASSWORD")
Encrypt some environment variables, as though they were arguments to
shush encrypt alias/app-secrets 'FOO=1 BAR=2' > secrets
env $(shush decrypt < secrets) some-command
If you dislike 8Gb binary files, and happen to have a Ruby interpreter handy, "ssssh" is a drop-in replacement for "shush":
Or, you can just use
base64, and the AWS CLI:
base64 -d < secrets.encrypted > /tmp/secrets.bin aws kms decrypt --ciphertext-blob fileb:///tmp/secrets.bin --output text --query Plaintext | base64 -d > secrets.txt
Please see docs/releasing.md
Copyright (c) 2019 REA Group Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Source-code for shush is on Github.