Access Denied for LogDestination: a-b-c-d. Please check LogDestination permission

0

Hi,

I am running into the permission issue and cannot really see why. We need to limit S3 access to a specific IP addresses and at the same time flow logs have to be delivered into the bucket. I am getting rejected when I am trying to create a flow log from the subnet side at the VPC level. The policy is:

{ "Version": "2012-10-17", "Id": "AAA-aws-flow-logs", "Statement": [ { "Sid": "AWSLogDeliveryWrite", "Effect": "Allow", "Principal": { "Service": [ "delivery.logs.amazonaws.com", "logging.s3.amazonaws.com" ] }, "Action": "s3:PutObject", "Resource": [ "arn:aws:s3:::AAA-aws-flow-logs", "arn:aws:s3:::AAA-aws-flow-logs/", "arn:aws:s3:::AAA-aws-flow-logs/AWSLogs/123456789012/" ], "Condition": { "StringEquals": { "s3:x-amz-acl": "bucket-owner-full-control", "aws:SourceAccount": "123456789012" }, "ArnLike": { "aws:SourceArn": "arn:aws:logs:eu-west-3:123456789012:" } } }, { "Sid": "AWSLogDeliveryAclCheck", "Effect": "Allow", "Principal": { "Service": [ "delivery.logs.amazonaws.com", "logging.s3.amazonaws.com" ] }, "Action": [ "s3:GetBucketAcl", "s3:ListBucket", "s3:PutObject" ], "Resource": [ "arn:aws:s3:::AAA-aws-flow-logs", "arn:aws:s3:::AAA-aws-flow-logs/", "arn:aws:s3:::AAA-aws-flow-logs/AWSLogs/123456789012/" ], "Condition": { "StringEquals": { "aws:SourceAccount": "123456789012" }, "ArnLike": { "aws:SourceArn": "arn:aws:logs:eu-west-3:123456789012:" } } }, { "Sid": "DenyAllExcept", "Effect": "Deny", "Principal": "", "Action": "s3:", "Resource": [ "arn:aws:s3:::AAA-aws-flow-logs/*", "arn:aws:s3:::AAA-aws-flow-logs" ], "Condition": { "NotIpAddress": { "aws:SourceIp": [ "1.2.3.4", "5.6.7.8" ] } } } ] }

質問済み 6ヶ月前133ビュー
3回答
0

In the Deny statement, the Principal field is empty (""). It's generally a best practice to specify the principal even in Deny statements. Try updating it to "*" to explicitly deny access to any principal.

{
   "Sid":"DenyAllExcept",
   "Effect":"Deny",
   "Principal":"*",
   "Action":"s3:",
   "Resource":[
      "arn:aws:s3:::AAA-aws-flow-logs/*",
      "arn:aws:s3:::AAA-aws-flow-logs"
   ],
   "Condition":{
      "NotIpAddress":{
         "aws:SourceIp":[
            "1.2.3.4",
            "5.6.7.8"
         ]
      }
   }
}

profile picture
回答済み 6ヶ月前
0

Hello,

Warm Greetings from AWS Premium Support. I hope you're doing well.

Thank you for reaching out to us with your concern. Firstly, I checked the Policy attached with the case notes, When I replicated in my lab environment I get Invalid principal format: The Principal element contents are not valid. Specify a key-value pair in the Principal element.

This is because, I can see that in "DenyAllExcept" statement, the Principal field is empty (""). As per AWS Policy, we need to specify key-value pair in the Principal element. Hence I would suggest you to enter the respective value anf try again.

{ "Sid":"DenyAllExcept", "Effect":"Deny", "Principal":"", "Action":"s3:", "Resource":[ "arn:aws:s3:::AAA-aws-flow-logs/", "arn:aws:s3:::AAA-aws-flow-logs" ], "Condition":{ "NotIpAddress":{ "aws:SourceIp":[ "1.2.3.4", "5.6.7.8" ] } } }

Incase If you face any error after making the change, Kindly share the error message. To view the exact error message, you can use cloudtrail to check the exact error message. Once, you get the error, kindly reach back to us , we will troubleshoot the issue further.

回答済み 6ヶ月前
0

Hi,

Thank you for looking into it. The principal statement is not empty and has a star for everything as it is indicated in a policy. Policy applies without any issues.

Regards

回答済み 6ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