Giter VIP home page Giter VIP logo

alks-cli's Introduction

ALKS CLI

NPM

Build Status

About

CLI for working with the ALKS service.

Prerequisites

To install and use the ALKS CLI, you will need Node.js (version 10 or greater) and NPM (nodejs.org).

Installing

ALKS CLI is meant to be installed via NPM.

npm install -g alks

Configuring

The ALKS CLI requires some basic environment information to get started. Simply run the configuration command and you'll be prompted for the necessary configuration settings.

alks developer configure
  • ALKS Server: The full URL to your ALKS server (ex: https://alks.company.com/rest)
  • Network Username: Your network username. Note: This is not your email prefix and can be found on the ALKS Users tab for an account at alks.coxautoinc.com
  • Network Password: Your network password (needed for loading list of accounts/roles)
  • Save Network Password: Whether or not to save your network password, we suggest saving your password for ease of use
  • Default Account/Role: Select the default ALKS account/role to use
  • Default Output Format: Select the default format to use when printing information such as ALKS Keys

Some commands will also work without configuration if the ALKS_SERVER, ALKS_USERID, and either ALKS_PASSWORD or ALKS_REFRESH_TOKEN environment variables are set, although you may be required to specify the output format, account, or role to use explicitly via CLI flags since no default configuration is set in this case.

Running

After installing the ALKS CLI it will be available on your path. Simply run the following to see a list of supported commands:

alks

Options

To see a what options are available to a command ask for help on it:

alks sessions help open

Password

Since ALKS requires you to pass your credentials, we've made the CLI provide multiple ways of handling this.

  1. Recommended: Store your password in the keychain. We offer the ability to store your password securely using built in OS functionality. On MacOS we use Keychain, on Windows we use Credential Vault and on Linux we use netrc. To store your password simply run alks developer login and follow the prompt. You can remove your password at any time by running alks developer logout.
  2. Provide your password as an argument, simply pass -p 'my pass!'. Note this will appear in your Bash history.
  3. Create an environment variable called ALKS_PASSWORD whose value is your password.
  4. Type your password. If we do not find a password we will prompt you on each use.

Password Priority

We will attempt to lookup your password in the following order:

  1. CLI argument
  2. Environment variable
  3. Keystore
  4. Prompt user

Two Factor Authentication

The preferred authentication mechanism is two-factor authentication. Simply log into the ALKS GUI and get your refresh token which we will securely store just like your password.

Note: Credential authentication will be removed in a future release of the ALKS CLI.

Docker

If you would rather run the ALKS CLI as a Docker container, simply run the following:

docker run -it -v ~:/root coxauto/alks-cli

If you are on a windows host and need SET instead of export then add a PLATFORM env:

docker run -it -e PLATFORM=windows -v %USERPROFILE%:/root coxauto/alks-cli sessions open -a %AWS_ACCT% -r %AWS_ROLE% -o env

Commands

Developer

developer configure

alks developer configure - Configures ALKS

developer login

alks developer login - Store your login credentials in the OS keychain.

developer logout

alks developer logout - Remove your login credentials from the OS keychain.

developer login2fa

alks developer login2fa - Store your 2FA refresh token in the OS keychain.

developer logout2fa

alks developer logout2fa - Remove your 2FA refresh token from the OS keychain.

developer info

alks developer info - Show your current developer configuration

developer accounts

alks developer accounts - Show all available ALKS accounts (both Standard and IAM)

developer favorites

alks developer favorites - Configure which accounts are favorites

Sessions

sessions open

alks sessions open Creates/resumes an ALKS session, this is the preferred way of using ALKS as it automates the underlying ALKS session for you. If you don't provide an account/role you'll be prompted for the one you'd like to use. Alternative you can use your default account/role by passing -d.

This will create your sessions with the maximum life and automatically renew them when necessary. If you would like to do IAM/Admin work you'll need to pass the -i flag.

Arguments:

  • -p [password] Your password
  • -a [account] The ALKS account to use, be sure to wrap in quotes
  • -r [role] The ALKS role to use, be sure to wrap in quotes
  • -i Specifies you wish to work as an IAM/Admin user
  • -o [output] Output format. Supports: env, json, docker, creds, idea, export, set, powershell, aws, fishshell, terraformenv, terraformarg
  • -n If output is set to creds, use this named profile (defaults to default)
  • -N Forces a new session to be generated
  • -d Uses your default account from alks developer configure
  • -f If output is set to creds, force overwriting of AWS credentials if they already exist
  • -F Filters favorite accounts

Output values:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_SESSION_TOKEN

sessions console

alks sessions console - Open the AWS console in the default browser for the specified ALKS session.

Arguments:

  • -p [password] Your password
  • -u [url] Print the URL
  • -a [account] The ALKS account to use, be sure to wrap in quotes
  • -r [role] The ALKS role to use, be sure to wrap in quotes
  • -i Specifies you wish to work as an IAM/Admin user
  • -o [appName] Open with an alternative app (safari, google-chrome, etc)
  • -N Forces a new session to be generated
  • -d Uses your default account from alks developer configure
  • -p [password] Your password
  • -F Filters favorite accounts

sessions list

alks sessions list - List active ALKS sessions, this includes both IAM and non-IAM sessions.

Arguments:

  • -p [password] Your password

IAM

iam createrole

alks iam createrole Creates a new IAM role for the requested type in the specified AWS account.

Arguments:

  • -p [password] Your password
  • -n [roleName] The name of the role, be sure to wrap in quotes, alphanumeric including: @+=._-
  • -t [roleType] The role type, to see available roles: alks iam roletypes, be sure to wrap in quotes. Must include roleType or trust policy, but not both
  • -p [trustPolicy] A trust policy as a JSON string. Must include trustPolicy or roleType, but not both
  • -d: Include default policies, defaults to false
  • -F Filters favorite accounts
  • -k [tags] A list of resource tags. Can either be a JSON representation '[{"Key":"string","Value":"string"},{"Key":"string","Value":"string"}]' or shorthand Key=string,Value=string Key=string,Value=string

Outputs the created role's ARN.

iam createtrustrole

alks iam createtrustrole Creates a new IAM Trust role for the requested type in the specified AWS account.

Arguments:

  • -T [trustarn] Your trust arn
  • -n [roleName] The name of the role, be sure to wrap in quotes, alphanumeric including: @+=._-
  • -t [roleType] The role type Cross Account or Inner Account, be sure to wrap in quotes
  • -a [alksAccount]: ALKS account to use
  • -r [alksRole]: ALKS role to use
  • -k [tags] A list of resource tags. Can either be a JSON representation '[{"Key":"string","Value":"string"},{"Key":"string","Value":"string"}]' or shorthand Key=string,Value=string Key=string,Value=string
  • -F Filters favorite accounts

Outputs the created role's ARN.

iam deleterole

alks iam deleterole Deletes a previously created IAM role in the specified AWS account. Note this only works for IAM roles that were created with ALKS.

Arguments:

  • -p [password] Your password
  • -n [roleName] The name of the role, be sure to wrap in quotes, alphanumeric including: @+=._-

iam roletypes

alks iam roletypes - List the available IAM role types.

Arguments:

  • -o [output] Output format. Supports: json, list

Outputs a list of available role types.

iam createltk

alks iam createltk Creates a new long term key in the specified AWS account.

Arguments:

  • Required
    • -a [account] The ALKS account to use, be sure to wrap in quotes
    • -n [iamusername] The name of the IAM user associated with the LTK, be sure to wrap in quotes, alphanumeric including: @+=._-
  • Optional
    • -o [output] Output format. Supports: text, json. Default: text
    • -r [role] The ALKS role to use, be sure to wrap in quotes
    • -F Filters favorite accounts
    • -k [tags] A list of resource tags. Can either be a JSON representation '[{"Key":"string","Value":"string"},{"Key":"string","Value":"string"}]' or shorthand Key=string,Value=string Key=string,Value=string

Outputs the created user's ARN along with the long term access key and long term secret key.

iam updateIamUser

alks iam updateIamUser Updates Tags on IamUser (ltk) with give iamusername.

Arguments:

  • Required
    • -a [account] The ALKS account to use, be sure to wrap in quotes
    • -n [iamusername] The name of the IAM user associated with the LTK, be sure to wrap in quotes, alphanumeric including: @+=._-
    • -k [tags] A list of resource tags. Can either be a JSON representation '[{"Key":"string","Value":"string"},{"Key":"string","Value":"string"}]' or shorthand Key=string,Value=string Key=string,Value=string
  • Optional
    • -o [output] Output format. Supports: text, json. Default: text

Outputs the created user's ARN along with the long term access key and long term secret key.

iam deleteltk

alks iam deleteltk Deletes a previously created LTK in the specified AWS account.

Arguments:

  • -p [password] Your password
  • -n [iamusername] The name of the IAM user, be sure to wrap in quotes, alphanumeric including: @+=._-

Metadata Server

The metadata server listens on http://169.254.169.254 and mimicks the AWS EC2 Instance Metadata server. If you request credentials from http://169.254.169.254/latest/meta-data/iam/security-credentials/alks it will ensure you have a valid set of up-to-date credentials from ALKS. The account and role used can be changed at any time by running alks server configure.

server configure

alks server configure - Configure the account and role used by the metadata server. This can also be invoked while the server is running.

Arguments:

  • -p [password] Your password
  • -a [account] The ALKS account to use, be sure to wrap in quotes
  • -r [role] The ALKS role to use, be sure to wrap in quotes
  • -i Specifies you wish to work as an IAM/Admin user
  • -F Filters favorite accounts

server start

alks server start - Start the metadata server.

server stop

alks server stop - Stop the metadata server.

Profile Management

profiles generate

alks profiles generate Creates an AWS profile or multiple profiles. If you pass an account, role, and profile name it will generate a single profile in your ~/.aws/credentials file and if you instead pass the --all flag it will generate profiles for all the account/role pairs that you currently have access to by naming each profile <accountAlias>-<roleName>

Try running alks profiles generate --help for more details on how to use this command

profiles list

Lists the profiles that you have. By default this will only print out the profiles that were created by this tool but you can list all of your profiles by passing the --all flag.

Try running alks profiles list --help for more details on how to use this command

profiles get

Gets the details for a single AWS profile. Essentially this will show you everything in the ~/.aws/credentials file for a single profile

Try running alks profiles get --help for more details on how to use this command

profiles remove

Removes an AWS profile, or multiple AWS profiles. If you specify a profile name this will remove just that single profile, or if you pass the --all flag this will remove all profiles that were generated with this tool

Try running alks profiles remove --help for more details on how to use this command

Output Formats trigger

ALKS CLI will output in a variety of formats, it uses the developer default (set with alks developer configure) and can be overridden by passing a value via -o.

  • env: Outputs Bash/Windows environment variable string. You can wrap this call in an eval: eval $(alks sessions open -d)
  • json: Outputs a JSON object
  • docker: Outputs environment arguments to pass to a Docker run call
  • creds: Updates the AWS credentials file
    • By default this will update the default profile, to use another named profile supply: -n namedProfile
    • If the named profile already exists you'll need to supply the overwrite flag: -f
  • idea: Outputs environment variables formatted for Intelli-J
  • export: Outputs environment variables via export
  • set: Outputs environment variables via SET
  • powershell: Outputs environment variables for Windows PowerShell
  • fishshell: Outputs environment variables for Fishshell
  • terraformenv: Outputs environment variables prefixed with ALKS
  • terraformarg: Outputs environment arguments to pass to a Docker run call prefixed with ALKS
  • aws: Outputs environment arguments to pass to AWS docs

alks-cli's People

Contributors

amagana3 avatar americk0 avatar apottere avatar aseitz avatar brianantonelli avatar cdonnellytx avatar danielruf avatar dkolb avatar ekozlowski avatar elliottzack429 avatar github-actions[bot] avatar jantman avatar jeffkeller87 avatar lgw4 avatar lumac0 avatar ntangy avatar pofallon avatar psmith6 avatar ranga543 avatar richierunner avatar twang817 avatar vellozzi avatar webbbarker 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

Watchers

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

alks-cli's Issues

Store alks.db in a ~/.alks folder

Just thinking it might be a bit cleaner to store the alks.db file (and any future config files) under a dedicated hidden folder in the user's home dir instead of the home dir root.

Caching Role Defect

I am trying to switch between roles to test some different IAM policies

I run alks sessions open -i -a "###/ALKSAdmin - foo" -r "Admin"
the I run alks sessions open -i -a "###/ALKSIAMAdmin - foo" -r "IAMAdmin"
notice the change from ALKSAdmin to ALKSIAMAdmin
and I get back the same set of keys

Its most likely caching at the account level and not taking the role into consideration.

Sessions Force Key Not Working

Running alks sessions open -N does not force a new session as documented.

🍔  alks sessions open -N
ALKS v2.4.0
? Please select an ALKS account/role  2) 123123123/ALKS_PowerUser - foo :: IAM-AEP-PowerUserAccess
Resuming existing session in 123123123/ALKS_PowerUser - foo IAM-AEP-PowerUserAccess

