Code Monkey home page Code Monkey logo

clisso's People

Contributors

bitte-ein-bit avatar brandonstrohmeyer avatar dependabot[bot] avatar dmitriyr333 avatar eliran-allcloud avatar eliran89c avatar esilva-everbridge avatar johananl avatar mmoyle avatar narkoleptik avatar tristanmcpherson avatar uznog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

clisso's Issues

Move to Go modules?

Moving from dep to Golang modules can make dependency management and building easier. It's nice to be able to simply git clone && make anywhere, without thinking about GOPATH etc.

Could not get temporary credentials: generating SAML assertion: doing HTTP request: 401 Unauthorized

Hello,

in my setup I have many different AWS accounts and each account has many roles. I am running into this issue with version 0.7.0 where if I get a credential from one account it works but if I try to get a credential from a different account right after I receive the error

Could not get temporary credentials: generating SAML assertion: doing HTTP request: 401 Unauthorized

It seems that if i delete the credential from my aws config as well as remove the clisso config and set it up again I am able to generate the other credential. It seems it can only be one at a time for some reason.
Thanks!

400 Bad Request when getting credentials

I have a OneLogin account connected to several AWS accounts. The OneLogin integration works fine from the OneLogin UI.

However, when I try to 'get' an AWS account, I get the following error:

$ clisso get stage
Could not get temporary credentials: generating SAML assertion: doing HTTP request: 400 Bad Request

I have gone through the steps to create a provider and the app, neither of which generated any errors.

Any idea what is going on here? Some configuration error in OneLogin?

Validate device ID

clisso/onelogin/get.go

Lines 96 to 105 in 98434dc

