Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving logstash dockerfile and associated files to its own folder #302

Merged
merged 19 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion integrations/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
external
docker/certs
docker/certs
docker/config
46 changes: 0 additions & 46 deletions integrations/amazon-security-lake/Dockerfile

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,27 @@ output {
s3 {
id => "output.s3"
access_key_id => "${AWS_ACCESS_KEY_ID}"
secret_access_key => "${AWS_SECRET_ACCESS_KEY}"
region => "${AWS_REGION}"
endpoint => "${AWS_ENDPOINT}"
bucket => "${S3_BUCKET_RAW}"
codec => "json_lines"
retry_count => 0
validate_credentials_on_root_bucket => false
encoding => "gzip"
endpoint => "${AWS_ENDPOINT}"
prefix => "%{+YYYY}%{+MM}%{+dd}"
region => "${AWS_REGION}"
retry_count => 0
secret_access_key => "${AWS_SECRET_ACCESS_KEY}"
server_side_encryption => true
server_side_encryption_algorithm => "AES256"
time_file => 5
validate_credentials_on_root_bucket => false
additional_settings => {
"force_path_style" => true
}
time_file => 5
}
file {
id => "output.file"
path => "/usr/share/logstash/logs/indexer-to-file-%{+YYYY-MM-dd-HH}.log"
file_mode => 0644
codec => json_lines
flush_interval => 30
}
}
3 changes: 2 additions & 1 deletion integrations/amazon-security-lake/src/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import urllib.parse
import json
import gzip
import boto3
import pyarrow as pa
import pyarrow.parquet as pq
Expand Down Expand Up @@ -31,7 +32,7 @@ def get_events(bucket: str, key: str) -> list:
logger.info(f"Reading {key}.")
try:
response = s3_client.get_object(Bucket=bucket, Key=key)
data = response['Body'].read().decode('utf-8')
data = gzip.decompress(response['Body'].read()).decode('utf-8')
return data.splitlines()
except ClientError as e:
logger.error(
Expand Down
25 changes: 20 additions & 5 deletions integrations/docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ ELASTIC_PASSWORD=elastic
# Password for the 'kibana_system' user (at least 6 characters)
KIBANA_PASSWORD=elastic

# Version of Elastic products
STACK_VERSION=8.6.2

# Set the cluster name
CLUSTER_NAME=elastic

Expand All @@ -22,8 +19,26 @@ KIBANA_PORT=5602
# Increase or decrease based on the available host memory (in bytes)
MEM_LIMIT=1073741824

# Wazuh version
WAZUH_VERSION=4.7.5

# Wazuh Indexer version (Provisionally using OpenSearch)
WAZUH_INDEXER_VERSION=2.14.0

# Wazuh Dashboard version (Provisionally using OpenSearch Dashboards)
WAZUH_DASHBOARD_VERSION=2.14.0

# Wazuh certs generator version
WAZUH_CERTS_GENERATOR_VERSION=0.0.1

# OpenSearch destination cluster version
OS_VERSION=2.14.0

# Wazuh version
WAZUH_VERSION=4.7.5
# Logstash version:
LOGSTASH_OSS_VERSION=8.9.0

# Splunk version:
SPLUNK_VERSION=9.1.4

# Version of Elastic products
STACK_VERSION=8.14.3
16 changes: 11 additions & 5 deletions integrations/docker/compose.amazon-security-lake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
command: bash -c "python run.py -a wazuh.indexer"

wazuh.indexer:
image: opensearchproject/opensearch:2.12.0
image: opensearchproject/opensearch:${WAZUH_INDEXER_VERSION}
container_name: wazuh.indexer
depends_on:
wazuh-certs-generator:
Expand All @@ -22,6 +22,7 @@ services:
ports:
- 9200:9200
environment:
- WAZUH_INDEXER_VERSION=${WAZUH_INDEXER_VERSION}
# - cluster.name=opensearch-cluster
- node.name=wazuh.indexer
- discovery.type=single-node
Expand Down Expand Up @@ -56,7 +57,7 @@ services:
- ./certs/root-ca.pem:/usr/share/opensearch/config/root-ca.pem

wazuh.dashboard:
image: opensearchproject/opensearch-dashboards:2.12.0
image: opensearchproject/opensearch-dashboards:${WAZUH_DASHBOARD_VERSION}
container_name: wazuh.dashboard
depends_on:
- wazuh.indexer
Expand All @@ -71,6 +72,7 @@ services:
- ./certs/wazuh.dashboard.pem:/usr/share/opensearch-dashboards/config/certs/opensearch.pem
- ./certs/root-ca.pem:/usr/share/opensearch-dashboards/config/certs/root-ca.pem
environment:
WAZUH_DASHBOARD_VERSION: ${WAZUH_DASHBOARD_VERSION}
OPENSEARCH_HOSTS: '["https://wazuh.indexer:9200"]' # Define the OpenSearch nodes that OpenSearch Dashboards will query
SERVER_SSL_ENABLED: 'true'
SERVER_SSL_KEY: '/usr/share/opensearch-dashboards/config/certs/opensearch.key'
Expand All @@ -80,7 +82,9 @@ services:
wazuh.integration.security.lake:
image: wazuh/indexer-security-lake-integration
build:
context: ../amazon-security-lake
context: ../logstash
args:
- LOGSTASH_OSS_VERSION=${LOGSTASH_OSS_VERSION}
container_name: wazuh.integration.security.lake
depends_on:
- wazuh.indexer
Expand All @@ -104,7 +108,6 @@ services:
- ./certs/root-ca.pem:/usr/share/logstash/root-ca.pem
- ../amazon-security-lake/src:/usr/share/logstash/amazon-security-lake # TODO use dedicated folder
# - ./credentials:/usr/share/logstash/.aws/credentials # TODO credentials are not commited (missing)
command: tail -f /var/log/logstash/logstash-plain.log
AlexRuiz7 marked this conversation as resolved.
Show resolved Hide resolved

s3.ninja:
image: scireum/s3-ninja:latest
Expand All @@ -126,6 +129,7 @@ services:
AWS_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE"
AWS_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
AWS_REGION: "us-east-1"
REGION: "us-east-1"
AlexRuiz7 marked this conversation as resolved.
Show resolved Hide resolved
AWS_BUCKET: "wazuh-aws-security-lake-parquet"
S3_BUCKET_OCSF: "wazuh-aws-security-lake-ocsf"
AWS_ENDPOINT: "http://s3.ninja:9000"
Expand Down Expand Up @@ -159,12 +163,14 @@ services:
"

wazuh-certs-generator:
image: wazuh/wazuh-certs-generator:0.0.1
image: wazuh/wazuh-certs-generator:${WAZUH_CERTS_GENERATOR_VERSION}
hostname: wazuh-certs-generator
depends_on:
generate-certs-config:
condition: service_completed_successfully
container_name: wazuh-certs-generator
environment:
- WAZUH_CERTS_GENERATOR_VERSION=${WAZUH_CERTS_GENERATOR_VERSION}
entrypoint: sh -c "/entrypoint.sh; chown -R 1000:999 /certificates; chmod 740 /certificates; chmod 440 /certificates/*"
volumes:
- ./certs/:/certificates/
Expand Down
16 changes: 11 additions & 5 deletions integrations/docker/compose.indexer-elastic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ services:
command: bash -c "python run.py -a wazuh.indexer"

wazuh.indexer:
image: opensearchproject/opensearch:2.12.0
image: opensearchproject/opensearch:${WAZUH_INDEXER_VERSION}
depends_on:
wazuh-certs-generator:
condition: service_completed_successfully
hostname: wazuh.indexer
ports:
- 9200:9200
environment:
- WAZUH_INDEXER_VERSION=${WAZUH_INDEXER_VERSION}
- node.name=wazuh.indexer
- discovery.type=single-node
- bootstrap.memory_lock=true
Expand Down Expand Up @@ -51,7 +52,7 @@ services:
- ./certs/root-ca.pem:/usr/share/opensearch/config/root-ca.pem

wazuh.dashboard:
image: opensearchproject/opensearch-dashboards:2.12.0
image: opensearchproject/opensearch-dashboards:${WAZUH_DASHBOARD_VERSION}
depends_on:
- wazuh.indexer
hostname: wazuh.dashboard
Expand All @@ -65,6 +66,7 @@ services:
- ./certs/wazuh.dashboard.pem:/usr/share/opensearch-dashboards/config/certs/opensearch.pem
- ./certs/root-ca.pem:/usr/share/opensearch-dashboards/config/certs/root-ca.pem
environment:
WAZUH_DASHBOARD_VERSION: ${WAZUH_DASHBOARD_VERSION}
OPENSEARCH_HOSTS: '["https://wazuh.indexer:9200"]' # Define the OpenSearch nodes that OpenSearch Dashboards will query
SERVER_SSL_ENABLED: 'true'
SERVER_SSL_KEY: '/usr/share/opensearch-dashboards/config/certs/opensearch.key'
Expand Down Expand Up @@ -92,8 +94,10 @@ services:
"

wazuh-certs-generator:
image: wazuh/wazuh-certs-generator:0.0.1
image: wazuh/wazuh-certs-generator:${WAZUH_CERTS_GENERATOR_VERSION}
hostname: wazuh-certs-generator
environment:
- WAZUH_CERTS_GENERATOR_VERSION=${WAZUH_CERTS_GENERATOR_VERSION}
depends_on:
generate-certs-config:
condition: service_completed_successfully
Expand Down Expand Up @@ -237,9 +241,11 @@ services:
depends_on:
es01:
condition: service_healthy
image: logstash-oss:8.6.2
image: logstash-oss:${LOGSTASH_OSS_VERSION}
build:
context: ../elastic
context: ../logstash
args:
- LOGSTASH_OSS_VERSION=${LOGSTASH_OSS_VERSION}
environment:
LOG_LEVEL: info
MONITORING_ENABLED: false
Expand Down
17 changes: 12 additions & 5 deletions integrations/docker/compose.indexer-opensearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ services:
command: bash -c "python run.py -a wazuh.indexer"

wazuh.indexer:
image: opensearchproject/opensearch:2.12.0
image: opensearchproject/opensearch:${WAZUH_INDEXER_VERSION}
depends_on:
wazuh-certs-generator:
condition: service_completed_successfully
hostname: wazuh.indexer
ports:
- 9200:9200
environment:
- WAZUH_INDEXER_VERSION=${WAZUH_INDEXER_VERSION}
- node.name=wazuh.indexer
- discovery.type=single-node
- bootstrap.memory_lock=true
Expand Down Expand Up @@ -51,7 +52,7 @@ services:
- ./certs/root-ca.pem:/usr/share/opensearch/config/root-ca.pem

wazuh.dashboard:
image: opensearchproject/opensearch-dashboards:2.12.0
image: opensearchproject/opensearch-dashboards:${WAZUH_DASHBOARD_VERSION}
depends_on:
- wazuh.indexer
hostname: wazuh.dashboard
Expand All @@ -66,6 +67,7 @@ services:
- ./certs/opensearch.dashboards.pem:/usr/share/opensearch-dashboards/config/certs/opensearch.pem
- ./certs/root-ca.pem:/usr/share/opensearch-dashboards/config/certs/root-ca.pem
environment:
WAZUH_DASHBOARD_VERSION: ${WAZUH_DASHBOARD_VERSION}
OPENSEARCH_HOSTS: '["https://wazuh.indexer:9200"]'
SERVER_SSL_ENABLED: 'true'
SERVER_SSL_KEY: '/usr/share/opensearch-dashboards/config/certs/opensearch.key'
Expand Down Expand Up @@ -97,8 +99,10 @@ services:
"

wazuh-certs-generator:
image: wazuh/wazuh-certs-generator:0.0.1
image: wazuh/wazuh-certs-generator:${WAZUH_CERTS_GENERATOR_VERSION}
hostname: wazuh-certs-generator
environment:
- WAZUH_CERTS_GENERATOR_VERSION=${WAZUH_CERTS_GENERATOR_VERSION}
depends_on:
generate-certs-config:
condition: service_completed_successfully
Expand Down Expand Up @@ -169,13 +173,16 @@ services:
- 'OPENSEARCH_HOSTS="https://opensearch.node:9200"'

logstash:
image: logstash-oss:8.6.2
image: logstash-oss:${LOGSTASH_OSS_VERSION}
depends_on:
opensearch.node:
condition: service_healthy
build:
context: ../opensearch
context: ../logstash
args:
- LOGSTASH_OSS_VERSION=${LOGSTASH_OSS_VERSION}
environment:
STACK_VERSION: ${STACK_VERSION}
AlexRuiz7 marked this conversation as resolved.
Show resolved Hide resolved
LOG_LEVEL: info
MONITORING_ENABLED: false
volumes:
Expand Down
Loading