From 3cb67fd39f02049898c8cef72aab7b1d2a9f4de3 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 29 Oct 2018 23:25:39 -0400 Subject: stop using keychain --- Makefile | 1 + bin/hush/gpg | 6 ------ bin/hush/gpg2 | 1 - bin/hush/ssh | 12 +++++------- bin/hush/ssh-add-helper | 14 -------------- bin/hush/ssh-askpass | 5 +++++ bin/hush/ssh-key-unlock | 7 ------- ssh/config | 1 + xprofile | 2 ++ 9 files changed, 14 insertions(+), 35 deletions(-) delete mode 100755 bin/hush/gpg delete mode 120000 bin/hush/gpg2 delete mode 100755 bin/hush/ssh-add-helper create mode 100755 bin/hush/ssh-askpass delete mode 100755 bin/hush/ssh-key-unlock create mode 100644 ssh/config diff --git a/Makefile b/Makefile index 871e0d6..ffb4086 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ INSTALL := \ .replyrc \ .screenrc \ .ssh/cao_key \ + .ssh/config \ .tigrc \ .tmux.conf \ .vimrc \ diff --git a/bin/hush/gpg b/bin/hush/gpg deleted file mode 100755 index d418711..0000000 --- a/bin/hush/gpg +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -GPG=/usr/bin/$(basename $0) - -keychain -q --timeout 30 -$GPG $* diff --git a/bin/hush/gpg2 b/bin/hush/gpg2 deleted file mode 120000 index a7506d6..0000000 --- a/bin/hush/gpg2 +++ /dev/null @@ -1 +0,0 @@ -gpg \ No newline at end of file diff --git a/bin/hush/ssh b/bin/hush/ssh index 453bb11..65c2f53 100755 --- a/bin/hush/ssh +++ b/bin/hush/ssh @@ -1,8 +1,6 @@ -#!/bin/bash +#!/bin/sh +set -eu +set -o pipefail -SSH=/usr/bin/$(basename $0) - -if [[ $1 != '-V' ]]; then - . ssh-key-unlock -fi -exec $SSH $* +ssh-add -l | grep -q "${HOME}/.ssh/id_rsa" || env SSH_ASKPASS="ssh-askpass" ssh-add < /dev/null +exec /usr/bin/"$(basename "$0")" "$@" diff --git a/bin/hush/ssh-add-helper b/bin/hush/ssh-add-helper deleted file mode 100755 index cae6f27..0000000 --- a/bin/hush/ssh-add-helper +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use IO::Pty::Easy; - -my $hostname = `hostname`; -my $pass = `pass search ssh.$hostname`; -my $pty = IO::Pty::Easy->new; -$pty->spawn("ssh-add -t 1800 $ARGV[0]"); -$pty->read; -$pty->write($pass . "\n"); -while (1) { - last if $pty->read =~ 'Identity added'; -} diff --git a/bin/hush/ssh-askpass b/bin/hush/ssh-askpass new file mode 100755 index 0000000..8088c8f --- /dev/null +++ b/bin/hush/ssh-askpass @@ -0,0 +1,5 @@ +#!/bin/sh +set -eu +set -o pipefail + +exec pass "ssh/$(hostname)" diff --git a/bin/hush/ssh-key-unlock b/bin/hush/ssh-key-unlock deleted file mode 100755 index e2654f1..0000000 --- a/bin/hush/ssh-key-unlock +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -keychain -q --timeout 30 -. ~/.keychain/${HOSTNAME}-sh -if ! ssh-add -l | grep -q '.ssh/id_rsa'; then - ssh-add-helper ~/.ssh/id_rsa -fi diff --git a/ssh/config b/ssh/config new file mode 100644 index 0000000..07ff3a5 --- /dev/null +++ b/ssh/config @@ -0,0 +1 @@ +AddKeysToAgent yes diff --git a/xprofile b/xprofile index 2666eed..6d491f5 100644 --- a/xprofile +++ b/xprofile @@ -2,6 +2,8 @@ start-pulseaudio-x11 +eval "$(ssh-agent)" + pidof svscan || (svscan $HOME/.services/enabled 2>&1 | readproctitle $USER ........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................) & setup-inputs -- cgit v1.2.3-54-g00ecf