|
| 1 | +# AWS access for team members |
| 2 | + |
| 3 | +Selected members of the Rust Team have access to the AWS account of the |
| 4 | +project. This includes both members of the Infrastructure Team and members of |
| 5 | +teams with services hosted on AWS. |
| 6 | + |
| 7 | +This document explains how to access our AWS account, and how to interact with |
| 8 | +it. |
| 9 | + |
| 10 | +## Setting up your user after receiving the credentials |
| 11 | + |
| 12 | +The first thing you need to do after receiving your credentials is changing the |
| 13 | +password and enabling 2-factor authentication: until you do these things, |
| 14 | +access will be restricted automatically to just the permissions needed to |
| 15 | +configure 2FA. |
| 16 | + |
| 17 | +[Sign into the console][console-login] with the temporary credentials given to |
| 18 | +you by the infrastructure team member who created the user. You'll be prompted |
| 19 | +to change the temporary password: change it and log in again. Then, go to the |
| 20 | +"My Security Credentials" page, located in the dropdown at the top: |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +Scroll down and click the "Assign MFA device" button. Choose "Virtual MFA |
| 25 | +device" (which is classic TOTP) and configure it with your authenticator app. |
| 26 | +Once you're done, log out of the console and log in again to gain access to the |
| 27 | +resources you're authorized to use. |
| 28 | + |
| 29 | +Do not choose "U2F security key", even if you own one: due to limitations of |
| 30 | +the AWS API, that would prevent you from using the CLI, restricting your access |
| 31 | +to the console alone. |
| 32 | + |
| 33 | +## Using the AWS console |
| 34 | + |
| 35 | +The AWS console provides a visual interface to most of the resources in our AWS |
| 36 | +account. |
| 37 | + |
| 38 | +<center> |
| 39 | + |
| 40 | +[Sign into the console.][console-login] |
| 41 | + |
| 42 | +</center> |
| 43 | + |
| 44 | +## Using the AWS CLI |
| 45 | + |
| 46 | +The [AWS CLI](https://aws.amazon.com/cli/) allows you to interact with our AWS |
| 47 | +account from a terminal or a script. To set it up the first time, follow |
| 48 | +Amazon's documentation to [install it][awscli-install] and [configure your |
| 49 | +credentials][awscli-configure]. The CLI doesn't use your console password to |
| 50 | +authenticate: you'll need to create an access key from the "My Security |
| 51 | +Credentials" page on the console. |
| 52 | + |
| 53 | +### 2-factor authentication |
| 54 | + |
| 55 | +To ensure the security of our AWS account, 2-factor authentication is required |
| 56 | +to interact with the CLI. The Infrastructure Team developed [a |
| 57 | +script][simpleinfra-script] that eases the authentication process by creating a |
| 58 | +temporary session validated with 2FA for the current shell. The session expires |
| 59 | +in 12 hours, and it's valid for an unlimited number of invocations. |
| 60 | + |
| 61 | +To use the script, clone the [rust-lang/simpleinfra][simpleinfra] repository in |
| 62 | +a directory. Then, every time you need to use the AWS CLI run this command in |
| 63 | +your shell: |
| 64 | + |
| 65 | +``` |
| 66 | +eval $(~/PATH/TO/SIMPLEINFRA/aws-creds.py) |
| 67 | +``` |
| 68 | + |
| 69 | +That command will prompt you for your 2FA code, and it will set a few |
| 70 | +environment variables in the current shell with the temporary credentials. |
| 71 | +You'll need to run the command again after 12 hours, or if you want the |
| 72 | +credentials on another shell. |
| 73 | + |
| 74 | +### Plaintext credentials |
| 75 | + |
| 76 | +By default, AWS CLI stores your credentials (including the secret key) in the |
| 77 | +`~/.aws/credentials` file, without any kind of encryption. While the danger of |
| 78 | +having plaintext credentials stored in your home directory is partially |
| 79 | +mitigated by the 2FA requirement, it'd be best not to store them anyway. |
| 80 | + |
| 81 | +If you use a password manager with a CLI interface, an approach you can take to |
| 82 | +avoid the problem is to store your credentials in the password manager, and |
| 83 | +configure the CLI to [call your password manager][credential_process] to fetch |
| 84 | +the credentials when needed. |
| 85 | + |
| 86 | +[awscli-configure]: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html |
| 87 | +[awscli-install]: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv1.html |
| 88 | +[console-login]: https://rust-lang.signin.aws.amazon.com/console |
| 89 | +[credential_process]: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sourcing-external.html |
| 90 | +[simpleinfra-script]: https://github.com/rust-lang/simpleinfra/blob/master/aws-creds.py |
| 91 | +[simpleinfra]: https://github.com/rust-lang/simpleinfra |
0 commit comments