alks-iam-deleterole account

alks iam deleterole is supposed to accept the account as an argument but ignores it.

$ alks iam deleterole -n "sagemaker-us-east-1" -a "$awsaepnp_admin"  -v
ALKS v2.17.0
[iam-delete]: validating role name: sagemaker-us-east-1
[iam-delete]: getting developer
[iam-delete]: getting password
[developer]: using password from keystore
[iam-delete]: getting accounts
[developer]: retreiving alks account

Console wipes data

Running the console subcommand is wiping out the developer configuration. Its a side effect of calling process.exit(1); which is needed for opn() to allow the CLI to exit. This is in keys and sessions.

support picking a specific account in `developer switch`

Support syntax like alks developer switch 8423XXXXX/ALKS_PowerUser in the CLI. Should be fine to accept the entire account id/role string because users would likely put this in a shell alias anyway.

Or should we use the account index # like how alks sessions open <#> works?

This came from a request via Slack.

Include client name and version in User-Agent header

We'd like each ALKS client application to return information about its name and version to the ALKS API when executing requests. This information will be used to gather user information and gather insight to aid in troubleshooting. To standardize across technologies, we'd like this client to use the standard User-Agent header to specify its name and version (plus any additional useful information specific to the tool). See the RFC for more details on this
https://tools.ietf.org/html/rfc2616?spm=5176.doc32013.2.3.Aimyd7#section-3.8

