Policy Builder CLI
Policy and procedure documents can now be managed in code and version controlled using a Git repository. This approach brings numerous benefits, such as improved collaboration, easier revisions and reviews, and better traceability of changes over time. JupiterOne offers a command-line interface (CLI) specifically designed to streamline the creation and management of policies and procedures.
Installing and Building
To get started, follow these steps to install and build the policies for the first time:
Install the JupiterOne Policy Builder CLI by running the following command:
npm install -g @jupiterone/jupiter-policy-builder
Create a new directory for your company's policies:
mkdir my-company-policies
cd my-company-policiesBuild the policies by running the following command:
psp build
During the build process, you will be prompted to provide some inputs, such as your company name, which will be included in the policy text.
When prompted to save the configuration to a file, enter
config.json
or choose a custom path. Saving the configuration allows you to easily reference the populated configurations for future policy rebuilds.
After completing these steps, the following contents will be created in your current directory:
./templates
: Contains the template files used for editing policies../partials
: Contains partial files used to generate the policy documents../docs
: Contains the generated policy documents.
For more details about these files and their usage, refer to the JupiterOne Policies Structure documentation.
Editing and Rebuilding
To make changes to the policies and procedures, you can edit the template files located in the ./templates
directory. Avoid directly modifying the ./docs
and ./partials
files, as they will be overwritten during the next build.
After making changes, you can rebuild the policies using the following command:
psp build -t ./templates -c path/to/your/config.json
This command will regenerate the policy documents based on your updated templates and configurations.
Publishing
To publish your policies and procedures to your JupiterOne account, follow these steps:
Generate an API key for your user by referring to the API Key Access documentation.
Set the environment variables for your JupiterOne account ID and API key:
export J1_ACCOUNT=<your_j1_account_id>\
export J1_API_KEY=<your_user_api_key>Run the following command to publish your policies and procedures:
psp publish -a $J1_ACCOUNT -k $J1_API_KEY -t ./templates -c ./config.json
Please note that your user needs to have policies admin permissions in order to publish the policies successfully.
Advanced Options
For additional details and advanced options, refer to the README file available here. This README provides more in-depth information on using the Policy Builder CLI and its various features.