mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-05 23:14:39 +01:00
Use rofi for SSH passphrases
This commit is contained in:
parent
e646389fab
commit
bb8b9420d6
3 changed files with 32 additions and 1 deletions
11
bin/ssh-askpass-rofi
Executable file
11
bin/ssh-askpass-rofi
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
arg="$*"
|
||||
|
||||
key="$(echo "${arg}" | perl -ne "/'(.*)'/"' and print "$1\n"')"
|
||||
pub="${key}.pub"
|
||||
fingerprint="$(ssh-keygen -l -v -f "${pub}")"
|
||||
|
||||
mesg="${arg} ${fingerprint} "
|
||||
|
||||
rofi -dmenu -disable-history -no-fixed-num-lines -l 1 -i -input /dev/null -password -p 'Passphrase' -mesg "${mesg}"
|
||||
|
|
@ -4,5 +4,6 @@ DOTFILES_ROOT_DIR="$(dirname "$DOTFILES_HOME_DIR")"
|
|||
DOTFILES_ZSH_DIR="$DOTFILES_ROOT_DIR/zsh"
|
||||
DOTFILES_BASH_DIR="$DOTFILES_ROOT_DIR/bash"
|
||||
DOTFILES_SHELL_DIR="$DOTFILES_ROOT_DIR/shell"
|
||||
DOTFILES_BIN_DIR="$DOTFILES_ROOT_DIR/bin"
|
||||
|
||||
# vim: ft=sh
|
||||
|
|
|
|||
21
shell/ssh
21
shell/ssh
|
|
@ -14,7 +14,7 @@ fi
|
|||
|
||||
# autoload keys if there's an agent
|
||||
if [[ -n "${SSH_AUTH_SOCK}" ]]; then
|
||||
if ! ssh-add -l > /dev/null; then
|
||||
if ! command ssh-add -l > /dev/null; then
|
||||
case "${OSTYPE}" in
|
||||
linux*)
|
||||
# TODO: unsure yet
|
||||
|
|
@ -33,6 +33,25 @@ if [[ -n "${SSH_AUTH_SOCK}" ]]; then
|
|||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case "${OSTYPE}" in
|
||||
linux*)
|
||||
SSH_ASKPASS="${DOTFILES_BIN_DIR}/ssh-askpass-rofi"
|
||||
SSH_ASKPASS_REQUIRE='prefer'
|
||||
export SSH_ASKPASS SSH_ASKPASS_REQUIRE
|
||||
;;
|
||||
*)
|
||||
:
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
function ssh-add() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
command ssh-add ~/.ssh/id_*[!.pub]
|
||||
else
|
||||
command ssh-add "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# vim: ft=bash
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue