Skip to content

caylent/siem-on-amazon-opensearch-service

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SIEM on Amazon OpenSearch Service

View this page in Japanese (日本語) | Chinese (中文)

SIEM on Amazon OpenSearch Service (successor to SIEM on Amazon Elasticsearch Service) is a solution for collecting multiple types of logs from multiple AWS accounts, correlating and visualizing the logs to help investigate security incidents. Deployment is easily done with the help of AWS CloudFormation or AWS Cloud Development Kit (AWS CDK), taking only about 30 minutes to complete. As soon as AWS services logs are put into a specified Amazon Simple Storage Service (Amazon S3) bucket, a purpose-built AWS Lambda function automatically loads those logs into SIEM on OpenSearch Service, enabling you to view visualized logs in the dashboard and correlate multiple logs to investigate security incidents.

Jump to | Configuring AWS Services(Log Sources) | Changing Configurations of SIEM on OpenSearch Service | Advanced Deployment | Dashboard | Supported Log Types | FAQ | Changelog |

Sample dashboard

Architecture

Architecture

Supported Log Types

SIEM on OpenSearch Service can load and correlate the following log types.

AWS Service Log
Security, Identity, & Compliance Amazon GuardDuty GuardDuty findings
Security, Identity, & Compliance AWS Directory Service Microsoft AD
Security, Identity, & Compliance AWS WAF AWS WAF Web ACL traffic information
AWS WAF Classic Web ACL traffic information
Security, Identity, & Compliance AWS Security Hub Security Hub findings
GuardDuty findings
Amazon Macie findings
Amazon Inspector findings
AWS IAM Access Analyzer findings
Security, Identity, & Compliance AWS Network Firewall Flow logs
Alert logs
Management & Governance AWS CloudTrail CloudTrail Log Event
CloudTrail Insight Event
Networking & Content Delivery Amazon CloudFront Standard access log
Real-time log
Networking & Content Delivery Amazon Route 53 Resolver VPC DNS query log
Networking & Content Delivery Amazon Virtual Private Cloud (Amazon VPC) VPC Flow Logs (Version5)
Networking & Content Delivery Elastic Load Balancing Application Load Balancer access logs
Network Load Balancer access logs
Classic Load Balancer access logs
Storage Amazon FSx for Windows File Server audit log
Storage Amazon Simple Storage Service (Amazon S3) access log
Database Amazon Relational Database Service (Amazon RDS)
(Experimental Support)
Amazon Aurora(MySQL)
Amazon Aurora(PostgreSQL)
Amazon RDS for MariaDB
Amazon RDS for MySQL
Amazon RDS for PostgreSQL
Analytics Amazon Managed Streaming for Apache Kafka (Amazon MSK) Broker log
Compute Linux OS
via CloudWatch Logs
/var/log/messages
/var/log/secure
Compute Windows Servver 2012/2016/2019
via CloudWatch Logs
System event log
Security event log
Containers Amazon Elastic Container Service (Amazon ECS)
via FireLens
Framework only
End User Computing Amazon WorkSpaces Event log
Inventory

Experimental Support: We may change field type, normalization and something in the future.

Supported logs are normalized in accordance with the Elastic Common Schema. Click here to see the correspondence table of the original and normalized field names for the logs.

Dashboard

See this

Getting Started

In this turorial, you will create a publicly accessible SIEM on OpenSearch Service domain using a CloudFormation template. See Advanced Deployment if you need to deploy it within an Amazon VPC or need to customize it.

You can add country information as well as latitude/longitude location information to each IP address. To get location information, SIEM on OpenSearch Service downloads and uses GeoLite2 Free by MaxMind. If you want to add location information, get your free licence from MaxMind.

Note: The CloudFormation template will deploy OpenSearch Service with a t3.medium.search instance. It's not the AWS Free Tier. Change it to an instance type that can deliver higher performance than t3 when using SIEM in the production environment as it requires higher processing power when aggregating many logs. Use the AWS Management Console to change the instance type, extend the volume, or use UltraWarm. This is because the CloudFormation template for SIEM on OpenSearch Service is designed for the initial deployment purpose only, and cannot be used for managment purposes like changing/deleting nodes.

1. Quick Start

Choose a region where you want to deploy SIEM on OpenSearch Service from the following:

Region CloudFormation
US East (N. Virginia)us-east-1 Deploy in us-east-1
US West (Oregon)us-west-2 Deploy in us-west-2
Asia Pacific (Tokyo)ap-northeast-1 Deploy in ap-northeast-1
Asia Pacific (Singapore)ap-southeast-1 Deploy in ap-southeast-1
Europe (Frankfurt)eu-central-1 Deploy in eu-central-1
Europe (London)eu-west-2 Deploy in eu-west-2

If your desired region is not listed above, manually choose the template below:

https://aes-siem-<REGION>.s3.amazonaws.com/siem-on-amazon-opensearch-service.template

Or you can create your own template by following the steps below.

2. Creating a CloudFormation template

You can skip this if you have already deployed SIEM on OpenSearch Service using one of the CloudFormation templates in Step 1 above.

2-1. Prerequisites

The following instance and tools need to be in place so that you can create a CloudFormation template:

  • AWS CloudShell or Amazon EC2 instance running Amazon Linux 2
    • "Development Tools"
    • Python 3.8
    • Python 3.8 libraries and header files
    • git

Run the following commands if the above tools have not been installed yet:

sudo yum groups mark install -y "Development Tools"
sudo yum install -y amazon-linux-extras
sudo amazon-linux-extras enable python3.8
sudo yum install -y python38 python38-devel git jq
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1

2-2. Cloning SIEM on OpenSearch Service

Clone SIEM on OpenSearch Service from our GitHub repository:

cd
git clone https://github.com/aws-samples/siem-on-amazon-opensearch-service.git

2-3. Setting up the enviroment variables

export TEMPLATE_OUTPUT_BUCKET=<YOUR_TEMPLATE_OUTPUT_BUCKET> # Name of the S3 bucket where the template is loaded
export AWS_REGION=<AWS_REGION> # Region where the distribution is deployed

Note: $TEMPLATE_OUTPUT_BUCKET indicates an S3 bucket name, so create yours beforehand. This bucket will be used to store files distributed for deployment, so it needs to be publicly accessible. The build-s3-dist.sh script (used to create a template) WILL NOT create any S3 bucket.

2-4. Packaging AWS Lambda functions and creating a template

cd ~/siem-on-amazon-opensearch-service/deployment/cdk-solution-helper/
chmod +x ./step1-build-lambda-pkg.sh && ./step1-build-lambda-pkg.sh && cd ..
chmod +x ./build-s3-dist.sh && ./build-s3-dist.sh $TEMPLATE_OUTPUT_BUCKET

2-5. Uploading the deployment assets to your Amazon S3 bucket

aws s3 cp ./global-s3-assets s3://$TEMPLATE_OUTPUT_BUCKET/ --recursive --acl bucket-owner-full-control
aws s3 cp ./regional-s3-assets s3://$TEMPLATE_OUTPUT_BUCKET/ --recursive --acl bucket-owner-full-control

Note: To run the commands, you'll need to grant permissions to upload files to the S3 bucket. Also ensure to set the right access policy to the files once they are uploaded.

2-6. Deploying SIEM on OpenSearch Service

The uploaded template is now stored in https://s3.amazonaws.com/$TEMPLATE_OUTPUT_BUCKET/siem-on-amazon-opensearch-service.template. Deploy this template using AWS CloudFormation.

3. Configuring OpenSearch Dashboards

It will take about 30 mins for the deployment of SIEM on OpenSearch Service to complete. You can then continue to configure OpenSearch Dashboards (the successor to Kibana).

  1. Navigate to the AWS CloudFormation console, choose the stack that you've just created, and then choose "Outputs" from the tab menu at the top right. You can find your username, password, and URL for OpenSearch Dashboards. Log into OpenSearch Dashboards using the credentials.
  2. When you login for the first time, [Select your tenant] is displayed. Select [Global]. You can use the prepared dashboard etc.
  3. You can also select [Private] instead of [Global] in [Select your tenant] and customize configuration and dashboard etc. for each user. The following is the procedure for each user. If you select Global, you do not need to set it.
    1. To import OpenSearch Dashboards's configuration files such as dashboard, download saved_objects.zip. Then unzip the file.
    2. Navigate to the OpenSearch Dashboards console. Click on "Stack Management" in the left pane, then choose "Saved Objects" --> "Import" --> "Import". Choose dashboard.ndjson which is contained in the unzipped folder. Then log out and log in again so that the imported configurations take effect.

4. Loading logs into OpenSearch Service

All you need to do to load logs into SIEM on OpenSearch Service is PUT logs to the S3 Bucket named aes-siem-<YOUR_AWS_ACCOUNT>-log. Then the logs will be automatically loaded into SIEM on OpenSearch Service. See this for detailed instructions on how to output AWS services logs to the S3 bucket.

Updating SIEM

If you want to update "SIEM on OpenSearch Service/SIEM on Amazon ES" to the latest version, upgrade the OpenSerch / Elasticsearch domain and then update it in the same way as you did for the initial setup (using CloudFormation or AWS CDK.) You can view the changelog of SIEM here.

Note: When you update SIEM, Global tenant settings, dashboards, etc. will be overwritten automatically. The configuration files and dashboards used before the update will be backed up to aes-siem-[AWS_Account]-snapshot/saved_objects/ in the S3 bucket, so restore them manually if you want to restore the original settings.

Upgrading the OpenSearch Service domain

