Skip to main content

Keyring backend reading password data from Bitwarden

Project description

Bitwarden Keyring

Build Status License: MIT PyPI version codecov

Implementation of the Keyring backend code reading secrets from Bitwarden using Bitwarden-cli

Overview

The Keyring python package provides a handy single point of entry for any secret holding system, allowing for seemless integration of those systems into applications needing secrets, like twine.

This projects implement Keyring to be able to read secrets from Bitwarden, an open source multiplatform cloud/self-hostable password manager.

This backend assumes that it will be used in the context of a CLI application, and that it can communicate with the user using sdtin, stdout and stderr. We could implement an additional backend for use in a library assuming that everything is already unlocked, or another one using pinentry to ask the user.

Requirements

This project uses the official bitwarden CLI under the hood, because there's no simple official Python bitwarden lib. Here are the installation instructions as of October 2018 and the link to the up to date instructions

You can install the Bitwarden CLI multiple different ways:

NPM

If you already have the Node.js runtime installed on your system, you can install the CLI using NPM. NPM makes it easy to keep your installation updated and should be the preferred installation method if you are already using Node.js.

npm install -g @bitwarden/cli

Native Executable

Natively packaged versions of the CLI are provided for each platform which have no requirements on installing the Node.js runtime. You can obtain these from the downloads section in the Bitwarden documentation.

Other Package Managers

Installation and configuration

pip install bitwarden-keyring

The Python packaging ecosystem can be quite a mess.

Because of this, it's likely that your setup and my setup are nothing alike. Keyring supports a configuration file with an option allowing to explicitely define the path to a backend. You may need that for your installation, or maybe not.

Usage

Use as a normal keyring backend. It is installed with priority 10 so it's likely going to be selected first.

If you want to use it with twine, good news, you're already set. Just make sure that this package is installed in the same location as twine.

bitwarden-keyring will automatically ask for credentials when needed. If you don't want to unlock your vault every time, export the vault session to your environment (use bw unlock and follow the instructions, or launch export BW_SESSION=$(bw unlock --raw)).

Caveats

bitwarden-keyring was only tested with:

  • macOS, using the bitwarden-cli from brew
  • ubuntu, using the bw from snap

As mentionned, bitwarden-keyring only works in the context of a CLI application with access to standard inputs and output. If you need something that either reads silently or using another method of communication, the best is probably to make another backend and most of the functions can be reused.

Licensing

bitwarden-keyring is published under the terms of the MIT License. The name Bitwarden is most probably the property of 8bit Solutions LLC.

Contributions and Code of Conduct

Contributions are welcome, please refer to the Contributing guide. Please keep in mind that all interactions with the project are required to follow the Code of Conduct.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitwarden-keyring-0.3.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

bitwarden_keyring-0.3.1-py2.py3-none-any.whl (6.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file bitwarden-keyring-0.3.1.tar.gz.

File metadata

  • Download URL: bitwarden-keyring-0.3.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for bitwarden-keyring-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c46e15c2fcb3cfbf99636be9911166bfe5a813c8029e1bf2730e65870640617f
MD5 98d3b2f67de714989e93a3b8fc1bf7f5
BLAKE2b-256 4da3c44874b6b28f2c0d002922bed5b871cbb446671f1ae0584d6896bb301179

See more details on using hashes here.

File details

Details for the file bitwarden_keyring-0.3.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for bitwarden_keyring-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9b46661b8551b215de64da0e5764fd5734c0a7fae34b190fe602af2f97160f7a
MD5 9b1879b3db11916fd362fa279621e446
BLAKE2b-256 0563e01e94bd3b7415692d5e53c2a7f5109f8aafd75015b199061affd73f05f9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page