Repository navigation
feat(dns): Route53 hosted zone in another AWS account via a cross-account role (Part of #273, closes #468) - #469
Open
bhumi46 wants to merge 1 commit into
Conversation
…ount role (mosip#468) For a team whose AWS account has no hosted zone for the domain (e.g. mosip.net is in another account). Opt-in dns_role_arn in common.tfvars: a role in the DNS account, limited to the zone, trusting the team's CI user and certbot role. Unset = unchanged behaviour. - dns: records go through a new aws.dns provider that assumes the role (dynamic assume_role, optional dns_role_external_id); the nginx lookup stays on the team-account provider. - iam: with route53_role_arn the certbot policy only allows sts:AssumeRole on that role (name/description unchanged; default policy byte-for-byte as before). - Ansible: generate.py maps dns_role_arn -> dns01_route53_role_arn; the tls role writes /root/.aws/config (0600) so certbot's route53 plugin assumes the role from the instance profile, renewals included. ARN validated in Terraform and Ansible. - Docs: profile comments; README section with the DNS account's trust and permission policies, team-side sts:AssumeRole, enable/disable. Part of mosip#273. Closes mosip#468. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: bhumi46 <thisisbn46@gmail.com>
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 17
Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #273
Closes #468
Problem
A team whose AWS account has no hosted zone for the domain can create every resource except DNS — the zone (e.g.
mosip.net) lives in another AWS account. Thednscomponent, the certbot IAM policy and the TLS DNS-01 step all assumed the zone is in the same account.How it works
The DNS account creates one role, limited to the zone, that trusts the team account's CI user and certbot role. At run time AWS STS hands out temporary (1 h) credentials for it — no keys from the DNS account are shared; the DNS account can revoke access by changing the role; CloudTrail logs both sides.
dns_role_arndnscomponentaws.dnsprovider withassume_role(optionaldns_role_external_id); nginx lookup stays in the team accountiamcomponentsts:AssumeRoleon the role (name/description unchanged)generate.pymapsdns_role_arn→dns01_route53_role_arn; nginx/root/.aws/config(0600):role_arn+credential_source = Ec2InstanceMetadata→ certbot assumes the role, renewals toodns01_credentials_filetogether rejectedREADME: new section Domain in another AWS account with the DNS account's trust + permission policies (zone-scoped:
ChangeResourceRecordSets,ListResourceRecordSets,GetHostedZoneon the zone;GetChange;ListHostedZones/ListHostedZonesByName), the team-sidests:AssumeRole, enable/disable steps.Tests
terraform test: iam 8 (+2: policy only assumes the role, name/description unchanged; bad ARN rejected; the legacy-permissions test still passes = default unchanged), dns root 6 (+2: same records planned viaaws.dns; bad ARN rejected), all other suites unchanged;validateall roots;fmt.terraform planof the dns root: withoutdns_role_arn→ plans as today; with a non-existent role →Error: Cannot assume IAM Role … STS: AssumeRole … AccessDenied(proves the records go through the role).generate.py: 18 passed (+2: mapping; absent by default).site.yml --syntax-checkall profiles./root/.aws/configwithrole_arn/credential_source, dir 0700 / file 0600, root-owned; bad ARN → fails; role + credentials file → fails; unset → skipped, no file.🤖 Generated with Claude Code