Package: okta-aws-credential-helper
okta_aws_cred_helperOKTA AWS credential helper.You you only need the following steps to setup your aws credentials file derived from Okta automatically. Procedures areokta-aws-cred-helper init
okta-aws-cred-helper refresh

# then you are ready to go.
AWS_PROFILE=okta-role aws s3 ls
# If you need to know what profiles are available to you, you need to check your aws credentials file, i.e. ~/.aws/credentials

# when your DevSecOps made change on permissions, you need to refresh your local aws credentials file to pick up the change.
okta-aws-cred-helper refreshInstallpip install okta-aws-credential-helperInitializePreparation:You need to know Okta AWS application sso URL. It should be likehttps://domain.okta.com/app/amazon_aws/`app-id`/sso/saml.You already have your email/password/google 2Fa set up.During the process, we will reset the Okta Google 2FA code. You will need a QR code scanner application (besides Google 2FA app) so it can read the TOTP code. An useful application can be:https://play.google.com/store/apps/details?id=com.tohsoft.qrcode.proRead your TOTP codeLogin to your Okta Account and reset your 2FA code. When you are resetting, while the QR code still displays, use the QR code scanner to decode the QR code, which will be likeotpauth://totp/xxx.okta.com:<your-email>?secret=<totp-code>&issuer=xxx.okta.comMark the totp code down and you will use it later.Initialize okta credentialsExecuteokta-aws-cred-helper initFollow the questions and input your answers.You will be asked for sso_url, okta username(email), okta password, totp code (you previously marked down). Note whatever you have input will be echo back to the screen. Please keep alert from peeping.review your okta credentials settingsNOTEyour okta credentials settings are stored in file~/.aws/okta-aws/settings.json. Keep it secret. You can also edit this file directly later instead of runningokta-aws-cred-helper initcommand.Once initialized, the file should be like{
  "sso_url": "https://domain.okta.com/app/amazon_aws/aaaaabbbbbcccccDDDDD/sso/saml",
  "region": "ap-southeast-2",
  "user_name": "name@email.com.au",
  "password": "<password>",
  "google_2fa_totp": "<totp code>"
}Automatically set your~/.aws/credentialsfileExecuteokta-aws-cred-helper refreshThis command will modify your~/.aws/credentialsfor the new credentials derived from okta. The credentials from Okta will be defined as profiles with name starting withokta-.Note existing credentials in~/.aws/credentialswith profile name not starting withokta-will be intact.After executing this command, simply check the content of~/.aws/credentialsto get familiar with what roles OKTA has allowed you to assume to. You can also configure other personal profiles to source from theseokta-profiles.CachingThis process uses directory~/.aws/okta-awsas temporary credential caches.RefreshingThis tool automatically refreshes the credentials behind the scene for you.SpeedWhile refreshing credentials, you may feel your aws tools (boto scripts or awscli) freeze for several seconds. This usually happens at the edge of every 30 seconds. When this tool sense it is close to the end of each 30 seconds, it will wait until this 30 second window pass, to avoid the google 2FA authentication failure caused by network delay or time in-synchronization.ImproveThe following items are in the view:Use more secure store.Test on windowsTest on linux(ubuntu)add a easy role assumption supportAllow signing Login URLs (working withawslogin)Package properly and add testingContribution welcome..