CyberArk: Get Password – cURL – Cert-Based Auth

Passwords can be retrieved from CyberArk credential provider using REST API.

In the following note i’ll show how to get account details, including password or SSH-key, from CyberArk safe from the command line using curl.

To authenticate on CyberArk i will use certificate-based authentication method.

Get Password from CyberArk

Use one of the following commands to get all account details or retrieve a password value only from CyberArk credential provider.

Get account details from CyberArk:

$ curl -sSf --cacert "{{CACert}}" --cert "{{Cert}}" --key "{{Key}}" \
  '{{BaseURL}}/AIMWebService/api/Accounts?AppID={{AppID}}&Safe={{Safe}}&Folder={{Folder}}&Object={{ObjectName}}' \
  -H 'Content-Type: application/json'

Get password value only:

$ curl -sSf --cacert "{{CACert}}" --cert "{{Cert}}" --key "{{Key}}" \
  '{{BaseURL}}/AIMWebService/api/Accounts?AppID={{AppID}}&Safe={{Safe}}&Folder={{Folder}}&Object={{ObjectName}}' \
  -H 'Content-Type: application/json' | grep -Po '"Content":"\K[^"]+'

CyberARK Request Parameters

ParameterDescription
AppIDThe unique ID of the application issuing the password request
SafeThe name of the Safe where the password is stored
FolderThe name of the folder where the password is stored (default: Root)
ObjectThe name of the password object to retrieve

More available parameters can be found here.

cURL Options

OptionDescription
-s, --silentDon’t show progress meter or error messages
-S, --show-errorWhen used with -s, --silent, it makes curl show an error message if it fails
-f, --failReturn an error if HTTP status code is not 200
-H, --header <header>Extra HTTP header to include in the request
--cacert <file>CA bundle file
--cert <file>Certificate file
--key <file>Key file
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值