From 144ad637cc59d67740c1deeaef51caf8e2232524 Mon Sep 17 00:00:00 2001 From: containerscrew <131241415+containerscrew@users.noreply.github.com> Date: Fri, 17 Nov 2023 23:26:06 +0100 Subject: [PATCH 1/6] pre-commit --- README.md | 95 ++++++++++++++++++++++++++++++++++++++++++++++-------- src/cli.rs | 4 +-- 2 files changed, 84 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 3267c4d..897777a 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,21 @@ - [Pipeline badges](#pipeline-badges) - [Introduction](#introduction) +- [Supported platforms](#supported-platforms) +- [Supported IDP](#supported-idp) - [Installation](#installation) + - [Quick installation (latest version)](#quick-installation-latest-version) + - [Using cargo](#using-cargo) - [Usage](#usage) + - [Setup configuration](#setup-configuration) + - [Start fetching credentials](#start-fetching-credentials) + - [Debug level](#debug-level) + - [Check version](#check-version) +- [Help command](#help-command) - [Switching accounts in your terminal](#switching-accounts-in-your-terminal) - [Fish shell](#fish-shell) - [Setting AWS_PROFILE](#setting-aws_profile) -- [TO DO](#to-do) +- [Credits](#credits) - [TO DO (not implemented yet)](#to-do-not-implemented-yet) - [Contribution](#contribution) - [LICENSE](#license) @@ -52,19 +61,85 @@ ....blablbla +# Supported platforms + +| OS | ARM64 | AMD64 | +|-----------|:-----:|------:| +| Mac | √ | √ | +| Linux | √ | √ | + +# Supported IDP + +* Google Workspaces +* Okta (not tested) + +If using other IDP with AWS SSO in your organization, and this tool don't work, please provide feedback in this repo. Open an issue! + # Installation -...TO DO +## Quick installation (latest version) + +```shell +curl --proto '=https' --tlsv1.2 -sSfL https://raw.githubusercontent.com/containerscrew/aws-sso-auth/main/scripts/install.sh | sh +``` + +## Using cargo + +Install rust toolchain: +```shell +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +```shell +cargo install aws-sso-auth --git https://github.com/containerscrew/aws-sso-auth +``` # Usage -```bash -aws-sso-auth --start-url https://XXXXXX.awsapps.com/start --region eu-west-1 +## Setup configuration + +```shell +aws-sso-auth config --start-url https://XXXX.awsapps.com/start --aws-region eu-west-1 --profile-name mycompany ``` +> This command will save a file in `~/.aws/aws-sso-auth.json` with the previous configuration + +* **profile_name:** the name of the profile configuration you are saving. For example, your company name * **start_url:** your start URL of SSO AWS app (https://docs.aws.amazon.com/singlesignon/latest/userguide/howtochangeURL.html) -* **region:** AWS region where you have your AWS SSO configured. By the default is `eu-west-1` (Ireland) +* **region:** AWS region where you have your AWS SSO configured. By the default is `us-east-1` + + +## Start fetching credentials + +```shell +aws-sso-auth start +``` + +* **workers:** Number of async/thread AWS API calls. + threads == + speed. Recommended: 5/8 max to avoid AWS API 429 errors TooManyRequestsException. Default: 5 +* **retries:** Number of retries when AWS API return errors. Default: 50 + +> This will open your default local browser where you have your IDP authenticated. In my case, I used Google as external IDP with AWS SSO + +## Debug level + +```shell +aws-sso-auth -l debug start +``` + +* **--log-level:** Log level. Default: info. Possible values: info, warn, trace, debug, error + +## Check version + +```shell +aws-sso-auth --version +``` + +# Help command + +```shell +aws-sso-auth --help +``` > All the credentials will be saved in your $HOME/.aws/credentials with the following pattern: [AccountName@RoleName] you are assuming @@ -114,13 +189,10 @@ Type `aws-profile` in your terminal, and you will see all the accounts you have [Official documentation](https://github.com/junegunn/fzf#installation) -# TO DO -> https://github.com/awslabs/aws-sdk-rust/discussions/771 -* Github actions pipeline to create binary and push to `releases` -* Testing -* Imagine you have 600 accounts with access in your AWS SSO portal, but you only want to fetch 100. How you can limit that? +# Credits +... # TO DO (not implemented yet) @@ -128,11 +200,8 @@ Type `aws-profile` in your terminal, and you will see all the accounts you have all their config (start-url, region) inside the config file. * If you have 200 accounts, only 123 (max), will be fetched * Select which account credentials (with prefix) do you want to fetch. -* Remove * Testing * In console output, exists and empty new line when after info message `Type ENTER to continue`. Need to flush console -* Implement multiple retries when you have 429 errors in API calls -* Overwrite `~/.aws/credentials` file every time you fetch account credentials * Create function to open file * Codecoverage pipeline not working * Changelog with release-please diff --git a/src/cli.rs b/src/cli.rs index 783288f..236dc51 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -58,7 +58,7 @@ enum Commands { #[arg( short = 'w', long = "workers", - help = "Number of threads! Recommended: 2/3 max to avoid AWS API 429 errors TooManyRequestsException", + help = "Number of threads! Recommended: 5/8 max to avoid AWS API 429 errors TooManyRequestsException", default_value = "5", required = false )] @@ -67,7 +67,7 @@ enum Commands { short = 'r', long = "retries", help = "Number of retries when you have AWS API errors", - default_value = "30", + default_value = "50", required = false )] retries: u32, From ae66cda2abb9d857cb80e2d82e3316eaa90aebb3 Mon Sep 17 00:00:00 2001 From: containerscrew <131241415+containerscrew@users.noreply.github.com> Date: Fri, 17 Nov 2023 23:35:42 +0100 Subject: [PATCH 2/6] Update README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 897777a..7d58510 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,12 @@ aws-sso-auth config --start-url https://XXXX.awsapps.com/start --aws-region eu-w aws-sso-auth start ``` +Or with flags: + +```shell +aws-sso-auth start -w 5 -r 40 +``` + * **workers:** Number of async/thread AWS API calls. + threads == + speed. Recommended: 5/8 max to avoid AWS API 429 errors TooManyRequestsException. Default: 5 * **retries:** Number of retries when AWS API return errors. Default: 50 From 8be3ca95efe495fc325d2ee3577bcdd628a6f642 Mon Sep 17 00:00:00 2001 From: containerscrew <131241415+containerscrew@users.noreply.github.com> Date: Sat, 18 Nov 2023 01:22:40 +0100 Subject: [PATCH 3/6] Update documentation, code warnings and logging --- README.md | 24 +++++++++++++----------- assets/aws-auth-screen.png | Bin 0 -> 22182 bytes src/commands/config.rs | 3 +-- src/commands/start.rs | 6 ++++-- src/logger.rs | 1 - src/utils.rs | 5 +---- 6 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 assets/aws-auth-screen.png diff --git a/README.md b/README.md index 7d58510..7196158 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,10 @@ - [Debug level](#debug-level) - [Check version](#check-version) - [Help command](#help-command) + - [Take a look inside `~/.aws/credentials`](#take-a-look-inside-awscredentials) - [Switching accounts in your terminal](#switching-accounts-in-your-terminal) - [Fish shell](#fish-shell) - [Setting AWS_PROFILE](#setting-aws_profile) -- [Credits](#credits) - [TO DO (not implemented yet)](#to-do-not-implemented-yet) - [Contribution](#contribution) - [LICENSE](#license) @@ -59,7 +59,9 @@ # Introduction -....blablbla +This tool will help you download your AWS organization's account credentials using `AWS SSO`. What we previously set manually with *IAM users* **(aws_access_key_id and aws_secret_access_key)**, now we have it automatically using AWS SSO, setting a token with expiration (depending on how you have AWS SSO configured). +It's a tool to use on a daily basis and be able to download the credentials in `~/.aws/credentials` and thus be able to work with the `aws cli` from the terminal, `EKS authenticated with IAM`, `terraform/terragrunt`... and more. +As you well know, AWS SSO can be configured to authenticate with an external IDP. In this case ONLY Google Workspaces has been tested as external IDP. [Take a look in supported IDP](https://github.com/containerscrew/aws-sso-auth/tree/latest_refactors#supported-idp) # Supported platforms @@ -71,7 +73,6 @@ # Supported IDP * Google Workspaces -* Okta (not tested) If using other IDP with AWS SSO in your organization, and this tool don't work, please provide feedback in this repo. Open an issue! @@ -149,6 +150,12 @@ aws-sso-auth --help > All the credentials will be saved in your $HOME/.aws/credentials with the following pattern: [AccountName@RoleName] you are assuming +## Take a look inside `~/.aws/credentials` + +```shell +cat ~/.aws/credentials +``` + ## Switching accounts in your terminal Copy the following function in your `~/.zshrc` or `~/.bashrc`: @@ -196,22 +203,17 @@ Type `aws-profile` in your terminal, and you will see all the accounts you have [Official documentation](https://github.com/junegunn/fzf#installation) -# Credits - -... - # TO DO (not implemented yet) * Multiple AWS SSO account configurations inside `aws-sso-auth.json` Imagine you are working in a consultant, and you have multiple customers with AWS SSO, and you want to save all their config (start-url, region) inside the config file. * If you have 200 accounts, only 123 (max), will be fetched -* Select which account credentials (with prefix) do you want to fetch. -* Testing -* In console output, exists and empty new line when after info message `Type ENTER to continue`. Need to flush console -* Create function to open file +* Select which account credentials (with prefix) do you want to fetch (maybe you don't want to fetch all accounts) +* Testing and mocking AWS API calls * Codecoverage pipeline not working * Changelog with release-please * Create Homebrew Formula +* Documentation in code functions # Contribution diff --git a/assets/aws-auth-screen.png b/assets/aws-auth-screen.png new file mode 100644 index 0000000000000000000000000000000000000000..077b81f6b9aba7e99674a12a92468b81a53cc46d GIT binary patch literal 22182 zcmeFZbx>Px7&RE6g|-wZrMR{5Lt5O6mtw_>yBBwYJEd5$0>!N@4#izUC=S8hf0{EtR zf(`s-_Zj~+@bJ|6lP(wp!XYVPV1L zuKKlgD-sviqCT8SPO=5(vD!*~hKq}g0KUjf%6FdukA2;;7$2piq@Jq>y&xnc?0oea zc+$oB_zCcYOYwic^gmbQf7-_XQ+J3fDR0m3acof6FiI*+j+^hT||M z7MGOL;>?|EcO5IFL`UYKbE?SbOoQz zRy!~))F1w5YWxysd|dEHvJ4+B?VsFTLK>s+X}0vSDoM((m{>5jUdtNQ&!4yb4mUR= zyUmK-L{D&^RW9rY+QBBT4fGlgsot!FMQ-)wLCQEZFu8jI0jpAvBPf?YrL%fbU zInAqYc%9}`r_0g_Nhs8IkWrte)Pi0Js(dfg(kj#KttAKRR=eT}_MT$sr)}~(EO@Ua zksBLxlv9cQ#5sV(%-4N|v7&}?a(G-$oQ5y?LNKp)a|LV`ivmL3s}_(V$NTT^44R*1 z45@~b- zMU4&R&Q4l1~fcZd-*4ymGAiFcyDty-0zLKc7)7r z))fzmEzH(h_=dW_h%YH5c@lp*tf=#e6E5Wb%RGEqDlA+T4i)lfiRqNBo^4_Y7T;nw z>pggsQa3)%bG^2AEQ0Ei9JXOg=X=BYUn&+3Pv*qh(+C11;gO=5eDypOgtPyad-D<=DC?O)F_&Q>sx)9-pcCg-Ask?;XyP6 z=_7WxCM%|*Li5~&TP3-)9UYU;o&$0 za8D-c`FgjsY_LeqP=;Z~CF*h~cCVs3hR@C%#wJX^{^BX>LU?)RsPv%vAZ)hLb%w28 zPZ#2t3#&~Yq97zEJn)0MOpw@n*cCGjia3urICgdxV`5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_{9+TBff|`L4%!wbV!`i=WYLwSW^5Q*+<@?ECA+$y?s%47IHMuj@ z`|_B1OE^FqaHi1-5TR5W*&);`a;I)O{Hf(_SUjzA&M^^fZzXKc=T&t-&qM1G66NP* z(@MZI6Cvs7YI}WO-;HPTFS^Wr(B=XY38Y5e$eIZg;xwklvTtU(`RyT(j!qfbG~P{1 z%ka2*{Qdg5;=aU~0=MZL->t#-gTMbk2*X)42fRjFAO{^IHD#`q-)RCGzwz?wK3+*o z$niWZxW7zxMGx;^sqjfd&Fcpl=eKDjiHdNBI~tdcD84NT^U`v!4ND&(rB}LF^3c8; zu3TOpe$k9VJFTPpxHm)=;G`i*f5J-5Xy~YJ;9S@Wkj-WhPTO0U!deyH|5y0 z`UxymspyC`4)gKqvW9%p30+jPWl6LfqAouYgcCzu2y0%VkYF1i3!m~cbgov`n z9Ja4JLfcm~u5z)9GESPs z9qDk6Gdc5hZgKI`ZU6pIbrvSW;`)k?uvgOUS0AMpJ$I+p>1mnds=p_ve>lL}#uSWg zD*%Sq6>Y$_?Qav}-(ac#HkzByIupi2UN}ZPPNv7H$^?qVZXF$$YeRr%CRfwVVV%g& z2{eRoOhH{#q|%#Utt=N$o_Q2M7u(X#fsM6;TxDO8%S%foAmdz2J4uG>sA5q>S__n# vmooSliGPRyt40S02LQOlhW}rPYo|=V$QR}<8yp0J_5w(Rg<*xh%g=uRwzO9@ literal 0 HcmV?d00001 diff --git a/src/commands/config.rs b/src/commands/config.rs index a48f285..1f4b080 100644 --- a/src/commands/config.rs +++ b/src/commands/config.rs @@ -1,7 +1,6 @@ use crate::utils::extend_path; use serde::{Deserialize, Serialize}; -use std::fs::{OpenOptions}; -use std::io::{Write}; +use std::fs::OpenOptions; use std::process::exit; use tracing::{error, info}; diff --git a/src/commands/start.rs b/src/commands/start.rs index 306761b..f3d109b 100644 --- a/src/commands/start.rs +++ b/src/commands/start.rs @@ -4,7 +4,7 @@ use aws_sso_auth::{ get_device_authorization_credentials, get_register_device_credentials, sso_client, ssoidc_client, AccountCredentials, DeviceAuthCredentials, DeviceClientCredentials, }; -use log::warn; +use log::{debug, warn}; use tracing::{error, info}; pub fn start(region_name: String, start_url: String, workers: usize, retries: u32) { @@ -73,6 +73,8 @@ pub async fn async_start( account_list.len() ); + info!("Starting..."); + let mut all_credentials: Vec = vec![]; // Semaphore will control the number of concurrent threads @@ -97,7 +99,7 @@ pub async fn async_start( .await { Ok(account_credentials) => { - info!("Credentials fetched for {}", &account_name); + debug!("Credentials fetched for {}", &account_name); Ok(account_credentials) } Err(err) => { diff --git a/src/logger.rs b/src/logger.rs index b3192b5..f150f9e 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -11,6 +11,5 @@ pub fn setup_logger(log_level: &String) { tracing_subscriber::fmt() .with_thread_names(true) .with_max_level(log_level) - .pretty() .init(); } diff --git a/src/utils.rs b/src/utils.rs index da37c14..00abadc 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,12 +1,9 @@ -use crate::commands::config::{CREDENTIALS_FILE_PATH}; +use crate::commands::config::CREDENTIALS_FILE_PATH; use aws_sso_auth::AccountCredentials; use colored::Colorize; use configparser::ini::Ini; use log::{error, info}; - use std::io; -use std::io::{Write}; - pub fn print_banner() { let banner = r#" From ec1db8518636255a6c2501a0f4edca3e62bd9945 Mon Sep 17 00:00:00 2001 From: containerscrew <131241415+containerscrew@users.noreply.github.com> Date: Sat, 18 Nov 2023 01:30:16 +0100 Subject: [PATCH 4/6] Update README --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7196158..a189f24 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ - [Pipeline badges](#pipeline-badges) - [Introduction](#introduction) +- [Requirements](#requirements) - [Supported platforms](#supported-platforms) - [Supported IDP](#supported-idp) - [Installation](#installation) @@ -59,9 +60,14 @@ # Introduction -This tool will help you download your AWS organization's account credentials using `AWS SSO`. What we previously set manually with *IAM users* **(aws_access_key_id and aws_secret_access_key)**, now we have it automatically using AWS SSO, setting a token with expiration (depending on how you have AWS SSO configured). -It's a tool to use on a daily basis and be able to download the credentials in `~/.aws/credentials` and thus be able to work with the `aws cli` from the terminal, `EKS authenticated with IAM`, `terraform/terragrunt`... and more. -As you well know, AWS SSO can be configured to authenticate with an external IDP. In this case ONLY Google Workspaces has been tested as external IDP. [Take a look in supported IDP](https://github.com/containerscrew/aws-sso-auth/tree/latest_refactors#supported-idp) +This tool will help you download your AWS organization's account credentials using `AWS SSO`. What we previously set manually with *IAM users* (aws_access_key_id and aws_secret_access_key), we now have automatically using AWS SSO (+ expiration token, depending on what you have configured). +In this case ONLY Google Workspaces has been tested as external IDP. [More info in supported IDP, just below](https://github.com/containerscrew/aws-sso-auth/tree/latest_refactors#supported-idp) + +In short, we want to have the credentials of our AWS accounts/roles, using AWS SSO, stored in our ~/.aws/credentials` to be able to work daily with our tools (terraform, aws cli...) + +# Requirements + +* Our default browser that we work with must be authenticated with our IDP. In this case, gmail if we use Google Workspaces. # Supported platforms From 475ae822cdf6b92e3276f4f09e20d834967883c9 Mon Sep 17 00:00:00 2001 From: containerscrew <131241415+containerscrew@users.noreply.github.com> Date: Sat, 18 Nov 2023 01:37:13 +0100 Subject: [PATCH 5/6] Update README --- README.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a189f24..a00b5b0 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ - [Check version](#check-version) - [Help command](#help-command) - [Take a look inside `~/.aws/credentials`](#take-a-look-inside-awscredentials) + - [Example of credentials file](#example-of-credentials-file) - [Switching accounts in your terminal](#switching-accounts-in-your-terminal) - [Fish shell](#fish-shell) - [Setting AWS_PROFILE](#setting-aws_profile) @@ -60,10 +61,10 @@ # Introduction -This tool will help you download your AWS organization's account credentials using `AWS SSO`. What we previously set manually with *IAM users* (aws_access_key_id and aws_secret_access_key), we now have automatically using AWS SSO (+ expiration token, depending on what you have configured). +This tool will help you download your AWS organization's account credentials using `AWS SSO`. What we previously set manually with *IAM users* **(aws_access_key_id and aws_secret_access_key)**, we now have automatically using AWS SSO. In this case ONLY Google Workspaces has been tested as external IDP. [More info in supported IDP, just below](https://github.com/containerscrew/aws-sso-auth/tree/latest_refactors#supported-idp) -In short, we want to have the credentials of our AWS accounts/roles, using AWS SSO, stored in our ~/.aws/credentials` to be able to work daily with our tools (terraform, aws cli...) +In short, we want to have the credentials of our `AWS accounts/roles`, using `AWS SSO`, stored in our `~/.aws/credentials` to be able to work daily with our tools **(terraform, aws cli...)** # Requirements @@ -134,6 +135,10 @@ aws-sso-auth start -w 5 -r 40 > This will open your default local browser where you have your IDP authenticated. In my case, I used Google as external IDP with AWS SSO +If everything went well, you must validate the authentication. Something like that: + +![Example authentication window](./assets/aws-auth-screen.png) + ## Debug level ```shell @@ -162,6 +167,24 @@ aws-sso-auth --help cat ~/.aws/credentials ``` +The configuration file should be something like this: + +## Example of credentials file + +```toml +[Account1@administrator] +aws_secret_access_key=XXXX +region=eu-west-1 +aws_access_key_id=XXXX +aws_session_token=XXXX + +[Account2@read-only] +aws_secret_access_key=XXXX +region=eu-west-1 +aws_access_key_id=XXXX +aws_session_token=XXXX +``` + ## Switching accounts in your terminal Copy the following function in your `~/.zshrc` or `~/.bashrc`: @@ -220,6 +243,7 @@ all their config (start-url, region) inside the config file. * Changelog with release-please * Create Homebrew Formula * Documentation in code functions +* Customize how account credentials are saved: `[AccountName@RoleName]` for `[WHATEVER]` # Contribution From c5d08579a06cd1766b89adfde81e15a55d6dead0 Mon Sep 17 00:00:00 2001 From: containerscrew <131241415+containerscrew@users.noreply.github.com> Date: Sat, 18 Nov 2023 01:43:06 +0100 Subject: [PATCH 6/6] Update README --- README.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a00b5b0..a61dc40 100644 --- a/README.md +++ b/README.md @@ -39,14 +39,16 @@ - [Usage](#usage) - [Setup configuration](#setup-configuration) - [Start fetching credentials](#start-fetching-credentials) - - [Debug level](#debug-level) + - [Debug logging](#debug-logging) - [Check version](#check-version) -- [Help command](#help-command) + - [Help command](#help-command) - [Take a look inside `~/.aws/credentials`](#take-a-look-inside-awscredentials) - [Example of credentials file](#example-of-credentials-file) - - [Switching accounts in your terminal](#switching-accounts-in-your-terminal) -- [Fish shell](#fish-shell) +- [Switching accounts in your terminal](#switching-accounts-in-your-terminal) + - [ZSH/BASH shell](#zshbash-shell) + - [Fish shell](#fish-shell) - [Setting AWS_PROFILE](#setting-aws_profile) +- [Demo](#demo) - [TO DO (not implemented yet)](#to-do-not-implemented-yet) - [Contribution](#contribution) - [LICENSE](#license) @@ -135,11 +137,11 @@ aws-sso-auth start -w 5 -r 40 > This will open your default local browser where you have your IDP authenticated. In my case, I used Google as external IDP with AWS SSO -If everything went well, you must validate the authentication. Something like that: +If everything went well, you must authorize the request. Something like that: ![Example authentication window](./assets/aws-auth-screen.png) -## Debug level +## Debug logging ```shell aws-sso-auth -l debug start @@ -153,7 +155,7 @@ aws-sso-auth -l debug start aws-sso-auth --version ``` -# Help command +## Help command ```shell aws-sso-auth --help @@ -185,7 +187,9 @@ aws_access_key_id=XXXX aws_session_token=XXXX ``` -## Switching accounts in your terminal +# Switching accounts in your terminal + +## ZSH/BASH shell Copy the following function in your `~/.zshrc` or `~/.bashrc`: @@ -201,7 +205,7 @@ Then, `source` the file if needed: source ~/.zshrc or source ~/.bashrc ``` -# Fish shell +## Fish shell Copy the following function inside `~/.config/fish/function/aws-profile.fish` @@ -231,6 +235,10 @@ Type `aws-profile` in your terminal, and you will see all the accounts you have [Official documentation](https://github.com/junegunn/fzf#installation) +# Demo + + + # TO DO (not implemented yet)