Skip to content

A "Swiss Army Knife" command-line interface (CLI) for easy human and non-human interaction with @cyberark suite of products.

License

Notifications You must be signed in to change notification settings

aharriscybr/cybr-cli

 
 

cybr-cli

A "Swiss Army Knife" command-line interface (CLI) for easy human and non-human interaction with CyberArk's suite of products.

Current products supported:

  • CyberArk Privileged Access Security (PAS)
  • CyberArk Conjur Secrets Manager Enterprise & Open Source

Want to get dangerous quickly? Check out the example bash script at dev/add-delete-pas-application.sh.

cybr-cli CI Quality Gate Status CodeQL

Table of Contents

Install

MacOS

$ brew tap infamousjoeg/tap
$ brew install cybr-cli

Windows or Linux

Download from the Releases page.

AWS CloudShell

mkdir -p ~/.local/bin && \
curl --silent "https://api.github.com/repos/infamousjoeg/cybr-cli/releases/latest" |
    grep '"tag_name":' |
    sed -E 's/.*"([^"]+)".*/\1/' |
    xargs -I {}  curl -o ~/.local/bin/cybr -sOL "https://github.com/infamousjoeg/cybr-cli/releases/download/"{}'/linux_cybr' && \
chmod +x ~/.local/bin/cybr

Install from Source

$ git clone https://github.com/infamousjoeg/pas-api-go.git
$ ./install
$ cybr help

Usage

  • $ cybr help for top-level commands list
  • $ cybr [command] -h for specific command details and sub-commands list

All commands are documentated in the docs/ directory.

Autocomplete

The cybr CLI has a completion command that can be used to enable autocomplete for the CLI. The completion command is dependant on your shell type. Currently the only shells that are supported are: bash, zsh, fish and powershell.

Below is an example on how to enable cybr cli auto-completion from a zsh shell.

# enable shell completetion. Only needs to be performed once.
echo "autoload -U compinit; compinit" >> ~/.zshrc

# create and write the auto-completion script.
# ${fpath[1]} '1' may be different depending on your environment.
cybr completion zsh > "${fpath[1]}/_cybr"

If you are using a different shell execute the completion command with the --help flag and follow instructions for the desired shell type.

cybr completion --help

Example Source Code

Logon to the PAS REST API Web Service

package main

import (
	"fmt"
	"log"
	"os"

	pasapi "github.com/infamousjoeg/pas-api-go/pkg/cybr/api"
)

var (
	hostname = os.Getenv("PAS_BASE_URL")
	username = os.Getenv("PAS_USERNAME")
	password = os.Getenv("PAS_PASSWORD")
	authType = os.Getenv("PAS_AUTH_TYPE")
)

func main() {
	// Logon to PAS REST API Web Services
	token, errLogon := pasapi.Logon(hostname, username, password, authType, false)
	if errLogon != nil {
		log.Fatalf("Authentication failed. %s", errLogon)
	}
	fmt.Printf("Session Token:\r\n%s\r\n\r\n", token)
}

Testing

go test -v ./...

Maintainers

@infamousjoeg

Buy me a coffee

@AndrewCopeland

Contributions

Pull Requests are currently being accepted. Please read and follow the guidelines laid out in CONTRIBUTING.md.

License

Apache 2.0

About

A "Swiss Army Knife" command-line interface (CLI) for easy human and non-human interaction with @cyberark suite of products.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.5%
  • Shell 1.3%
  • Dockerfile 0.2%