summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-11-03 11:03:43 -0200
committerSilvio Rhatto <rhatto@riseup.net>2017-11-03 11:03:43 -0200
commitd49abdf863b9ddc79a1eade3d8d512de469a23d2 (patch)
tree3f2bc6adfee49b7a97269f1da5e5681beb66ee86
parent3c23d9d24eb07c6faab184e3da30b2c7efe7028e (diff)
parent6c62a1906b59e4ab8eb3475ebfe3c3b7cfa67f0b (diff)
downloadkeyringer-d49abdf863b9ddc79a1eade3d8d512de469a23d2.tar.gz
keyringer-d49abdf863b9ddc79a1eade3d8d512de469a23d2.tar.bz2
Merge tag 'upstream_keyringer_0.5.2' into debian
Upstream version 0.5.2
-rw-r--r--ChangeLog8
-rw-r--r--Makefile4
l---------README.md2
-rw-r--r--development.md (renamed from development.mdwn)0
-rw-r--r--index.md (renamed from index.mdwn)0
-rwxr-xr-xkeyringer2
-rwxr-xr-xlib/keyringer/actions/append1
-rwxr-xr-xlib/keyringer/actions/decrypt2
-rwxr-xr-xlib/keyringer/actions/find2
-rwxr-xr-xlib/keyringer/actions/pwgen2
-rwxr-xr-xlib/keyringer/actions/recipients4
-rwxr-xr-xlib/keyringer/actions/recrypt3
-rwxr-xr-xlib/keyringer/actions/sclip6
-rwxr-xr-xlib/keyringer/actions/teardown3
-rwxr-xr-xlib/keyringer/actions/tree7
-rwxr-xr-xlib/keyringer/functions13
-rw-r--r--share/man/keyringer.130
-rw-r--r--share/man/keyringer.1.md (renamed from share/man/keyringer.1.mdwn)0
18 files changed, 62 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 5b55279..69a4751 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2017-11-03 - 0.5.2 - Silvio Rhatto <rhatto@riseup.net>
+
+ Fixed incorrect exit statement on append, thanks jamie (#79)
+
+ Fixed possible race condition on append-batch/decrypt, thanks jamie (#80)
+
+ Various fixes for running keyringer on *BSD systems, thanks rysiek
+
2017-05-31 - 0.5.1 - Silvio Rhatto <rhatto@riseup.net>
Do not abort when keys are expired on actions that are
diff --git a/Makefile b/Makefile
index b503b68..5d46fc6 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ install_bin:
$(INSTALL) -D --mode=0755 keyringer $(DESTDIR)/$(PREFIX)/bin/keyringer
install_doc:
- $(INSTALL) -D --mode=0644 index.mdwn $(DESTDIR)/$(PREFIX)/share/doc/$(PACKAGE)/README.md
+ $(INSTALL) -D --mode=0644 index.md $(DESTDIR)/$(PREFIX)/share/doc/$(PACKAGE)/README.md
$(INSTALL) -D --mode=0644 LICENSE $(DESTDIR)/$(PREFIX)/share/doc/$(PACKAGE)/LICENSE
install_man:
@@ -50,7 +50,7 @@ install: clean
build_man:
# Pipe output to sed to avoid http://lintian.debian.org/tags/hyphen-used-as-minus-sign.html
# Fixed in http://johnmacfarlane.net/pandoc/releases.html#pandoc-1.10-2013-01-19
- pandoc -s -w man share/man/keyringer.1.mdwn -o share/man/keyringer.1
+ pandoc -s -w man share/man/keyringer.1.md -o share/man/keyringer.1
sed -i -e 's/--/\\-\\-/g' share/man/keyringer.1
tarball:
diff --git a/README.md b/README.md
index 9f2fbdb..dd0ea36 120000
--- a/README.md
+++ b/README.md
@@ -1 +1 @@
-index.mdwn \ No newline at end of file
+index.md \ No newline at end of file
diff --git a/development.mdwn b/development.md
index 2349c84..2349c84 100644
--- a/development.mdwn
+++ b/development.md
diff --git a/index.mdwn b/index.md
index 6c1849a..6c1849a 100644
--- a/index.mdwn
+++ b/index.md
diff --git a/keyringer b/keyringer
index 3b4cdc0..6d4b035 100755
--- a/keyringer
+++ b/keyringer
@@ -140,7 +140,7 @@ function keyringer_dispatch {
# Config
NAME="keyringer"
-KEYRINGER_VERSION="0.5.1"
+KEYRINGER_VERSION="0.5.2"
CONFIG_VERSION="0.1"
CONFIG_BASE="$HOME/.$NAME"
CONFIG="$CONFIG_BASE/config"
diff --git a/lib/keyringer/actions/append b/lib/keyringer/actions/append
index 905867a..ccb25fb 100755
--- a/lib/keyringer/actions/append
+++ b/lib/keyringer/actions/append
@@ -6,7 +6,6 @@
# Load functions
LIB="`dirname $0`/../functions"
source "$LIB" readwrite $* || exit 1
-exit
# Get file
keyringer_get_file "$2"
diff --git a/lib/keyringer/actions/decrypt b/lib/keyringer/actions/decrypt
index e17f0e0..7442b29 100755
--- a/lib/keyringer/actions/decrypt
+++ b/lib/keyringer/actions/decrypt
@@ -11,7 +11,7 @@ source "$LIB" read $* || exit 1
keyringer_get_file "$2"
# Decrypt
-$GPG --use-agent -d "$KEYDIR/$FILE"
+cat "$KEYDIR/$FILE" | $GPG --use-agent -d -
# Exit
exit "$?"
diff --git a/lib/keyringer/actions/find b/lib/keyringer/actions/find
index 043e80d..45b4f11 100755
--- a/lib/keyringer/actions/find
+++ b/lib/keyringer/actions/find
@@ -15,5 +15,5 @@ shift
ARGS="`echo "$*" | sed -e "s|^/*||"`"
# Run find command
-cd "$KEYDIR/$RELATIVE_PATH" && find | grep -i "$ARGS" | sed -e 's|^./||g'
+cd "$KEYDIR/$RELATIVE_PATH" && find ./ | grep -i "$ARGS" | sed -e 's|^./||g'
cd "$CWD"
diff --git a/lib/keyringer/actions/pwgen b/lib/keyringer/actions/pwgen
index 1ca3829..3c03681 100755
--- a/lib/keyringer/actions/pwgen
+++ b/lib/keyringer/actions/pwgen
@@ -32,4 +32,4 @@ elif [ ! -z "$SIZE" ] && ! echo $SIZE | egrep -q '^[0-9]+$'; then
fi
# Encrypt and store a randomly-generated secret
-keyringer_pwgen $SIZE | keyringer_exec encrypt "$BASEDIR" "$FILE"
+keyringer_pwgen $SIZE | keyringer_exec encrypt-batch "$BASEDIR" "$FILE" && echo "Secret generated and stored."
diff --git a/lib/keyringer/actions/recipients b/lib/keyringer/actions/recipients
index 3c18516..889f73e 100755
--- a/lib/keyringer/actions/recipients
+++ b/lib/keyringer/actions/recipients
@@ -38,7 +38,9 @@ elif [ "$COMMAND" == "edit" ]; then
keyringer_exec git "$BASEDIR" add "$RECIPIENTS_FILE_BASE"
else
echo "Please specify one recipient to edit among the available:"
- ls $RECIPIENTS | sed -e 's/^/\t/'
+ # \t is a GNU extension
+ # https://stackoverflow.com/questions/8400602/sed-replace-literal-tab
+ ls $RECIPIENTS | sed -e "`printf 's/^/\t/'`"
exit 1
fi
else
diff --git a/lib/keyringer/actions/recrypt b/lib/keyringer/actions/recrypt
index d88a749..0e2f6a0 100755
--- a/lib/keyringer/actions/recrypt
+++ b/lib/keyringer/actions/recrypt
@@ -9,6 +9,7 @@ source "$LIB" readwrite $* || exit 1
# Recrypt a single secret
function keyringer_recrypt {
+
# Get file
keyringer_get_file "$1"
@@ -39,7 +40,7 @@ function keyringer_recrypt {
if [ ! -z "$2" ]; then
keyringer_recrypt $2
else
- cd $KEYDIR && find | while read file; do
+ cd $KEYDIR && find ./ | while read file; do
if [ ! -d "$KEYDIR/$file" ]; then
keyringer_recrypt "$file"
fi
diff --git a/lib/keyringer/actions/sclip b/lib/keyringer/actions/sclip
index 156762a..de9c3b5 100755
--- a/lib/keyringer/actions/sclip
+++ b/lib/keyringer/actions/sclip
@@ -13,12 +13,14 @@ keyringer $KEYRING xclip $*
# Se window switch combo
if [ -z "$XDOTOOL_NEXT_WINDOW" ]; then
- XDOTOOL_NEXT_WINDOW="alt+Tab"
+ XDOTOOL_NEXT_WINDOW="Alt_L+Tab"
fi
# Move to the next window
if which xdotool &> /dev/null; then
- xdotool key $XDOTOOL_NEXT_WINDOW
+ # Use a smaller delay otherwise the window
+ # manager might ignore the key combo
+ xdotool key --delay 2 $XDOTOOL_NEXT_WINDOW
fi
# Sleep
diff --git a/lib/keyringer/actions/teardown b/lib/keyringer/actions/teardown
index 2e8725b..55de3d6 100755
--- a/lib/keyringer/actions/teardown
+++ b/lib/keyringer/actions/teardown
@@ -16,8 +16,9 @@ if [ -z "$CONFIRM" ] || [ "$CONFIRM" != "-y" ]; then
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
+ read -rep "Are you sure to WIPE keyring $KEYRING (type uppercase YES to confirm)? " key
if [ "$key" != "YES" ]; then
+ echo "CANCELLED!"
exit 1
fi
fi
diff --git a/lib/keyringer/actions/tree b/lib/keyringer/actions/tree
index 7bf173d..a877548 100755
--- a/lib/keyringer/actions/tree
+++ b/lib/keyringer/actions/tree
@@ -5,7 +5,7 @@
# Thanks http://www.centerkey.com/tree/
function keyringer_tree {
- ls -R $* | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
+ find $* | sed -e 's/[^-][^\/]*\//| /g' | sed -r -e 's/\| ([^|])/|- \1/'
}
# Load functions
@@ -19,6 +19,11 @@ CWD="`pwd`"
shift
ARGS="`echo "$*" | sed -e "s|^/*||"`"
+# on *BSD, find expects at least one argument with the path
+if [ "$ARGS" == "" ]; then
+ ARGS="./"
+fi
+
# Check implementation
if which tree &> /dev/null; then
TREE="tree"
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index 0d96288..6f9a5e3 100755
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -293,7 +293,7 @@ function keyringer_set_env {
fi
# Avoid viminfo, see https://keyringer.pw/trac/ticket/50
- if $EDITOR --help | grep -q -e "^VIM"; then
+ if $EDITOR --help 2>&1 | grep -q -e "^VIM"; then
if ! echo $EDITOR | grep -q -- "-i NONE"; then
EDITOR="$EDITOR -S $SHARE/editors/vim"
fi
@@ -537,7 +537,12 @@ function keyringer_show_actions {
# Usage
function keyringer_usage {
- local keyrings="$(ls --color=never `dirname $CONFIG` | sed -e 's/config//' | xargs)"
+ # are we're using an `ls` that supports `--color`?
+ if ls --version > /dev/null 2>&1; then
+ local keyrings="$(ls --color=never `dirname $CONFIG` | sed -e 's/config//' | xargs)"
+ else
+ local keyrings="$(ls `dirname $CONFIG` | sed -e 's/config//' | xargs)"
+ fi
printf "Keyringer $KEYRINGER_VERSION\n"
printf "Usage: keyringer <keyring> <action> [arguments]\n\n"
@@ -552,7 +557,9 @@ function keyringer_usage {
if [ ! -z "$keyrings" ] && [ -z "$1" ]; then
printf "\tinit <path> [remote]\n" $BASENAME
fi
- keyringer_show_actions | sed -e 's/^/\t/'
+ # \t is a GNU extension
+ # https://stackoverflow.com/questions/8400602/sed-replace-literal-tab
+ keyringer_show_actions | sed -e "`printf 's/^/\t/'`"
printf "\n"
}
diff --git a/share/man/keyringer.1 b/share/man/keyringer.1
index 7b1b030..16cceb7 100644
--- a/share/man/keyringer.1
+++ b/share/man/keyringer.1
@@ -1,4 +1,7 @@
+.\" Automatically generated by Pandoc 1.17.2
+.\"
.TH "KEYRINGER" "1" "Oct 25, 2013" "Keyringer User Manual" ""
+.hy
.SH NAME
.PP
keyringer \- encrypted and distributed secret sharing software
@@ -186,7 +189,7 @@ variable and then re\-encrypting it.
.RS
.PP
Please make sure to use an
-\f[I]\f[I]E\f[]\f[I]D\f[]\f[I]I\f[]\f[I]T\f[]\f[I]O\f[]\f[I]R\f[] * \f[I]w\f[]\f[I]h\f[]\f[I]i\f[]\f[I]c\f[]\f[I]h\f[]\f[I]d\f[]\f[I]o\f[]\f[I]e\f[]\f[I]s\f[]\f[I]n\f[]\f[I]o\f[]\f[I]t\f[]\f[I]l\f[]\f[I]e\f[]\f[I]a\f[]\f[I]k\f[]\f[I]d\f[]\f[I]a\f[]\f[I]t\f[]\f[I]a\f[]\f[I]l\f[]\f[I]i\f[]\f[I]k\f[]\f[I]e\f[]\f[I]h\f[]\f[I]i\f[]\f[I]s\f[]\f[I]t\f[]\f[I]o\f[]\f[I]r\f[]\f[I]y\f[]\f[I]b\f[]\f[I]u\f[]\f[I]f\f[]\f[I]f\f[]\f[I]e\f[]\f[I]r\f[]\f[I]s\f[].\f[I]K\f[]\f[I]e\f[]\f[I]y\f[]\f[I]r\f[]\f[I]i\f[]\f[I]n\f[]\f[I]g\f[]\f[I]e\f[]\f[I]r\f[]\f[I]t\f[]\f[I]r\f[]\f[I]i\f[]\f[I]e\f[]\f[I]s\f[]\f[I]t\f[]\f[I]o\f[]\f[I]d\f[]\f[I]e\f[]\f[I]t\f[]\f[I]e\f[]\f[I]c\f[]\f[I]t\f[]\f[I]i\f[]\f[I]f\f[] * EDITOR\f[]
+\f[I]\f[I]E\f[]\f[I]D\f[]\f[I]I\f[]\f[I]T\f[]\f[I]O\f[]\f[I]R\f[] * \f[I]w\f[]\f[I]h\f[]\f[I]i\f[]\f[I]c\f[]\f[I]h\f[]\f[I]d\f[]\f[I]o\f[]\f[I]e\f[]\f[I]s\f[]\f[I]n\f[]\f[I]o\f[]\f[I]t\f[]\f[I]l\f[]\f[I]e\f[]\f[I]a\f[]\f[I]k\f[]\f[I]d\f[]\f[I]a\f[]\f[I]t\f[]\f[I]a\f[]\f[I]l\f[]\f[I]i\f[]\f[I]k\f[]\f[I]e\f[]\f[I]h\f[]\f[I]i\f[]\f[I]s\f[]\f[I]t\f[]\f[I]o\f[]\f[I]r\f[]\f[I]y\f[]\f[I]b\f[]\f[I]u\f[]\f[I]f\f[]\f[I]f\f[]\f[I]e\f[]\f[I]r\f[]\f[I]s\f[].\f[I]K\f[]\f[I]e\f[]\f[I]y\f[]\f[I]r\f[]\f[I]i\f[]\f[I]n\f[]\f[I]g\f[]\f[I]e\f[]\f[I]r\f[]\f[I]t\f[]\f[I]r\f[]\f[I]i\f[]\f[I]e\f[]\f[I]s\f[]\f[I]t\f[]\f[I]o\f[]\f[I]d\f[]\f[I]e\f[]\f[I]t\f[]\f[I]e\f[]\f[I]c\f[]\f[I]t\f[]\f[I]i\f[]\f[I]f\f[]*EDITOR\f[]
is set to VIM and disables the \f[I]\&.viminfo\f[] file.
.RE
.TP
@@ -359,15 +362,22 @@ to the \f[C]$KEYRING_FOLDER/config/recipients/\f[] folder.
.RE
.RE
.SH FILES
-.PP
-$HOME/.keyringer/config : User\[aq]s main configuration file used to map
-alias names to keyrings.
-.PP
-$HOME/.keyringer/\f[I]keyring\f[] : User preferences for the keyringer
-aliased \f[I]keyring\f[] keyring.
-.PP
-$KEYRING_FOLDER/config/options : Custom keyring options which will be
-applied for all users that use the keyringer repository.
+.TP
+.B $HOME/.keyringer/config
+User\[aq]s main configuration file used to map alias names to keyrings.
+.RS
+.RE
+.TP
+.B $HOME/.keyringer/\f[I]keyring\f[]
+User preferences for the keyringer aliased \f[I]keyring\f[] keyring.
+.RS
+.RE
+.TP
+.B $KEYRING_FOLDER/config/options
+Custom keyring options which will be applied for all users that use the
+keyringer repository.
+.RS
+.RE
.SH LIMITATIONS
.PP
Keyringer currently has the following limitations:
diff --git a/share/man/keyringer.1.mdwn b/share/man/keyringer.1.md
index 8acd747..8acd747 100644
--- a/share/man/keyringer.1.mdwn
+++ b/share/man/keyringer.1.md