Custom Record Types

The CLI has a list of default record types that are available to all users. The CLI also allows for the creation of records using custom record types.

In order to create records, that use custom record types, the schema needs to be defined within CLI. This is done by exporting the custom record type using Keeper Commander.

The below will export the "My Custom" record type, as JSON, to the file my_record_type.json.

My Vault> rti --format json -lr "My Custom" --output my_record_type.json

The JSON file should be copied into a directory called record_type. The location of the record_type directory is the same as the location of the keeper.ini file. The record_type doesn't need to be in the same directory as the keeper.ini, it just need to be in locations where the CLI will check for the keeper.ini.

  • The path defined by the environmental variable KSM_INI_DIR

  • The current directory

  • The user's home directory

    • ${HOME}

    • ${HOME}/.config/ksm

    • $env:USERPROFILE

  • Various system directories

    • /etc

    • /etc/ksm

    • /etc/keeper

    • $env:APPDATA/Keeper

    • $env:ProgamData/Keeper

    • $env:ProgramFiles/Keeper

An alternative directory can be set via the config command.

$ ksm config record-type-dir -d /path/to/my/record/type/schemas

Once the file is copied into the record_type directory, it will be visible in the list of available record types.

 $ ksm secret template record -l
 Record Type
 ------------------------
 login
 bankAccount
 address
 ...
 My Custom

At this point the custom record type can be used to create a new record.

$ ksm secret add field --sf XXXX --rt "My Custom" -t "My Record" \
    "login=jsmith" "password=XXXX" "url=https://localhost"

If the custom record type name contains spaces, the name will need to be surrouned by quotes.

All custom record type name need to be unique. An error will occur if a record type with the same name has already been imported. You also can not override the default record types.

Last updated