Closed hugoShaka closed 4 months ago
With @Joerger we discussed the following approaches:
~/.tsh
profile and MFAThis approach removes the use of impersonation, Terraform would run as the user. The user would get prompted for MFA when running Terraform.
This approach offers a simple setup flow (no additional user, role, bot, just use your rights) and a strong security posture (MFA for admin security properties are preserved).
This approach requires the user to have the appropriate rights. This was already the case indirectly with the previous impersonation approach. This means users potentially have higher standing privileges by default, although most users applying Terraform code are very likely already editors/
This approach is a port of the current impersonation approach, but with "MFA for admin" support. This implies:
This would make the old approach functional again. However, this would remove most security benefits brought by "MFA for Admin"
This would partially address the UX issue. The user would pass a bot token to Terraform, and Terraform would do the MachineID dance to get Bot certs, without the need for tbot
.
This improves the UX locally, but also in the CI: you can pass to Terraform a GHA token and let it get the certs automatically.
However this doesn't address the security aspect of having long-lived/renewable admin certificates not subject to MFA on every admin laptop.
MFA for admin action blocks the local execution of Terraform code and forces the administrators to use machineID locally. This both degrades the Terraform experience and reduces the security.
Expected behaviour:
Current behaviour:
tctl auth sign
to get a Terraform idenittyWhy local Terraform execution matters
Why the local machine ID workaround is a security downgrade
The users deploying Terraform code locally are administrators. They are the high-privilege target we want to protect with "MFA for admin".
Setting up a local MachineID bot generates long-lived renewable credentials on their machine. Those credentials can be exfiltrated and MachineID's exfiltrartion mechanism only works when the bot is running (which is very infrequent as we are using it in oneshot mode).
We wanted to reduce the risk of admin account takeover, but forced users to create more sensitive long-lived credentials, increasing the risk of admin account exfiltration. Those credentials are also not subject to "MFA for admin" by definition.
Workaround:
on
instead ofwebauthn
)Bug details: