Amazon Macie

Amazon Macie is a security service that uses machine learning to automatically discover, classify, and protect sensitive data in AWS. Macie recognizes sensitive data such as personally identifiable information (PII) or intellectual property, and provides you with dashboards and alerts that give visibility into how this data is being accessed or moved. The fully managed service continuously monitors data access activity for anomalies, and generates detailed alerts when it detects risk of unauthorized access or inadvertent data leaks.

Amazon configuration

  1. Go to Services > Storage > S3:
  1. Click on the Create bucket:
  1. Create a new bucket, giving it a name and clicking on the Create button:
  1. Go to Services > Analytics > Kinesis:

4.1. If it’s the first time you’re using this service, you’ll see the following screen. Just click on Get started:

  1. Click on Create delivery stream button:
  1. Put a name to your delivery stream and click on the Next button at the bottom of the page:
  1. On the next page, leave both options as Disabled and click on Next:
  1. Select Amazon S3 as destination, then select the previously created S3 bucket and add a prefix where logs will be stored. AWS Firehose creates a file structure YYYY/MM/DD/HH, if a prefix is used the created file structure would be firehose/YYYY/MM/DD/HH. If a prefix is used it must be specified under the Wazuh Bucket configuration:
  1. You can select which compression do your prefer. Wazuh supports any kind of compression but Snappy. After that, click on Create new or choose:
  1. Give a proper name to the role and click on the Allow button:
  1. The following page is just a summary about the Firehose stream created, go to the bottom of the page and click on the Create delivery stream button:
  1. Go to Services > Management Tools > CloudWatch:
  1. Select Rules on the left menu and click on the Create rule button:
  1. Select which service do you want to get logs from using the Service name slider, then, click on the Add target button and add the previously created Firehose delivery stream there. Also, create a new role to access the delivery stream:
  1. Give the rule some name and click on the Create rule button:
  1. Once the rule is created, data will start to be sent to the previously created S3 bucket. Remember to first enable the service you want to monitor, otherwise you won’t get any data.

Wazuh configuration

  1. Open the Wazuh configuration file (/var/ossec/etc/ossec.conf) and add the following block:
<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="custom">
    <name>wazuh-aws-wodle</name>
    <path>macie</path>
    <aws_profile>default</aws_profile>
  </bucket>
</wodle>

Note

Check the AWS S3 module reference manual to learn more about each setting.

  1. Restart Wazuh in order to apply the changes:
  • If you’re configuring a Wazuh manager:

    1. For Systemd:
    # systemctl restart wazuh-manager
    
    1. For SysV Init:
    # service wazuh-manager restart
    
  • If you’re configuring a Wazuh agent:

    1. For Systemd:
    # systemctl restart wazuh-agent
    
    1. For SysV Init:
    # service wazuh-agent restart
    

Use cases

Amazon S3 (Simple Storage Service) provides secure and reliable storage capacity in the cloud. When using this service, it is highly recommended to monitor it to detect data loss attacks.

Below are some use cases for Wazuh alerts built for S3.

Bucket removal

Multiple alerts will be raised when a Bucket has been removed. Some examples are shown below: