Skip to content

when installing Bitwarden, ask user if it should be used as SSH agent - #5024

Closed
sgruendel wants to merge 23 commits into
omacom:devfrom
sgruendel:bitwarden_ssh_agent
Closed

sgruendel wants to merge 23 commits into
omacom:devfrom
sgruendel:bitwarden_ssh_agent

Conversation

@sgruendel

Copy link
Copy Markdown
Contributor

Bitwarden can also be used as SSH agent

Copilot AI review requested due to automatic review settings March 27, 2026 19:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI review requested due to automatic review settings April 7, 2026 13:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI review requested due to automatic review settings April 15, 2026 19:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@timlau

timlau commented Apr 17, 2026

Copy link
Copy Markdown
echo "env = SSH_AUTH_SOCK,/home/$USER/.bitwarden-ssh-agent.sock" | tee -a "$HOME/.config/uwsm/env" >/dev/null

Do not work for me (running fish shell)

echo "export SSH_AUTH_SOCK=/home/$USER/.bitwarden-ssh-agent.sock" | tee -a "$HOME/.config/uwsm/env" >/dev/null

Does work in both bash and fish

@timlau

timlau commented Apr 17, 2026

Copy link
Copy Markdown

Here is a more safe version there can be run multiple times and only do needed actions

#!/bin/bash

env_file=$HOME/.config/uwsm/env
packages=("bitwarden" "bitwarden-cli")
use_bitwarden_as_ssh_agent=false

echo ${packages[@]}
if omarchy-pkg-missing "${packages[@]}"; then
  echo "Installing Bitwarden..."
  omarchy-pkg-add "${packages[@]}"
else
  echo "Bitwarden already installed"
fi

if ! grep -Fq "SSH_AUTH_SOCK" $env_file; then
  # ask user if they want to use Bitwarden as their SSH agent and configure SSH_AUTH_SOCK accordingly
  if gum confirm "Use Bitwarden as SSH agent?"; then
    use_bitwarden_as_ssh_agent=true
    echo "export SSH_AUTH_SOCK=/home/$USER/.bitwarden-ssh-agent.sock" | tee -a $env_file &>/dev/null
    echo "Make sure to enable SSH agent support in Bitwarden settings."
  fi
fi

setsid gtk-launch bitwarden &>/dev/null

if [[ $use_bitwarden_as_ssh_agent == "true" ]]; then
  touch ~/.local/state/omarchy/reboot-required
  omarchy-update-restart
fi

Copilot AI review requested due to automatic review settings April 17, 2026 19:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sgruendel

Copy link
Copy Markdown
Contributor Author
echo "env = SSH_AUTH_SOCK,/home/$USER/.bitwarden-ssh-agent.sock" | tee -a "$HOME/.config/uwsm/env" >/dev/null

Do not work for me (running fish shell)

Good catch, I think it was a leftover from the previous approach of updating the env file. Fixed now to use proper export syntax.

@timlau

timlau commented Apr 18, 2026

Copy link
Copy Markdown

it is a good idea to redirect the output from launching bitwarden into null, it outputs a lot of debug info to the terminal.

The check for SSH_AUTH_SOCK exist in my scrtipt is also a good idea, so you dont add it multiple times, if a user run it multiple times. I ended up with adding it many times in my testing.

setsid gtk-launch bitwarden &>/dev/null

Copilot AI review requested due to automatic review settings April 18, 2026 06:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sgruendel

Copy link
Copy Markdown
Contributor Author

it is a good idea to redirect the output from launching bitwarden into null, it outputs a lot of debug info to the terminal.

changed it accordingly

The check for SSH_AUTH_SOCK exist in my scrtipt is also a good idea, so you dont add it multiple times, if a user run it multiple times. I ended up with adding it many times in my testing.

Good idea, also user might already have set this to use e.g. ssh-agent, no need to ask then.

Copilot AI review requested due to automatic review settings April 30, 2026 19:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 "Installing Bitwarden..."
omarchy-pkg-add bitwarden bitwarden-cli

env_file=$HOME/.config/uwsm/env

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we need to set it this high up in the stack. I think using a regular bashrc env should be fine, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm had probably copied it over from my ssh-agent implementation where it was needed because that agent is started via systemd. Want me to change it to .bashrc?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out this is not working in .bashrc e.g. for VSCode (started via Walker), so probably same for all apps not started via interactive shell. Better keeping it in .config/uwsm/env then.

Copilot AI review requested due to automatic review settings May 3, 2026 15:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI review requested due to automatic review settings May 4, 2026 14:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI review requested due to automatic review settings May 8, 2026 18:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Copilot AI review requested due to automatic review settings May 12, 2026 17:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Copilot AI review requested due to automatic review settings May 31, 2026 08:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@sgruendel

Copy link
Copy Markdown
Contributor Author

superseded by #6719 for Quattro

@sgruendel sgruendel closed this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants