Tchater maintenant avec le support
Tchattez avec un ingénieur du support

Safeguard for Privileged Sessions On Demand Hosted - REST API Reference Guide

Introduction Using the SPS REST API Basic settings User management and access control Managing SPS General connection settings HTTP connections Citrix ICA connections MSSQL connections RDP connections SSH connections Telnet connections VNC connections Search, download, and index sessions Reporting Health and maintenance Advanced authentication and authorization Completing the Welcome Wizard using REST Enable and configure analytics using REST

Advanced authentication and authorization

Topics:

Usermapping policy

For SSH, RDP, Telnet, and Citrix ICA connections, usermapping policies can be defined. A usermapping policy describes who can use a specific username to access the remote server: only members of the specified local or LDAP usergroups (for example, administrators) can use the specified username (for example, root) on the server.

URL
GET https://<IP-address-of-SPS>/api/configuration/policies/usermapping_policies
Cookies
Cookie name Description Required Values
session_id Contains the authentication token of the user Required

The value of the session ID cookie received from the REST server in the authentication response, for example, a1f71d030e657634730b9e887cb59a5e56162860. For details on authentication, see Authenticate to the SPS REST API.

NOTE: This session ID refers to the connection between the REST client and the SPS REST API. It is not related to the sessions that SPS records (and which also have a session ID, but in a different format)..

Sample request

The following command lists the existing usermapping policies.

curl --cookie cookies https://<IP-address-of-SPS>/api/configuration/policies/usermapping_policies

The following command retrieves the properties of a specific usermapping policy.

curl --cookie cookies https://<IP-address-of-SPS>/api/configuration/policies/usermapping_policies<object-id>
Response

The following is a sample response received when listing usermapping policies.

For details of the meta object, see Message format.

{
  "meta": {
    "first": "/api/configuration/policies/audit_policies",
    "href": "/api/configuration/policies/usermapping_policies",
    "last": "/api/configuration/policies/usermapping_policies",
    "next": null,
    "parent": "/api/configuration/policies",
    "previous": "/api/configuration/policies/userlists",
    "transaction": "/api/transaction"
  },
  "items": [
    {
      "key": "11581153055704544883f77",
      "meta": {
        "href": "/api/configuration/policies/usermapping_policies/11581153055704544883f77"
      }
    },
    {
      "key": "9328731525704545f5e3de",
      "meta": {
        "href": "/api/configuration/policies/usermapping_policies/9328731525704545f5e3de"
      }
    }
  ]
}

When retrieving the endpoint of a specific host key, the response is the following.

{
  "body": {
    "allow_other_remote_users_without_mapping": false,
    "mappings": [
      {
        "allowed_groups": [],
        "remote_user": "test"
      },
      {
        "allowed_groups": [
          "admins"
        ],
        "remote_user": "root"
      }
    ],
    "name": "Test"
  },
  "key": "9328731525704545f5e3de",
  "meta": {
    "first": "/api/configuration/policies/usermapping_policies/277736452570454272e157",
    "href": "/api/configuration/policies/usermapping_policies/9328731525704545f5e3de",
    "last": "/api/configuration/policies/usermapping_policies/9328731525704545f5e3de",
    "next": null,
    "parent": "/api/configuration/policies/usermapping_policies",
    "previous": "/api/configuration/policies/usermapping_policies/11581153055704544883f77",
    "transaction": "/api/transaction"
  }
}
Element Type Description
key string Top level element, contains the ID of the policy.
body Top level element (string) The elements of the usermapping policy.
allow_other_remote_users_without_mapping boolean

Default value: true.

To allow access the remote servers for users who are not explicitly listed in the Usermapping Policy, configure true. Note that these users must use the same username on the SPS gateway and the remote server.

mappings Top level list Contains the list of user groups and the corresponding remote usernames the group members can use to log in.
allowed_groups list

The usergroups allowed to log in as the remote_user on the remote server.

Required element. Empty means all users.

remote_user string

The username on the remote server that the users configured in allowed_groups can use to log in.

Required element. Must have a value.

Example mappings:

Anyone can log in to the remote server as the test user:

