Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #108 add authn ldap support #109

Merged
merged 11 commits into from
Apr 16, 2021
Binary file modified bin/darwin_arm64_cybr
Binary file not shown.
Binary file renamed bin/cybr → bin/darwin_cybr
Binary file not shown.
Binary file modified bin/linux_cybr
Binary file not shown.
Binary file modified bin/windows_cybr.exe
Binary file not shown.
13 changes: 11 additions & 2 deletions cmd/conjur.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ var (
// Account conjur account
Account string

// AuthnLDAP Authenticator Service ID
AuthnLDAP string

// PolicyBranch branch policy is being loaded into
PolicyBranch string

Expand Down Expand Up @@ -106,12 +109,17 @@ var conjurLogonCmd = &cobra.Command{
certPath = conjur.GetConjurPemPath(homeDir, Account)
}

err = conjur.CreateConjurRc(Account, BaseURL, InsecureTLS)
err = conjur.CreateConjurRc(Account, BaseURL, InsecureTLS, AuthnLDAP)
if err != nil {
log.Fatalf("Failed to create ~/.conjurrc file. %s\n", err)
}

apiKey, err := conjur.Login(BaseURL, Account, Username, byteSecretVal, certPath)
authnURL := conjur.GetAuthURL(BaseURL, "authn", "")
if AuthnLDAP != "" {
authnURL = conjur.GetAuthURL(BaseURL, "authn-ldap", AuthnLDAP)
}

apiKey, err := conjur.Login(authnURL, Account, Username, byteSecretVal, certPath)
if err != nil {
log.Fatalf("Failed to login and retrieve api key. %s", err)
}
Expand Down Expand Up @@ -396,6 +404,7 @@ func init() {
conjurLogonCmd.MarkFlagRequired("account")
conjurLogonCmd.Flags().StringVarP(&BaseURL, "base-url", "b", "", "Conjur appliance URL")
conjurLogonCmd.MarkFlagRequired("base-url")
conjurLogonCmd.Flags().StringVarP(&AuthnLDAP, "authn-ldap", "", "", "Uses provided Service ID to configure LDAP Authentication")
AndrewCopeland marked this conversation as resolved.
Show resolved Hide resolved
conjurLogonCmd.Flags().BoolVar(&InsecureTLS, "self-signed", false, "Retrieve and use self-signed certificate when sending requests to the Conjur API")

// append-policy
Expand Down
2 changes: 1 addition & 1 deletion docs/cybr.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ Security.
* [cybr users](cybr_users.md) - User actions for PAS REST API
* [cybr version](cybr_version.md) - Display current version

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ All account actions that can be taken via PAS REST API.
* [cybr accounts reconcile](cybr_accounts_reconcile.md) - Mark an account for reconciliation
* [cybr accounts verify](cybr_accounts_verify.md) - Mark an account for verification

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_accounts_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ cybr accounts add [flags]

* [cybr accounts](cybr_accounts.md) - Account actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_accounts_change.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ cybr accounts change [flags]

* [cybr accounts](cybr_accounts.md) - Account actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_accounts_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ cybr accounts delete [flags]

* [cybr accounts](cybr_accounts.md) - Account actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_accounts_get-password.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ cybr accounts get-password [flags]

* [cybr accounts](cybr_accounts.md) - Account actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_accounts_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ cybr accounts get [flags]

* [cybr accounts](cybr_accounts.md) - Account actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_accounts_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ cybr accounts list [flags]

* [cybr accounts](cybr_accounts.md) - Account actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_accounts_move.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ cybr accounts move [flags]

* [cybr accounts](cybr_accounts.md) - Account actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_accounts_reconcile.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ cybr accounts reconcile [flags]

* [cybr accounts](cybr_accounts.md) - Account actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_accounts_verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ cybr accounts verify [flags]

* [cybr accounts](cybr_accounts.md) - Account actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ All applications actions that can be taken via PAS REST API.
* [cybr applications list](cybr_applications_list.md) - List all applications
* [cybr applications list-authn](cybr_applications_list-authn.md) - List all authn methods on a specific application

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_applications_add-authn.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ cybr applications add-authn [flags]

* [cybr applications](cybr_applications.md) - Applications actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_applications_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ cybr applications add [flags]

* [cybr applications](cybr_applications.md) - Applications actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_applications_delete-authn.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ cybr applications delete-authn [flags]

* [cybr applications](cybr_applications.md) - Applications actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_applications_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ cybr applications delete [flags]

* [cybr applications](cybr_applications.md) - Applications actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_applications_list-authn.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ cybr applications list-authn [flags]

* [cybr applications](cybr_applications.md) - Applications actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_applications_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ cybr applications list [flags]

* [cybr applications](cybr_applications.md) - Applications actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_ccp.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ All actions that can be performed with the Central Credential Provider.
* [cybr](cybr.md) - cybr is CyberArk's PAS command-line interface utility
* [cybr ccp get-account](cybr_ccp_get-account.md) - Get account from CCP

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_ccp_get-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ cybr ccp get-account [flags]

* [cybr ccp](cybr_ccp.md) - CCP actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ cybr completion [bash|zsh|fish|powershell]

* [cybr](cybr.md) - cybr is CyberArk's PAS command-line interface utility

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_conjur.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ Perform actions on conjur
* [cybr conjur set-secret](cybr_conjur_set-secret.md) - Set secret in conjur
* [cybr conjur update-policy](cybr_conjur_update-policy.md) - Update policy to conjur

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_conjur_append-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ cybr conjur append-policy [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_conjur_enable-authn.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ cybr conjur enable-authn [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_conjur_get-secret.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ cybr conjur get-secret [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_conjur_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ cybr conjur info [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
4 changes: 2 additions & 2 deletions docs/cybr_conjur_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cybr conjur list [flags]
-h, --help help for list
-i, --inspect Show full object information
-k, --kind string Narrows results to only resources of that kind
-l, --limit int Maximum number of returned resource (default 25)
-l, --limit int Maximum number of returned resources
-o, --offset int Index to start returning results from for pagination
-s, --search string Narrows results to those pertaining to the search query
```
Expand All @@ -34,4 +34,4 @@ cybr conjur list [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_conjur_logoff.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ cybr conjur logoff [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_conjur_logon-non-interactive.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ cybr conjur logon-non-interactive [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
13 changes: 7 additions & 6 deletions docs/cybr_conjur_logon.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ cybr conjur logon [flags]
### Options

```
-a, --account string Conjur account
-b, --base-url string Conjur appliance URL
-h, --help help for logon
-l, --login string Conjur login name
--self-signed Retrieve and use self-signed certificate when sending requests to the Conjur API
-a, --account string Conjur account
--authn-ldap string Uses provided Service ID to configure LDAP Authentication
AndrewCopeland marked this conversation as resolved.
Show resolved Hide resolved
-b, --base-url string Conjur appliance URL
-h, --help help for logon
-l, --login string Conjur login name
--self-signed Retrieve and use self-signed certificate when sending requests to the Conjur API
```

### Options inherited from parent commands
Expand All @@ -33,4 +34,4 @@ cybr conjur logon [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_conjur_replace-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ cybr conjur replace-policy [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_conjur_rotate-api-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ cybr conjur rotate-api-key [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_conjur_set-secret.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ cybr conjur set-secret [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_conjur_update-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ cybr conjur update-policy [flags]

* [cybr conjur](cybr_conjur.md) - Conjur actions

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_logoff.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ cybr logoff [flags]

* [cybr](cybr.md) - cybr is CyberArk's PAS command-line interface utility

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_logon.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ cybr logon [flags]

* [cybr](cybr.md) - cybr is CyberArk's PAS command-line interface utility

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_safes.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ All safe actions that can be taken via PAS REST API.
* [cybr safes remove-member](cybr_safes_remove-member.md) - Remove a member from a safe
* [cybr safes update](cybr_safes_update.md) - Update a safe

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_safes_add-member.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ cybr safes add-member [flags]

* [cybr safes](cybr_safes.md) - Safe actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_safes_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ cybr safes add [flags]

* [cybr safes](cybr_safes.md) - Safe actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_safes_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ cybr safes delete [flags]

* [cybr safes](cybr_safes.md) - Safe actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_safes_list-members.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ cybr safes list-members [flags]

* [cybr safes](cybr_safes.md) - Safe actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_safes_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ cybr safes list [flags]

* [cybr safes](cybr_safes.md) - Safe actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_safes_remove-member.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ cybr safes remove-member [flags]

* [cybr safes](cybr_safes.md) - Safe actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_safes_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ cybr safes update [flags]

* [cybr safes](cybr_safes.md) - Safe actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_users.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ All users actions that can be taken via PAS REST API.
* [cybr users list](cybr_users_list.md) - List cyberark PAS users
* [cybr users unsuspend](cybr_users_unsuspend.md) - Unsuspend a specific user

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_users_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ cybr users add [flags]

* [cybr users](cybr_users.md) - User actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_users_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ cybr users delete [flags]

* [cybr users](cybr_users.md) - User actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_users_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ cybr users list [flags]

* [cybr users](cybr_users.md) - User actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_users_unsuspend.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ cybr users unsuspend [flags]

* [cybr users](cybr_users.md) - User actions for PAS REST API

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
2 changes: 1 addition & 1 deletion docs/cybr_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ cybr version [flags]

* [cybr](cybr.md) - cybr is CyberArk's PAS command-line interface utility

###### Auto generated by spf13/cobra on 30-Mar-2021
###### Auto generated by spf13/cobra on 7-Apr-2021
Loading