AWS Policy: Allow update specific record in route53 hosted zone

vskubriev

Assume the documentation, I should use policy, like this:

{
   "Version": "2017-11-27",
   "Statement":[
      {   
         "Effect":"Allow",
         "Action": [
           "route53:ChangeResourceRecordSets"
         ],  
         "Resource": [
          "arn:aws:route53:::hostedzone/<ZONE_ID>"
         ]
   ]   
}

I need a very safe policy.

I cannot add specific resource record set (one record in zone) in arn. I can use Condition to check what record should be changed with ChangeResourceRecordSets API call. If I'm not mistaken.

This is necessary for automatic update only one record in public domain zone. Updates _acme-challenge.ldap.example.com. record for automatically update let's encrypt certificates. I know that acme.sh is available to achive my goal. But I want to write my own custom and simple script to do this.

Michael - sqlbot

I can use Condition to check what record should be changed with ChangeResourceRecordSets API call. If I'm not mistaken.

I believe you may be mistaken.

Amazon Route 53 has no service-specific [condition] context keys that can be used in an IAM policy.

http://docs.aws.amazon.com/IAM/latest/UserGuide/list_route53.html

Additionally, none of the global condition keys seem applicable.

However, I believe there's a workaround for this.

Create a second public hosted zone for the domain _acme-challenge.ldap.example.com. I know you're probably thinking "but that's not a domain!" but in the relevant sense, it actually is still a domain.

Route 53 will assign 4 new nameservers to this new hosted zone. Make a note of those servers.

Back in your original hosted zone, create a record for _acme-challenge.ldap.example.com of type NS. The value you will use to create this record will be the 4 nameservers that Route 53 assigned to the new hosted zone, one per line. Do not change any of the existing NS records in either of the zones.

This is called a delegation -- you're delegating authority for this particular subdomain to a different hosted zone, which you will notice was automatically assigned a completely different set of 4 Route 53 servers from those that handle your parent domain.

You can now create a new record in the root of the new hosted zone, and when you do a DNS query for _acme-challenge.ldap.example.com, the answer returned will be the answer from the new hosted zone.

Now, you can give your script permission only to modify records in the new zone, and it will be unable to modify anything in the parent zone, because you gave it no permissions, there.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to fetch the AWS Route53 hosted zone id?

Can't delete a private hosted zone in AWS Route53

Check a CNAME exist in a hosted zone in aws route53

DNS hosted zone not taking effect - AWS Route53

List resource record sets from hosted zone in route53 giving a very weird error

Route53 Private hosted zone certificate

Will Route53 private hosted zone work over AWS VPC Peering

Will Route53 private hosted zone work over AWS VPC Peering in two account

How do I point to my AWS account's load balancer from another AWS account's route53 hosted zone?

AWS Route53 - Adding Simple Record

Can I have a route53 subdomain in a different Hosted Zone?

Creating Route53 Hosted zone fails with InvalidClientTokenId

Best Practices for multiple subdomains in AWS Route 53 Hosted Zone

AWS Route 53 -- create Hosted Zone with third level Domain Name?

Amazon AWS Route 53 Hosted Zone does not work

AWS Cloudfront with Geolocation policy vs Route53

AWS Route53 Zone Delegation to internal datacenter nameservers

"no matching Route53Zone found": Terraform's Route53 data source is not recognizing the hosted zone name

Delete AWS CloudFormation stack but preserve Route53 record set

Redirect A record to Apigateway custom domain in AWS Route53

How to modify the Route53 hosted zone created after domain registration (i.e. method RegisterDomain)

Fetch zone_id of hosted domain on route53 using terraform

Can I use an internal AWS hostname for my Route 53 Hosted Zone?

AWS Simple Email Service Domain Validation and Domain created in Route 53 Private Hosted Zone

AWS Route53 - different AWS accounts with same hosting zone name

AWS ACM and Route53 - 2 hosted zones with same name, how to handle cert validation

Why does a Route53 record I created with terraform resource aws_route53_record not resolve publicly?

AWS CLI - route53 change-resource-record-sets command failing if A record but passes if CNAME

How to create route53 zone with predefined NS, or update NS of a registered domain?