if len(devices) > 1 {
for i, d := range devices {
fmt.Printf("%d. %d - %s\n", i+1, d.DeviceId, d.DeviceType)
}
fmt.Printf("Please choose an MFA device to authenticate with (1-%d): ", len(devices))
var selection int
fmt.Scanln(&selection)
deviceID = fmt.Sprintf("%v", devices[selection-1].DeviceId)

When selecting an invalid index, the app will panic.

Update README

README isn't up to date at the moment.

Things which need to be present:

  • Overview
  • Installation
  • Usage
  • Developing
  • Caveats
  • TODO

Move Spinner code to function

With this API for spinner, it would be easy to forget to call Stop() when handling errors and spin forever.

Maybe it could be changed to a function to help you rememeber to clean up?

s.Run(func() {
  // after this runs the spinner is stopped
})

Image of Max H Max H

Originally posted by @pullrequest[bot] in #96 (comment)

Get a group of apps

Most of the times we are working with more than one app at the same time. At the moment, to get credentials one needs to call clisso get appname for each app and introduce the password (and the otp if configured) for each call.

This is redundant and my proposal is to add the possibility to either call get with multiple app names (ex: clisso get appname1 appname2 appname3) or cache the authentication (for let's say 30 sec).

WDYT?

Improve CLI output

  • Separate stdout/stderr
  • Enable silent mode for | sh
  • Add spinner
  • Terminal colors

Store passwords in system keychains

Storing passwords in system keychains would ensure that lost/ compromised machines don't leak onelogin passwords (or: if they do, it's not down to this tool).

A simple implementation could use runtime.GOOS to determine the OS and infer keychains from there (a good jumping off point would be via: https://github.com/tmc/keyring) and then default to the config file/ asking should it be unable to access any).

Add license

Need to choose a suitable OSS license and add license info to source.

Handle missing ~/.aws directory

At the moment, when trying to run clisso get when the ~/.aws directory doesn't exist, Clisso exits with the following error:

Error processing credentials: writing credentials to file: open /Users/<user>/.aws/credentials: no such file or directory

It is probably safe to create this directory if it doesn't exist, and perhaps show a warning to the user. The ~/.aws/credentials file is already created automatically if it doesn't exist.

Clisso newer than 0.7 causes 500 errors in OneLogin

This is with 2FA turned on. Think it can be pretty easily reproduced. The --debug flag would be useful as while a 500 error is their problem, they won't support it without:

Just generate data showing all the input parameters and the full HTTP header data that is returned when you get that 500 internal server error response from OneLogin.

Extract ARNs from SAML on onelogin

Given that onelogin/ aws saml reponses return necessary ARNs, extract these and use them to generate credentials rather than hardcoding them in config.

Where multiple ARNs exist, such as is the case with the onelogin multi-account app, present a form for a user to select from.

This approach is used in onelogin reference implementations of pulling AWS creds:

  1. https://developers.onelogin.com/api-docs/1/samples/aws-cli
  2. https://github.com/onelogin/onelogin-aws-cli-assume-role/blob/master/onelogin-aws-assume-role-cli/src/main/java/com/onelogin/aws/assume/role/cli/OneloginAWSCLI.java#L222-L241

Question: how to assign a default AWS region?

Everything I use Clisso get, I have to set up the AWS region again. Can there be a way to set this up in the provider? I can't seem to use the "region" for this as it seems that it is used for something else.

End-to-end tests

At the moment we have no e2e tests for Clisso. It would be extremely valuable to be able to verify the application actually works, possibly on every pull request etc.

I was thinking about adding a directory for e2e tests, and using the built-in Golang testing library to spawn a Clisso process with various arguments, then verifying the process' stdout and result (credentials written to shell / file etc.).

Ideally we should have a way of doing so without communicating with real resources. The OneLogin API can probably be mocked easily using a simple HTTP server with pre-configured responses. Mocking AWS IAM may be slightly more complicated (but maybe something like this or this could help?).

Start versioning

Need to start versioning the project, including displaying version info on clisso version.

Add debug flag

It could be very useful to have a --debug flag on Clisso which would cause the app to log for example HTTP requests.

Use an interface to abstract provider types

clisso/cmd/get.go

Lines 87 to 109 in baae940

if pType == "onelogin" {
creds, err := onelogin.Get(app, provider)
if err != nil {
log.Fatal(color.RedString("Could not get temporary credentials: "), err)
}
// Process credentials
err = processCredentials(creds, app)
if err != nil {
log.Fatalf(color.RedString("Error processing credentials: %v"), err)
}
} else if pType == "okta" {
creds, err := okta.Get(app, provider)
if err != nil {
log.Fatal(color.RedString("Could not get temporary credentials: "), err)
}
// Process credentials
err = processCredentials(creds, app)
if err != nil {
log.Fatalf(color.RedString("Error processing credentials: %v"), err)
}
} else {
log.Fatalf(color.RedString("Unsupported identity provider type '%s' for app '%s'"), pType, app)
}

We could use an interface to eliminate the code duplication above and have something like the following:

p := NewProvider(pType)
creds, err := p.Get()
...

The concrete provider type would be constructed based on the invoked command.

Print app name in `clisso get`

Need to print the app name in the output of clisso get, especially when running the command without arguments (that is - when getting the selected app).

Error - Could not get temporary credentials: EOF

Hello,
I'm trying to setup the clisso on my windows machine. The okta is configured with the MFA (okta verify). I tried various ways to get the temp token. It accepts my password and challenges for the MFA (OTP from my MFA device - Okta verify app) and then gets the following error
"Could not get temporary credentials: EOF"

Here are the various commands that I tried
C:\Program Files\clisso-windows-386.exe>clisso.exe get okta
Please enter my-provider password:
Please enter the OTP from your MFA device: 951212
Could not get temporary credentials: EOF

C:\Program Files\clisso-windows-386.exe>clisso.exe get okta -w "C:\Users\dinesh.katariya.aws\credentials"
Please enter my-provider password:
Please enter the OTP from your MFA device: 412350
Could not get temporary credentials: EOF

C:\Program Files\clisso-windows-386.exe>clisso.exe get okta -s
Please enter my-provider password:
Please enter the OTP from your MFA device: 009326
Could not get temporary credentials: EOF

Support OneLogin app lookup

Need to see if there is a convenient (and secure!) way to query the OneLogin API for existing applications for the user. This could save having to configure applications in the config file.

Reduce nested if statements

This point in the code is very deeply nested within if statements, which makes it difficult to tell if the error handling is correct.

Maybe you could extract this into a helper function? Extracting this code into a smaller helper function, maybe something likefetchMFA(), could reduce the complexity of this code and make it less error-prone.

Image of Max H Max H

Originally posted by @pullrequest[bot] in #96 (comment)

Error should be handled first

clisso/aws/aws.go

Lines 40 to 47 in 3beeddd

if err == nil {
if time.Now().UTC().Unix() > v.Unix() {
cfg.DeleteSection(s.Name())
}
} else {
log.Printf(color.YellowString("Cannot parse date (%v) in section %s: %s",
s.Key("aws_expiration")), s.Name(), err)
}

We should first return on error, then continue normal flow without else.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.