Skip to content

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

CommandPurpose
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 probeList 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 versionReport the installed version.
bsh helpShow 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:

  1. Command-line flags.
  2. Nonempty BSH_* environment variables.
  3. Recognized Bridge host variables, for the settings listed under Bridge settings.
  4. The YAML file, with params taking precedence over the corresponding structured field.
  5. 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:

FlagEnvironment variableYAML params key
--target-hostBSH_TARGET_HOSTtarget_host
--transport-userBSH_TRANSPORT_USERtransport_user
--home-rootBSH_HOME_ROOThome_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

TypeAccepted values
BooleanCase-insensitive true, false, 1, 0, yes, no, on, off, t, f, y, or n.
IntegerA decimal integer, such as 22.
DurationA 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.
ListA 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:

bsh.yml
protocol: postgres
method: temp-user
timeout: 25s
transport:
  host: env://DATABASE_HOST
  user: aws-sm://prod/database?key=username&region=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&region=us-east-1

The 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:

SectionFields
Top levelprotocol, method, mode, format, timeout
loglevel, format
identityusername, prefix, preserve_case, max_len
transportkind, 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
bridgeurl, public_url, native_port, insecure_skip_verify, ca_cert_path, ca_cert, username, role, session_duration, record_session
paramsParameters 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

VariableDefaultMeaning
BSH_PROTOCOL, BSH_METHODNoneAccess protocol and operation, unless supplied in the command or file.
BSH_MODEstandardstandard or bridge. Bridge role-session methods imply bridge.
BSH_FORMATjsonjson or raw in standard mode.
BSH_USER_EMAILNoneRequesting user’s identity. The permission maps user.username to this value.
BSH_USERNAMEDerivedExplicit target account name.
BSH_USERNAME_PREFIXEmptyPrefix for a derived account name.
BSH_USERNAME_PRESERVE_CASEfalsePreserve case in derived names.
BSH_USERNAME_MAX_LEN32Derived name length limit. Windows local accounts default to 20.
BSH_TRANSACTION_IDNonePlatform profile.transactionId. Required for Bridge checkout and checkin.
BSH_SESSION_IDNoneAlternate 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

VariableDefaultMeaning
BSH_TIMEOUT25sDeadline for the bsh invocation.
BSH_SCRIPT_TIMEOUTUnknownBroker 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_DURATIONMethod-dependentAccess 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.

VariableMeaning
BSH_TARGET_HOSTTarget hostname. Required for remote transports.
BSH_TARGET_PORTPort of the service the user accesses, such as RDP on 3389.
BSH_TRANSPORT_PORTPort 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_USERAdministrative account, database user, or directory bind DN.
BSH_TRANSPORT_PASSWORDAdministrative password. Supports references and _FILE.
BSH_TRANSPORT_CA_CERT_PATHPath to the CA bundle used to verify the administrative connection.
BSH_TRANSPORT_CA_CERTCA bundle as PEM content. Takes precedence over the path.
BSH_TLS_MODEdisable, 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.

VariableMeaning
BSH_TRANSPORT_KEYAdministrative private key content. Supports references and _FILE.
BSH_TRANSPORT_KEY_PATHPath to an administrative private key on the broker.
BSH_KNOWN_HOSTSPath to a known_hosts file, or its content.
BSH_KNOWN_HOSTS_DATAknown_hosts content.
BSH_TARGET_SSH_HOST_KEYA single OpenSSH public host key to pin. Also used by Bridge.
BSH_TRANSPORT_SUDORun 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_KEYAccept 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

VariableMeaning
BSH_KUBE_API_SERVERKubernetes API URL. In a cluster, the mounted service-account configuration is used when explicit settings are absent.
BSH_KUBE_TOKENAdministrative bearer token. Supports references and _FILE.
BSH_KUBE_CA_CERT_PATH, BSH_KUBE_CA_CERTCA bundle for the Kubernetes API.
BSH_DIRECTORY_BASE_DNBase 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 variableBridge host fallbackMeaning
BSH_BRIDGE_URLBRIDGE_SERVER_TELEMETRY_REVIEW_BASE_URLPublic Bridge origin that users reach. --bridge-url overrides both variables.
BSH_BRIDGE_BROKER_API_URLBRIDGE_BROKER_API_URLAPI address that the broker uses to register and end checkouts.
BSH_BRIDGE_BROKER_API_TOKEN_FILEBRIDGE_BROKER_API_TOKEN_FILELocal 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_PATHBRIDGE_CA_CERTCA bundle for the broker API connection.
BSH_BRIDGE_INSECURE_SKIP_VERIFYBRIDGE_TLS_INSECURESkip 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

VariableDefaultMeaning
BSH_BRIDGE_USERNAMEBSH_USER_EMAILOverride for the identity used to connect to Bridge.
BSH_BRIDGE_ROLEuserTarget checkouts use user. The admin-session and auditor-session methods select their respective roles.
BSH_SESSION_DURATION1hBridge session lifetime, shortened when the issued credential expires earlier.
BSH_BRIDGE_RECORD_SESSIONBridge default, recording enabledExplicit recording override.
BSH_BROWSER_ENABLED, BSH_NATIVE_ENABLEDBridge defaultsEnable or disable supported connection paths. At least one supported path must remain enabled.
BSH_NATIVE_AUTHDeployment-dependentldap or bridge_credentials. A supplied Bridge password selects bridge_credentials when LDAP passthrough is off.
BSH_BRIDGE_AUTH_PASSWORDGenerated when bridge_credentials is selectedUser’s Bridge login password. Supports references and _FILE. A generated password is returned in the checkout payload.
BSH_LDAP_AUTH_PASSTHROUGHfalseForward the user’s directory password to the target for supported protocols. Conflicts with bridge_credentials.
BSH_BRIDGE_USER_PUBLIC_KEYNoneUser’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.

ScopeVariables
Target identityBSH_TARGET_DOMAIN, BSH_TARGET_DATABASE
Oracle redirectsBSH_ORACLE_REDIRECT_TARGETS, a list of host:port endpoints, at most 32. Redirects require target certificate verification.
RDP securityBSH_RDP_SECURITY: any, nla, tls, or rdp. BSH_RDP_IGNORE_CERT: certificate verification override.
RDP transfer and clipboardBSH_RDP_ENABLE_DRIVE, BSH_RDP_DISABLE_COPY, BSH_RDP_DISABLE_PASTE, BSH_RDP_CLIPBOARD_SAVE_FILES, BSH_RDP_CLIPBOARD_MAX_FILE_MB
RDP displayBSH_RDP_COLOR_DEPTH: 8, 16, 24, or 32. BSH_RDP_SERVER_LAYOUT, BSH_RDP_TIMEZONE
RDP appearanceBSH_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 keyboardBSH_BRIDGE_PROMPT_KB_LAYOUT, default us
Kubernetes execBSH_KUBE_POD, required. BSH_KUBE_NAMESPACE, BSH_KUBE_CONTAINER, BSH_KUBE_COMMAND, BSH_KUBE_TTY
Command filteringBSH_ALLOWED_COMMANDS, BSH_BLOCKED_COMMANDS, BSH_ALLOWED_PATTERNS, BSH_BLOCKED_PATTERNS. Patterns use Go regular expressions. VNC rejects these settings.
HTTP proxyBSH_BLOCKED_METHODS, BSH_SANITIZE_HEADERS_EXTEND, BSH_SANITIZE_QUERY_PARAMS_EXTEND, BSH_SANITIZE_BODY_FIELDS_EXTEND
Session policyBSH_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.

Last updated on