Repository navigation
Conversation
|
I use 1password as my ssh agent, so this wouldn't be a good fit for a default setup, but I'm open to the idea that we could have a way to add this on as an optional service installation. |
Where would you see it then? "Install > Service", like Bitwarden? |
|
That's what I'm thinking for now? |
| # Start ssh-agent automatically for user | ||
| systemctl enable --user ssh-agent.service | ||
|
|
||
| echo 'SSH Agent has been installed and enabled. Please reboot to apply changes.' No newline at end of file |
There was a problem hiding this comment.
Maybe create $HOME/.local/state/omarchy/reboot-required and call omarchy-update-restart @dhh ?
|
I cannot use 1password for various reasons on all my machine, so I hook a bash script into my .bashrc with the following. #!/bin/bash
sshkeys() {
local agentName agentCheck=1 cmpTo
local AGENT_ENV_FILE="${HOME}/.ssh/agent_env"
case "$OSTYPE" in
msys*) agentName="/usr/bin/ssh-agent"; cmpTo=0 ;;
linux*) agentName="ssh-agent"; cmpTo=1 ;;
*) echo "Unsupported OS: $OSTYPE"; return 1 ;;
esac
# Load existing agent vars if the file exists
if [[ -f "$AGENT_ENV_FILE" ]]; then
source "$AGENT_ENV_FILE" > /dev/null
# Check if agent is alive and socket exists
if ! kill -0 "$SSH_AGENT_PID" 2>/dev/null || [[ ! -S "$SSH_AUTH_SOCK" ]]; then
rm -f "$AGENT_ENV_FILE"
unset SSH_AGENT_PID SSH_AUTH_SOCK
fi
fi
# Start a new agent if necessary
if [[ -z "$SSH_AGENT_PID" || -z "$SSH_AUTH_SOCK" ]]; then
eval "$(ssh-agent -s)" > /dev/null
echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" > "$AGENT_ENV_FILE"
echo "export SSH_AGENT_PID=$SSH_AGENT_PID" >> "$AGENT_ENV_FILE"
# Add keys only when a new agent is started
if [[ -d $SSHHOME ]]; then
for key in "$SSHHOME"/*.pub; do
if [[ ! -f "$key" ]]; then
echo "ERROR: $SSHHOME does not have any public keys."
continue
else
echo "ssh-add: ${key%.*}"
ssh-add "${key%.*}" 2>/dev/null
fi
done
else
echo "ERROR: SSHHOME is not defined or not a directory."
fi
fi
}
sshkeys "$@"
|
|
Does this also fix #730 ? |
| @@ -0,0 +1,15 @@ | |||
| #!/bin/bash | |||
|
|
|||
| # add ssh keys to ssh-agent | |||
There was a problem hiding this comment.
This doesn't actually add SSH keys to the agent. It just creates the client configuration for it.
There was a problem hiding this comment.
clarified the comment, thanks for pointing this out
|
That would be a nice addition as a service to install - are there blockers for the change? If not just bumping it. |
Yeah I've switched to Bitwarden as SSH agent some weeks ago, just created #5024 to make this available. |
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo 'AddKeysToAgent yes' | tee -a ~/.ssh/config >/dev/null | ||
|
|
||
| # Ensure Hyprland picks up the SSH_AUTH_SOCK variable | ||
| echo 'env = SSH_AUTH_SOCK,$XDG_RUNTIME_DIR/ssh-agent.socket' | tee -a ~/.config/uwsm/env >/dev/null |
There was a problem hiding this comment.
This is not the correct syntax for uwsm/env, needs to be normal export.
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi! Please update the PR description and double check the source branch which will allow us to review it. |
|
Thank you for this, @sgruendel. Caching SSH key passphrases is a real need, and this PR is where the idea of offering an agent as an optional service started. It is being closed in favour of #9399, which does the same job on This branch targets Read by Claude Opus 5.5 and by Codex Medium, which was asked separately and agreed, though its independence is not guaranteed; nothing was run. Closed at the maintainer's request. If #9399 doesn't cover your case, say so there or reopen this. |
ssh-agent support so git or VSCode passphrases are stored as described in https://www.lorenzobettini.it/2023/09/hyprland-and-ssh-agent/