Install fails with yarn

> yarn add alks                                                                                                                                                            
yarn add v1.0.2                                                                                                                                                            
info No lockfile found.                                                                                                                                                    
[1/4] Resolving packages...                                                                                                                                                
warning [email protected]: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.    
[2/4] Fetching packages...                                                                                                                                                 
error [email protected]: The engine "node" is incompatible with this module. Expected version "^4.0.0".                                                                        
error Found incompatible module                                                                                                                                            
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.                                             

Refactor Account

Change Account to Developer to remove confusion between account and alks account. Check if anyone has multiple roles to an account, if not maybe we can drop references to role. Its such a long string with both.

Use CLI to Alert about TF Provider Updates

Michael brought this one up, so wanted to stash the idea here.

The gist is to use the CLI to inform users when there's a new TF Provider out (for some period of time afterwards).

Improve LTK Error Message

So when the -n flag is missing the CLI doesn't seem to provide a decent standard error message unless you are running in verbose mode. As far as I can tell even though the message is provided is very similar to what AWS would provide it is baked into the CLI.

A more descriptive error message should be put in place

image

AWS Credentials Encoding

There might be an encoding/formatting issue when prop-ini modifies the AWS credentials file. One user reported an encoding issue and I found that it adds arbitrary spaces in the file and when using aws configure after ALKS modifies the file any new entries start at the end of the previous line - breaking the file.

