From 2409a2c5bcdfd43c61072545e23148e9e9c6ca67 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 10 Dec 2013 18:45:10 -0200 Subject: Adding 'shell' and 'help' to manpage (#34) --- share/man/keyringer.1.mdwn | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'share/man/keyringer.1.mdwn') diff --git a/share/man/keyringer.1.mdwn b/share/man/keyringer.1.mdwn index d4b71e3..b383507 100644 --- a/share/man/keyringer.1.mdwn +++ b/share/man/keyringer.1.mdwn @@ -61,6 +61,16 @@ tree <*path*> if *path* is specified using a tree-like format. Like the ls wrapper, this is a wrapper around the *TREE(1)* command. +shell +: Run keyringer on interactive mode from a built-in command-line prompt where + all other actions can be called and are operated from the current selected + keyring. + + An additional "cd" internal command is available for directory navigation. + + All <*secret*> parameters from actions invoked from the shell are called + relatively from the current selected directory. + # SECRET MANIPULATION ACTIONS All secret manipulation actions operate upon a *secret* which is the pathname @@ -151,6 +161,9 @@ preferences <*ls*|*edit*|*add*> usage : Show keyringer usage information. +help +: Alias for usage action. + recipients <*ls*|*edit*> <*recipients-file*> : List, create or edit recipients configuration. -- cgit v1.2.3 From d3c34db2f307d86209235832db8b9c04a2942405 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 10 Dec 2013 18:48:53 -0200 Subject: Adding mkdir action (#34) --- lib/keyringer/actions/mkdir | 19 +++++++++++++++++++ share/man/keyringer.1.mdwn | 3 +++ 2 files changed, 22 insertions(+) create mode 100755 lib/keyringer/actions/mkdir (limited to 'share/man/keyringer.1.mdwn') diff --git a/lib/keyringer/actions/mkdir b/lib/keyringer/actions/mkdir new file mode 100755 index 0000000..b31eb0b --- /dev/null +++ b/lib/keyringer/actions/mkdir @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Create folders. +# + +# Load functions +LIB="`dirname $0`/../functions" +source "$LIB" || exit 1 + +# Aditional parameters +CWD="`pwd`" + +# Avoid leading slash +shift +ARGS="`echo "$*" | sed -e "s|^/*||"`" + +# Run mkdir command +cd "$KEYDIR/$RELATIVE_PATH" && mkdir -p $ARGS +cd "$CWD" diff --git a/share/man/keyringer.1.mdwn b/share/man/keyringer.1.mdwn index b383507..f8d243e 100644 --- a/share/man/keyringer.1.mdwn +++ b/share/man/keyringer.1.mdwn @@ -56,6 +56,9 @@ ls <*path*> if *path* is specified. Like the git wrapper, this is a wrapper around the *LS(1)* command. +mkdir <*path*> +: Create a directory inside the repository *keys* folder. + tree <*path*> : List contents from the toplevel repository *keys* folder or from relative paths if *path* is specified using a tree-like format. Like the ls wrapper, this is a -- cgit v1.2.3 From 21e393464645c76c949d74180ce04b7507e0d738 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 10 Dec 2013 22:13:25 -0200 Subject: Adding 'teardown' action --- development.mdwn | 4 +--- lib/keyringer/actions/teardown | 27 +++++++++++++++++++++++++++ lib/keyringer/functions | 13 ++++++++++--- share/man/keyringer.1.mdwn | 4 ++++ 4 files changed, 42 insertions(+), 6 deletions(-) create mode 100755 lib/keyringer/actions/teardown (limited to 'share/man/keyringer.1.mdwn') diff --git a/development.mdwn b/development.mdwn index 1f475b6..8366b59 100644 --- a/development.mdwn +++ b/development.mdwn @@ -102,9 +102,7 @@ Setup: Teardown: - rm -rf ~/code/tests/keyringer - rm ~/.keyringer/test - sed -i -e '/^test=/d' ~/.keyringer/config + keyringer test teardown -y Translation ----------- diff --git a/lib/keyringer/actions/teardown b/lib/keyringer/actions/teardown new file mode 100755 index 0000000..3d33da4 --- /dev/null +++ b/lib/keyringer/actions/teardown @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Remove a keyring. +# + +# Load functions +LIB="`dirname $0`/../functions" +source "$LIB" || exit 1 + +# Options +CONFIRM="$2" + +if [ -z "$CONFIRM" ] || [ "$CONFIRM" != "-y" ]; then + echo "WARNING: about to remove the LOCAL copy of $KEYRING" + echo "WARNING: This will irrevocably destroy $KEYDIR" + echo "WARNING: the action cannot be undone!" + + read -rep "Are you sure to WIPE keyring $KEYRING (type YES to confirm)? " key + if [ "$key" != "YES" ]; then + exit 1 + fi +fi + +# Teardown +keyringer_shred `dirname $KEYDIR` +keyringer_shred $HOME/.keyringer/$KEYRING +sed -i -e "/^$KEYRING=/d" $HOME/.keyringer/config diff --git a/lib/keyringer/functions b/lib/keyringer/functions index 872dac9..0e795ee 100755 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -206,10 +206,17 @@ function keyringer_shred { echo "$message $path using $tool..." if [ -d "$path" ]; then - find $path -exec $tool -f {} \; - rmdir $path + if [ "$tool" == "wipe" ] || [ "$tool" == "rm" ]; then + $tool -rf $path + else + find $path -exec $tool -uf {} \; + fi else - $tool -f "$path" + if [ "$tool" == "wipe" ] || [ "$tool" == "rm" ]; then + $tool -f "$path" + else + $tool -uf "$path" + fi fi } diff --git a/share/man/keyringer.1.mdwn b/share/man/keyringer.1.mdwn index f8d243e..ad9569b 100644 --- a/share/man/keyringer.1.mdwn +++ b/share/man/keyringer.1.mdwn @@ -74,6 +74,10 @@ shell All <*secret*> parameters from actions invoked from the shell are called relatively from the current selected directory. +teardown +: Remove permanently a local copy of a repository, very dangerous if you + have just a single copy. + # SECRET MANIPULATION ACTIONS All secret manipulation actions operate upon a *secret* which is the pathname -- cgit v1.2.3 From b95155761a1789557ea1569491d149e3c90d295b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 26 Dec 2013 21:56:04 -0200 Subject: Adding 'find' action --- ChangeLog | 4 ++++ lib/keyringer/actions/find | 19 +++++++++++++++++++ share/man/keyringer.1.mdwn | 3 +++ 3 files changed, 26 insertions(+) create mode 100755 lib/keyringer/actions/find (limited to 'share/man/keyringer.1.mdwn') diff --git a/ChangeLog b/ChangeLog index 2de87c4..eb6b543 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-12-26 - Silvio Rhatto + + New action: find. + 2013-12-10 - Silvio Rhatto New actions: shell (#34), help, mkdir, teardown. diff --git a/lib/keyringer/actions/find b/lib/keyringer/actions/find new file mode 100755 index 0000000..92bec25 --- /dev/null +++ b/lib/keyringer/actions/find @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Find secrets. +# + +# Load functions +LIB="`dirname $0`/../functions" +source "$LIB" || exit 1 + +# Aditional parameters +CWD="`pwd`" + +# Avoid leading slash +shift +ARGS="`echo "$*" | sed -e "s|^/*||"`" + +# Run find command +cd "$KEYDIR/$RELATIVE_PATH" && find -iname "*$ARGS*" +cd "$CWD" diff --git a/share/man/keyringer.1.mdwn b/share/man/keyringer.1.mdwn index ad9569b..c3a8a7c 100644 --- a/share/man/keyringer.1.mdwn +++ b/share/man/keyringer.1.mdwn @@ -37,6 +37,9 @@ Keyringer has three types of actions: # REPOSITORY LOOKUP AND MANIPULATION ACTIONS +find <*expression*> +: Find secrets in the repository. + init <*path*> [*remote*] : Initialize a new keyringer repository. If a *remote* URL is specified, keyringer will clone an existing repository. -- cgit v1.2.3 From 6e077ce5604f8de1eec8e953248674423254246d Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 26 Dec 2013 23:56:30 -0200 Subject: Adding mv and rmdir actions --- ChangeLog | 6 ++++-- lib/keyringer/actions/mv | 28 ++++++++++++++++++++++++++++ lib/keyringer/actions/rmdir | 19 +++++++++++++++++++ share/man/keyringer.1.mdwn | 6 ++++++ 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100755 lib/keyringer/actions/mv create mode 100755 lib/keyringer/actions/rmdir (limited to 'share/man/keyringer.1.mdwn') diff --git a/ChangeLog b/ChangeLog index eb6b543..401fc64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,12 @@ 2013-12-26 - Silvio Rhatto - New action: find. + New actions: find, mv, rmdir + + Support for RELATIVE_FOLDER at git action 2013-12-10 - Silvio Rhatto - New actions: shell (#34), help, mkdir, teardown. + New actions: shell (#34), help, mkdir, teardown 2013-11-26 - 0.2.9 Silvio Rhatto diff --git a/lib/keyringer/actions/mv b/lib/keyringer/actions/mv new file mode 100755 index 0000000..aaf6772 --- /dev/null +++ b/lib/keyringer/actions/mv @@ -0,0 +1,28 @@ +#!/bin/bash +# +# Move secrets. +# + +# Load functions +LIB="`dirname $0`/../functions" +source "$LIB" || exit 1 + +# Avoid leading slash +ORIG="$(keyringer_filename `echo "$2" | sed -e "s|^/*||"`)" +DEST="`echo "$3" | sed -e "s|^/*||"`" + +# Set destination +if [ ! -d "$KEYDIR/$RELATIVE_PATH/$DEST" ]; then + keyringer_get_new_file $DEST +else + FILE="$DEST" +fi + +# Check if secret exists +if ! echo "$ORIG" | grep -q '*' && [ ! -e "$KEYDIR/$RELATIVE_PATH/$ORIG" ]; then + echo "Secret not found: $ORIG" + exit 1 +fi + +# Run move command +keyringer_exec git "$BASEDIR" mv $ORIG $FILE diff --git a/lib/keyringer/actions/rmdir b/lib/keyringer/actions/rmdir new file mode 100755 index 0000000..398cf11 --- /dev/null +++ b/lib/keyringer/actions/rmdir @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Remove folders. +# + +# Load functions +LIB="`dirname $0`/../functions" +source "$LIB" || exit 1 + +# Aditional parameters +CWD="`pwd`" + +# Avoid leading slash +shift +ARGS="`echo "$*" | sed -e "s|^/*||"`" + +# Run rmdir command +cd "$KEYDIR/$RELATIVE_PATH" && rmdir $ARGS +cd "$CWD" diff --git a/share/man/keyringer.1.mdwn b/share/man/keyringer.1.mdwn index c3a8a7c..1cd7a45 100644 --- a/share/man/keyringer.1.mdwn +++ b/share/man/keyringer.1.mdwn @@ -62,6 +62,9 @@ ls <*path*> mkdir <*path*> : Create a directory inside the repository *keys* folder. +:rmdir <*path*> +: Remove an empty folder inside the repository *keys* folder. + tree <*path*> : List contents from the toplevel repository *keys* folder or from relative paths if *path* is specified using a tree-like format. Like the ls wrapper, this is a @@ -116,6 +119,9 @@ del <*secret*> rm <*secret*> : Alias for *del* action. +mv <*secret*> <*dest*> +: Rename a secret. + edit <*secret*> : Edit a secret by temporarily decrypting it, opening the decrypted copy into the text editor defined by the *$EDITOR* environment variable and then re-encrypting it. -- cgit v1.2.3 From 04b03dd14a0abe02f436f86e3d647f97b3e5522b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 19 Feb 2014 23:42:29 -0300 Subject: Adding xclip action thanks to password-store (2) --- lib/keyringer/actions/xclip | 6 ++++++ lib/keyringer/completions/bash/keyringer | 2 +- lib/keyringer/completions/zsh/_keyringer | 2 +- share/man/keyringer.1.mdwn | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) (limited to 'share/man/keyringer.1.mdwn') diff --git a/lib/keyringer/actions/xclip b/lib/keyringer/actions/xclip index 414013b..b28984f 100755 --- a/lib/keyringer/actions/xclip +++ b/lib/keyringer/actions/xclip @@ -38,6 +38,12 @@ clip() { LIB="`dirname $0`/../functions" source "$LIB" || exit 1 +# Check for xclip +if ! which xclip; then + echo "fatal: xclip not found" + exit 1 +fi + # Get file keyringer_get_file "$2" diff --git a/lib/keyringer/completions/bash/keyringer b/lib/keyringer/completions/bash/keyringer index eb8fabd..a640583 100644 --- a/lib/keyringer/completions/bash/keyringer +++ b/lib/keyringer/completions/bash/keyringer @@ -94,7 +94,7 @@ _keyringer() { recipients) opts="ls edit" ;; - ls|tree|mkdir|encrypt|encrypt-batch|decrypt|edit|append|append-batch|del|rm|recrypt|open) + ls|tree|mkdir|encrypt|encrypt-batch|decrypt|edit|append|append-batch|del|rm|recrypt|open|clip|xclip) cur="`echo ${cur} | sed -e "s|^/*||"`" # avoid leading slash opts="$(bash -c "set -f && export KEYRINGER_CHECK_VERSION=false && keyringer $instance ls -p -d ${cur}*" 2> /dev/null)" ;; diff --git a/lib/keyringer/completions/zsh/_keyringer b/lib/keyringer/completions/zsh/_keyringer index e889fd8..1a6d8c6 100644 --- a/lib/keyringer/completions/zsh/_keyringer +++ b/lib/keyringer/completions/zsh/_keyringer @@ -50,7 +50,7 @@ _keyringer() { recipients) compadd "$@" ls edit ;; - ls|tree|mkdir|encrypt|encrypt-batch|decrypt|edit|append|append-batch|del|rm|recrypt|open) + ls|tree|mkdir|encrypt|encrypt-batch|decrypt|edit|append|append-batch|del|rm|recrypt|open|clip|xclip) words[4]="`echo $words[4] | sed -e "s|^/*||"`" # avoid leading slash compadd "$@" $(KEYRINGER_CHECK_VERSION=false keyringer $words[2] ls -p -d $words[4]'*' 2> /dev/null) ;; diff --git a/share/man/keyringer.1.mdwn b/share/man/keyringer.1.mdwn index 1cd7a45..ccaabdf 100644 --- a/share/man/keyringer.1.mdwn +++ b/share/man/keyringer.1.mdwn @@ -150,6 +150,9 @@ recrypt <*secret*> into the recipient configuration. If no *secret* is given, all secrets in the repository are re-encrypted. +clip <*secret*>, xclip <*secret*> +: Copy the first line of a secret to the clipboard, following password-store convention. + # CONFIGURATION ACTIONS commands -- cgit v1.2.3 From 013726598e074399344c0bf435e057bc8049959a Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 20 Feb 2014 11:09:18 -0300 Subject: Keyringer 0.3 --- ChangeLog | 4 +--- keyringer | 2 +- share/man/keyringer.1 | 55 ++++++++++++++++++++++++++++++++++++++++++++++ share/man/keyringer.1.mdwn | 5 ++++- 4 files changed, 61 insertions(+), 5 deletions(-) (limited to 'share/man/keyringer.1.mdwn') diff --git a/ChangeLog b/ChangeLog index 16617c9..e7f7cf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2014-02-19 - Silvio Rhatto +2014-02-20 - 0.3 - Silvio Rhatto Try to find a similar file at keyringer_get_file @@ -12,8 +12,6 @@ Support for RELATIVE_FOLDER at git action -2013-12-10 - Silvio Rhatto - New actions: shell (#34), help, mkdir, teardown 2013-11-26 - 0.2.9 Silvio Rhatto diff --git a/keyringer b/keyringer index cc8378f..0930637 100755 --- a/keyringer +++ b/keyringer @@ -122,7 +122,7 @@ function keyringer_dispatch { # Config NAME="keyringer" -KEYRINGER_VERSION="0.2.9" +KEYRINGER_VERSION="0.3" CONFIG_VERSION="0.1" CONFIG_BASE="$HOME/.$NAME" CONFIG="$CONFIG_BASE/config" diff --git a/share/man/keyringer.1 b/share/man/keyringer.1 index c0fed1c..8402b9c 100644 --- a/share/man/keyringer.1 +++ b/share/man/keyringer.1 @@ -31,6 +31,11 @@ and other read/write operations on secrets. Configuration actions, handling repository metadata. .SH REPOSITORY LOOKUP AND MANIPULATION ACTIONS .TP +.B find <\f[I]expression\f[]> +Find secrets in the repository. +.RS +.RE +.TP .B init <\f[I]path\f[]> [\f[I]remote\f[]] Initialize a new keyringer repository. If a \f[I]remote\f[] URL is specified, keyringer will clone an existing @@ -60,6 +65,16 @@ command. .RS .RE .TP +.B mkdir <\f[I]path\f[]> +Create a directory inside the repository \f[I]keys\f[] folder. +.RS +.RE +.TP +.B :rmdir <\f[I]path\f[]> +Remove an empty folder inside the repository \f[I]keys\f[] folder. +.RS +.RE +.TP .B tree <\f[I]path\f[]> List contents from the toplevel repository \f[I]keys\f[] folder or from relative paths if \f[I]path\f[] is specified using a tree-like format. @@ -67,6 +82,25 @@ Like the ls wrapper, this is a wrapper around the \f[I]TREE(1)\f[] command. .RS .RE +.TP +.B shell +Run keyringer on interactive mode from a built-in command-line prompt +where all other actions can be called and are operated from the current +selected keyring. +.RS +.PP +An additional "cd" internal command is available for directory +navigation. +.PP +All <\f[I]secret\f[]> parameters from actions invoked from the shell are +called relatively from the current selected directory. +.RE +.TP +.B teardown +Remove permanently a local copy of a repository, very dangerous if you +have just a single copy. +.RS +.RE .SH SECRET MANIPULATION ACTIONS .PP All secret manipulation actions operate upon a \f[I]secret\f[] which is @@ -115,6 +149,11 @@ Alias for \f[I]del\f[] action. .RS .RE .TP +.B mv <\f[I]secret\f[]> <\f[I]dest\f[]> +Rename a secret. +.RS +.RE +.TP .B edit <\f[I]secret\f[]> Edit a secret by temporarily decrypting it, opening the decrypted copy into the text editor defined by the \f[I]$EDITOR\f[] environment @@ -162,6 +201,17 @@ If no \f[I]secret\f[] is given, all secrets in the repository are re-encrypted. .RS .RE +.TP +.B clip <\f[I]secret\f[]> +Copy the first line of a secret to the clipboard, following +password-store convention. +.RS +.RE +.TP +.B xclip <\f[I]secret\f[]> +Alis to clip action. +.RS +.RE .SH CONFIGURATION ACTIONS .TP .B commands @@ -200,6 +250,11 @@ Show keyringer usage information. .RS .RE .TP +.B help +Alias for usage action. +.RS +.RE +.TP .B recipients <\f[I]ls\f[]|\f[I]edit\f[]> <\f[I]recipients-file\f[]> List, create or edit recipients configuration. .RS diff --git a/share/man/keyringer.1.mdwn b/share/man/keyringer.1.mdwn index ccaabdf..e8df829 100644 --- a/share/man/keyringer.1.mdwn +++ b/share/man/keyringer.1.mdwn @@ -150,9 +150,12 @@ recrypt <*secret*> into the recipient configuration. If no *secret* is given, all secrets in the repository are re-encrypted. -clip <*secret*>, xclip <*secret*> +clip <*secret*> : Copy the first line of a secret to the clipboard, following password-store convention. +xclip <*secret*> +: Alis to clip action. + # CONFIGURATION ACTIONS commands -- cgit v1.2.3