From 78a591e5a26431d6783bdb007bc014cf03b4b30d Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Sun, 19 Sep 2010 12:44:43 -0400 Subject: adding contrib directory and sample bash wrapper for simplifying keyringer usage. --- contrib/pass | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 contrib/pass (limited to 'contrib') 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 +# +# 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 -- cgit v1.2.3