From 02fd51a72b0bc6924343b1c12b15af8198a47195 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Thu, 23 Jan 2025 12:16:22 +0300 Subject: [PATCH] console: enable ssh-agent --- .profile | 9 +++++++++ Console.org | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/.profile b/.profile index dddbbc2..49c2acd 100755 --- a/.profile +++ b/.profile @@ -50,6 +50,15 @@ if [ -d "$HOME/.guix-extra-profiles" ] ; then fi # SSL Certs:1 ends here +# [[file:Console.org::*ssh-agent][ssh-agent:1]] +if ! pgrep -u "$USER" ssh-agent > /dev/null; then + ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env" +fi +if [[ ! -f "$SSH_AUTH_SOCK" ]]; then + source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null +fi +# ssh-agent:1 ends here + # [[file:Console.org::*Guix settings][Guix settings:1]] if [ -z "$IS_ANDROID" ] && [ -z "$NO_GUIX" ] ; then GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles diff --git a/Console.org b/Console.org index b4b6e87..12b8f24 100644 --- a/Console.org +++ b/Console.org @@ -103,6 +103,19 @@ if [ -d "$HOME/.guix-extra-profiles" ] ; then export CURL_CA_BUNDLE="$SSL_CERT_FILE" fi #+end_src +** ssh-agent +I'm paranoid so I encrypt my SSH keys. + +Got the idea for below from [[https://wiki.archlinux.org/title/SSH_keys#SSH_agents][ArchWiki]]: + +#+begin_src bash +if ! pgrep -u "$USER" ssh-agent > /dev/null; then + ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env" +fi +if [[ ! -f "$SSH_AUTH_SOCK" ]]; then + source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null +fi +#+end_src ** Guix settings Enable extra profiles