Skip to content

About

One-step saml2aws + Okta AWS login setup for WSL, with Desktop shortcuts

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

saml2aws-setup

Sign in to AWS through Okta from Windows (WSL) without retyping your details every time.

  • AWS Login: signs you in to an AWS environment (dev, mgmt, prod, …) so the AWS CLI works.
  • AWS Database Password: signs you in, then gives you a 15-minute database password (RDS IAM token) and copies it to the clipboard.

The first time you use an environment you paste its Okta link and type your username and password. After that, each is remembered per environment:

What Where it is kept
Okta link and username ~/.saml2aws (one section per environment)
Password ~/.config/samllogin/passwords/<env>.dpapi, encrypted with Windows DPAPI so only your Windows login can read it
Database hostname ~/.config/samllogin/hosts (yours) and ~/.config/samllogin/team.conf (team defaults)

You still approve the Okta Verify prompt on your phone each time.

Install (Windows with WSL)

  1. If your team shares a saml2aws-team.conf (Okta links and database hosts), save it to your Windows Downloads folder. The installer picks it up, so you only type your username and password.

  2. Open Ubuntu from the Start menu.

  3. Paste this line and press Enter:

    git clone -q https://github.com/GSA/saml2aws-setup.git /tmp/saml2aws-setup && /tmp/saml2aws-setup/install.sh

    Or, from PowerShell (WSL must already be installed):

    wsl bash -lc "rm -rf /tmp/saml2aws-setup; git clone -q https://github.com/GSA/saml2aws-setup.git /tmp/saml2aws-setup && /tmp/saml2aws-setup/install.sh"
  4. For each environment, answer Y and enter your Okta username: always your GSA email (first.last@gsa.gov), never a personal address. Anything else is refused. Without a team file you're also asked for the Okta link: open your Okta dashboard, right-click the AWS tile for that environment, and choose Copy link.

  5. Two shortcuts appear on your Desktop: AWS Login and AWS Database Password. ~/awslogin.sh and ~/samllogin.sh are added to your home folder too.

The installer copies what it needs to ~/.local/share/saml2aws-setup, so nothing else is left in your home folder. To update, run the same line again (rm -rf /tmp/saml2aws-setup first).

Team file

saml2aws-team.example.conf shows the format: one [environment] section with url (the Okta AWS tile link, which is the same for everyone in your Okta org) and optional db_host (the RDS proxy endpoint). Share the real file privately, not in this public repo. Pass it explicitly with install.sh --team FILE; rerun that to pick up changes.

To produce it from a setup that already works for you:

./make-team-file.sh --title "My team settings" dev=<dev-proxy-host> prod=<prod-proxy-host>

It writes saml2aws-team.conf here (ignored by git) with the Okta link of every environment in your ~/.saml2aws. Database hosts come from the ENV=HOST arguments, else your saved hosts, else your installed team file. Usernames and passwords are never copied. Check the file, then share it privately (Teams, OneDrive) for others to save to their Downloads folder.

Use

Double-click a Desktop shortcut and pick the environment, or run it from a terminal:

awslogin.sh mgmt                  # then: aws --profile mgmt ...
samllogin.sh prod                 # prints a database password; samllogin.sh prod readonly for another DB user
samllogin.sh --list               # saved database hostnames

If your password changes, sign-in fails once and you're asked for the new one, which replaces the saved one.

Change or remove saved details

To Do
Change an environment's Okta link or username Delete its section from ~/.saml2aws; you'll be asked again
Fix a non-GSA username saved earlier Nothing: it's refused on next use and you're asked for your GSA email
Use another email domain export SAMLLOGIN_EMAIL_DOMAIN=example.gov (empty allows any)
Forget a saved password rm ~/.config/samllogin/passwords/<env>.dpapi
Never save passwords export SAMLLOGIN_NO_SAVE=1
Change a database hostname Type a new one at the prompt (Enter keeps the saved or team one)

saml2aws.example shows what ~/.saml2aws looks like, with placeholders.

Files

File Purpose
install.sh Installs saml2aws, the scripts, the team file, home-folder links and Desktop shortcuts
awslogin.sh, samllogin.sh, lib/common.sh The login scripts
make-team-file.sh Builds saml2aws-team.conf from your working setup
saml2aws-team.example.conf, saml2aws.example Formats, with placeholders

Notes

  • Okta sessions are turned off (disable_sessions = true): Okta now answers saml2aws's session call with HTTP 403 after you approve the push. Older setups are switched over on next use.

  • Outside WSL, passwords are saved in the desktop keyring if secret-tool is installed; otherwise you're asked each time.

  • Sessions last 8 hours, or 1 hour for environments whose name starts with prod. Change aws_session_duration in ~/.saml2aws if your role allows something else.

  • The installer downloads the latest saml2aws release and checks its published SHA-256 before installing it to ~/.local/bin.

License

Public domain under CC0 1.0.

About

One-step saml2aws + Okta AWS login setup for WSL, with Desktop shortcuts

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages