Exec Command
Execute arbitrary system calls and replaces templated environmental variables with Keeper vault secrets
exec
command
exec
commandTo perform magic environmental variable substitution, use the ksm exec
command.
Parameters:
System call or script to run with replaced environment variables
format: ksm exec -- <SYSTEM CALL OR SCRIPT>
(1) Example Linux / Mac script
Set a couple environmental variables then execute the script:
(2) Example Windows batch file
(3) Example PowerShell script
Environment Variable Replacement
Environment variables must be templated so that the CLI can find and replace them correctly. For example:
See the Keeper Notation documentation for more information on notation query format and capabilities
Example Shell Script
Below is a Linux bash script example. Before an application is started or a command is run, any environmental variables that start with keeper://
will be replaced with secret values from the vault. Make sure to replace XXXX with the Record UID of the secret.
Here's a simple bash script that prints the secrets to the console:
And here's the output from executing the bash script with ksm exec
Last updated