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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