Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitwarden-Adapter: "bw" cli not found #1065

Open
bjesuiter opened this issue Oct 6, 2024 · 2 comments
Open

Bitwarden-Adapter: "bw" cli not found #1065

bjesuiter opened this issue Oct 6, 2024 · 2 comments

Comments

@bjesuiter
Copy link

What I want

Being able to fetch secrets via the bitwarden adapter

kamal secrets fetch --adapter bitwarden --account [email protected] --from Kamal/DOCKER_REGISTRY_PASSWORD

My System

  • MacOS Sequoia 15.0.0
  • Mac Book Pro with M3 Max Processor

Try 1: Running the command via the docker alias

alias kamal='docker run -it --rm -v "${PWD}:/workdir" -v "/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock" -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/basecamp/kamal:latest'

kamal secrets fetch --adapter bitwarden --account [email protected] --from Kamal/DOCKER_REGISTRY_PASSWORD
 ERROR (Errno::ENOENT): No such file or directory - bw

=> The bw cli is probably not present in the kamal docker image

Try 2: mount my local bw cli into the kamal docker

by using -v $HOME/bin/bw:/usr/local/bin/bw

alias kamal-bw='docker run -it --rm -v "${PWD}:/workdir" -v "/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock" -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/bin/bw:/usr/local/bin/bw ghcr.io/basecamp/kamal:latest'

kamal secrets fetch --adapter bitwarden --account [email protected] --from Kamal/DOCKER_REGISTRY_PASSWORD
Cannot run macOS (Mach-O) executable in Docker: Exec format error
  ERROR (JSON::ParserError): unexpected token at ''

=> I probably cannot run my macOS style bw executable in my linux style kamal docker

Try 3 - installing kamal as ruby gem

Problem 1: The default ruby version of my system is ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin24] => too old for some dependencies

Problem 2: Installing newer ruby via "internet-recommended" rvm fails, because compilation fails for some reason for Mac 15.0/Arm64

Conclusion

There are more methods of setting up ruby, but I normally don't need a full ruby stack installed and I don't want to get into the weeds of this.

Also: the kamal docker image should work "out-of-the-box" in my opinion, providing the bw cli itself if it needs it.

@bjesuiter bjesuiter changed the title Bitwarden-Adapter: Cannot extract secrets Bitwarden-Adapter: "bw" cli not found Oct 6, 2024
@bjesuiter
Copy link
Author

bjesuiter commented Oct 6, 2024

Update - solved via workaround

Works when I install the gem version with a ruby setup in homebrew:

brew install ruby 

# in your .zshrc 

# Ruby Setup - via brew
export HOMEBREW_PREFIX="$(brew --prefix)";
if [ -d "${HOMEBREW_PREFIX}/opt/ruby/bin" ]; then
  export PATH="${HOMEBREW_PREFIX}/opt/ruby/bin:$PATH"
  export PATH=`gem environment gemdir`/bin:$PATH
fi

But I still think that the alias version with docker should work out of the box

@tuladhar
Copy link
Contributor

tuladhar commented Oct 8, 2024

@bjesuiter I've submitted the Dockerfile enhancement PR below:

Also pushed this update to DockerHub repository. If you'd like to use it, feel free to pull from here:

docker pull ptuladhar/kamal:latest

Forked repository: https://github.com/tuladhar/kamal

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

No branches or pull requests

2 participants