diff --git a/.config/environment.d/ssh.conf b/.config/environment.d/ssh.conf new file mode 100644 index 0000000..bbfcca2 --- /dev/null +++ b/.config/environment.d/ssh.conf @@ -0,0 +1 @@ +SSH_AUTH_SOCK=${XDG_RUNTIME_DIR}/ssh-agent.socket diff --git a/.config/systemd/user/ssh-agent.service b/.config/systemd/user/ssh-agent.service new file mode 100644 index 0000000..9d71206 --- /dev/null +++ b/.config/systemd/user/ssh-agent.service @@ -0,0 +1,14 @@ +[Unit] +Description=SSH key agent + +[Service] +Type=simple +Restart=on-failure +Environment=DISPLAY=:0 +Environment=WAYLAND_DISPLAY=wayland-0 +Environment=SSH_ASKPASS=/usr/bin/ksshaskpass +Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket +ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK + +[Install] +WantedBy=default.target diff --git a/.ssh/config b/.ssh/config index d8b018d..981024c 100644 --- a/.ssh/config +++ b/.ssh/config @@ -1,4 +1,4 @@ -ForwardAgent yes +ForwardAgent no ServerAliveInterval 15 ServerAliveCountMax 3 ControlMaster auto @@ -19,15 +19,10 @@ PKCS11Provider /usr/lib/pkcs11/libtpm2_pkcs11.so Host 10.1.100.16 Host dln-dev Hostname 10.1.100.16 -IdentityAgent ${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh ForwardAgent yes -ForwardX11 no ExitOnForwardFailure yes Compression yes LocalForward 127.0.0.1:3000 127.0.0.1:3000 LocalForward 127.0.0.1:3011 127.0.0.1:3011 LocalForward 127.0.0.1:8000 127.0.0.1:8000 LocalForward 127.0.0.1:8080 127.0.0.1:8080 -# RemoteForward ${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent ${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.extra -RemoteForward ${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh ${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh -# RemoteForward ${XDG_RUNTIME_DIR}/gnupg/S.scdaemon ${XDG_RUNTIME_DIR}/gnupg/S.scdaemon diff --git a/.ssh/rc b/.ssh/rc index 7cdde35..61b9390 100755 --- a/.ssh/rc +++ b/.ssh/rc @@ -1,3 +1,3 @@ if [[ -S "$SSH_AUTH_SOCK" && ! -h "$SSH_AUTH_SOCK" ]]; then - ln -sf "$SSH_AUTH_SOCK" $HOME/.ssh/ssh_auth_sock; + ln -sf "$SSH_AUTH_SOCK" "${XDG_RUNTIME_DIR}/ssh-agent.sock"; fi diff --git a/.tmux.conf b/.tmux.conf index bb50935..637f407 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -17,7 +17,7 @@ set-option -g mouse on set -g set-clipboard on bind-key ] paste-buffer -p -set -g update-environment "BUILDCOMMAND GOPACKAGESDRIVER XAUTHORITY DISPLAY WINDOWID SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION" +set -g update-environment "BUILDCOMMAND GOPACKAGESDRIVER SSH_AUTH_SOCK SSH_CONNECTION" set -g default-command zsh set -g history-limit 10000