summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/common/askpass5
-rwxr-xr-xbin/menuscripts/keyadd7
-rw-r--r--config/essentials/shell/functions.sh23
-rw-r--r--config/home/.zshenv3
4 files changed, 23 insertions, 15 deletions
diff --git a/bin/common/askpass b/bin/common/askpass
index ebd833c..c7d2249 100755
--- a/bin/common/askpass
+++ b/bin/common/askpass
@@ -12,5 +12,6 @@ key="$(printf '%s\n' "$1" |
pass="keys/$(hostname)/ssh/$key"
# optional: add key to running ssh-agent
-keyadd "$key" &&
- pass show "$pass" | head -n 1
+keyadd "$key" &
+
+pass show "$pass" | head -n 1
diff --git a/bin/menuscripts/keyadd b/bin/menuscripts/keyadd
index 5a38bfb..fb7e66e 100755
--- a/bin/menuscripts/keyadd
+++ b/bin/menuscripts/keyadd
@@ -2,8 +2,11 @@
log()
{
- herbe "keyadd" "$1" &
- >&2 printf '%s\n' "$1"
+ if [ "${Logging:-1}" -eq 1 ]
+ then
+ herbe "keyadd" "$1" &
+ >&2 printf '%s\n' "$1"
+ fi
}
SSHFOLDER="$HOME/.ssh"
diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh
index f0ee134..2962d2c 100644
--- a/config/essentials/shell/functions.sh
+++ b/config/essentials/shell/functions.sh
@@ -375,20 +375,21 @@ then
# Wrapper to automatically add the key
# could have been alias='SSH_ASKPASS=askpass SSH_ASKPASS_REQUIRE=prefer ssh'
# but this option is very slow for some reason
- ssh() {
- for arg in $@; do
- if grep "Host $arg\s*\$" ~/.ssh/config > /dev/null 2>&1 ;
- then
- # Disable notification by unsetting the DISPLAY varibles
- keyadd "$arg" 2> /dev/null
- break
- fi
- done
- /usr/bin/ssh $@
+ ssh()
+ {
+ for arg in $@; do
+ if grep "Host $arg\s*\$" ~/.ssh/config > /dev/null 2>&1 ;
+ then
+ Logging=0 keyadd "$arg"
+ break
+ fi
+ done
+ /usr/bin/ssh $@
}
fi
-ssl_req() {
+ssl_req()
+{
[ "$1" ] || return 1
[ "$2" ] || return 2
openssl req -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out "$1" -keyout "$2"
diff --git a/config/home/.zshenv b/config/home/.zshenv
index ffe8cde..31f9cc5 100644
--- a/config/home/.zshenv
+++ b/config/home/.zshenv
@@ -113,3 +113,6 @@ export VAKKEN="$HOME/docs/school/2024-2025"
if [ "$(hostname)" = "spring" ]; then
export GIT_TRACK_REPOS="$HOME/git-track.txt"
fi
+
+export SSH_ASKPASS=askpass
+export SSH_ASKPASS_REQUIRE=prefer