Using a CSV Template

Use our script to convert a CSV template to a JSON file for PAM Project commands

Conversion Process

There are two main ways to handle conversion from CSV to JSON:

  1. Work exclusively from a CSV file

    Set all pamDirectory, pamMachine and pamUser objects in your CSV.

  2. Work with a reduced CSV file, and with a JSON template to fill default attributes

    The CSV file would only include information unique to your pamMachines and pamUsers, but fill in all other data from a JSON template file.

1 – Working Exclusively from CSV

Required Fields

The minimum fields for the CSV are as follows:

hostname
username
user_path

DESKTOP-001.local

Administrator

DESKTOP-001.local

The user_path column defined under which resource the user should be placed. This example would create the following JSON object:

{
        "title": "DESKTOP-001.local",
        "type": "pamMachine",
        "host": "DESKTOP-001.local",
        "pam_settings": {
          "options": {
            "rotation": "off",
            "connections": "on",
            "tunneling": "off",
            "graphical_session_recording": "on"
          },
          "connection": {}
        },
        "users": [
          {
            "title": "DESKTOP-001.local - Administrator",
            "login": "Administrator",
            "password": "",
            "type": "pamUser",
            "rotation_settings": {}
          }
        ]
      }

Named Fields

Beyond the required fields above, named fields can be used:

folder_path
title
hostname
type
username
password
user_path

SF/AD

AD

dc.com

pamDirectory

SF/Users

Admin

admin

pwd123

AD

These are fields which either apply to all objects (e.g. title) or apply automatically to specific objects (e.g. password will only apply to pamUsers).

Notes:

  • The type column will default to pamMachine for rows that include a hostname, and pamUser for rows that include a username and user_path.

  • The folder_path column only applies to the pam project extend command, and will be ignored for pam project import. See more on the subject here.

Advanced Fields

Finally, fields that apply to a resource or user object can be set with the rs and usr prefixes respectively.

Resource examples:

rs.port, rs.operating_system, rs.pam_settings.connection.protocol, rs.pam_settings.connection.administrative_credentials

User examples:

usr.distinguished_name, usr.rotation_settings.enabled

Using a CSV File with a JSON Template

With this process, an additional JSON file would be used to define the project settings, your pamDirectory record, and the default fields for your pamMachine records. The CSV would then create all resources using the pamMachine template, and all users using the pamUser template from the JSON file.

In our example, we will create a file name import_template.json, with the following content:

From the above template, replace every field labelled XXX with static information. Fields labelled xxx will be replaced by the script from the CSV data.

Your CSV would then only exclude the pamDirectory resource and user, but include any other resource and user. Default fields from the template can be overridden by columns of the CSV.

hostname
username
user_path
password

DESKTOP-001

Domain Admin

Example AD

pwd123

Local Admin

DESKTOP-001

pwd123

Run the Conversion

Download the script herearrow-up-right and save it to a local directory.

To simplify the command to run, you can have the following files in this directory:

  • servers_to_import.csv

  • import_template.json (only needed if you want to convert from a CSV and JSON)

To run the conversion with the CSV file exclusively:

To run the conversion with both a CSV and JSON template files:

The script supports the following arguments if you want to specify the file paths or output:

--input-file: path to the CSV file.

--template-file: path to the JSON template file.

--output-file: path to the JSON output.

By default, the script will create a file called pam_import.json in the same directory which contains all of the resources to be imported into Keeper.

Last updated

Was this helpful?