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
已回答 5 个月前
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.

已回答 5 个月前
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

已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则