Passwords with a backslash are not saved correctly

When entering a password into alks developer configure, if it has a backslash, it will allow you to save and pick a default account, but will not work properly when trying to open a session afterwards. I was able to open a session when passing the -p flag and my password though.

.netrc permissions

If we fall back to .netrc we should be chmoding it so its only readable by the owner. We are currently doing this for the alks.db, just need to apply it to .netrc as well.

If ~/.aws/credentials file does not exists cli bugs out

When file does not exist:

Error encountered during database keys transaction! Swallowing to preserve file integrity.
{ [Error: EEXIST: file already exists, mkdir '/Users/smuggla/.aws']
  errno: -17,
  code: 'EEXIST',
  syscall: 'mkdir',
  path: '/Users/smuggla/.aws' }

Crash wipes database

It seems that if the CLI throws an exception this wipes the database. Look into this, is it because we have it open and its not closing properly?

Enhance .aws/credentials synchronization

When a new key is requested, automatically add the key to the credentials file using the account alias and role as the profile.

For example,

[coxatlabs27-Admin]
aws_access_key_id=something
aws_secret_access_key=Something Else
aws_session_token=Some Long Stuff

Allow the user to specify if the environment variables and the [default] profile should not be updated; otherwise, update those by default as well.

Anytime a key is updated, perform the appropriate actions to the environment variables and the credentials file.

