ThycoticDSV Deprecated

Deprecated. Use DelineaDSV instead.

Authentication & Identity Management · ThycoticDSV (Deprecated)

Details

IDThycoticDSV
ProviderDelinea
CategoryAuthentication & Identity Management
From Version6.0.0
Docker Imagedemisto/python3:3.9.8.24399
Supported ModulesAgentix XSIAM

README

Thycotic DevOps Secrets Vault is a high velocity vault that centralizes secrets management, enforces access, and provides automated logging trails.
DevOps Secrets Vault is an API-as-a-Service, which makes getting up and running easy. No installation of the vault or database is required and Thycotic even handles all the updates.
This integration was integrated and tested with version 6.0 of ThycoticDSV.
Supported Cortex XSOAR versions: 5.0.0 and later.

Configure ThycoticDSV in Cortex

Parameter Description Required
url Server URL (e.g. https://example.com) True
insecure Trust any certificate (not secure) False
proxy Use system proxy settings False
client_id Client id for client_credentials grant type True
client_secret Client secret for client_credentials grant type True

Commands

You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

dsv-secret-get


Get secret for client

Base Command

dsv-secret-get

Input

Argument Name Description Required
name Name secret for operation Get. Required

Context Output

Path Type Description
secret String JSON object secret

Command Example

!dsv-secret-get name="accounts/xsoar"

Context Example

{
    "DSV": {
        "Secret": {
            "attributes": {},
            "created": "2020-12-15T11:50:45Z",
            "createdBy": "users:thy-one:anikolaev@accessecm.com",
            "data": {
                "password": "XSOARPassword",
                "username": "xsoar"
            },
            "description": "",
            "id": "e88f725b-ff1c-4902-961e-fcdf3c7f712f",
            "lastModified": "2020-12-20T14:17:03Z",
            "lastModifiedBy": "users:thy-one:anikolaev@accessecm.com",
            "path": "accounts:xsoar",
            "version": "1"
        }
    }
}

Human Readable Output

{‘id’: ‘e88f725b-ff1c-4902-961e-fcdf3c7f712f’, ‘path’: ‘accounts:xsoar’, ‘attributes’: {}, ‘description’: ‘’, ‘data’: {‘password’: ‘XSOARPassword’, ‘username’: ‘xsoar’}, ‘created’: ‘2020-12-15T11:50:45Z’, ‘lastModified’: ‘2020-12-20T14:17:03Z’, ‘createdBy’: ‘users:thy-one:anikolaev@accessecm.com’, ‘lastModifiedBy’: ‘users:thy-one:anikolaev@accessecm.com’, ‘version’: ‘1’}

Configuration parameters

  • url — Server URL (e.g. https://example.com) (required)
  • insecure — Trust any certificate (not secure)
  • proxy — Use system proxy settings
  • client_id — Client ID (required)
  • client_secret — Client Secret (required)

Commands (1)

  • dsv-secret-get

    Getting a secret fom DSV

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401
import urllib3
from CommonServerUserPython import *
#   from typing import Dict

# Disable insecure warnings
urllib3.disable_warnings()


class Client(BaseClient):
    def __init__(self, server_url: str, client_id: str, client_secret: str, proxy: bool, verify: bool):
        super().__init__(base_url=server_url, proxy=proxy, verify=verify)
        self._client_id = client_id
        self._client_secret = client_secret
        self._token = self._generate_token()
        self._headers = {'Authorization': self._token, 'Content-Type': 'application/json'}

    def _generate_token(self) -> str:
        body = {
            "client_id": self._client_id,
            "client_secret": self._client_secret,
            "grant_type": "client_credentials",
            "provider": "thy-one"
        }

        headers = {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
        return "Bearer " + (self._http_request("POST", "/v1/token", headers=headers, data=body)).get('accessToken')

    def getSecret(self, name: str) -> str:
        return self._http_request("GET", url_suffix="/v1/secrets/" + str(name))


def dsv_secret_get_command(client, name: str = ''):
    secret = client.getSecret(name)
    markdown = tableToMarkdown("Information", secret)

    return CommandResults(
        readable_output=markdown,
        outputs_prefix="DSV.Secret",
        outputs_key_field="secret",
        raw_response=secret,
        outputs=secret
    )


def test_module(client) -> str:
    if client._token == '':
        raise Exception('Failed to get authorization token. Check you credential and access to DSV.')

    return 'ok'


def main():
    client_id = demisto.params().get('client_id')
    client_secret = demisto.params().get('client_secret')

    # get the service API url
    url = demisto.params().get('url')
    proxy = demisto.params().get('proxy', False)
    verify = not demisto.params().get('insecure', False)
#    credential_objects = demisto.params().get('credentialobjects')

    LOG(f'Command being called is {demisto.command()}')

    thycotic_commands = {
        'dsv-secret-get': dsv_secret_get_command
    }

    try:
        client = Client(server_url=url,
                        client_id=client_id,
                        client_secret=client_secret,
                        proxy=proxy,
                        verify=verify)

        if demisto.command() in thycotic_commands:
            return_results(
                thycotic_commands[demisto.command()](client, **demisto.args())  # type: ignore[operator]
            )

        elif demisto.command() == 'test-module':
            # This is the call made when pressing the integration Test button.
            result = test_module(client)
            demisto.results(result)

    except Exception as e:
        return_error(f'Failed to execute {demisto.command()} command. Error: {str(e)}')


if __name__ in ('__main__', '__builtin__', 'builtins'):
    main()