Your first steps with Keeper Commander
Follow these instructions to install Keeper Commander on your system for CLI access
CLI Installation on WindowsCLI Installation on macOSCLI Installation on LinuxInstalling the CLI from source code with scripting capabilities
Python Developer SDKPowerShell Module.NET Developer SDKIn order to add additional modules, change source code or make other edits to Commander, you will need to Install Commander in Developer mode. Developer mode clones the Commander source code to your local machine in a virtual environment.
Python Developer SDKHow to install Keeper Commander CLI on Microsoft Windows
Windows 10 (1903 and above)
Windows Server 2016 (1803 and above)
Watch the video below to learn how to install and log in to Keeper Commander.
⬇️ Download Keeper Commander .exe file from GitHub
On the Commander Github page, the current commander build is always available via the releases link.
The binary download is the file named:
keeper-commander-windows-vX.XX.exe
Note about Windows installs: - You may have to right click on the executable and go to properties to unblock the file. - You need to have admin rights to install Commander - Sometimes antivirus may block the files, create a one time exception to install as needed
Download the current version of Python from https://www.python.org/
Recommended releases:
Windows 11 - Python 3.10.8
Windows 10 - Python 3.10.8
Server 2018 - Python 3.10.8
Server 2016 - Python 3.9.13
On the first screen of the installation, opt-in to include python.exe in the PATH
Validate Python is correctly installed by checking the installed version from launching the cmd prompt.
From the command prompt, install Keeper Commander with pip3:
Once installed, ensure you have the latest version by upgrading Commander:
Please validate all updates in your test environment as commands and functionality is under rapid development.
Login to Keeper in order to validate Keeper Commander is properly installed:
Note, for your first time logging into a new device or a new location, you may have to perform device authorization through email or other 2FA methods.
How to install Keeper Commander on macOS
Mac OS 10.15 or newer
Watch the video below to learn how to install and log in to Keeper Commander.
On the Commander Github page, the current commander build is always available via the releases link.
For mac installs download and install the file named: keeper-commander-mac-vx.xx.pkg
After installation, type "keeper shell
" to login.
Download and install Python and pip3
Download the current version of Python from: https://www.python.org/
Depending on your operating system security settings you may need to "Allow" the application to run or install. To do this open "System Preferences" > "Security and Privacy" > "General" tab
Validate Python is correctly installed by checking the installed version from a terminal window:
From a terminal window, install Keeper Commander with pip3:
Once installed, ensure you have the latest version by upgrading Commander:
Please do not upgrade a production system without validation in your test environment as commands and functionality is under rapid development.
To see which version of Keeper you're running:
To validate Keeper Commander is properly installed login:
Note, for your first time logging into a new device or a new location, you may have to perform device authorization through email or other 2FA methods.
How to install the Keeper Commander CLI on Linux
Ubuntu (Current release and latest LTS release)
CentOS (Current)
RedHat (Current)
Watch the video below to learn how to install and log in to Keeper Commander.
Install Python 3.x
Install Package installer for Python
Based on your distribution, follow the instructions to install Python 3.x, typical installation commands are listed below.
OR
Also ensure the "Package installer for Python" is installed (you may need to run an apt-get update first):
OR
Next, upgrade pip3 to the latest version using the command:
Validate Python is correctly installed by checking the installed version from a terminal window:
Next, install Keeper Commander using pip3:
Once installed, ensure you have the latest version by upgrading Commander:
Please validate all updates in your test environment as commands and functionality is under rapid development.
Now you can launch the keeper shell using command:
You should see:
Note, for your first time logging into a new device or a new location, you may have to perform device approval through email or other 2FA methods.
Instructions for installation of Python-based Commander with the intent on modifying source code
If you are a developer and you plan to create Python source code or set up a development environment based on the Github repository, you can use a virtual environment to isolate the environment for testing. Follow the below instructions:
Clone or download the Commander repository from: https://github.com/Keeper-Security/Commander
2. Install Python3
Find the most recent Python3 installation from python.org
3. Install Virtualenv
4. Create and activate the virtual environment for your keeper project
Virtualenv creation and activation differs on Mac OS/Linux and Windows operating systems. Please follow the corresponding instructions.
5. Install Commander to the virtual environment
🎉 Setup Complete
You should be able to now login to the CLI by typing:
Additional Plugins
Keeper supports plugins for various 3rd party systems for password reset integration. Depending on the plugin, you will need to also install the modules required by that plugin. For example, our MySQL plugin requires the PyMySQL module.
See Password Rotation Plugins section for more information about Commander plugins.
After you have installed Keeper Commander in developer mode, you can simply login using the keeper shell
command:
Several standalone python scripts can be found here, with examples for searching records, creating teams and sharing folders, and more.
Keeper Commander .NET Developer SDK
The Keeper Commander CLI is has been written in 3 languages (Python, .Net and Golang) with the source code available on Github.
Keeper's .Net Commander tool provides basic vault access, a developer SDK for vault access and administrative functions: https://github.com/Keeper-Security/keeper-sdk-dotnet
For source integration into your .Net code, please utilize the KeeperSDK Library source code: https://github.com/Keeper-Security/keeper-sdk-dotnet/tree/release/KeeperSdk
Find detailed API documentation at the following URL: https://keeper-security.github.io/gitbook-keeper-sdk/CSharp/html/R_Project_Documentation.htm
.Net Framework 4.5
.Net Core 2.1
.Net Standard 2.0
For help with implementation of SDK features, please see the Sample Application: https://github.com/Keeper-Security/keeper-sdk-dotnet/tree/master/Sample
The .Net Commander CLI Sample App contains several basic operations such as logging in, authentication with two-factor, loading and decrypting the vault and updating passwords.
https://github.com/Keeper-Security/keeper-sdk-dotnet/tree/release/Commander
Installing the Keeper Commander PowerShell Module
A version of Keeper Commander is developed in .Net with a PowerShell module. This is published to the PowerShell Gallery as the PowerCommander
module. This document provides instructions for installing and using this PowerShell Module.
Keeper's PowerShell command-line tool (PowerCommander) provides basic vault access and administrative functions.
PowerShell module for Keeper Commander is available on the PowerShell Gallery:
To install PowerCommander from PowerShell Gallery:
To run the PowerCommander module from the source, refer to the following GitHub Link:
https://github.com/Keeper-Security/keeper-sdk-dotnet/tree/master/PowerCommander
Set Execution Policy Permissions
If you are unable to run PowerCommander commands, you may need to set the Execution Policy. To check this, run the following command:
Your output would be similar to this:
If the Scope for your installation is Undefined
or Restricted
, set it to Unrestricted
with the following command:
Note: The above command set the CurrentUser
scope
Cmdlet name | Alias | Description |
---|---|---|
Connect-Keeper | kc | Login to Keeper server |
Sync-Keeper | ks | Sync with Keeper server |
Disconnect-Keeper | Logout and clear the data | |
Get-KeeperLocation | kpwd | Print current Keeper folder |
Set-KeeperLocation | kcd | Change Keeper folder |
Get-KeeperChildItem | kdir | Display subfolder and record names in the current Keeper folder |
Get-KeeperObject | ko | Get Keeper object by UID |
Get-KeeperRecord | kr | Enumerate all records |
Get-KeeperSharedFolder | ksf | Enumerate all shared folders |
Add-KeeperRecord | kadd | Add/Modify Keeper record |
Get-KeeperRecordType | krti | Get Record Type Information |
Remove-KeeperRecord | kdel | Delete Keeper record |
Move-RecordToFolder | kmv | Move records to Keeper folder |
Add-KeeperFolder | kmkdir | Create Keeper folder |
Remove-KeeperFolder | krmdir | Remove Keeper folder |
Copy-KeeperToClipboard | kcc | Copy record password to clipboard |
Show-TwoFactorCode | 2fa | Display Two Factor Code |
Copy-KeeperFileAttachment | kda | Download file attachments |
Copy-KeeperFileAttachmentToStream | Download file attachement to stream | |
Copy-FileToKeeperRecord | Upload file attachment to a record | |
Get-KeeperInformation | kwhoami | Print account license information |
Get-KeeperDeviceSettings | Print the current device settings | |
Set-KeeperDeviceSettings | this-device | Modifies the current device settings |
Cmdlet name | Alias | Description |
---|---|---|
Show-KeeperRecordShare | kshrsh | Show a record sharing information |
Grant-KeeperRecordAccess | kshr | Share a record with user |
Revoke-KeeperRecordAccess | kushr | Remove record share from user |
Move-KeeperRecordOwnership | ktr | Transfer record ownership to user |
Grant-KeeperSharedFolderAccess | kshf | Add a user or team to a shared folder |
Revoke-KeeperSharedFolderAccess | kushf | Remove a user or team from a shared folder |
Get-KeeperAvailableTeam | kat | Get available teams |
Get-KeeperOneTimeShare | kotsg | Get One-Time Shares for a record |
New-KeeperOneTimeShare | kotsn | Create One-Time Share |
Remove-KeeperOneTimeShare | kotsr | Remove One-Time Share |
Cmdlet name | Alias | Description |
---|---|---|
Sync-KeeperEnterprise | ked | Sync Keeper enterprise information |
Get-KeeperEnterpriseNode | ken | Enumerate all enterprise nodes |
Get-KeeperEnterpriseUser | keu | Enumerate all enterprise users |
Get-KeeperEnterpriseTeam | ket | Enumerate all enterprise teams |
Get-KeeperEnterpriseTeamUser | ketu | Get a list of enterprise users for team |
New-KeeperEnterpriseNode | kena | Create Node (new) |
Add-KeeperEnterpriseUser | invite-user | Invite User to Enterprise (new) |
Lock-KeeperEnterpriseUser | lock-user | Lock Enterprise User |
Unlock-KeeperEnterpriseUser | unlock-user | Unlock Enterprise User |
Move-KeeperEnterpriseUser | transfer-user | Transfer user account to another user |
Remove-KeeperEnterpriseUser | delete-user | Delete Enterprise User |
Get-KeeperEnterpriseRole | ker | Enumerate all enterprise roles (new) |
Get-KeeperMspLicenses | msp-license | Return MSP licenses |
Switch-KeeperMC | switch-to-mc | Switch to Managed Company (new) |
Switch-KeeperMSP | switch-to-msp | Switch back to MSP (new) |
Get-KeeperManagedCompany | kmc | Enumerate all enterprise managed companies |
New-KeeperManagedCompany | kamc | Create Managed Company |
Remove-KeeperManagedCompany | krmc | Remove Managed Company |
Edit-KeeperManagedCompany | kemc | Edit Managed Company |
Get-MspBillingReport | Run MSP Billing Report |
Cmdlet name | Alias | Description |
---|---|---|
Get-KeeperSecretManagerApp | ksm | Enumerate all Keeper Secret Manager Applications |
Add-KeeperSecretManagerApp | ksm-create | Add a Keeper Secret Manager Application |
Grant-KeeperSecretManagerFolderAccess | ksm-share | Add a shared folder to KSM Application |
Revoke-KeeperSecretManagerFolderAccess | ksm-unshare | Remove a Shared Folder from KSM Application |
Add-KeeperSecretManagerClient | ksm-addclient | Add a client/device to KSM Application |
Remove-KeeperSecretManagerClient | ksm-rmclient | Remove a client/device from KSM Application |
Not all capabilities of Keeper Commander (Python) have been added to the PowerShell module. We add them on request by customers. If you have requests for our engineering team, please email commander@keepersecurity.com.
Connect To Keeper Account
List the content of Keeper folder
f - folder
r - record
S - shared
A - file attachments
O - owner
Show Two Factor Code for all records in the current Keeper folder
Show Two Factor Code for all records in the Vault.
where
kr
is alias for Get-KeeperRecord
2fa
is alias for Show-TwoFactorCode
Copy record password to clipboard
where
contro
is a substring of the record title. See last entry of kdir
output in example #2
kcc
is alias for Copy-KeeperToClipboard
or
'ktY3jEBqwFDi9UYZSxmIpw'
is the Record UID of the same record
Add/Modify Keeper record
creates a legacy record in Keeper
creates a record of login
type in Keeper
generates a new password for existing record
Pre-defined fields supported by both legacy and typed records
login
Login
password
Password
url
Website Address
Copy owned record to folder
copies all records in the current Keeper folder to the folder with name 'Shared Folder'
List all enterprise users
Create a new Managed Company
Switch to a new Managed Company
How to login and use the Keeper Commander CLI
To login to Commander for the first time, click the Keeper Commander icon or open a shell and type:
Once the shell is open, begin the login by typing login
. If this is your first login, you will need to follow the device approval workflow. This is only needed once, as an extra layer of security to trust the device you are on.
First Login Example:
If you wish to approve via email:
Type email_send
or es
Enter the security code via email_code=<code>
If you wish to approve via Keeper Push:
Type keeper_push
Approve via push
Type approval_check
If you wish to approve via 2fa code:
Input 2fa_send
Input 2fa_code=<code>
Once complete you will receive the following message:
After device approval, you will immediately move to the login process, or if you previously approved the device, this will be the first step.
Login Example (approved device):
If you have 2FA enforced on your account, you will be required to pass the 2FA step before logging in with a Master Password. Your login flow in commander will follow the same rules you have for logging into the Vault.
Login Example (2FA):
Each 2FA method that is enabled will have a number next to it.
In this example, only TOTP is enabled, so 3
would need to be entered, followed by the TOTP code. Enter the corresponding number to proceed:
By default, Keeper Commander prompts for 2FA code on every login. To store 2FA authentication for this device either for 30 days or forever, type one of the following before entering the code:
2fa_duration=30_days
to prompt for 2FA every 30 days, or...
2fa_duration=forever
to never prompt again on this device
If your network configuration requires using a proxy server you can use the proxy
command before logging in.
If SSO is configured for your Keeper enterprise, the following screen will appear for users that login to Commander:
To login to Commander using SSO, you will need to paste a token provided by the SSO provider from your web browser into Commander. To receive the SSO token, follow these steps:
Option 1: Open the Page Automatically From Commander
To have Commander automatically open the default browser to the SSO Connect page, enter "o" in the SSO selection and hit Enter
The default browser for your system will open to the SSO Connect page.
Depending on your operating system, settings, and administrator privileges, Commander may be unable to open the web browser, in this case use the following option to open the SSO Connect screen.
Option 2: Paste the SSO Login Screen URL into a Browser
You can copy the URL to your SSO's logins screen from the SSO Connect text in Commander, or enter "c" in the SSO selection and hit Enter
to copy the URL to your clipboard.
Once the URL is copied, paste it into a web browser to navigate to the SSO Connect page.
After a successful SSO login, the web page will show a yellow "Copy" button. Click the button to copy the token.
Once the token has been copied, go back to Commander to complete the SSO login.
In Commander enter "p" in the SSO selection screen and hit Enter
to paste the token from your clipboard into Commander and complete SSO login.
If device approval is turned on for your account, the device approval selection will be shown after the first SSO login.
Enter your selection and hit Enter
to continue with device approval.
1 : Approve with Keeper Push
2 : Approve with Admin Approval
r : Resume SSO login after the device has been approved
See First Login on a New Device section for more details on device approval.
Customers who normally login to their Keeper Vault using Enterprise SSO Login (SAML 2.0) can also login to Keeper Commander using a Master Password. To make use of this capability, it must be enabled by the Keeper Administrator and then configured by the user. The steps are below:
(1) Login to the Keeper Admin Console
As the admin, login to the Keeper Admin Console as you normally do.
(2) Enable SSO Master Password Policy
For the User/Role who will be accessing Keeper Commander, open the Role Enforcement Policy setting screen. Enable the option "Allow users who login with SSO to create a Master Password"
(3) Login to the End-User Vault using SSO
As the user who will be using Commander, login to the Keeper Web Vault or Keeper Desktop app with your SSO provider as you normally do.
(4) Create a Master Password
Visit the Settings > General screen and setup a Master Password
After the Master Password is created, you are now able to login to Keeper Commander.
Add the following line to your configuration file.
Commander can be configured to stay logged in between sessions, and you can also configure how long the device will remain logged in without activity.
Use the this-device
command to set your preferences.
Example:
To enable "Stay Logged In" so that you're not prompted for authentication, use these commands:
If persistent login is enabled, you won't be prompted to authenticate the next time you run Commander:
Changing persistent-login ("stay logged in") affects all devices that you use with Keeper
To set the inactivity logout timer to a certain number of minutes:
Understanding the Commander configuration file for automation and CLI usage
When you login to Commander for the first time, a config.json
file is created, if one does not exist. When launching Commander as an application, the config file is created at ~/.keeper
on MacOS and Linux, and at C:\Users\[USERNAME]\.keeper
on Windows. When using Commander from the command line or terminal, the config.json
file is created in the current directory, unless the --config
option is passed a different location.
server
Keeper data center region
Commander defaults to the US region, so customers hosted in other regions will need to specify a server in the config.
Region | Property Setting for "server" |
US | https://keepersecurity.com |
EU | https://keepersecurity.eu |
AU | https://keepersecurity.com.au |
GOV | https://govcloud.keepersecurity.us |
CA | https://keepersecurity.ca |
JP | https://keepersecurity.jp |
debug
enable or disable detailed crypto output and network logging
set to true
or false
plugins
Set which password rotation plugin will be loaded.
Learn more about password rotation plugins for Commander.
commands
Comma-separated list of Keeper commands to run
timedelay
Run the specified commands every X seconds.
example: "timedelay":600
will run the commands every 10 minutes.
private_key
Device private key generated by Commander on a new device. This key is used to encrypt and decrypt vault data.
device_token
Device token generated by the backend for every new device. The device token is used to uniquely identify the device, and it controls the session behavior.
proxy
Proxy URL: schema://[user:password@]host:port
where schema
http
HTTP proxy
socks5
SOCKS5 proxy with local DNS
socks4
SOCKS4 proxy with local DNS
socks4a
SOCKS4 proxy with remote DNS
socks5h
SOCKS5 proxy with remote DNS
sso_master_password
Forces master password login for Enterprise SSO Accounts
skip_records
Prevents syncing of records if the value is set to true
. For users with very large vaults, this allows you to login and perform commands without requiring a full sync of records. After login, to force sync records use sync-down --force
Example line in config.json: "skip_records":true,
Using the commands
field allows for predetermined commands to be run on login.
Enter a comma-separated list of Keeper Commander commands to be run. Example:
In this example, it will sync, and then download a report of the available files in the vault.
If you start Commander from the binary installer, the config file will be located in the user's home directory in a folder called ".keeper".
On Mac environments, the configuration file is located in ~/.keeper/config.json
In Windows environments, the configuration file is located in /Users/{Username}/Documents/.keeper/config.json
If you use Commander from a pip3 or source installation, the configuration file will be created in the current folder where the Commander executable is started from.
You can specify the config file to use when launching Commander, for example:
In an environment with multiple servers or dynamic servers, you can use the same config.json
file for each instance as long as all of the fields are populated, and the device identifier has been "approved".
Example config.json
file:
As long as you have performed a device approval step at least one time, this configuration file can be loaded on any number of servers.
If you plan to distribute this file to multiple instances, we recommend protecting this file through secure storage facilities provided by your cloud infrastructure. We also recommend assigning the user account to a Role Enforcement policy on the Keeper Admin Console that is locked down based on IP range.
Persistent Login allows a Commander device to authenticate to Keeper without having to populate the "password" in the configuration file. This is useful for automation scripts or calling Commander from other software.
In order to enable this feature, you need to register the device and turn on the persistent login setting. Once that's done the next time you login with the specified configuration file, the session will be resumed and the user will be automatically logged in. Several tokens are stored in the config.json
file in order to resume a session automatically.
Commands to enable persistent login on a device for 30 days (max):
You can use seconds as the value (e.g. 60 for 60 seconds) or numbers and letters (e.g. 1m for one minute, 5h for 5 hours, and 7d for 7 days).
Also note that typing "logout" will invalidate the session. Just "quit" the Commander session to exit.
Once persistent login is set up on a device, the config.json
in the local folder will look something like this:
The configuration file can be modified to include auto-execution of commands or other features. See the configuration documentation for more details.
You can create any number of persistent login sessions. However, the persistent session option is not intended for dynamic multi-server environments. If you share the exact configuration file on multiple servers, persistent login will fail when attempting to login to the second server.
For multi-server dynamic environments, please refer to the prior section of using a fully populated config file that is distributed to each instance.
If you would like to maintain different configurations, you can run Commander with a specified config file. For example, this will open the CLI without prompting for login:
To leave the CLI, make sure to type "quit" instead of "logout". Typing "logout" will expire the session and you'll need to create a new persistent session config.
Another example would be executing a particular command without prompting for login. In the below example, a new record is created automatically with a single line.
You can batch execute a series of commands and pipe the file to STDIN of Commander. For example, create a text file called test.cmd
with the following lines:
To run this file in a batch mode:
or
Handling Errors
The batch execution is aborted if some command returns failure. Use @
in front of the command to suppress the possible command error.
Batch Mode in Windows
Following example shows how to execute three commands using Windows command line:
By setting up a persistent login configuration (as described in the previous section), you can execute a series of batch commands without any prompt for login. For example:
Keeper supports a batch mode from within the CLI which can conveniently execute commands sequentially.
The command is called "run-batch" and can be executed like below:
In this example, each command is executed with a delay of 10 seconds in between.
On Linux environments, the path can also be specified such as:
The sensitive configuration file parameters (user, password, server, device_token, private_key, clone_code) can be optionally stored in 3rd party secrets managers or hardware security modules.
To use protected storage, add config_storage
property to your config file. config_storage
value has URL format. Please reference the appropriate section below for storage URL format.
Commander supports the following protected storages:
Protecting configuration with AWS Secrets Manager
Amazon AWS Secrets Manager can be utilized on an EC2 instance hosting Keeper Commander in order to protect and store the configuration data.
The AWS Secrets Manager protected storage resource URL format is as follows:
Example:
aws-sm://us-west-2/commander/config
The secret name should contain URL-safe characters and not start with forward slash /
Keeper Commander requires the following access permissions to the secret resource
secretsmanager:GetSecretValue
secretsmanager:PutSecretValue
Example AWS policy granting access to secret
Keeper Commander installed with pip
requires boto3
package to present in the virtual environment
pip install boto3
Protecting configuration with AWS Secrets Manager
Amazon AWS Key Management Service can be utilized on an EC2 instance hosting Keeper Commander in order to protect and store the configuration data.
The AWS Key Management Service protected storage resource URL format is as follows:
Example:
aws-kms://us-east-1/12345678-abcd-1234-dcba-123456789012
aws-kms://eu-west-1/alias/key
The secret name should contain URL-safe characters
Keeper Commander requires "key users policy" to be granted to AWS user or role.
Running Commander CLI commands using Windows Task automation
To set up a scheduled task in Windows to run a specific Keeper Commander CLI command on a scheduled basis, you can use the Task Scheduler tool.
In the below example, we'll re-generate a password in the vault on a daily basis.
Prerequisites:
(1) Install
Install Keeper Commander for Windows
(2) Login
Login to Commander by launching the application. For example:
(3) Enable persistent login
After login, set up persistent login so that the command can execute from Task Scheduler
As an example, the below commands will enable "Stay Logged In" for 30 days:
To exit the shell session, type quit
but don't type logout
. Logout will expire the session and the automations won't work.
To confirm that persistent login is working, execute Commander again and it will automatically login to the shell.
(4) Create a record
From the command line, we'll create a quick record with a random password.
If you have the web vault or other Keeper vault opened, you'll see the record appear.
Press Win + R
to open the Run dialog.
Type taskschd.msc
and press Enter. This opens the Task Scheduler.
In the Task Scheduler, click on the "Create Basic Task..." option on the right side.
Enter a name and description for your task, such as "Daily Keeper Commander Task".
Click Next.
Choose the "Daily" option and click Next.
Set the start date and time for the task to run. Ensure the recurrence is set to "1 day" to repeat the task daily.
Click Next.
Choose the "Start a program" option and click Next.
In the "Program/script" field, enter the path to your Keeper Commander executable, for example:
In the "Add arguments (optional)" field, enter your Keeper Commander CLI command. For example:
Click Next to review the details of your task.
Click Finish to create the task.
(10) Execute
To make sure the command works, select the Task and click "Run" on the right side.
In this particular example, the password will rotate from the Keeper vault and you'll see this occur in realtime across all logged-in vault clients. Another example is running a security audit report, such as:
Any feature or capability of the end-user vault or Admin Console can be automated this way. Take a look at all the Keeper Commander commands available.
To expand upon this use case, you would likely want to set up a Batch file and execute the batch of commands instead of adding them directly on the CLI arguments. More information about batch mode commands can be found here.
Run Commander in the AWS Cloud
Commander is a powerful tool that can solve many issues and provide valuable information about your Keeper Security environment. In addition to using Commander on a local desktop or server, Commander can be run in a cloud environment such as AWS for performing scheduled or on-demand requirements.
In this example, we will demonstrate how to use Commander with AWS Lambda to run user and usage reports on a scheduled basis.
Commander
See the Installation and Setup page for download details
A Keeper user account with a Master Password login method (SSO login and MFA will not work without human interaction)
Access to AWS with permissions to create Lambda functions and associated layers, along with access to AWS CloudShell
Commander needs to be packaged on a machine that matches what it will run on in AWS Lambda. To do this, we can create the Commander package in CloudShell.
AWS CloudShell comes with Python 3.7 pre-installed, but just to be sure you are using a supported version of Python (versions 3.6 - 3.11) to build your Lambda Layer, go ahead and check the version of the installed Python interpreter in your CloudShell console.
In case the Python version you're running is not supported by Commander, install one of the supported versions listed above prior to proceeding.
For the next part of the process, we provide a convenient shell script for you to run from within your CloudShell environment, which will create the zip file that contains the keepercommander
package needed for our Lambda Layer.
This script is intended to simplify and streamline much of the layer-content packaging process, both by encapsulating the various command calls that are standard for the process, and by abstracting away some build-process quirks specific to the keepercommander
package and its dependencies. As such, we highly recommend using this approach over a more generic one, as it is much less likely to be error-prone.
To use the script provided above, perform the following steps after downloading the file:
Upload the script to any folder (preferably an empty one) in your CloudShell environment
(Optional) If your project has a requirements.txt
file containing a list of its dependencies, you can upload it to the same folder to include those dependencies in the resulting layer in addition to the keepercommander
package.
In that same folder, run the following command in the terminal:
You should now have a zip file (commander-layer.zip
) in your current folder, which represents the content of your Lambda Layer.
There is a size limit on packaged Lambda layer content (even if stored in S3). So if you try to include additional dependencies by providing the requirements.txt
file for the script above, and it results in the total content size exceeding this limit, the resulting zip file will be unusable. Hence, no layer content will be output when the script detects this scenario, and a helpful message will be shown to the user instead.
A relatively simple solution is to break up your dependencies into smaller groups to be packaged into corresponding separate layers. You can remove some (or all) dependencies from requirements.txt
and run the script again. Any dependencies excluded from the resulting package can then be packaged separately into another layer using the standard packaging process.
Because the resulting zip file is going to be bigger than 50MB (the maximum allowed to be uploaded directly to a Lambda Layer), we'll have to first upload it to an AWS S3 Bucket, and then link the resulting S3 item to our Lambda Layer.
There are multiple ways to complete the remaining steps just mentioned, and if you prefer a GUI-based route, using the AWS Console is a perfectly valid option at this point. But since we're already in our CloudShell environment, using its built-in AWS CLI command-line tool seems like the simplest and most direct way forward, so that is the method we'll show here.
First, we need to upload our zip file to AWS S3. If you didn't previously create a S3 bucket for this task, you can do so by running the following command in CloudShell:
where <bucket-name>
is required to be a globally unique name, so you may have to try at least a few times until one is found.
Upload the newly-packaged zip file from CloudShell to your S3 bucket
Publish the Lambda layer with the uploaded content
In AWS Lambda, use the Lambda editor to write a Python function.
The lambda_handler
function is triggered by Lambda when it is processed.
See a complete example of a Commander Lambda function below:
The function is made up of several parts:
This function is called when the lambda is triggered, all other functions should be called from this one.
Commander uses some parameters in order to authenticate the user account. We will attach these as environment variables and inject them into the Lambda. See further instructions below.
The above steps are all that are required to run Commander in Lambda, once they have been done and Commander SDK code can be performed.
In this example, we run a user status report and send the results to an email address.
Commander uses some parameters to authenticate the user account and identify what Keeper region to access. In order to pass these parameters into Lambda, we will set them as environment variables.
Commander automatically creates the required parameters when you login to the CLI. The easiest way to generate the required parameters is to login to the Commander CLI on your machine.
To get the Commander parameters, open the generated config.json file. By default this is located in the Users/[your username]/.keeper/
folder on your machine. See the config file documentation for more information.
You should see a file that looks similar to this:
To set the required Commander parameters as environment variables, first head to the lambda configuration and select "Environment Variables".
Set each commander parameter as an environment variable to be used by the Lambda.
You will also need to add your keeper master password to be used to login to Commander.
Environment Variable Name | Value | Example |
---|---|---|
KEEPER_USER | Keeper user account email address (config | user@example.com |
KEEPER_SERVER | Keeper server domain (config | keepersecurity.com |
KEEPER_PRIVATE_KEY |
| sxv[...]oz3p=fzw |
KEEPER_DEVICE_TOKEN |
| xko[...]r2IxdiQ |
KEEPER_PASSWORD | Password for keeper account | ***** |
KEEPER_SENDER | Email address to send emails from | user@example.com |
KEEPER_SENDTO | Email address to send emails to | receiver@example.com |
We are using environment variables to set the email addresses to send from and to for this example code. If you are not sending an email in your script, these are not needed
In the general configuration section of the Lambda configuration, it is recommended to change the timeout value. Some Commander functions take time, so if your script takes longer to complete than this number, the Lambda will automatically end without finishing.
You can set this to any number you are comfortable with. A value of 300 seconds (5 minutes) should be more than enough time for most processes.
In the Lambda editor, select the layer that you created above to include the Commander package in your Lambda build.
Create an EventCloud trigger to trigger the Lambda and set it to trigger at a cadence of your choice (for example once per day, or once every 30 days).
AWS can also be configured to trigger Lambda from a number of other sources including email and SMS triggers. See Amazon's documentation on invoking Lambda for more options:
In this example, we are sending an email with the report results. In order to enable the email, you will need to allow Lambda to access SES SendEmail/SendRawEmail
service.
You will also need to create an IAM identity to enable email sending.
For more information on setting up email sending with AWS, see Amazon's documentation:
In this example, we are sending an email with the report results. In order to enable the email, you will need to allow Lambda to access SES SendEmail
/SendRawEmail
service.
In this example, we run a report that combines the results of 2 Commander reports (user-report
and security-audit-report
) and send it via email as a JSON attachment, allowing us to obtain enterprise-wide security-monitoring data -- e.g., last-login date and overall security scores for each user in the enterprise -- in a regularly-scheduled and automated way. However, with this setup, any other set of Commander functions can be run with Lambda.
Experiment with other Commander functionality, Lambda invocation methods, and other AWS services (such as SNS for utilizing various methods for push notifications -- including SMS messages) to bring automated value to your Keeper processes.
For some examples of using the Commander SDK code, see the example scripts in the Commander GitHub repo:
To learn more about Commander's various methods, see the Command Reference section.
Command ReferenceInstructions on uninstalling Keeper Commander
If you installed Keeper Commander with pip3, you can uninstall Keeper Commander by invoking the following command:
You will be prompted to confirm uninstallation:
If you installed Keeper Commander using the Windows binary, follow the following steps to uninstall:
Open Control Panel
Navigate to Programs > Programs & Features
Right Click "Keeper Commander" and select "Uninstall"
Follow the prompted directions on screen
For alternative ways on uninstalling program on Windows, refer to this page.
If you installed Keeper Commander using the Mac binary, follow the following steps to uninstall:
Open Finder
Navigate to Application Folder
Right Click "Keeper Commander" and select "Move to Trash"