Remove password

If users chooses No to "Save Password" during alks developer configure then we should wipe out any previously stored passwords.

Option for PowerShell Variables

For our Windows friends enable the option to toggle ALKS to output PowerShell environmental variables instead of CMD Prompt variables

it should be in the form of

$env:AWS_ACCESS_KEY_ID="{access-key}"
$env:AWS_SECRET_ACCESS_KEY= "{secret-key}"
$env:AWS_SESSION_TOKEN="{session-token}"
$env:AWS_DEFAULT_REGION="us-east-1"

Improve "Error saving developer!" messaging

On my Windows 10 machine, while executing "alks developer configure", and after I select default ALKS account/role I would receive a "Error saving developer" message in the console.

I downloaded the source and added console.error(err.message); to Developer.saveDeveloper callback if(err) block and got a more helpful "ENOENT: no such file or directory, open 'D:\Users\kjmil\alks.db'"

I created a "D:\Users\kjmil" directory and received a successful "Developer saved!" message.

This is the first time I have used ALKS-CLI so I'm not sure exactly what issue should be resolved, but I think I may be seeing a combination of possible issues:

  1. ALKS-CLI probably wanted to use "C:\Users\kjmil" which does exist instead of "D:..."
  2. Should ALKS-CLI create the directory if it doesn't exist?
  3. I didn't dig deeper, but I'm not sure where utils.log(program, logger, 'error saving! ' + err.message); is writing to. Should a user have to dig deeper to find the log (or hack at the source like me) to view the err.message?

Update for Cross-Account Role Support

ALKS handles validation of business rules on the server side. Ping me for our blog posts on this subject if needed.

Role type is Cross Account
Need to pass a trustArn as well

Add favorites or float used roles up in CLI/UI

It would be great if ALKS remembered which accounts you wanted to use, either by tracking which ones you use most or by adding "favorites". Often developers have a handful of accounts with a few roles each, which makes finding the correct role annoying.

If ALKS supported favoriting certain roles and put them at the top of the list, it would be much easier.

Bonus points for adding a flag to only show favorites in the CLI!

Validate Password

Providing a bad password crashes configure.

🍔  alks developer configure
ALKS v2.3.0
ALKS server:  (xxxxx) 
Network Username:  (xxxxx) 
Network Password:  *********

? Save password Yes
/usr/local/lib/node_modules/alks/bin/alks-developer-configure:93
            if(!accounts.length){
                        ^

TypeError: Cannot read property 'length' of undefined
    at /usr/local/lib/node_modules/alks/bin/alks-developer-configure:93:25
    at Request._callback (/usr/local/lib/node_modules/alks/node_modules/alks-node/lib/alks-api.js:142:20)
    at Request.self.callback (/usr/local/lib/node_modules/alks/node_modules/request/request.js:186:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/alks/node_modules/request/request.js:1081:10)
    at emitOne (events.js:77:13)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/alks/node_modules/request/request.js:1001:12)
    at IncomingMessage.g (events.js:260:16)

delete-role account shortcut

Account/role shortcutting isn't working on delete role. You have to supply both the account and the role. Should work like sessions commands and extract the role type from the account string.

Not given all choices for accounts with `alks open sessions`

The first time I used the command alks sessions open, I was prompted with all of my available accounts to choose from (I have 3 available to me at the portal when I am using a browser).

Now, whenever I use alks sessions open I am only able to choose a single account, the first one I ever chose.

If I run alks developer accounts I can see the 3 accounts available to me in the browser.

I tried uninstalling/reinstalling but did not have any luck.

