-
Notifications
You must be signed in to change notification settings - Fork 3
/
logsearch-platform-jobs.yml
338 lines (337 loc) · 13.7 KB
/
logsearch-platform-jobs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
instance_groups:
#######################################################
#First deploy group - elasticsearch_master, maintenance
#######################################################
- name: elasticsearch_master
instances: 3
jobs:
- name: bpm
release: bpm
- name: elasticsearch-platform
release: logsearch
provides:
elasticsearch-platform: {as: elasticsearch_master}
consumes:
elasticsearch-platform: {from: elasticsearch_master}
properties:
elasticsearch:
cluster_name: logsearch-platform
node:
allow_master: true
allow_data: false
limits:
fd: 131072 # 2 ** 17
health:
timeout: 900
recovery:
delay_allocation_restart: "15m"
jvm_options:
- "-Dlog4j2.formatMsgNoLookups=true"
- name: snort-config
release: jammy-snort
properties:
snort:
rules:
- 'alert tcp any any -> any 9200 (msg:"Unexpected logsearch action"; content:"POST"; http_method; content: "logs-platform"; http_uri; content:"/_update"; http_uri; classtype:web-application-attack; sid:343080003; rev:1;)'
- 'alert tcp any any -> any 9200 (msg:"Unexpected logsearch action"; content:"DELETE"; http_method; content: "logs-platform"; http_uri; classtype:web-application-attack; sid:343080005; rev:1;)'
- (( concat "suppress gen_id 1, sig_id 343080005, track by_src, ip " instance_groups.maintenance.networks.services.static_ips.[0] ))
- 'suppress gen_id 1, sig_id 343080005, track by_src, ip 127.0.0.1'
- 'suppress gen_id 1, sig_id 57907, track by_src, ip 127.0.0.1'
- 'suppress gen_id 1, sig_id 26275, track by_src, ip 127.0.0.1'
- 'suppress gen_id 1, sig_id 41495, track by_src, ip 127.0.0.1'
- 'suppress gen_id 1, sig_id 58741'
- 'drop tcp $EXTERNAL_NET any -> $HOME_NET $HTTP_PORTS (msg:"SERVER-OTHER Apache Log4j logging remote code execution attempt"; flow:to_server,established; content:"${"; fast_pattern:only; http_client_body; pcre:"/\x24\x7b.{0,200}(%(25)?24|\x24)(%(25)?7b|\x7b).{0,200}(%(25)?3a|\x3a)(%(25)?(27|2d|5c|22)|[\x27\x2d\x5c\x22])*([jndi\x7d\x3a\x2d]|(%(25)?(7d|3a|2d))|(%(25)?5c|\x5c)u00[a-f0-9]{2}){1,4}(%(25)?(22|27)|[\x22\x27])?(%(25)?(3a|7d)|[\x3a\x7djndi])/Pi"; metadata:policy balanced-ips drop, policy connectivity-ips drop, policy max-detect-ips drop, policy security-ips drop, ruleset community, service http; reference:cve,2021-44228; reference:cve,2021-44832; reference:cve,2021-45046; reference:cve,2021-45105; classtype:attempted-user; sid:58741000; rev:6;)'
vm_type: logsearch_es_master
persistent_disk_type: logsearch_es_master
stemcell: default
azs: [z1]
networks:
- name: services
static_ips:
- (( grab terraform_outputs.logsearch_static_ips.[7]))
- (( grab terraform_outputs.logsearch_static_ips.[8]))
- (( grab terraform_outputs.logsearch_static_ips.[9]))
update:
max_in_flight: 1 # Should never update more than one ES master node at a time or cluster will go down
- name: maintenance
instances: 1
vm_extensions: [errand-profile]
jobs:
- name: bpm
release: bpm
- name: elasticsearch-platform
release: logsearch
consumes:
elasticsearch-platform: {from: elasticsearch_master}
properties:
elasticsearch:
heap_size: 2G
config_options: {"xpack.monitoring.enabled": false}
jvm_options:
- "-Dlog4j2.formatMsgNoLookups=true"
- name: curator
release: logsearch
properties:
curator:
purge_logs:
retention_period: 30
actions:
- action: index_settings
description: >-
Sets indices older than 1 day to be read only
options:
index_settings:
index:
blocks:
write: true
filters:
- filtertype: pattern
kind: regex
value: logs*
- filtertype: age
source: creation_date
direction: older
unit: days
unit_count: 1
- name: elasticsearch_config
release: logsearch
properties:
elasticsearch_config:
app_index_prefix: logs-platform
component_templates:
- shards-and-replicas: /var/vcap/jobs/elasticsearch_config/index-templates/shards-and-replicas.json
- index-settings: /var/vcap/jobs/elasticsearch_config/index-templates/index-settings.json
- index-mappings: /var/vcap/jobs/elasticsearch_config/index-templates/index-mappings.json
- index-mappings-lfc: /var/vcap/jobs/elasticsearch-config-lfc/component-index-mappings.json
- index-mappings-app-lfc: /var/vcap/jobs/elasticsearch-config-lfc/component-index-mappings-app.json
- index-mappings-platform-lfc: /var/vcap/jobs/elasticsearch-config-lfc/component-index-mappings-platform.json
index_templates:
- index-mappings-lfc: /var/vcap/jobs/elasticsearch-config-lfc/index-mappings.json
- index-mappings-app-lfc: /var/vcap/jobs/elasticsearch-config-lfc/index-mappings-app.json
- index-mappings-platform-lfc: /var/vcap/jobs/elasticsearch-config-lfc/index-mappings-platform.json
- name: elasticsearch-config-lfc
release: logsearch-for-cloudfoundry
properties:
elasticsearch_config:
base_index_component_name: index-mappings-lfc
app_index_component_name: index-mappings-app-lfc
platform_index_component_name: index-mappings-platform-lfc
index_mappings_component_name: index-mappings
index_settings_component_name: index-settings
shards_and_replicas_component_name: shards-and-replicas
- name: elasticsearch_exporter
release: prometheus
properties:
elasticsearch_exporter:
es:
uri: http://localhost:9200
all: true
- name: upload-kibana-objects
release: logsearch-for-cloudfoundry
properties:
elasticsearch_config:
app_index_prefix: logs-platform
cloudfoundry:
system_domain: (( grab $CF_SYSTEM_DOMAIN ))
user: (( grab $CF_USERNAME ))
password: (( grab $CF_PASSWORD ))
logs_hostname: logs-platform
kibana_objects:
host_name: logs-platform
login_fqdn: opslogin.fr.cloud.gov
upload_patterns:
- {type: index-pattern, pattern: "/var/vcap/jobs/upload-kibana-objects/kibana-objects/index-pattern/logs-platform.json"}
- {type: search, pattern: "/var/vcap/jobs/upload-kibana-objects/kibana-objects/search/platform-*.json"}
- {type: visualization, pattern: "/var/vcap/jobs/upload-kibana-objects/kibana-objects/visualization/Platform-*.json"}
- {type: dashboard, pattern: "/var/vcap/jobs/upload-kibana-objects/kibana-objects/dashboard/Platform-*.json"}
vm_type: logsearch_maintenance
stemcell: default
azs: [z1]
networks:
- name: services
static_ips:
- (( grab terraform_outputs.logsearch_static_ips.[6] ))
update:
serial: true # Block on this job to create deploy group 1
#########################################################
#2nd deploy group - elasticsearch_data, kibana, ingestors
#########################################################
- name: elasticsearch_data
instances: 9
jobs:
- name: bpm
release: bpm
- name: elasticsearch-platform
release: logsearch
consumes:
elasticsearch-platform: {from: elasticsearch_master}
properties:
elasticsearch:
jvm_options:
- "-Dlog4j2.formatMsgNoLookups=true"
node:
allow_master: false
allow_data: true
limits:
fd: 131072 # 2 ** 17
health:
timeout: 900
recovery:
delay_allocation_restart: "15m"
config_options: {"xpack.monitoring.enabled": false}
vm_type: logsearch_es_data
persistent_disk_type: logsearch_es_platform_data
stemcell: default
azs: [z1]
networks:
- name: services
update:
max_in_flight: 1 # Only update 1 ES data node at a time or risk downtime
- name: kibana
instances: 2
jobs:
- name: bpm
release: bpm
- name: elasticsearch-platform
release: logsearch
consumes:
elasticsearch-platform: {from: elasticsearch_master}
properties:
elasticsearch:
heap_size: 2G
- name: kibana-platform
release: logsearch
consumes:
elasticsearch-platform: {from: elasticsearch_master}
provides:
kibana-platform: {as: kibana_link}
properties:
kibana:
port: 5602
memory_limit: 75
default_app_id: "dashboard/Platform-Overview"
env:
- NODE_ENV: production
health:
timeout: 600
- name: oauth2-proxy
release: oauth2-proxy
properties:
address: http://127.0.0.1:5601
upstream: http://127.0.0.1:5602
provider: oidc
client_id: (( param "specify oauth-proxy client" ))
client_secret: (( param "specify oauth-proxy client secret" ))
cookie_secret: (( param "specify oauth-proxy cookie secret" ))
email_domain: gsa.gov
- name: secureproxy
release: secureproxy
properties:
secureproxy:
listen_port: 5600
proxy_port: 5601
vm_type: logsearch_kibana
vm_extensions:
- platform-kibana-lb
- 50GB_ephemeral_disk
stemcell: default
azs: [z1]
networks:
- name: services
- name: ingestor
instances: 5
jobs:
- name: bpm
release: bpm
- name: elasticsearch-platform
release: logsearch
consumes:
elasticsearch-platform: {from: elasticsearch_master}
properties:
elasticsearch:
jvm_options:
- "-Dlog4j2.formatMsgNoLookups=true"
heap_size: 1G
config_options: {"xpack.monitoring.enabled": false}
- name: ingestor_syslog
release: logsearch
consumes:
elasticsearch: {from: elasticsearch_master}
provides:
ingestor: {as: ingestor_link}
properties:
logstash:
jvm_options:
- "-Dlog4j2.formatMsgNoLookups=true"
queue:
max_bytes: 30gb
logstash_parser:
elasticsearch:
# Use per-day indexing strategy
index: "logs-platform-%{+YYYY.MM.dd}"
index_type: "%{@type}"
data_hosts: [127.0.0.1]
filters:
- path: /var/vcap/packages/logsearch-config-logstash-filters/logstash-filters-default.conf
- content: |
if [@source][component] == "snort" {
grok {
match => {
"@message" => "\[%{INT:gid}:%{INT:sid}:%{INT:rev}\]\s%{DATA:msg}\s\{%{DATA:proto}\}\s%{IP:src_ip}:%{INT:src_port}\s->\s%{IP:dst_ip}:%{INT:dst_port}"
}
}
}
if [@source][component] == "clamd" {
grok {
match => {
"@message" => "%{WORD:event_type}:\s%{DATA:file_path}:\s%{DATA:signature_name}\sFOUND"
}
}
}
outputs:
- plugin: s3
options:
region: (( grab terraform_outputs.vpc_region ))
bucket: (( grab terraform_outputs.platform_logs_bucket_name ))
access_key_id: (( grab terraform_outputs.platform_logs_bucket_access_key_id_curr ))
secret_access_key: (( grab terraform_outputs.platform_logs_bucket_secret_access_key_curr ))
server_side_encryption: true
prefix: "%{+yyyy/MM/dd/HH/mm}"
encoding: "gzip"
temporary_directory: /var/vcap/data/ingestor_syslog/s3_temp
# note that this is different than in the archivers
# here, we're uploading the parsed message as json, not the raw log line
codec: json
- plugin: elasticsearch
options: {}
deployment_dictionary:
- /var/vcap/packages/logsearch-config/deployment_lookup.yml
- /var/vcap/jobs/parser-config-lfc/config/deployment_lookup.yml
- name: parser-config-lfc
release: logsearch-for-cloudfoundry
vm_type: logsearch_ingestor
vm_extensions: [platform-syslog-lb]
persistent_disk_type: logsearch_ingestor
stemcell: default
azs: [z1]
networks:
- name: services
###########################
#3rd deploy group - errands
###########################
- name: smoke-tests
instances: 1
vm_type: errand_small
vm_extensions: [errand-profile]
stemcell: default
azs: [z1]
networks:
- name: services
lifecycle: errand
release: logsearch
jobs:
- name: smoke_tests
release: logsearch
consumes:
elasticsearch: {from: elasticsearch_master}
ingestor_link: {from: ingestor_syslog}