Use ssh-agent instead og gpg-agent for SSH

This commit is contained in:
Sam A. 2023-03-14 15:25:23 +01:00
parent 865d5fcd2a
commit 0deeea5b74
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA
3 changed files with 6 additions and 1 deletions

View file

@ -27,6 +27,10 @@ get_ip() {
eval "curl ${ARGS[@]} -fsSL 'https://ifconfig.co/json$IP' $JQ" eval "curl ${ARGS[@]} -fsSL 'https://ifconfig.co/json$IP' $JQ"
} }
gpg_ssh() {
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
}
http() { http() {
(( ${+commands[python]} )) || return 2 (( ${+commands[python]} )) || return 2
[[ $# -gt 0 ]] && local DIR="--directory=$1" && shift [[ $# -gt 0 ]] && local DIR="--directory=$1" && shift

View file

@ -1,6 +1,5 @@
if [[ -z $SSH_CONNECTION ]] && [[ $HOSTNAME != "toolbox" ]]; then if [[ -z $SSH_CONNECTION ]] && [[ $HOSTNAME != "toolbox" ]]; then
export GPG_TTY="$TTY" export GPG_TTY="$TTY"
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
gpgconf --launch gpg-agent gpgconf --launch gpg-agent
gpg-connect-agent updatestartuptty /bye &> /dev/null gpg-connect-agent updatestartuptty /bye &> /dev/null
fi fi

2
zsh/.config/zsh/ssh.zsh Normal file
View file

@ -0,0 +1,2 @@
[[ -z $SSH_CONNECTION ]] && [[ $HOSTNAME != "toolbox" ]] &&
eval "$(ssh-agent)" &> /dev/null