Skip to main content

bitwarden_access_connector/
lib.rs

1//! Bitwarden PAM access connector library, the core of the `bwac` binary.
2
3bitwarden_commercial_marker::commercial_crate!();
4
5// Links bitwarden-crypto's global `ZeroizingAllocator`, which wipes heap memory on free.
6use bitwarden_crypto as _;
7
8pub(crate) mod api;
9pub(crate) mod auth;
10/// CLI arguments.
11pub mod cli;
12/// Configuration loading.
13pub mod config;
14pub(crate) mod crypto;
15/// Startup errors.
16pub mod error;
17/// Run loop configuration and exit reasons.
18pub mod executor;
19/// One process per access connector token on a host.
20pub mod instance_lock;
21pub(crate) mod integrations;
22pub(crate) mod resolver;
23pub(crate) mod sys;
24#[cfg(test)]
25mod test_support;
26
27/// Run the connector poll loop until it exits; the result says why.
28pub async fn run(
29    cfg: executor::AccessConnectorConfig,
30    cancel: bitwarden_threading::cancellation_token::CancellationToken,
31) -> executor::RunExit {
32    executor::run(cfg, cancel).await
33}
34
35/// Serialises tests that mutate environment variables. Hold it for the whole mutation.
36#[cfg(test)]
37pub(crate) static TEST_ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());