Upgrade the domain to Opensearch 1.0 or Elasticsearch version 7.10:

  1. Navigate to the OpenSearch Service console
  2. Choose domain: [aes-siem]
  3. Choose [Actions] icon, and choose [Upgrade domain] from the drop-down menu
  4. For "Version to upgrade to", choose [OpenSearch 1.0] or [Elasticsearch 7.10] and then choose [Submit]

If you completed the initial setup using CloudFormation, move on to the next step. If you completed the initial setup using the AWS CDK, see
"Updating SIEM with the AWS CDK" section in Advanced Deployment.

Updating the CloudFormation stack

You can update the CloudFormation stack by specifying the CloudFormation template below:

https://aes-siem-<REGION>.s3.amazonaws.com/siem-on-amazon-opensearch-service.template
  1. Navigate to the CloudFormation console
  2. Choose stack [aes-siem]
  3. Choose [Update] at the right top on the screen
  4. In Update stack, choose the following:
    • Prepare template: [Replace current template]
    • Template source: [Amazon S3 URL]
    • Amazon S3 URL:
    • Choose [Next]
  5. Leave all the other settings as default, and continue to click Next to complete.

Updating is now complete.

Changing Configurations

Changing the OpenSearch Service domain resources after deployment

If you want to make changes to the OpenSearch Service domain itself such as changing the access policy of OpenSearch Service, changing the instance type, changing the Availability Zone or adding a new one, or changing to UltraWarm, perform the change from the OpenSearch Service console of AWS Management Console.

Managing the index and customizing SIEM

SIEM on OpenSearch Service saves logs in the index and rotates it once a month. If you want to change this interval or load logs from non-AWS services, see this.

Loading stored logs through batch processing

You can execute es-loader, which is a python script, in the local environment to load past logs stored in the S3 bucket into SIEM on OpenSearch Service.

AWS resources created by the CloudFormation template

Below is the list of AWS resources created by the CloudFormation template. AWS Identity and Access Management (IAM) resources can be found from the AWS Management Console.

AWS Resource Resource Name Purpose
penSearch Service 1.0 or Elasticsearch 7.X aes-siem SIEM itself
S3 bucket aes-siem-[AWS_Account]-log For collecting logs
S3 bucket aes-siem-[AWS_Account]-snapshot For capturing manual snapshots of OpenSearch Service
S3 bucket aes-siem-[AWS_Account]-geo For storing downloaded GeoIPs
Lambda function aes-siem-es-loader For normalizing logs and loading them into OpenSearch Service
Lambda function aes-siem-deploy-aes For creating the OpenSearch Service domain
Lambda function aes-siem-configure-aes For configuring OpenSearch Service
Lambda function aes-siem-geoip-downloader For downloading GeoIPs
Lambda function aes-siem-BucketNotificationsHandler For configuring invent notification for the S3 bucket that stores logs
AWS Key Management Service
(AWS KMS) CMK & Alias
aes-siem-key For encrypting logs
Amazon SQS Queue aes-siem-sqs-splitted-logs A log is split into multiple parts if it has many lines to process. This is the queue to coordinate it
Amazon SQS Queue aes-siem-dlq A dead-letter queue used when loading logs into OpenSearch Service fails
CloudWatch Events aes-siem-CwlRuleLambdaGeoipDownloader For executing aes-siem-geoip-downloader every day
Amazon SNS Topic aes-siem-alert This is selected as the destination for alerting in OpenSearch Service
Amazon SNS Subscription inputd email This is the email address where alerts are sent

Cleanup

  1. Navigate to the CloudFormation console and delete stack: aes-siem
  2. Delete the following AWS resources manually:
    • Opensearch Service domain: aes-siem
    • Amazon S3 bucket: aes-siem-[AWS_Account]-log
    • Amazon S3 bucket: aes-siem-[AWS_Account]-snapshot
    • Amazon S3 bucket: aes-siem-[AWS_Account]-geo
    • AWS KMS customer-managed key: aes-siem-key
      • Please delete this with care. After deleting this customer-managed key, you will no longer be able to read logs if they are encrypted using this key.
  3. If you deployed SIEM on OpenSearch Service within an Amazon VPC, delete the following AWS resources as well:
    • Amazon VPC: aes-siem/VpcAesSiem (if you created a new VPC)
    • SecurityGroup: aes-siem-vpc-sg

Note If you want to redeploy SIEM on OpenSearch Service right after deleting it, you need to delete the key alias using the AWS CLI commands below. Otherwise, redeployment will fail as the KMS CMK alias still remains:

export AWS_DEFAULT_REGION=<AWS_REGION>
aws kms delete-alias  --alias-name  "alias/aes-siem-key"

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

This product uses GeoLite2 data created by MaxMind and licensed under CC BY-SA 4.0, available from https://www.maxmind.com.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 92.0%
  • Shell 8.0%