Skip to content

Commit d11232f

Browse files
committed
Add Manager to Splunk integration (#268)
1 parent 7223e1e commit d11232f

File tree

3 files changed

+205
-2
lines changed

3 files changed

+205
-2
lines changed

Diff for: integrations/docker/manager-splunk.yml

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
name: "manager-splunk-integration"
2+
3+
services:
4+
events-generator:
5+
image: wazuh/indexer-events-generator
6+
build:
7+
context: ../tools/events-generator
8+
depends_on:
9+
wazuh.indexer:
10+
condition: service_healthy
11+
command: bash -c "python run.py -o filebeat"
12+
volumes:
13+
- alerts:/var/ossec/logs/alerts/
14+
15+
wazuh.manager:
16+
image: wazuh/wazuh-manager:${WAZUH_VERSION}
17+
hostname: wazuh.manager
18+
restart: always
19+
ulimits:
20+
memlock:
21+
soft: -1
22+
hard: -1
23+
nofile:
24+
soft: 655360
25+
hard: 655360
26+
ports:
27+
- "1514:1514"
28+
- "1515:1515"
29+
- "514:514/udp"
30+
- "55000:55000"
31+
environment:
32+
- INDEXER_URL=https://wazuh.indexer:9200
33+
- INDEXER_USERNAME=admin
34+
- INDEXER_PASSWORD=admin
35+
- FILEBEAT_SSL_VERIFICATION_MODE=full
36+
- SSL_CERTIFICATE_AUTHORITIES=/etc/ssl/root-ca.pem
37+
- SSL_CERTIFICATE=/etc/ssl/filebeat.pem
38+
- SSL_KEY=/etc/ssl/filebeat.key
39+
- API_USERNAME=wazuh-wui
40+
- API_PASSWORD=MyS3cr37P450r.*-
41+
- LOG_LEVEL=info
42+
- MONITORING_ENABLED=false
43+
volumes:
44+
- ./certs/root-ca-manager.pem:/etc/ssl/root-ca.pem
45+
- ./certs/wazuh.manager.pem:/etc/ssl/filebeat.pem
46+
- ./certs/wazuh.manager-key.pem:/etc/ssl/filebeat.key
47+
- ./certs/root-ca.pem:/usr/share/logstash/root-ca.pem
48+
- alerts:/var/ossec/logs/alerts/
49+
50+
wazuh.indexer:
51+
image: opensearchproject/opensearch:2.12.0
52+
depends_on:
53+
wazuh-certs-generator:
54+
condition: service_completed_successfully
55+
hostname: wazuh.indexer
56+
ports:
57+
- 9200:9200
58+
environment:
59+
- node.name=wazuh.indexer
60+
- discovery.type=single-node
61+
- bootstrap.memory_lock=true
62+
- "DISABLE_INSTALL_DEMO_CONFIG=true"
63+
- plugins.security.ssl.http.enabled=true
64+
- plugins.security.allow_default_init_securityindex=true
65+
- plugins.security.ssl.http.pemcert_filepath=/usr/share/opensearch/config/wazuh.indexer.pem
66+
- plugins.security.ssl.transport.pemcert_filepath=/usr/share/opensearch/config/wazuh.indexer.pem
67+
- plugins.security.ssl.http.pemkey_filepath=/usr/share/opensearch/config/wazuh.indexer-key.pem
68+
- plugins.security.ssl.transport.pemkey_filepath=/usr/share/opensearch/config/wazuh.indexer-key.pem
69+
- plugins.security.ssl.http.pemtrustedcas_filepath=/usr/share/opensearch/config/root-ca.pem
70+
- plugins.security.ssl.transport.pemtrustedcas_filepath=/usr/share/opensearch/config/root-ca.pem
71+
- plugins.security.authcz.admin_dn="CN=wazuh.indexer,OU=Wazuh,O=Wazuh,L=California, C=US"
72+
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
73+
- compatibility.override_main_response_version=true
74+
ulimits:
75+
memlock:
76+
soft: -1
77+
hard: -1
78+
nofile:
79+
soft: 65536
80+
hard: 65536
81+
healthcheck:
82+
test: curl -sku admin:admin https://localhost:9200/_cat/health | grep -q docker-cluster
83+
start_period: 10s
84+
start_interval: 3s
85+
volumes:
86+
- data:/usr/share/opensearch/data
87+
- ./certs/wazuh.indexer.pem:/usr/share/opensearch/config/wazuh.indexer.pem
88+
- ./certs/wazuh.indexer-key.pem:/usr/share/opensearch/config/wazuh.indexer-key.pem
89+
- ./certs/root-ca.pem:/usr/share/opensearch/config/root-ca.pem
90+
91+
wazuh-certs-generator:
92+
image: wazuh/wazuh-certs-generator:0.0.1
93+
hostname: wazuh-certs-generator
94+
entrypoint: sh -c "/entrypoint.sh; chown -R 1000:999 /certificates; chmod 740 /certificates; chmod 440 /certificates/*"
95+
volumes:
96+
- ./certs/:/certificates/
97+
- ./config/certs.yml:/config/certs.yml
98+
99+
logstash:
100+
depends_on:
101+
splunk:
102+
condition: service_healthy
103+
wazuh-certs-generator:
104+
condition: service_completed_successfully
105+
image: logstash-oss:8.6.2
106+
build:
107+
dockerfile: ../elastic/Dockerfile
108+
context: ../splunk
109+
environment:
110+
LOG_LEVEL: info
111+
MONITORING_ENABLED: false
112+
volumes:
113+
- ../splunk/logstash/pipeline:/usr/share/logstash/pipeline
114+
- ./certs/root-ca.pem:/etc/ssl/root-ca.pem
115+
- alerts:/var/ossec/logs/alerts/
116+
command: logstash -f /usr/share/logstash/pipeline/manager-to-splunk.conf
117+
118+
# ================================================
119+
# Splunk
120+
# ================================================
121+
122+
generator:
123+
image: cfssl/cfssl
124+
depends_on:
125+
wazuh-certs-generator:
126+
condition: service_completed_successfully
127+
volumes:
128+
- ./certs/:/certs/
129+
- ../splunk/cfssl/:/conf/
130+
entrypoint: /bin/bash
131+
command: >
132+
-c '
133+
cd /certs
134+
cat /conf/host.json | \
135+
cfssl gencert \
136+
-ca root-ca.pem \
137+
-ca-key root-ca.key \
138+
-config /conf/cfssl.json \
139+
-profile=server - | \
140+
cfssljson -bare splunk
141+
openssl pkcs8 -topk8 -inform pem -in splunk-key.pem -outform pem -nocrypt -out splunk.key
142+
rm splunk.csr
143+
cat splunk.pem splunk-key.pem root-ca.pem > splunkhec.pem
144+
chown -R 1000:1000 /certs/splunk*
145+
'
146+
147+
splunk:
148+
image: splunk/splunk:9.0.4
149+
volumes:
150+
- ./certs/splunk.key:/opt/splunk/etc/auth/custom/splunk.key
151+
- ./certs/splunk.pem:/opt/splunk/etc/auth/custom/splunk.pem
152+
- ./certs/splunkhec.pem:/opt/splunk/etc/auth/custom/splunkhec.pem
153+
- ../splunk/config/indexes.conf:/opt/splunk/etc/system/local/indexes.conf
154+
- ../splunk/config/default.yml:/tmp/defaults/default.yml
155+
depends_on:
156+
generator:
157+
condition: service_completed_successfully
158+
ports:
159+
- '8000:8000'
160+
- '8088:8088'
161+
environment:
162+
SPLUNK_HEC_TOKEN: "abcd1234"
163+
SPLUNK_HOSTNAME: splunk
164+
SPLUNK_HTTP_ENABLESSL: 'true'
165+
SPLUNK_PASSWORD: Password.1234
166+
SPLUNK_STANDALONE_URL: https://splunk:8080
167+
SPLUNK_START_ARGS: --accept-license
168+
169+
volumes:
170+
data:
171+
es_certs:
172+
alerts:

Diff for: integrations/splunk/README.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,34 @@ This document describes how to prepare a Docker Compose environment to test the
1313
```bash
1414
docker compose -f ./docker/splunk.yml up -d
1515
```
16+
3. If you prefer, you can start the integration with the Wazuh Manager as data source:
17+
```bash
18+
docker compose -f ./docker/manager-splunk.yml up -d
19+
```
1620

1721
The Docker Compose project will bring up the following services:
1822

1923
- 1x Events Generator (learn more in [wazuh-indexer/integrations/tools/events-generator](../tools/events-generator/README.md)).
2024
- 1x Wazuh Indexer (OpenSearch).
21-
- 1x Wazuh Dashboards (OpenSearch Dashboards).
2225
- 1x Logstash
2326
- 1x Splunk
27+
- 1x Wazuh Manager (optional).
2428

2529
For custom configurations, you may need to modify these files:
2630

2731
- [docker/splunk.yml](../docker/splunk.yml): Docker Compose file.
2832
- [docker/.env](../docker/.env): Environment variables file.
2933
- [splunk/logstash/pipeline/indexer-to-splunk.conf](./logstash/pipeline/indexer-to-splunk.conf): Logstash Pipeline configuration file.
3034

35+
If you opted to start the integration with the Wazuh Manager, you can modify the following files:
36+
- [docker/manager-splunk.yml](../docker/manager-splunk.yml): Docker Compose file.
37+
- [splunk/logstash/pipeline/manager-to-splunk.conf](./logstash/pipeline/manager-to-splunk.conf): Logstash Pipeline configuration file.
38+
3139
Check the files above for **credentials**, ports, and other configurations.
3240

3341
| Service | Address | Credentials |
3442
| ---------------- | ---------------------- | ------------------- |
3543
| Wazuh Indexer | https://localhost:9200 | admin:admin |
36-
| Wazuh Dashboards | https://localhost:5601 | admin:admin |
3744
| Splunk | https://localhost:8000 | admin:Password.1234 |
3845

3946
## Importing the dashboards
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
input {
2+
file {
3+
id => "wazuh_alerts"
4+
codec => "json"
5+
start_position => "beginning"
6+
stat_interval => "1 second"
7+
path => "/var/ossec/logs/alerts/alerts.json"
8+
mode => "tail"
9+
ecs_compatibility => "disabled"
10+
}
11+
}
12+
13+
14+
output {
15+
http {
16+
format => "json"
17+
http_method => "post"
18+
url => "https://splunk:8088/services/collector/raw"
19+
headers => ["Authorization", "Splunk abcd1234"]
20+
cacert => "/etc/ssl/root-ca.pem"
21+
}
22+
stdout{}
23+
}
24+

0 commit comments

Comments
 (0)