AWS CloudTrail is a service that enables auditing of your AWS account. With CloudTrail, you can log, monitor, and retain account activity related to actions across your AWS infrastructure. This service provides event history of your AWS account activity, such as actions taken through the AWS Management Console, AWS SDKs, command line tools, and other AWS services.
From your AWS console, choose “CloudTrail” from the Deployment & Management section:
Create a new trail:
Provide a name for the new S3 bucket that will be used to store the CloudTrail logs (remember the name you provide here, you’ll need to reference it during plugin setup):
The standard file system AWS CloudTrail will create has this structure:
The structure may change depending on the different configuration of the services, and the user may only change the bucket_name & prefix values.
Open the Wazuh configuration file (
/var/ossec/etc/ossec.conf) and add the following configuration block to enable the integration with CloudTrail:
<wodle name="aws-s3"> <disabled>no</disabled> <interval>10m</interval> <run_on_start>yes</run_on_start> <skip_on_error>yes</skip_on_error> <bucket type="cloudtrail"> <name>wazuh-cloudtrail</name> <aws_profile>default</aws_profile> </bucket> </wodle>
To monitor logs for multiple AWS accounts, configure multiple
<bucket>options within the
aws-s3wodle. Bucket tags must have a
typeattribute which depends on the service which is monitored.
Check the AWS S3 module reference manual to learn more about each setting.
Restart Wazuh in order to apply the changes:
If you’re configuring a Wazuh manager:
# systemctl restart wazuh-manager
For SysV Init:
# service wazuh-manager restart
If you’re configuring a Wazuh agent:
# systemctl restart wazuh-agent
For SysV Init:
# service wazuh-agent restart
Amazon EC2 (Elastic Compute Cloud) provides scalable computing capacity in the cloud. When using this service, it is highly recommended to monitor it for intrusion attempts or other unauthorized actions performed against your cloud infrastructure.
Below are some use cases for Wazuh rules built for EC2.
When an user runs a new instance in EC2, an AWS event is generated. As previously mentioned, the log message is collected by the Wazuh agent, and forwarded to the manager for analysis. The following alert will be shown in Kibana, it shows data such as instance type, the user who created it or creation date:
When an user tries to run an instance without relevant permissions, then the following alert will be shown in Kibana:
When an instance in EC2 is started, the following alert will be shown on Kibana, it shows information such as the instance id and the user who started it:
If an user tries to start instances without relevant permissions the following alert will be shown on Kibana:
When an instance in EC2 is stopped, the following alert will be shown on Kibana:
If an user tries to stop instances without relevant permissions, the following alert will be show on Kibana:
When a new security group is created, the following alert is shown on Kibana. It shows information such as the user who created it and information about the security group:
If a new Elastic IP is allocated, the following alert will be shown on Kibana:
AWS Identity and Access Management (IAM) log data can be used to monitor user access to AWS services and resources. Using IAM, you can create and manage AWS users and groups, and manage permissions to allow and deny their access to AWS resources.
Below are some use cases for Wazuh alerts built used for IAM events.
When we create a new user account in IAM, an AWS event is generated. As previously mentioned, the log message is collected by the Wazuh agent, and forwarded to the manager for analysis. When an user account is created, the following alert will appear on Kibana. You can see the username of the created user and who created it:
If an unauthorized user attempts to create new users, the following alert will be shown in kibana. It will show you which user has tried to create an user account and the username it tried to create:
When an user tries to log in with an invalid password, the following alert will be shown in Kibana. There will be shown data such as the user who tried to login or the browser it was using:
When more than 4 authentication failures occur in a 360 second time window, Wazuh raises this alert: