bsh configuration reference
bsh accepts command-line flags, environment variables, and a YAML configuration file. Permission variables become environment variables in the process that runs the script.
Commands
| Command | Purpose |
|---|---|
bsh checkout <protocol> --method <method> | Grant access and return the credential or connection payload. |
bsh checkin <protocol> --method <method> | Revoke access according to the method. In Bridge mode, end the Bridge checkout first. |
bsh probe | List supported protocols, methods, and transports. |
bsh probe <protocol> --method <method> | Validate core settings and report the selected configuration without connecting to the target. |
bsh doctor --protocol <protocol> --method <method> | Inspect the configured transport and attempt supported connectivity checks. |
bsh render --template <file> --data <file> | Render a Jinja template using JSON data. --data - reads JSON from stdin. |
bsh version | Report the installed version. |
bsh help | Show command usage. |
For checkout, checkin, and probe, a positional protocol precedes the flags. doctor accepts the protocol through --protocol, not as a positional argument. The method reference lists valid protocol and method combinations.
Configuration precedence
Values resolve in this order, from highest to lowest priority:
- Command-line flags.
- Nonempty
BSH_*environment variables. - Recognized Bridge host variables, for the settings listed under Bridge settings.
- The YAML file, with
paramstaking precedence over the corresponding structured field. - Defaults.
An empty environment variable is treated as absent. Bare names such as TARGET_HOST are not read automatically. An external reference can read a differently named variable or a value in a cloud store.
Flags use hyphens, environment variables use the BSH_ prefix and uppercase underscores, and YAML params keys use lowercase underscores:
| Flag | Environment variable | YAML params key |
|---|---|---|
--target-host | BSH_TARGET_HOST | target_host |
--transport-user | BSH_TRANSPORT_USER | transport_user |
--home-root | BSH_HOME_ROOT | home_root |
Method-specific parameters also accept flag form. Boolean parameters accept true or false. Explicit boolean values work with =, for example --transport-sudo=false.
Literal credentials are rejected in flags. Credential flags accept references such as --transport-password 'env://DATABASE_PASSWORD'. Environment variables, files, and external references can supply the credential itself.
Value types
| Type | Accepted values |
|---|---|
| Boolean | Case-insensitive true, false, 1, 0, yes, no, on, off, t, f, y, or n. |
| Integer | A decimal integer, such as 22. |
| Duration | A Go duration such as 25s, 30m, or 1h. Environment variables and params also accept a number of seconds, such as 3600. Literal --timeout, YAML timeout, and YAML bridge.session_duration require duration units. |
| List | A string with comma-separated or whitespace-separated items. Directory group DNs use semicolon-separated values because a DN contains commas. |
YAML file
The default path is /etc/britive/bsh.yml. --config overrides BSH_CONFIG, which overrides the default path. The following file uses a local CA bundle and external references for database connection values:
protocol: postgres
method: temp-user
timeout: 25s
transport:
host: env://DATABASE_HOST
user: aws-sm://prod/database?key=username®ion=us-east-1
tls_mode: verify-full
ca_cert_path: /etc/britive/database-ca.pem
params:
target_database: reporting
roles: report_reader
transport_password: aws-sm://prod/database?key=password®ion=us-east-1The permission supplies the requesting user’s identity separately. The database role must already exist. The setup guide describes identity mappings and matching checkout and checkin scripts.
Structured YAML fields are:
| Section | Fields |
|---|---|
| Top level | protocol, method, mode, format, timeout |
log | level, format |
identity | username, prefix, preserve_case, max_len |
transport | kind, host, port, user, key_path, known_hosts_path, known_hosts_data, host_key, insecure_ignore_host_key, sudo, engine, database, tls_mode, ca_cert_path, ca_cert, use_https, winrm_auth, api_server, base_dn, oracle_connect_type, insecure_skip_verify |
bridge | url, public_url, native_port, insecure_skip_verify, ca_cert_path, ca_cert, username, role, session_duration, record_session |
params | Parameters in lowercase underscore form. Values are strings. |
bridge.url is the broker API address. bridge.public_url is the user-facing address. A transport password belongs in params.transport_password, usually as a reference. There is no structured transport.password field.
Core and identity settings
| Variable | Default | Meaning |
|---|---|---|
BSH_PROTOCOL, BSH_METHOD | None | Access protocol and operation, unless supplied in the command or file. |
BSH_MODE | standard | standard or bridge. Bridge role-session methods imply bridge. |
BSH_FORMAT | json | json or raw in standard mode. |
BSH_USER_EMAIL | None | Requesting user’s identity. The permission maps user.username to this value. |
BSH_USERNAME | Derived | Explicit target account name. |
BSH_USERNAME_PREFIX | Empty | Prefix for a derived account name. |
BSH_USERNAME_PRESERVE_CASE | false | Preserve case in derived names. |
BSH_USERNAME_MAX_LEN | 32 | Derived name length limit. Windows local accounts default to 20. |
BSH_TRANSACTION_ID | None | Platform profile.transactionId. Required for Bridge checkout and checkin. |
BSH_SESSION_ID | None | Alternate session identifier. Takes precedence over BSH_TRANSACTION_ID. |
Without BSH_USERNAME, the account name comes from the email local part, with non-alphanumeric characters removed and letters converted to lowercase. For example, jane.doe@example.com becomes janedoe. The prefix and length limit then apply.
BSH_USERNAME also accepts a Jinja expression. Its context includes email, domain, local_part, username, session_id, protocol, method, and non-secret params. The rendered name is sanitized and truncated. Credential values are not rendered as templates.
Execution and access duration
| Variable | Default | Meaning |
|---|---|---|
BSH_TIMEOUT | 25s | Deadline for the bsh invocation. |
BSH_SCRIPT_TIMEOUT | Unknown | Broker script deadline. When greater than five seconds, this caps the bsh deadline at the script timeout minus five seconds. It does not change the broker’s timeout. |
BSH_SESSION_DURATION | Method-dependent | Access lifetime. Bridge sessions and Kubernetes tokens default to one hour. This value is separate from script execution time. |
Transport settings
The transport performs administrative operations on the target. BSH_TRANSPORT selects it. A method with one supported transport selects that transport automatically. Methods that support local and SSH execution default to local; remote execution requires BSH_TRANSPORT=ssh.
| Variable | Meaning |
|---|---|
BSH_TARGET_HOST | Target hostname. Required for remote transports. |
BSH_TARGET_PORT | Port of the service the user accesses, such as RDP on 3389. |
BSH_TRANSPORT_PORT | Port used for administrative operations. When it differs from the target service port, it needs a separate value. WinRM defaults to 5986 for HTTPS or 5985 for HTTP. |
BSH_TRANSPORT_USER | Administrative account, database user, or directory bind DN. |
BSH_TRANSPORT_PASSWORD | Administrative password. Supports references and _FILE. |
BSH_TRANSPORT_CA_CERT_PATH | Path to the CA bundle used to verify the administrative connection. |
BSH_TRANSPORT_CA_CERT | CA bundle as PEM content. Takes precedence over the path. |
BSH_TLS_MODE | disable, require, or verify-full for SQL, NoSQL, and directory transports. The default require encrypts without verifying the certificate. verify-full verifies the server. |
For a VNC service on 5900 managed over SSH, the ports are BSH_TARGET_PORT=5900 and BSH_TRANSPORT_PORT=22. Telnet and NETCONF account management over SSH also need an explicit SSH transport port when the target service uses another port.
SSH
SSH requires an administrative user, a private key or password, and host verification.
| Variable | Meaning |
|---|---|
BSH_TRANSPORT_KEY | Administrative private key content. Supports references and _FILE. |
BSH_TRANSPORT_KEY_PATH | Path to an administrative private key on the broker. |
BSH_KNOWN_HOSTS | Path to a known_hosts file, or its content. |
BSH_KNOWN_HOSTS_DATA | known_hosts content. |
BSH_TARGET_SSH_HOST_KEY | A single OpenSSH public host key to pin. Also used by Bridge. |
BSH_TRANSPORT_SUDO | Run remote administrative commands through sudo -n. Default false. This is separate from BSH_SUDO, which grants sudo access to the target user. |
BSH_INSECURE_IGNORE_HOST_KEY | Accept an unverified host key when no pin is configured. Default false. |
WinRM
WinRM requires BSH_TRANSPORT_USER and BSH_TRANSPORT_PASSWORD. BSH_WINRM_HTTPS defaults to true. BSH_WINRM_AUTH accepts ntlm, the default, or basic. BSH_WINRM_CA_CERT_PATH and BSH_WINRM_CA_CERT supply the listener’s trusted CA. BSH_WINRM_INSECURE_SKIP_VERIFY disables certificate verification and defaults to false.
Databases
SQL protocols select the database engine automatically. BSH_ADMIN_DATABASE names the administrative connection database. BSH_TARGET_DATABASE names the grant scope and the database returned to the user. When no administrative database is set, the target database also supplies the connection database. BSH_DB_TLS_MODE overrides BSH_TLS_MODE.
Oracle uses BSH_TARGET_DATABASE as its service name or SID. BSH_ORACLE_CONNECT_TYPE defaults to service_name and also accepts sid.
For NoSQL, BSH_DATABASE is MongoDB’s authentication database or Cassandra’s keyspace. Redis can use an unnamed default administrative user. Database credentials and CA settings otherwise follow the common transport settings.
Kubernetes and directory services
| Variable | Meaning |
|---|---|
BSH_KUBE_API_SERVER | Kubernetes API URL. In a cluster, the mounted service-account configuration is used when explicit settings are absent. |
BSH_KUBE_TOKEN | Administrative bearer token. Supports references and _FILE. |
BSH_KUBE_CA_CERT_PATH, BSH_KUBE_CA_CERT | CA bundle for the Kubernetes API. |
BSH_DIRECTORY_BASE_DN | Base DN for directory searches. The transport user is the bind DN. |
Directory connections use LDAPS on port 636. Other ports use StartTLS unless BSH_TLS_MODE=disable. The default directory port is 389.
Bridge settings
Bridge mode requires Britive Bridge 3.0.0 or later. The Bridge setup guide describes the permission scripts and platform mappings.
Connection addresses and authentication
| bsh variable | Bridge host fallback | Meaning |
|---|---|---|
BSH_BRIDGE_URL | BRIDGE_SERVER_TELEMETRY_REVIEW_BASE_URL | Public Bridge origin that users reach. --bridge-url overrides both variables. |
BSH_BRIDGE_BROKER_API_URL | BRIDGE_BROKER_API_URL | API address that the broker uses to register and end checkouts. |
BSH_BRIDGE_BROKER_API_TOKEN_FILE | BRIDGE_BROKER_API_TOKEN_FILE | Local file containing the broker API token. Without either path, /data/keys/bridge-broker-api.token is used when the API URL is configured. |
BSH_BRIDGE_CA_CERT_PATH | BRIDGE_CA_CERT | CA bundle for the broker API connection. |
BSH_BRIDGE_INSECURE_SKIP_VERIFY | BRIDGE_TLS_INSECURE | Skip broker API certificate verification. Default false. |
Bridge supplies these host fallbacks to its colocated broker. On an external
broker, set the API URL to Bridge’s HTTPS endpoint. Supply the checkout token
through BSH_BRIDGE_BROKER_API_TOKEN or its token-file alternative. This requires
Bridge 3.0.2 or later with
server.checkout_api_tokens.enabled. See
external broker setup.
The public URL receives an https:// prefix when only a hostname is supplied.
Trailing slashes are removed.
BSH_BRIDGE_BROKER_API_TOKEN can supply the token directly or through an external reference. BSH_BRIDGE_CA_CERT supplies PEM content instead of a path. BSH_BRIDGE_NATIVE_PORT changes the native connection port returned to the user, independently of the target and transport ports.
Session and login settings
| Variable | Default | Meaning |
|---|---|---|
BSH_BRIDGE_USERNAME | BSH_USER_EMAIL | Override for the identity used to connect to Bridge. |
BSH_BRIDGE_ROLE | user | Target checkouts use user. The admin-session and auditor-session methods select their respective roles. |
BSH_SESSION_DURATION | 1h | Bridge session lifetime, shortened when the issued credential expires earlier. |
BSH_BRIDGE_RECORD_SESSION | Bridge default, recording enabled | Explicit recording override. |
BSH_BROWSER_ENABLED, BSH_NATIVE_ENABLED | Bridge defaults | Enable or disable supported connection paths. At least one supported path must remain enabled. |
BSH_NATIVE_AUTH | Deployment-dependent | ldap or bridge_credentials. A supplied Bridge password selects bridge_credentials when LDAP passthrough is off. |
BSH_BRIDGE_AUTH_PASSWORD | Generated when bridge_credentials is selected | User’s Bridge login password. Supports references and _FILE. A generated password is returned in the checkout payload. |
BSH_LDAP_AUTH_PASSTHROUGH | false | Forward the user’s directory password to the target for supported protocols. Conflicts with bridge_credentials. |
BSH_BRIDGE_USER_PUBLIC_KEY | None | User’s public key for Bridge’s SSH or NETCONF listener. |
The Bridge login identity resolves from --bridge-username, then BSH_BRIDGE_USERNAME, YAML params.bridge_username, YAML bridge.username, and finally BSH_USER_EMAIL. An empty environment value falls through to the file settings and then the email. Explicit Bridge username overrides require bsh version 0.2.0 or later.
BSH_BRIDGE_USERNAME selects the Bridge login. BSH_USERNAME selects the target account. Setting a Bridge username does not change BSH_USER_EMAIL or the target account name.
Kubernetes exec uses browser access. HTTP, WinRM, and NETCONF use native access. A connection control cannot enable a path that the protocol does not support.
Target connection and session controls
Bridge connects to the target separately from the bsh administrative connection. BSH_TARGET_TLS, BSH_TARGET_CA_CERT, and BSH_TARGET_TLS_SKIP_VERIFY configure that connection. Administrative transport TLS settings do not replace them.
| Scope | Variables |
|---|---|
| Target identity | BSH_TARGET_DOMAIN, BSH_TARGET_DATABASE |
| Oracle redirects | BSH_ORACLE_REDIRECT_TARGETS, a list of host:port endpoints, at most 32. Redirects require target certificate verification. |
| RDP security | BSH_RDP_SECURITY: any, nla, tls, or rdp. BSH_RDP_IGNORE_CERT: certificate verification override. |
| RDP transfer and clipboard | BSH_RDP_ENABLE_DRIVE, BSH_RDP_DISABLE_COPY, BSH_RDP_DISABLE_PASTE, BSH_RDP_CLIPBOARD_SAVE_FILES, BSH_RDP_CLIPBOARD_MAX_FILE_MB |
| RDP display | BSH_RDP_COLOR_DEPTH: 8, 16, 24, or 32. BSH_RDP_SERVER_LAYOUT, BSH_RDP_TIMEZONE |
| RDP appearance | BSH_RDP_ENABLE_WALLPAPER, BSH_RDP_ENABLE_THEMING, BSH_RDP_ENABLE_FONT_SMOOTHING, BSH_RDP_ENABLE_FULL_WINDOW_DRAG, BSH_RDP_ENABLE_DESKTOP_COMPOSITION, BSH_RDP_ENABLE_MENU_ANIMATIONS, BSH_RDP_DISABLE_BITMAP_CACHING |
| Bridge prompt keyboard | BSH_BRIDGE_PROMPT_KB_LAYOUT, default us |
| Kubernetes exec | BSH_KUBE_POD, required. BSH_KUBE_NAMESPACE, BSH_KUBE_CONTAINER, BSH_KUBE_COMMAND, BSH_KUBE_TTY |
| Command filtering | BSH_ALLOWED_COMMANDS, BSH_BLOCKED_COMMANDS, BSH_ALLOWED_PATTERNS, BSH_BLOCKED_PATTERNS. Patterns use Go regular expressions. VNC rejects these settings. |
| HTTP proxy | BSH_BLOCKED_METHODS, BSH_SANITIZE_HEADERS_EXTEND, BSH_SANITIZE_QUERY_PARAMS_EXTEND, BSH_SANITIZE_BODY_FIELDS_EXTEND |
| Session policy | BSH_PASTE_CAPTURE, BSH_KEYSTROKE_CAPTURE, BSH_LOCK_BLOCKS_SCREEN, BSH_REDACT_RESPONSE_BODIES. Bridge determines the accepted policy string values. |
Output and logs
In standard mode, JSON output contains the target username, credential when issued, and connection metadata. --format raw returns only the primary credential, without a trailing newline. Raw output fails for methods that do not issue a credential, such as group membership and role grants.
Bridge output contains the transaction ID and connection details. Target credentials are sent to Bridge. Telnet also returns the target password for the target’s login prompt. A generated Bridge login password is a separate value.
Checkin produces no stdout payload. Diagnostics go to stderr. Combining stderr with stdout corrupts the credential payload.
BSH_LOG_LEVEL accepts debug, info, warn, warning, or error, with info as the default. BSH_LOG_FORMAT accepts text or json, with text as the default. Exit codes and recovery procedures are listed in Troubleshoot bsh.