"mappings": [
  {
    "allowed_groups": [],
    "remote_user": "test"
  }
Only the members of the admin group can log in to the remote server as the root user:
"mappings": [
  {
    "allowed_groups": [
      "admins"
    ],
    "remote_user": "root"
  }
    
Status and error codes

The following table lists the typical status and error codes for this request. For a complete list of error codes, see Application level error codes.

Code Description Notes
201 Created The new resource was successfully created.
400 InvalidQuery The requested filter or its value is invalid.
401 Unauthenticated The requested resource cannot be retrieved because the client is not authenticated and the resource requires authorization to access it. The details section contains the path that was attempted to be accessed, but could not be retrieved.
403 Unauthorized The requested resource cannot be retrieved because the client is not authorized to access it. The details section contains the path that was attempted to be accessed, but could not be retrieved.
404 NotFound The requested object does not exist.
Add a usermapping policy

To add a usermapping policy, you have to:

  1. Open a transaction.

    For more information, see Open a transaction.

  2. Create the JSON object for the new usermapping policy.

    POST the JSON object to the https://<IP-address-of-SPS>/api/configuration/policies/usermapping endpoint. You can find a detailed description of the available parameters listed in Element .

    If the POST request is successful, the response includes the key of the new usermapping policy. For example:

    {
      "key": "2e8692fa-7fda-4753-8363-37e8244f6b80",
      "meta": {
        "href": "/api/configuration/policies/usermapping_policies/2e8692fa-7fda-4753-8363-37e8244f6b80",
        "parent": "/api/configuration/policies/usermapping_policies",
        "transaction": "/api/transaction"
      }
    }
  3. Commit your changes.

    For more information, see Commit a transaction.

Modify a usermapping policy

To modify a usermapping policy, you have to:

  1. Open a transaction.

    For more information, see Open a transaction.

  2. Modify the JSON object of the usermapping policy.

    PUT the modified JSON object to the https://<IP-address-of-SPS>/api/configuration/policies/usermapping/<key-of-the-object> endpoint. You can find a detailed description of the available parameters listed in Element .

  3. Commit your changes.

    For more information, see Commit a transaction.

Plugins

Contains the endpoints for configuring plugins.

URL
GET https://<IP-address-of-SPS>/api/configuration/plugins
Cookies
Cookie name Description Required Values
session_id Contains the authentication token of the user Required

The value of the session ID cookie received from the REST server in the authentication response, for example, a1f71d030e657634730b9e887cb59a5e56162860. For details on authentication, see Authenticate to the SPS REST API.

NOTE: This session ID refers to the connection between the REST client and the SPS REST API. It is not related to the sessions that SPS records (and which also have a session ID, but in a different format)..

Sample request

The following command lists endpoints for configuring plugins.

curl --cookie cookies https://<IP-address-of-SPS>/api/configuration/plugins
Response

The following is a sample response received when listing endpoints for configuring plugins.

For details of the meta object, see Message format.

{
    "items": [
        {
            "key": "aa",
            "meta": {
                "href": "/api/configuration/plugins/aa"
            }
        },
        {
            "key": "configuration_sync",
            "meta": {
                "href": "/api/configuration/plugins/configuration_sync"
            }
        },
        {
            "key": "credentialstore",
            "meta": {
                "href": "/api/configuration/plugins/credentialstore"
            }
        },
        {
            "key": "signingca",
            "meta": {
                "href": "/api/configuration/plugins/signingca"
            }
        }
    ],
    "meta": {
        "first": "/api/configuration/aaa",
        "href": "/api/configuration/plugins",
        "last": "/api/configuration/x509",
        "next": "/api/configuration/policies",
        "parent": "/api/configuration",
        "previous": "/api/configuration/passwords",
        "remaining_seconds": 600,
        "transaction": "/api/transaction"
    }
}
Element Description
aa Endpoint for configuring authentication and authorization plugins.
configuration_sync Endpoint for configuring plugins that synchronize the configuration of SPS clusters that receive their configuration from the Central Management node.
credentialstore Endpoint for configuring credential store plugins.
signingca Endpoint for configuring plugins to sign certificates.
Status and error codes

The following table lists the typical status and error codes for this request. For a complete list of error codes, see Application level error codes.

Code Description Notes
401 Unauthenticated The requested resource cannot be retrieved because the client is not authenticated and the resource requires authorization to access it. The details section contains the path that was attempted to be accessed, but could not be retrieved.
403 Unauthorized The requested resource cannot be retrieved because the client is not authorized to access it. The details section contains the path that was attempted to be accessed, but could not be retrieved.
404 NotFound The requested object does not exist.

Upload a plugin

To upload or update a plugin, complete the following steps. To update a plugin, upload a new version. Starting with version 6.4, you can also delete plugins using the REST API. For details, see Delete a plugin.

  1. Open a transaction.

    For more information, see Open a transaction.

  2. POST the plugin as a zip file (application/zip) to the https://<IP-address-of-SPS>/api/upload/plugins endpoint, for example:

    curl -X POST -H "Content-Type: application/zip" --cookie cookies https://<IP-address-of-SPS>/api/upload/plugins --data-binary @<path-to-plugin.zip>

    If the POST request is successful, the response includes the key of the new plugin, as well as information about the uploaded plugin. For example:

    {
        "meta": {
            "href": "/api/configuration/plugins/aa/aa423b72-0d0f-4275-be30-494e9a99ffad",
            "parent": "/api/configuration/plugins/aa"
        },
        "key": "aa423b72-0d0f-4275-be30-494e9a99ffad",
        "body": {
            "name": "Sample-Authentication-Plugin",
            "description": "My custom authentication plugin",
            "version": "1.12",
            "path": "/opt/scb/var/plugins/aa/Sample-Authentication-Plugin",
            "api": "1.0"
        }
    }
  3. Commit your changes.

    For more information, see Commit a transaction.

Note the following points.

  • Re-uploading an already existing plugin overwrites the existing plugin.

  • Uploading a newer version of an already existing plugin overwrites the existing plugin.

Status and error codes

The following table lists the typical status and error codes for this request. For a complete list of error codes, see Application level error codes.

Code Description Notes
201 Created The plugin has been successfully uploaded. The response should include the key of the created object.
400 The plugin does not support this version of SPS.
400 InvalidPlugin The type or some other value in the Manifest file of the plugin is invalid, or this version of SPS does not support this type of plugin. Check the error key in the response for details.
401 Unauthenticated The requested resource cannot be retrieved because the client is not authenticated and the resource requires authorization to access it. The details section contains the path that was attempted to be accessed, but could not be retrieved.
422 TransactionProcessingError The plugin was uploaded but deploying the plugin failed for some reason.
Documents connexes

The document was helpful.

Sélectionner une évaluation

I easily found the information I needed.

Sélectionner une évaluation