Skip to content

Commit e0c7a77

Browse files
committed
Init. Amazon Security Lake integration (#143)
* Init. Amazon Security Lake integration Signed-off-by: Álex Ruiz <[email protected]>
1 parent 01c8b91 commit e0c7a77

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
### Amazon Security Lake integration - Logstash
2+
3+
Follow the [Wazuh indexer integration using Logstash](https://documentation.wazuh.com/current/integrations-guide/opensearch/index.html#wazuh-indexer-integration-using-logstash)
4+
to install `Logstash` and the `logstash-input-opensearch` plugin.
5+
6+
> RPM: https://www.elastic.co/guide/en/logstash/current/installing-logstash.html#_yum
7+
```markdown
8+
9+
# Install plugins (logstash-output-s3 is already installed)
10+
sudo /usr/share/logstash/bin/logstash-plugin install logstash-input-opensearch
11+
12+
# Copy certificates
13+
mkdir -p /etc/logstash/wi-certs/
14+
cp /etc/wazuh-indexer/certs/root-ca.pem /etc/logstash/wi-certs/root-ca.pem
15+
chown logstash:logstash /etc/logstash/wi-certs/root-ca.pem
16+
17+
# Configuring new indexes
18+
SKIP
19+
20+
# Configuring a pipeline
21+
22+
# Keystore
23+
## Prepare keystore
24+
set +o history
25+
echo 'LOGSTASH_KEYSTORE_PASS="123456"'| sudo tee /etc/sysconfig/logstash
26+
export LOGSTASH_KEYSTORE_PASS=123456
27+
set -o history
28+
sudo chown root /etc/sysconfig/logstash
29+
sudo chmod 600 /etc/sysconfig/logstash
30+
sudo systemctl start logstash
31+
32+
## Create keystore
33+
sudo -E /usr/share/logstash/bin/logstash-keystore --path.settings /etc/logstash create
34+
35+
## Store Wazuh indexer credentials (admin user)
36+
sudo -E /usr/share/logstash/bin/logstash-keystore --path.settings /etc/logstash add WAZUH_INDEXER_USERNAME
37+
sudo -E /usr/share/logstash/bin/logstash-keystore --path.settings /etc/logstash add WAZUH_INDEXER_PASSWORD
38+
39+
# Pipeline
40+
sudo touch /etc/logstash/conf.d/wazuh-s3.conf
41+
# Replace with cp /vagrant/wazuh-s3.conf /etc/logstash/conf.d/wazuh-s3.conf
42+
sudo systemctl stop logstash
43+
sudo -E /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/wazuh-s3.conf --path.settings /etc/logstash/
44+
|- Success: `[INFO ][logstash.agent ] Pipelines running ...`
45+
46+
# Start Logstash
47+
sudo systemctl enable logstash
48+
sudo systemctl start logstash
49+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
input {
2+
opensearch {
3+
hosts => ["localhost:9200"]
4+
user => "${WAZUH_INDEXER_USERNAME}"
5+
password => "${WAZUH_INDEXER_PASSWORD}"
6+
index => "wazuh-alerts-4.x-*"
7+
ssl => true
8+
ca_file => "/etc/logstash/wi-certs/root-ca.pem"
9+
query => '{
10+
"query": {
11+
"range": {
12+
"@timestamp": {
13+
"gt": "now-1m"
14+
}
15+
}
16+
}
17+
}'
18+
schedule => "* * * * *"
19+
}
20+
}
21+
22+
output {
23+
stdout { codec => rubydebug }
24+
s3 {
25+
access_key_id => "<aws-access-key>"
26+
secret_access_key => "<aws-secret-key>"
27+
region => "<your-region>"
28+
server_side_encryption => true
29+
server_side_encryption_algorithm => "AES256"
30+
bucket => "wazuh-indexer-amazon-security-lake-bucket"
31+
canned_acl => "bucket-owner-full-control"
32+
codec => "json"
33+
}
34+
}

0 commit comments

Comments
 (0)