diff options
author | Jamie McClelland <jm@mayfirst.org> | 2010-09-19 12:44:43 -0400 |
---|---|---|
committer | Jamie McClelland <jm@mayfirst.org> | 2010-09-19 12:44:43 -0400 |
commit | 78a591e5a26431d6783bdb007bc014cf03b4b30d (patch) | |
tree | 0762a3f513f30a2cb398b01711edbbb112c02390 /contrib/pass | |
parent | ab583a9e2a2e0f8452016cfc968339d638da40b4 (diff) | |
download | keyringer-78a591e5a26431d6783bdb007bc014cf03b4b30d.tar.gz keyringer-78a591e5a26431d6783bdb007bc014cf03b4b30d.tar.bz2 |
adding contrib directory and sample bash wrapper for simplifying
keyringer usage.
Diffstat (limited to 'contrib/pass')
-rwxr-xr-x | contrib/pass | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/contrib/pass b/contrib/pass new file mode 100755 index 0000000..b4d5954 --- /dev/null +++ b/contrib/pass @@ -0,0 +1,50 @@ +#!/bin/bash + +# Sample wrapper program for simplying the use of keyringer. +# This wrapper assumes you are using one key file with many +# stored secrets. It helps users find keys and appends new +# keys in a standard format. +# +# You can copy this program into your bin directory and then +# modify as needed. +# +# Usage +# Search for a matching secret in your key file: +# pass <search-string> +# +# Add a new secret to your key file, responding to prompts: +# pass + +# modify these variables +keyring=mfpl +file=mfpl.asc +remote_git_repo=mfpl +remote_git_branch=master + +if [ -z "$1" ]; then + echo + echo "Adding a new secret. You will need to enter your passphrase" + echo "twice. Once to decrypt, and again to re-encrypt." + echo + # collect variables + read -p "Host/Description: " + host="$REPLY" + read -p "User: " + user="$REPLY" + default_password=$(pwgen -s 15 1) + read -p "Password [$default_password]: " + pass="$REPLY" + [ -z "$pass" ] && pass="$default_password" + echo "$host : $user : $pass" | keyringer "$keyring" append-batch "$file" + read -p "Commit changes? [Yn] " + if [ "$REPLY" = "y" ] || [ "$REPLY" = "Y" ] || [ -z "$REPLY" ]; then + keyringer "$keyring" git commit "keys/$file" + keyringer "$keyring" git push "$remote_git_repo" "$remote_git_branch" + else + echo "Not committing changes." + fi + +else + keyringer "$keyring" decrypt "$file" | egrep -i "$1" +fi +echo |