Improved error messaging on `configure`

Currently an incorrect password provided during alks developer configure returns the error message "Error configuring developer: Bad response received, please check API URL.".

The actual API call is returning the error message which we should be displaying:

{
  "errorMessage": "Authentication failed. Invalid username or password"
}

CLI Error

From Bret Lowery:

I'm using the AWS and ALKS CLI on a PoC project. A Bash script on my EC2 instance makes this ALKS CLI call multiple times a day:
alks sessions open -a "912278622850/ALKSLabAdmin - awscoxautolabs62" -r "LabAdmin"

Normally it returns this to stdout:
Creating new session in 912278622850/ALKSLabAdmin - awscoxautolabs62 LabAdmin

But once a day, when I SSH into the instance for the first time and the CLI call happens for the first time that day, it sends this to stdout and stderr:
Creating new session in 912278622850/ALKSLabAdmin - awscoxautolabs62 LabAdmin
(node:5374) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:5374) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:5374) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:5374) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:5374) Warning: Use Cipheriv for counter mode of aes-256-ctr

If I call it again anytime that day it doesn't happen, but it does the following morning. I am getting ALKS keys/tokens with a 24hr expiration, if that has anything to do with it.

In all cases it seems to work normally. I get my session and subsequent AWS CLI calls with those keys/tokens in the env vars work, no problem.

Is this an error or do I need to do anything on my end to prevent this?

Set Default Account

I liked being able to pick an account and have alks do operations on that account till I switched (since I rarely switch)

[11:40]
I have aliases set up for generating idea/env credentials based on the current account, it would get cumbersome to have an alias for each account

[11:40]
I’m fine with getting the account picker every time, too - it just doesn’t pipe nicely

[1143]
Maybe you can set a default during developer configure and then if you send --useDefault to sessions open it wont prompt.

alks developer set-default
alks sessions open --useDefault

Issue with Windows environments

I have tried the following on 3 different Windows environments and found the same issue. Not sure if I some different order needs to be done on Windows, but the same steps work on a Mac:

**alks developer configure**
      selected the account I want to use as power user
**alks sessions open -i -f -n**
      selected the IAM Admin session I want to use (basically the same account as above with IAM Admin)

Then tried any AWS CLI commands (aws iam list-roles, aws lambda list-functions, etc...)

I get the following error on all machines

A client error (IncompleteSignatureException) occurred when calling the ListFunctions operation: '/20170321/us-west-1/lambda/aws4_request' not a valid key=value pair (missing equal-sign) in Authorization header: 'AWS4-HMAC-SHA256 Credential=ASIAI6MS4VF2DKZT4E2A /20170321/us-west-1/lambda/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=bc3e0110fa58fcb2796433ba7634b341f21101c2034172b02de9dcdab3d8227b'.

If I go to the website, select keys for a session there, and set them as environment vars I am able to use the AWS CLI commands.

Create aws config file

I had assumed you would only do profile outputs if you had installed the AWS CLI, but a few people have commented on the file missing error lately... I just need to create the dir/file (~/.aws/credentials) if it doesnt already exist when a user does a profile output.

Error adding new line!
{
   "errno": -2,
   "code": "ENOENT",
   "syscall": "open",
   "path": "/home/jkemp/.aws/credentials"
}

Unable to run "alks developer configure"

I was unable to run 'alks developer configure'. alks developer logout2fa fixed the issue. Posting for further debugging.

ddcwillb@~$ /Users/ddcwillb/.nvm/versions/node/v9.11.2/bin/alks developer configure -v
ALKS v3.0.1
[dev-config]: getting developer
? ALKS server https://alks.coxautoinc.com/rest
? Network Username ddcwillb
[dev-config]: getting existing auth
[developer]: checking for access token
[dev-config]: getting existing password
[dev-config]: getting password
[developer]: getting password from prompt
? Network Password [hidden]
? Save password Yes
[dev-config]: Getting ALKS accounts
[developer]: retreiving alks account
[developer]: using cached auth object
[api:injectAuth]: getting refresh token
Error configuring developer: Failed

Credentials override error breaks config

If you try to export to the credentials file and the profile exists and you dont provide the force flag it wipes out the config.

