Adding a new user
Every person who works with Hosty has their own IAM user, and so does the CI of each project. OpenTofu creates the user and its permissions. You then give a person access to the AWS Console, and give CI its access keys. Both need a VPN profile.
Add the user to main.tf
Add the username to users in the locals block of terraform/main.tf:
locals {
# ...
users = [
# People. A prefix with the name of their company helps to tell them apart.
"company.alice",
"company.bob",
# CI users, one per project.
"ci.shop",
]
}Being in users alone gives almost no permissions. Give the user a role too, in the same change:
- add them to administrators for full access to the whole hosting;
- or add them to lead_developers, developers or release_managers of a project. See Adding a new project for what each role can do.
Then apply:
cd /src/terraform
tofu plan
tofu applyOpenTofu creates:
- the IAM user, in the group users, which lets them manage their own password, MFA device and access keys;
- for admins: membership in administrators, with full access to AWS once they have an MFA session, and admin access to every cluster;
- for people in a project: membership in the IAM groups of the project, and access to the namespaces of the project in its cluster;
- a VPN profile <user>.<cluster>.ovpn in the bucket vpn.<hosted zone>, for each cluster where the user is an admin or has a project. A user without a role gets no VPN profile.
People
Give them access to the AWS Console
OpenTofu doesn't set passwords, so do it in the AWS Console:
- Open IAM, then Users, the user, and the Security credentials tab.
- Click Enable console access, let AWS generate a password, and keep the option to make them change it at the first sign-in.
- Note the sign-in URL of the account, https://<account id>.signin.aws.amazon.com/console.
Passwords must have at least 10 characters with uppercase and lowercase letters, numbers and symbols. They expire after a year, and the last 6 can't be reused.
Give them their VPN profile
Download the profile of the user for each cluster they need:
aws s3 cp s3://vpn.<hosted zone>/<user>.<cluster>.ovpn .The profile holds the private key of the user, so send it privately.
Send the details
Send the person their username, the sign-in URL, the password and the VPN profile. Send the password through another channel than the rest. They then finish the setup themselves, as described in Setting up a new user: they change the password, add an MFA device and create their access keys. Hosty CLI needs the MFA device for hosty auth, and admins can do almost nothing in AWS without it.
CI users
A CI user doesn't sign in to the Console and has no MFA device. It only needs access keys and a VPN profile.
- Open the user in IAM, then the Security credentials tab, and click Create access key. Choose Third-party service as the use case.
- Download its VPN profile as shown above.
- Give the access keys and the profile to the lead developer of the project, to store in the secrets of their CI, as described in CI/CD configuration.
The keys don't expire. Create new ones and delete the old ones when someone who has seen them leaves.