Skip to main content

Salt Extension for Bitwarden

Read from and write to a Bitwarden vault from Salt: items, folders, attachments, Sends and organization collections, through execution, runner, state and sdb modules. Secrets can stay in the vault and be pulled in at render time, or the vault itself can be managed declaratively.

Example login:
  bitwarden.item_present:
    - name: Example Login
    - item:
        type: 1
        login:
          username: jdoe
          password: {{ salt['sdb.get']('sdb://bitwarden/by-uuid/.../password') }}

Status

The Vault Management API is covered for both reads and writes. The Public (Organization Management) API is not yet implemented.

This extension is changing quickly, and while attempts will be made to not make breaking changes, the current focus is on functionality rather than syntax/API stability.

Requires Python 3.10 or newer and Salt 3006 or newer.

Design notes

Most work goes through bw serve, not the CLI. The Bitwarden CLI is a Node application, and paying its startup cost per operation is slow enough to matter in a state run. bw serve exposes the same vault over a local HTTP API, so this extension talks to that and shells out to bw only for login and logout, which have no API equivalent.

Prefer a unix socket over a TCP port. The Vault Management API has no authentication of its own: once the vault is unlocked, whatever can reach it can read every secret in it. On a TCP port that is every process on the host. Binding bw serve to a unix socket puts access under ordinary filesystem permissions instead. See the configuration guide.

The cache is eventually consistent. bw serve answers from a local cache it populates asynchronously, so a read immediately after a write can return the old value. The states sync before comparing, and reads retry once after a sync when an object is unexpectedly missing.

Transient failures are retried, but never in a way that can duplicate a write. bw serve returns HTTP 400 for every failure, so retries are decided by what went wrong, not by status code. A request that never reached bw serve, or that Bitwarden rate limited, is retried whatever its method. One whose response was lost is retried only if it is a GET, PUT or DELETE, since a POST may already have created the object. See the troubleshooting guide.

Branching

master is the release branch. Work happens on topic branches merged via merge request. Tags matching v* enable a manual PyPI publish job.

Security

If you discover a security vulnerability, please refer to Salt's security guide.

Note that this extension necessarily handles vault credentials. The configuration profile contains your master password, and any node running bw serve holds an unlocked vault in memory. The configuration guide covers how to limit what can reach it.

User Documentation

For setup and usage instructions, please refer to the User Documentation.

Contributing

The saltext-bitwarden project welcomes contributions from anyone!

The Salt Extensions guide provides comprehensive instructions on all aspects of Salt extension development, including writing tests, running tests, writing documentation and rendering the docs.

Quickstart

To get started contributing, first clone this repository (or your fork):

# Clone the repo
git clone --origin upstream git@gitlab.com:ggiesen/saltext-bitwarden.git

# Change to the repo dir
cd saltext-bitwarden

Automatic

If you have installed direnv, copying the included .envrc.example to .envrc and allowing it to run ensures a proper development environment is present and the virtual environment is active.

Without direnv, you can still run the automation explicitly:

make dev  # or python3 tools/initialize.py
source .venv/bin/activate

Manual

Please follow the first steps, skipping the repository initialization and first commit.

Ways to contribute

Contributions come in many forms, and they're all valuable! Here are some ways you can help without writing code:

  • Documentation: Especially examples showing how to use this project to solve specific problems.
  • Triaging issues: Help manage issues.

You can also contribute by:

  • Writing blog posts
  • Sharing your experiences using Salt + Bitwarden on social media
  • Giving talks at conferences
  • Publishing videos
  • Engaging in IRC, Discord or email groups

Any of these things are super valuable to our community, and we sincerely appreciate every contribution!

License

This project is licensed under the Mozilla Public License 2.0. See LICENSE for the licence text.

Releases up to and including 0.1.0 were published under the Apache Software License. That grant is not retracted: anyone who obtained those releases keeps their rights under Apache 2.0. MPL 2.0 applies from the next release onwards.

Some of the packaging and tooling in this repository (noxfile.py, docs/conf.py, the .pre-commit-hooks/ scripts and parts of the test scaffolding) originates from the Apache-2.0 licensed salt-extension-copier template. MPL 2.0 is a file-level licence and explicitly allows combining with other terms, so those files may still carry their original licence.

Metadata

Release files for saltext.bitwarden 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for saltext.bitwarden 0.3.0
File Size Uploaded Provenance Actions
saltext_bitwarden-0.3.0.tar.gz 135.0 kB Without provenance Details for saltext_bitwarden-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for saltext.bitwarden 0.3.0
File Interpreter ABI Platform Actions
saltext_bitwarden-0.3.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for saltext_bitwarden-0.3.0-py2.py3-none-any.whl

Total release size: 186.8 kB

Release files / saltext_bitwarden-0.3.0.tar.gz

Download URL saltext_bitwarden-0.3.0.tar.gz
Size 135.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f653d8abaf99d2e2b616d99cca49824fc832ae3711179128a79a3a5ca8052813
BLAKE2b-256 checksum
How to use checksums
8d41d8012eea9aad4d3f6a18b0d248c4a32467d7c6daf4ef832408d169463b10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / saltext_bitwarden-0.3.0-py2.py3-none-any.whl

Download URL saltext_bitwarden-0.3.0-py2.py3-none-any.whl
Size 51.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
832df4f50bcf9a3a8bf9e97426afc6d692d2e9e89283bf0fe2378c6782ef3f27
BLAKE2b-256 checksum
How to use checksums
fd0af99827508b3b738cdf27ad9fe121efda1217cee22d1fd812f467cc1c1eb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

Security for saltext.bitwarden 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page