🍔  alks sessions open -o creds -n test
ALKS v2.3.0
Resuming existing session in #####/ALKS_PowerUser - ###### IAM-AEP-PowerUserAccess
The test profile already exists in AWS credentials. Please pass -f to force overwrite.
brianantonelli in ~/Dev/ALKS-CLI on master*
🍔  alks sessions open -o creds -n test -f
ALKS v2.3.0
Error: ALKS CLI is not configured. Please run: alks developer configure

Prompt lib output to stderr

Would be a nice feature if we could modify the lib used for the account selection to pipe to stderr instead of stdout. Then you could wrap your session open in an eval and still see the prompts.

ALKS TF Provider -o option

Would be nice to have an output option for the ALKS Terraform Provider's environmental variables

something like-o tfenv or -o tf to output ALKS_ACCESS_KEY_ID instead of AWS_ACCESS_KEY_ID from the -o env flag so that it is a little less work to use IAMAdmin and inherited credentials from AWS Roles with the ALKS TF provider.

Alternatively maybe a -t that would modify all output formats to be their ALKS counterpart.. you know for our Windows and Fishshell friends :)

https://github.com/Cox-Automotive/terraform-provider-alks#provider-configuration

Default to Assumed Role Session

Defaulting to Federated Sessions cause more issues than it solves. IAM Sessions should be the default functionality. This could be bundled with #105

Credentials override using default profile causes logging error

I tried to open session and save the result to my ~/.aws/credentials file.
When complaining about already existing AWS credentials, the log message refers to an undefined profile rather than the default profile.

% alks sessions open -o creds
The undefined profile already exists in AWS credentials. Please pass -f to force overwrite.

Purely cosmetic issue. The complaint is valid and adding -f does correctly overwrite the credentials under the default profile.

CLI session open options format not obvious

Just a Minor annoyance since I havn't used the CLI in months.

The format of the -r and -a options isn't obvious from help or readme.md. I tried copying from ALKS web gui and the list presented when you don't provide -r or -a. Neither worked and threw a no permissions error.

I figured it out by looking through the source code to see exactly what it wanted. Realized later that running alks developer accounts gave me the format needed. Seems so obvious now that the delimiter is :: but I can see this as a major frustration to a newbie (or someone like me who has been using the desktop app for too long).

Expected: copy and paste from the alks session open list into a command line option to eliminate the need for user input

Observed: Format of list doesn't match with command line option format

Suggested fixes:

  • update documentation with an example
  • create a single command line option with both role and account in single string that can be copy and pasted from the alks session open list

Allow choice of IAM session TTL

An ALKS server can support several different choices for session TTL. The alks-cli should also support choosing a specific TTL. Perhaps something like:

alks sessions open --iam --newSession -expires 12

Update Metadata Server to work on Linux

Currently, the metadata server only supports running on a macOS. Updating this to get it running on Linux would be a great addition. Specifically Linux RedHat 7 Enterprise.

PowerShell user profile script output causes false error when getting password from keystore

Windows PowerShell
alks sessions open

In developer.js line 99: clortho.getFromKeychain(ALKS_USERID) an error is returned if the PowerShell user profile script writes to stdout/err (not sure which).

In my profile script, I had Start-SshAgent -Quiet which was writing Identity added: C:\Users\gdawson/.ssh/id_rsa (C:\Users\gdawson/.ssh/id_rsa). This is being caught as an error on line 109 (in devloper.js: exports.getPasswordFromKeystore).

Workaround: Don't output within profile script
Suggested: Would it be better to run the PowerShell command with no profile? Would require PR to clortho.

Example: (I added the gpfk>ipss>err log)

D:\git\openSource\alks-cli\node_modules\clortho [master ≡ +0 ~3 -0 !]> alks sessions open --verbose                                                                                                                         ALKS v3.0.3
[sessions-open]: getting developer
[sessions-open]: getting auth
[developer]: checking for access token
[developer]: no access token found, falling back to password
[developer]: gpfk>ipss>err: Error: Identity added: C:\Users\gdawson/.ssh/id_rsa (C:\Users\gdawson/.ssh/id_rsa)

[developer]: no password found, prompting user
[developer]: getting password from prompt
? Password [hidden] [input is hidden]

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.