Skip to content

Troubleshoot bsh

Run diagnostic commands as the same operating-system user and in the same container or host environment as the permission script. Differences in environment variables, mounted files, cloud identity, and network access can explain a command that works in an interactive shell but fails in the broker.

Identify the failing operation

Confirm the executable and version

command -v bsh
bsh version
bsh probe

If the executable is missing, follow Install bsh. If the expected method is absent, compare the installed version with the version used by the permission.

Check the selected configuration

Use the permission’s protocol, method, and mode. For a standard SSH key permission:

bsh probe ssh --method ephemeral-key

Check the derived username, transport, and configuration errors. probe validates core settings but does not connect to the target or verify every method-specific grant. External references can still contact a store.

Check connectivity

bsh doctor --protocol ssh --method ephemeral-key

doctor uses flags for both protocol and method. For SSH, it attempts a connection, reports the remote identity, and reports the sudo setting. It does not create the target account.

NoSQL connectivity is not tested by doctor. For Bridge, it reports client configuration and token availability without sending a checkout request. A successful diagnostic does not prove that the administrative identity can perform every provisioning operation.

Inspect the failure details

Read the broker’s script stderr. The bsh failed entry includes code, category, error, and remediation. Follow the remediation for that error. For more detail, set BSH_LOG_LEVEL=debug and repeat the diagnostic.

Keep stderr separate from stdout, which carries credentials during checkout. Before sharing diagnostics, remove credentials, tokens, and sensitive target details.

Resolve a configuration error

Check the highest-priority value first. Flags override BSH_* environment variables, which override the YAML file. Recognized Bridge host variables sit between the BSH_* values and YAML.

For an unexpected username, inspect BSH_USERNAME, BSH_USER_EMAIL, and the username prefix and length settings. For a boolean error, use an accepted value such as true or false. For a timeout error, use duration units such as 25s.

If a remote SSH permission selects local, set BSH_TRANSPORT=ssh. Methods with both local and SSH support default to local execution.

If a credential flag is rejected, replace its literal value with an environment variable, _FILE setting, or external reference:

bsh probe postgres --method temp-user \
	--transport-password 'env://DATABASE_PASSWORD'

The command still needs the permission’s other database and identity settings.

Resolve an external value error

  1. Check that the reference uses ://, such as env://DATABASE_HOST.
  2. Confirm that the variable, file, secret, and requested version exist in the broker’s environment.
  3. Confirm that the broker identity can read the source. For AWS, also confirm the region. For Vault, confirm VAULT_ADDR and token availability.
  4. If the reference uses ?key=, confirm that the value is a JSON object with that top-level field.
  5. Check that the fetched value matches the setting’s type. A port needs an integer. A list needs a delimited string.

Do not expect a fetched value that contains another reference to resolve again. See External value references for each provider’s syntax and authentication requirements.

Resolve a target connection failure

Check BSH_TARGET_HOST, the target service port, and BSH_TRANSPORT_PORT. For RDP provisioning, the administrative connection uses WinRM. For VNC provisioning over SSH, the administrative connection normally uses port 22, independently of VNC’s service port.

For an SSH host-key mismatch, verify the target’s key through your approved inventory or management channel, then update the configured pin. For a certificate error, verify the CA bundle and the hostname in the certificate.

If authentication succeeds but provisioning fails, check the administrative account’s privileges. SSH methods that manage users need the relevant operating-system permissions. A non-root account using BSH_TRANSPORT_SUDO=true needs passwordless sudo. Database and directory methods need permission to create accounts, change passwords, or alter memberships for the chosen method.

Resolve a Bridge failure

Confirm that the deployment runs Bridge 3.0.0 or later. Check the broker API address and token separately from the public URL:

  • BSH_BRIDGE_BROKER_API_URL or BRIDGE_BROKER_API_URL must be reachable by the broker.
  • The broker token file must be readable by the broker’s operating-system user.
  • BSH_BRIDGE_URL or BRIDGE_SERVER_TELEMETRY_REVIEW_BASE_URL must identify the origin that users can reach.
  • BSH_TRANSACTION_ID must receive the platform transaction ID during both checkout and checkin.

If a returned connection address is wrong, inspect --bridge-url before the environment values. That flag has the highest priority. The host fallback applies only when the broker receives BRIDGE_SERVER_TELEMETRY_REVIEW_BASE_URL from its Bridge deployment.

If Bridge receives an email when the user needs a different login, check BSH_BRIDGE_USERNAME and the identity line in bsh doctor output. For BSH_BRIDGE_USERNAME=will, that line must report identity: will. The target account is controlled separately by BSH_USERNAME.

If the override still reports the email, run bsh version inside the broker’s container. The fix requires bsh version 0.2.0 or later. Update the broker image and redeploy it if the installed version is older. Updating an executable on the host does not update a copy inside a container.

If Bridge rejects authentication settings, check BSH_NATIVE_AUTH, BSH_BRIDGE_AUTH_PASSWORD, and BSH_LDAP_AUTH_PASSTHROUGH. Bridge credentials and LDAP password passthrough conflict. For a disabled connection path, confirm that at least one path supported by the protocol remains enabled.

Recover from checkin or rollback failure

Use the same protocol, method, mode, target, identity, and session values as the original checkout. Correct the reported connection or permission error, then retry checkin through the platform.

In Bridge mode, checkin ends the Bridge checkout before revoking target access. If Bridge cannot be reached, restore that connection before retrying. If Bridge rejects checkout after bsh has provisioned target access, bsh attempts to revoke the access. A rollback error means that an operator must verify and remove any remaining target access.

Check the method’s revocation behavior before changing cleanup settings. Shared-password rotation affects other users of that account. SSH key cleanup affects overlapping checkouts for the same email on the same target account.

Interpret the exit status

Use the logged category and remediation with the exit status:

Exit statusCategoryNext check
0SuccessVerify the intended result on the target or Bridge.
2UsageCommand, protocol, method, and flag syntax.
3ConfigurationMissing values, types, files, and transport compatibility.
4AuthenticationCredentials, store identity, broker token, and host-key pins.
5TargetTarget, Bridge, or external-store reachability and rejection details.
6ProvisioningAccount creation, grants, rotation, or revocation permissions.
7TimeoutExecution deadline and slow external operations.
8InternalPreserve the version and sanitized error details for support.

Verify

Repeat the diagnostic that failed. Then use a test permission to complete checkout and checkin. Confirm that checkout returns the intended credential or connection details and that checkin revokes access as described for the method. For Bridge permissions, also confirm that the session ends.

If the failure persists, provide support with bsh version, the protocol and method, the error code and category, the timestamp, and sanitized diagnostic output.

Last updated on