Thank you for getting back to me!
The instance profile does have GetObject permission. Here's the IAM profile:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "wazuhGetObjectsInS3Bucket",
"Effect": "Allow",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::logstash-test-bucket/*",
"arn:aws:s3:::guardduty/*",
"arn:aws:s3:::vpcflow/*",
"arn:aws:s3:::cloudtrail/*",
"arn:aws:s3:::s3/*"
]
},
{
"Sid": "wazuhListObjectsInS3Bucket",
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": [
"arn:aws:s3:::logstash-test-bucket/*",
"arn:aws:s3:::guardduty/*",
"arn:aws:s3:::vpcflow/*",
"arn:aws:s3:::cloudtrail/*",
"arn:aws:s3:::s3/*"
]
},
{
"Sid": "wazuhCheckForBucketAccess",
"Effect": "Allow",
"Action": "s3:HeadBucket",
"Resource": [
"arn:aws:s3:::logstash-test-bucket/*",
"arn:aws:s3:::guardduty/*",
"arn:aws:s3:::vpcflow/*",
"arn:aws:s3:::cloudtrail/*",
"arn:aws:s3:::s3/*"
]
},
{
"Sid": "wazuhGetVPCFlowLogs",
"Effect": "Allow",
"Action": "ec2:DescribeFlowLogs",
"Resource": "*"
},
{
"Sid": "wazuhAssumeRole",
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": [
"arn:aws:iam::111122223333:role/ReadOnly_S3Bucket",
"arn:aws:iam::111122223333:role/wazuh_InstanceProfile",
"arn:aws:iam::*:role/vpc_flow_logs"
]
},
{
"Sid": "wazuhUseKMS",
"Effect": "Allow",
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey"
],
"Resource": [
"arn:aws:s3:::guardduty/*",
"arn:aws:s3:::vpcflow/*",
"arn:aws:s3:::cloudtrail/*",
"arn:aws:s3:::s3/*"
]
}
]
}
The instance profile is applied to the node running the agent and I've tried restarting the node several times without much luck. It appears that the profile is working properly because the debug messages from Wazuh show that the host can reach STS and assume a role and get temporary credentials.
The Wazuh config on the node itself is configured to use the instance profile as well:
<wodle name="aws-s3">
<disabled>no</disabled>
<interval>5m</interval>
<run_on_start>yes</run_on_start>
<skip_on_error>yes</skip_on_error>
<!-- S3 Audit Logs -->
<bucket type="custom">
<name>s3</name>
<only_logs_after>2021-JAN-21</only_logs_after>
<regions>us-west-1</regions>
<iam_role_arn>arn:aws:iam::111122223333:role/wazuh_InstanceProfile</iam_role_arn>
</bucket>
</wodle>
I'm sorry for the poor formatting. I thought there used to be a way to format text as code, but I can't find the option to do that anymore.
Thank you again for your help! Any advice would be amazing.