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

v0.0.6-alpha Release #51

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f8625a6
Do not list unless prompted to list (#21)
AndrewCopeland Jan 8, 2021
d5dd264
Push current README changes for review
infamousjoeg Jan 8, 2021
6a5ba00
Fix typo to resolve issue #23 (#24)
AndrewCopeland Jan 8, 2021
a1abeec
modify the application CMD for authn-<action> (#25)
AndrewCopeland Jan 8, 2021
26fa9fe
Fix unit tests (#26)
AndrewCopeland Jan 8, 2021
06fb635
fix dev example
infamousjoeg Jan 8, 2021
a2f1710
Added code of conduct, contributing, updated readme
infamousjoeg Jan 9, 2021
99eaf76
v0.0.4-alpha
infamousjoeg Jan 11, 2021
7c167ea
Conjur commands (#27)
AndrewCopeland Jan 11, 2021
bb3b27e
Update conjur.go
infamousjoeg Jan 11, 2021
8f8a584
Merge branch 'dev' of https://github.com/infamousjoeg/pas-api-go into…
infamousjoeg Jan 11, 2021
bea2fbb
Safe members (#29)
AndrewCopeland Jan 11, 2021
e0fde5c
Number of Days will not be omitted when 0
AndrewCopeland Jan 12, 2021
f3aefd7
Dev creating application flow (#34)
AndrewCopeland Jan 12, 2021
e3f0d02
Merge branch 'main' into dev
AndrewCopeland Jan 12, 2021
33706b4
v0.0.5-alpha Ready for Release (#35)
infamousjoeg Jan 13, 2021
389cb05
Add new line to commands #33 (#39)
AndrewCopeland Jan 13, 2021
43aea0e
#38 Add cybr conjur logoff command (#40)
AndrewCopeland Jan 13, 2021
1dc2342
#44 refactor api tests (#45)
AndrewCopeland Jan 14, 2021
f8c0e92
Add #37 add verbose v006 (#41)
AndrewCopeland Jan 15, 2021
6c5dbc3
Fix #42 RADIUS authentication support for push, append, challenge/res…
infamousjoeg Jan 15, 2021
9b3901d
#30 Unsuspend a user from failed logon attempts (#43)
AndrewCopeland Jan 15, 2021
0c2cbfd
Merge branch 'main' into v006
infamousjoeg Jan 15, 2021
02f5804
Add logger to user api pkg
AndrewCopeland Jan 15, 2021
1116688
Remove duplicate tests
AndrewCopeland Jan 15, 2021
55ea054
Implement client.GetLogger() function so null logger cannot be returned
AndrewCopeland Jan 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix #42 RADIUS authentication support for push, append, challenge/res…
…ponse modes (#48)

* support for radius authentication append,  push and challened/response
  • Loading branch information
infamousjoeg authored Jan 15, 2021
commit 6c5dbc3f1a5e593a2079624ce707213485f4be05
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Current products supported:

- [Install](#install)
- [MacOS](#macos)
- [Windows & Linux](#windows-or-linux)
- [Windows or Linux](#windows-or-linux)
- [Usage](#usage)
- [Command-Line Interface (CLI)](#command-line-interface-cli)
- [logon](#logon)
Expand Down Expand Up @@ -101,7 +101,7 @@ $ cybr logon -u username -a cyberark-or-ldap -b https://pvwa.example.com
|-b|--base-url|☑||URL to /PasswordVault|https://pvwa.example.com|
|-i|--insecure-tls||false|Whether to validate TLS|false|

Logon to the PAS REST API as the username you provide using the authentication method you choose. At this time, only `cyberark` and `ldap` authentication methods are supported.
Logon to the PAS REST API as the username you provide using the authentication method you choose. At this time, only `cyberark`, `ldap`, `radius` authentication methods are supported. If your RADIUS server is configured for challenge/response, you will first be prompted for your `password` followed by your `one-time passcode`.

Upon successful logon, a file will be created in your user's home directory at `.cybr/config`. It is an encoded file that cannot be read in plain-text. This holds your current session information.

Expand Down
8 changes: 2 additions & 6 deletions cmd/logoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ var logoffCmd = &cobra.Command{
if err != nil {
log.Fatalf("Failed to read configuration file. %s", err)
}
// Logoff the PAS REST API
err = client.Logoff()
if err != nil {
log.Fatalf("Failed to log off. %s", err)
return
}
// Remove the config file written to local file system
err = client.RemoveConfig()
if err != nil {
log.Fatalf("Failed to remove configuration file. %s", err)
}
// Logoff the PAS REST API
_ = client.Logoff()

fmt.Println("Successfully logged off PAS.")
},
Expand Down
25 changes: 21 additions & 4 deletions cmd/logon.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"
"log"
"strings"
"syscall"

pasapi "github.com/infamousjoeg/cybr-cli/pkg/cybr/api"
Expand Down Expand Up @@ -53,9 +54,25 @@ var logonCmd = &cobra.Command{
}

err = client.Logon(credentials)
if err != nil {
if err != nil && !strings.Contains(err.Error(), "ITATS542I") {
log.Fatalf("Failed to Logon to the PVWA. %s", err)
return
}

// if error contains challenge error code, deal with OTPCode here instead and redo client.Logon()
if err != nil {
// Get secret value from STDIN
fmt.Print("Enter one-time passcode: ")
byteOTPCode, err := terminal.ReadPassword(int(syscall.Stdin))
credentials.Password = string(byteOTPCode)
fmt.Println()
if err != nil {
log.Fatalln("An error occurred trying to read one-time passcode from " +
"Stdin. Exiting...")
}
err = client.Logon(credentials)
if err != nil {
log.Fatalf("Failed to respond to challenge. Possible timeout occurred. %s", err)
}
}

err = client.SetConfig()
Expand All @@ -71,10 +88,10 @@ var logonCmd = &cobra.Command{
func init() {
logonCmd.Flags().StringVarP(&Username, "username", "u", "", "Username to logon PAS REST API using")
logonCmd.MarkFlagRequired("username")
logonCmd.Flags().StringVarP(&AuthenticationType, "auth-type", "a", "", "Authentication method to logon using")
logonCmd.Flags().StringVarP(&AuthenticationType, "auth-type", "a", "", "Authentication method to logon using [cyberark|ldap|radius]")
logonCmd.MarkFlagRequired("authType")
logonCmd.Flags().BoolVarP(&InsecureTLS, "insecure-tls", "i", false, "If detected, TLS will not be verified")
logonCmd.Flags().StringVarP(&BaseURL, "base-url", "b", "", "Base URL to send Logon request to")
logonCmd.Flags().StringVarP(&BaseURL, "base-url", "b", "", "Base URL to send Logon request to [https://pvwa.example.com]")
logonCmd.MarkFlagRequired("base-url")
rootCmd.AddCommand(logonCmd)
}
1 change: 1 addition & 0 deletions pkg/cybr/api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func (c *Client) Logon(req LogonRequest) error {
return err
}

// Handle cyberark, ldap, and radius push, append & challenge/response authentication methods
url := fmt.Sprintf("%s/PasswordVault/api/auth/%s/logon", c.BaseURL, c.AuthType)
token, err := httpJson.SendRequestRaw(url, "POST", "", req, c.InsecureTLS, c.Logger)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cybr/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func getUserHomeDir() (string, error) {

// IsValid checks to make sure that the authentication method chosen is valid
func (c *Client) IsValid() error {
if c.AuthType == "cyberark" || c.AuthType == "ldap" {
if c.AuthType == "cyberark" || c.AuthType == "ldap" || c.AuthType == "radius" {
return nil
}
return fmt.Errorf("Invalid auth type '%s'", c.AuthType)
Expand Down