Expand description
§Bitwarden PAM
Commercial crate implementing Privileged Access Management (PAM) functionality against the Bitwarden server.
PAM lets organizations put privileged Bitwarden collections behind explicit, auditable access requirements. Rather than a member holding standing access to a sensitive credential, access is gated by an access rule and granted for a bounded period (a lease).
§Access rules
An access rule governs privileged access to a set of collections. Each rule bundles together:
- Conditions that must be satisfied before access is granted - for example requiring human approval, or restricting access to an allow-list of CIDR ranges.
- Lease parameters controlling access once granted: a default and maximum lease duration, whether a lease may be extended (and for how long), and whether a cipher may have at most one active lease at a time.
- The collections the rule governs.
The AccessRulesClient, reached via the
PamClient, provides CRUD operations over these rules:
ⓘ
use bitwarden_pam::{AccessCondition, AccessRuleAddEditRequest, PamClientExt};
// `client` is a bitwarden_core::Client that has been authenticated.
let access_rules = client.pam().access_rules();
let created = access_rules
.create(
organization_id,
AccessRuleAddEditRequest {
name: "Production database".to_string(),
description: Some("Requires approval and an internal IP".to_string()),
enabled: true,
conditions: vec![
AccessCondition::HumanApproval,
AccessCondition::IpAllowlist {
cidrs: vec!["10.0.0.0/8".to_string()],
},
],
single_active_lease: true,
default_lease_duration_seconds: Some(3600),
max_lease_duration_seconds: Some(28_800),
allows_extensions: true,
max_extension_duration_seconds: Some(3600),
collections: vec![collection_id],
},
)
.await?;
let all_rules = access_rules.list(organization_id).await?;Requests are validated locally before being sent, so malformed input fails fast with a typed
AccessRuleValidationError instead of a server round trip.
Modules§
- access_
requests 🔒 - PAM access request operations.
- access_
rules 🔒 - PAM access rule CRUD operations.
- approvals 🔒
- PAM approver operations.
- error 🔒
- leases 🔒
- PAM access lease operations.
- pam_
client 🔒 - rotation 🔒
- PAM credential rotation operations.
Structs§
- Access
Approver - The identity of a human approver, denormalized by the server.
- Access
Connector - An access connector: the unattended agent that performs credential rotations for an organization.
- Access
Connector Detail - A connector together with its recent rotation activity.
- Access
Connector Id - NewType wrapper for
AccessConnectorId - Access
Connector Registration Response - The result of registering a connector, including its one-time token.
- Access
Connectors Client - Client for PAM access connector operations.
- Access
Decision Request - An approver’s decision on a pending access request.
- Access
Lease Extension Request - Request to extend an active lease.
- Access
Lease Id - NewType wrapper for
AccessLeaseId - Access
Lease Revoke Request - Request to revoke (end) a lease before it expires.
- Access
Lease View - An access lease, as its requester sees it.
- Access
PreCheck View - The resolved approval outcome for a cipher, read without submitting a request.
- Access
Request Create Request - Request to lease a cipher.
- Access
Request Decision View - A single decision recorded on an access request’s decision log.
- Access
Request Id - NewType wrapper for
AccessRequestId - Access
Request Result View - The result of submitting a cipher-lease request.
- Access
Request Summary View - A just-submitted access request, as its requester sees it; a lighter sibling of
AccessRequestView. - Access
Request View - An access request, as returned by the server.
- Access
Requests Client - Client for a requester’s PAM access requests.
- Access
Rule AddEdit Request - Request to create or edit an access rule.
- Access
Rule Id - NewType wrapper for
AccessRuleId - Access
Rule View - An access rule, as returned by the server.
- Access
Rules Client - Client for PAM access rule CRUD operations.
- Approvals
Client - Client for a PAM approver’s queue. The requester side is
AccessRequestsClient. - Cipher
Access State View - A single-snapshot read of the caller’s access state for one cipher, powering the cipher-view banner and the vault-row badge.
- Leases
Client - Client for reading and managing a requester’s PAM access leases. Leases are minted by
AccessRequestsClient::activate. - PamClient
- Entry point for Privileged Access Management (PAM) operations.
- Password
Policy - Password generation policy for a target system. For
Manualsystems it is guidance for the operator that nothing enforces. Lives only in the sealed blob. - Rotation
Attempt - One connector’s execution of the rotation sequence for a job.
- Rotation
Attempt Id - NewType wrapper for
RotationAttemptId - Rotation
Client - Entry point for PAM credential rotation.
- Rotation
Config Actions - The actions a rotation config offers right now, derived together so no pair contradicts.
- Rotation
Config Create Request - Request to create or update a rotation config.
- Rotation
Config Detail View - A config together with its rotation history.
- Rotation
Config Id - NewType wrapper for
RotationConfigId - Rotation
Config Sealed Fields - Security-relevant fields of a rotation config; the server only stores them sealed.
- Rotation
Config View - A managed credential: the link between a vault cipher and the target system its credential is rotated against, with its sealed fields unsealed.
- Rotation
Configs Client - Client for PAM managed-credential (rotation config) operations.
- Rotation
Job - One dispatch of the rotation workflow for a config. Each claim records an attempt, so a retried or released job carries several.
- Rotation
JobId - NewType wrapper for
RotationJobId - Rotation
Schedule Client - The WASM-facing surface for the schedule helpers.
- Target
System Create Error - Failure from
TargetSystemsClient::create. - Target
System Id - NewType wrapper for
TargetSystemId - Target
System Sealed Fields - Security-relevant fields of a target system; the server only stores them sealed.
- Target
System View - A target system a credential can be rotated against, with its sealed fields unsealed.
- Target
Systems Client - Client for PAM rotation target-system operations.
- Verified
Job - A claim cross-checked by
WorkSnapshot::verify; private fields keep it constructible only there. - Work
Snapshot - The work snapshot returned by a successful claim;
WorkSnapshot::verifychecks it before any field is trusted.
Enums§
- Access
Approval Mode - The approval path an access request takes.
- Access
Badge State - The single badge to show for a gated cipher: an active lease outranks an approved request,
which outranks a pending one. Has no
unavailableorexpiredstate, since the access-state response covers only the caller. - Access
Condition - A single condition that gates access under an access rule.
- Access
Connector Status - Lifecycle state of an access connector. Removing a connector for good is a delete, not a status.
- Access
Decider - Who made a decision on an access request.
- Access
Decision Verdict - An approver’s verdict on an access request decision.
- Access
Lease Error - Errors returned from
super::LeasesClientoperations. - Access
Lease Status - The lifecycle state of an access lease.
- Access
Lease Termination - How an access lease’s grant ended before its window closed.
- Access
Request Error - Errors returned from
super::AccessRequestsClientoperations. - Access
Request Status - The lifecycle state of an access request.
- Access
Request Window Error - Errors from validating an
AccessRequestCreateRequestbefore it is sent to the server. - Access
Rule Error - Errors returned from
super::AccessRulesClientoperations. - Access
Rule Validation Error - Errors from validating an
AccessRuleAddEditRequestbefore it is sent to the server. - Approval
Error - Errors returned from
super::ApprovalsClientoperations. - PamDecode
Error - Errors from decoding a PAM server response into a domain view.
- Quartz
Schedule Preset - A named rotation schedule, for presentation only; the server stores only the cron string.
- Rotation
Attempt Status - Per-attempt outcome within a rotation job.
- Rotation
Error - Errors returned from the PAM rotation clients.
- Rotation
Failure Code - Why a rotation attempt failed, as the connector reports it. On the wire it is a snake_case
token, which the server stores as the start of
RotationAttempt::failure_reason. - Rotation
JobStatus - Overall status of a rotation job.
- Rotation
Source - What triggered a rotation job.
- Rotation
Sync State - Whether a failed rotation attempt left the target system’s credential changed.
- Rotation
Validation Error - Errors from validating a rotation request before it is sent to the server.
- Seal
Rejection - Why
WorkSnapshot::verifyrefused a claim. Carries no claim or blob values, only which check failed. - Session
Termination Outcome - Whether the connector terminated the account’s active sessions after rotating.
- Target
System Create Request - Request to create or update a target system. Method and kind can’t change after creation, but
TargetSystemsClient::updatestill takes the full shape. - Target
System Kind - The technology a target system represents. Only meaningful for
Automaticsystems; a manual rotation has no integration. Lives only in the sealed blob. - Target
System Method - How a target system’s credential is rotated.
- Target
System Status - Lifecycle state of a target system.
- Work
Snapshot Error - Errors from parsing a claim response. They never include payload content.
Constants§
- DEFAULT_
REQUEST_ ACCESS_ DURATION_ SECONDS - Duration, in seconds, to pre-select when the pre-check response names no default; mirrors the server’s global default.
- MAX_
REQUEST_ ACCESS_ WINDOW_ SECONDS - Maximum span, in seconds, of an access request’s activation window - mirrors the server’s
LeaseDurationBounds.GlobalMaxSeconds(one year). Applies to both the automatic path’sduration_secondsand the human path’sstart/endspan.
Traits§
- PamClient
Ext - Extension trait that exposes
PamClienton [Client].
Functions§
- default_
request_ access_ duration_ seconds DEFAULT_REQUEST_ACCESS_DURATION_SECONDS, for callers that cannot read a Rustconst.- is_
likely_ quartz_ cron - Reports whether a string is shaped like a Quartz cron expression. Checks only field count and character set; the server is authoritative.
- is_
valid_ cidr - Returns
truefor a canonical CIDR range such as10.0.0.0/8, with no host bits set. Ambiguous forms (leading-zero or hex octets, IPv4-mapped IPv6) are rejected so client and server agree on which network a rule matches. - max_
request_ access_ window_ seconds MAX_REQUEST_ACCESS_WINDOW_SECONDS, for callers that cannot read a Rustconst.- preset_
for_ cron - Derives the preset that best describes a stored cron expression. Absent or blank is
QuartzSchedulePreset::None, an exact match (ignoring surrounding whitespace) is that preset, and anything else isCustom. - rotation_
config_ actions - Derives the actions a config offers, given the status of its target system. Pass
Nonewhile the target system has not loaded; every dependent predicate then fails closed.