search cancel

REST API create linux target account - SSH2_PUBLIC_KEY

book

Article ID: 190503

calendar_today

Updated On:

Products

CA Privileged Access Manager (PAM) CA Privileged Access Manager - Cloakware Password Authority (PA) CA Privileged Access Manager - Server Control (PAMSC)

Issue/Introduction

How to create an UNIX target account which can make use of SSH_PUBLIC_KEY protocol.

Environment

Release : 3.2

Component : PRIVILEGED ACCESS MANAGEMENT

Cause

This is an sample for creating an TargetAccount for UNIX hosts using SSH_PUBLIC_KEY protocol.

Resolution

https://community.broadcom.com/enterprisesoftware/communities/community-home/digestviewer/viewthread?MessageKey=bc4fcfca-bdd8-47da-91e8-b91d7d62fc39&CommunityKey=3e91a086-c7b2-4bd0-9f8d-3493ed834111&tab=digestviewer#bmbc4fcfca-bdd8-47da-91e8-b91d7d62fc39


The above Community Discussion can be used to understand how to create the TargetAccount, below is an example of the same in detail.

Steps:
1. Identify the TargetDevice 'id'
2. Identify the TargetApplication 'id'
3. Create the TargetAccount with the required protocol type, in here we would show an example, only for step3.
NOTE: The Private Key and Public Key have to be base64 encoded before they can be used for creating the TargetAccount using REST API

Be default, the following is the template for creating an TargetAccount.

{
    "accountName":null,
    "aliasNames":null,
    "attributes":null,
    "cacheBehavior":null,
    "cacheDuration":null,
    "description1":null,
    "description2":null,
    "password":null,
    "passwordViewPolicyId":null,
    "privileged":null,
    "synchronize":null,
    "useAliasNameParameter":null
}

The parameter "attributes" is where we need to provide all the details with respect to the SSH2_PUBLIC_KEY_AUTH, the list of parameters that are accepted in the REST API for the "attributes" are listed in the product documentation in the CLI part - UNIX Target Account CLI Parameters

For example below are the accepted parameters under the "attributes", while using with REST API, remove 'Attribute' and use the part after the dot.
Attribute.keyOptions
Attribute.publicKey
Attribute.passphrase
Attribute.protocol
Attribute.passwordChangeMethod
Attribute.verifyThroughOtherAccount
Attribute.useOtherAccountToChangePassword
Attribute.otherAccount

Attribute privateKey is not mentioned in the CLI documentation, it's mentioned in the REST API documentation.

Below is an example of how the template should look like with all the attributes in place.

{
    "accountName":null,
    "aliasNames":null,
    "attributes":  {
  "keyOptions":null,
  "publicKey":null,
"privateKey":nul,
  "passphrase":null,
  "protocol":null,
  "passwordChangeMethod":null,
  "verifyThroughOtherAccount":null,
  "useOtherAccountToChangePassword":null,
  "otherAccount":null},
    "cacheBehavior":null,
    "cacheDuration":null,
    "description1":null,
    "description2":null,
    "password":null,
    "passwordViewPolicyId":null,
    "privileged":null,
    "synchronize":null,
    "useAliasNameParameter":null
}

============

Actually executed example.

{
 "accountName":"ssh2user",
 "aliasNames":"f",
 "attributes":{
 "protocol":"SSH2_PUBLIC_KEY_AUTH",
 "keyOptions":null,
 "verifyThroughOtherAccount":"false",
 "discoveryAllowed":"f",
 "publicKey":"c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBQkl3QUFBUUVBbkhqQmEyeTFzcUFIZ2pwc2RZOGZ3R0pWbkNSdlFMUndqVWY4Y1NSM08xRlZPS05vbzVQME1kNFJrRXl6eitSNHZxVlBZWU52aUNoRVhGclRqbUErQkFOYzZvUG1BWlBPRFNraG5FajRkWkcwTGk3ZElPbnlPREw5NG5mc25VQ3RDcWp4bWdUcHR2N1puekZKaGlBbEdldWgzNVh1ZEFrVERpNHBLWlZHNEJZbnFLZnBjU1ZYNDl6eTV4eUk2bE43WW56ZDdTMWx3S2xqdWJlY1RNVkZENEcyU2l6dXlQeVBLTE5Qb0hCK1U4aFY3UzJqaDM4bzZJVkpTcktGSDJsY3E0SlkwaGtaTitrL0xVbWtVcmZKNzdZcmMyUnB6OVhLNmRveHRMbkpUUEVsWHJycHRwdkx0Q1hpNi9pckVyTzJsNzAvV1poanYzTTlMT2ZZVHNoUjZRPT0gc3NoMnVzZXJAbHZudGVzdDAwMTk0MS5icGMuYnJvYWRjb20ubmV0Cg==",
 "passphrase":"",
 "privateKey":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb1FJQkFBS0NBUUVBbkhqQmEyeTFzcUFIZ2pwc2RZOGZ3R0pWbk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TQSBQUklWQVRFIEtFWS0tLS0tCg==",
 "otherAccount":null,
 "descriptor2":null,
 "discoveryGlobal":"f",
 "descriptor1":null,
 "extensionType":"unixII",
 "useOtherAccountToChangePassword":"false"},
 "cacheBehavior":null,
 "cacheDuration":null,
 "description1":"ssh2",
 "description2":"user",
 "password":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb1FJQkFBS0NBUUVBbkhqQmEyeTFzcUFIZ2pwc2RZOGZ3R0pWbkNSdlFMUndqVWY4Y1NSM08xRlZPS05vCm81UDBNZDRSa0V5enorUjR2cVZQWVlOdmlDaEVYRnJUam1BK0JBTmM2b1BtQVpQT0RTa2huRWo0ZFpHMExpN2QKSU9ueU9ETDk0bmZzblVDdENxanhtZ1RwdHY3Wm56RkpoaUFsR2V1aDM1WHVkQWtURGk0cEtaVkc0QllucUtmcApjU1ZYNDl6eTV4eUk2bE43WW56ZDdTMWx3S2xqdWJlY1RNVkZENEcyU2l6dXlQeVBLTE5Qb0hCK1U4aFY3UzJqCmgzOG82SVZKU3JLRkgybGNxNEpZMGhrWk4ray9MVW1rVXJmSjc3WXJjMlJwejlYSzZkb3h0TG5KVFBFbFhycnAKdHB2THRDWGk2L2lyRXJPMmw3MC9XWmhqdjNNOUxPZllUc2hSNlFJQkl3S0NBUUJtMHdMQzc2cVo5Q0l4QWRJKwpuK0dxVHorU2ZsZTh6bGlYV3pEY291OUVQTUw1VlhDbUFpUWd4U0Y4RlNXMGdESVc0YWt4YzZFUVZQbTVDSHhrCjRDakF6d0tMZXo5Z0gwemtFN2NBVFRXUEZwcjV4d1pYZFNvazdrOFJLanhuVm1NVm9qaGQ1ZmlyZEVYZHBBdSsKaWljQ1o2VGpZb2JCUjhxeGpBeHJ5SDhJU0F1U28zcWI0Q2lMM1lMUWFudHNOSUZZd0VHSEVJcUtKRU9VZUlrQgpwRCtIelh1ekhBTEdiZG1PdUUwVHQxQXdydEVZSHphUDRTZWZsRnVvd1VHeHEwMlN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