-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.yaml
More file actions
521 lines (449 loc) · 15.2 KB
/
Copy pathauth.yaml
File metadata and controls
521 lines (449 loc) · 15.2 KB
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
version: 1
log_family: auth
pipeline:
classifier:
strategy: aho_corasick
fallback: generic_parser
signatures:
# --- SSH Authentication ---
- id: auth_ssh_success
contains:
- "Accepted password for"
- "Accepted publickey for"
- id: auth_ssh_failed
contains:
- "Failed password for"
- "Failed publickey for"
- id: auth_ssh_invalid_user
contains:
- "Invalid user"
- id: auth_ssh_auth_failure
contains:
- "pam_unix(sshd:auth): authentication failure"
- id: auth_ssh_connection_closed_invalid
contains:
- "Connection closed by invalid user"
- "Connection closed by authenticating user"
# --- SSH Session Lifecycle ---
- id: auth_ssh_session_opened
contains:
- "pam_unix(sshd:session): session opened"
- id: auth_ssh_session_closed
contains:
- "pam_unix(sshd:session): session closed"
- id: auth_ssh_disconnect
contains:
- "Received disconnect from"
- id: auth_ssh_disconnected
contains:
- "Disconnected from user"
- id: auth_ssh_server_listen
contains:
- "Server listening on"
# --- CRON Session ---
- id: auth_cron_session_opened
contains:
- "pam_unix(cron:session): session opened"
- id: auth_cron_session_closed
contains:
- "pam_unix(cron:session): session closed"
# --- Sudo / Su ---
- id: auth_sudo_command
contains:
- "sudo:"
- "TTY="
- id: auth_sudo_session_opened
contains:
- "pam_unix(sudo:session): session opened"
- id: auth_sudo_session_closed
contains:
- "pam_unix(sudo:session): session closed"
- id: auth_su_switch
contains:
- "(to root)"
- id: auth_su_session_opened
contains:
- "pam_unix(su:session): session opened"
- id: auth_su_session_closed
contains:
- "pam_unix(su:session): session closed"
# --- systemd-logind ---
- id: auth_logind_new_session
contains:
- "New session"
- id: auth_logind_session_logout
contains:
- "logged out. Waiting for processes to exit"
- id: auth_logind_removed_session
contains:
- "Removed session"
# --- systemd-user ---
- id: auth_systemd_user_session_opened
contains:
- "pam_unix(systemd-user:session): session opened"
- id: auth_systemd_user_session_closed
contains:
- "pam_unix(systemd-user:session): session closed"
# --- login session ---
- id: auth_login_session_opened
contains:
- "pam_unix(login:session): session opened"
# --- System boot / polkitd / seat ---
- id: auth_logind_new_seat
contains:
- "New seat"
- id: auth_polkitd
contains:
- "polkitd"
- id: auth_pam_module_error
contains:
- "PAM unable to dlopen"
- "PAM adding faulty module"
specialized_parsers:
# =================== SSH Authentication ===================
auth_ssh_success:
strategy: dissect
patterns:
# Accepted password for fusion from 10.8.0.46 port 49209 ssh2
- "Accepted %{?method} for %{user.name:notspace} from %{source.ip:ip} port %{source.port:int} %{?proto}"
ecs:
static:
event.dataset: auth
event.category: authentication
event.action: login
event.outcome: success
event.type_id: auth_ssh_success
auth_ssh_failed:
strategy: dissect
patterns:
# Failed password for invalid user sumersoc from 10.8.0.38 port 45088 ssh2
- "Failed %{?method} for invalid user %{user.name:notspace} from %{source.ip:ip} port %{source.port:int} %{?proto}"
# Failed password for fusion from 10.8.0.58 port 59770 ssh2
- "Failed %{?method} for %{user.name:notspace} from %{source.ip:ip} port %{source.port:int} %{?proto}"
ecs:
static:
event.dataset: auth
event.category: authentication
event.action: login
event.outcome: failure
event.type_id: auth_ssh_failed
auth_ssh_invalid_user:
strategy: dissect
patterns:
# Invalid user sanket from 10.8.0.10 port 35758
- "Invalid user %{user.name:notspace} from %{source.ip:ip} port %{source.port:int}"
ecs:
static:
event.dataset: auth
event.category: authentication
event.action: login
event.outcome: failure
event.reason: invalid_user
event.type_id: auth_ssh_invalid_user
auth_ssh_auth_failure:
strategy: dissect
patterns:
# pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=10.8.0.58 user=fusion
- "%{?head}rhost=%{source.ip:notspace} user=%{user.name:notspace}"
- "%{?head}rhost=%{source.ip:notspace} user=%{user.name:notspace}"
# rhost-only (no user field, e.g. unknown user)
- "%{?head}rhost=%{source.ip:notspace}"
ecs:
static:
event.dataset: auth
event.category: authentication
event.action: login
event.outcome: failure
event.reason: pam_auth_failure
event.type_id: auth_ssh_auth_failure
auth_ssh_connection_closed_invalid:
strategy: dissect
patterns:
# Connection closed by invalid user sanket 10.8.0.10 port 35758 [preauth]
- "Connection closed by invalid user %{user.name:notspace} %{source.ip:ip} port %{source.port:int}%{?rest}"
# Connection closed by authenticating user fusion 10.8.0.10 port 60014 [preauth]
- "Connection closed by authenticating user %{user.name:notspace} %{source.ip:ip} port %{source.port:int}%{?rest}"
ecs:
static:
event.dataset: auth
event.category: authentication
event.action: connection_closed
event.outcome: failure
event.type_id: auth_ssh_connection_closed_invalid
# =================== SSH Session Lifecycle ===================
auth_ssh_session_opened:
strategy: dissect
patterns:
# pam_unix(sshd:session): session opened for user fusion(uid=1004) by fusion(uid=0)
- "session opened for user %{user.name:notspace}(%{user.id}) by %{user.effective.name:notspace}(%{user.effective.id})"
ecs:
static:
event.dataset: auth
event.category: session
event.type: start
event.action: ssh_session_opened
event.type_id: auth_ssh_session_opened
auth_ssh_session_closed:
strategy: dissect
patterns:
# pam_unix(sshd:session): session closed for user fusion
- "session closed for user %{user.name:notspace}"
ecs:
static:
event.dataset: auth
event.category: session
event.type: end
event.action: ssh_session_closed
event.type_id: auth_ssh_session_closed
auth_ssh_disconnect:
strategy: dissect
patterns:
# Received disconnect from 10.8.0.46 port 49634:11: disconnected by user
- "Received disconnect from %{source.ip:ip} port %{source.port:int}:%{?reason}"
- "Received disconnect from %{source.ip:ip}:%{?reason}"
ecs:
static:
event.dataset: auth
event.action: disconnect
event.type_id: auth_ssh_disconnect
auth_ssh_disconnected:
strategy: dissect
patterns:
# Disconnected from user fusion 10.8.0.46 port 49634
- "Disconnected from user %{user.name:notspace} %{source.ip:ip} port %{source.port:int}"
ecs:
static:
event.dataset: auth
event.action: disconnected
event.type_id: auth_ssh_disconnected
auth_ssh_server_listen:
strategy: dissect
patterns:
# Server listening on 0.0.0.0 port 22.
- "Server listening on %{server.address:notspace} port %{server.port:int}."
ecs:
static:
event.dataset: auth
event.category: network
event.action: server_start
event.type_id: auth_ssh_server_listen
# =================== CRON Session ===================
auth_cron_session_opened:
strategy: dissect
patterns:
- "session opened for user %{user.name:notspace}(%{user.id}) by %{user.effective.name:notspace}(%{user.effective.id})"
ecs:
static:
event.dataset: auth
event.category: session
event.type: start
event.action: cron_session_opened
event.type_id: auth_cron_session_opened
auth_cron_session_closed:
strategy: dissect
patterns:
- "session closed for user %{user.name:notspace}"
ecs:
static:
event.dataset: auth
event.category: session
event.type: end
event.action: cron_session_closed
event.type_id: auth_cron_session_closed
# =================== Sudo / Su ===================
auth_sudo_command:
strategy: dissect
patterns:
# summersoc : TTY=pts/0 ; PWD=/home/summersoc ; USER=root ; COMMAND=/usr/bin/su
- "%{user.name:notspace} : TTY=%{tty:notspace} ; PWD=%{cwd:notspace} ; USER=%{user.target.name:notspace} ; COMMAND=%{process.command_line}"
ecs:
static:
event.dataset: auth
event.category: process
event.action: sudo_command
event.type_id: auth_sudo_command
auth_sudo_session_opened:
strategy: dissect
patterns:
# pam_unix(sudo:session): session opened for user root(uid=0) by summersoc(uid=1000)
- "session opened for user %{user.target.name:notspace}(%{user.target.id}) by %{user.name:notspace}(%{user.id})"
ecs:
static:
event.dataset: auth
event.category: session
event.type: start
event.action: sudo_session_opened
event.type_id: auth_sudo_session_opened
auth_sudo_session_closed:
strategy: dissect
patterns:
- "session closed for user %{user.target.name:notspace}"
ecs:
static:
event.dataset: auth
event.category: session
event.type: end
event.action: sudo_session_closed
event.type_id: auth_sudo_session_closed
auth_su_switch:
strategy: dissect
patterns:
# (to root) root on pts/1
- "(to %{user.target.name:notspace}) %{user.name:notspace} on %{tty:notspace}"
ecs:
static:
event.dataset: auth
event.category: authentication
event.action: su_switch
event.type_id: auth_su_switch
auth_su_session_opened:
strategy: dissect
patterns:
# pam_unix(su:session): session opened for user root(uid=0) by summersoc(uid=0)
- "session opened for user %{user.target.name:notspace}(%{user.target.id}) by %{user.name:notspace}(%{user.id})"
ecs:
static:
event.dataset: auth
event.category: session
event.type: start
event.action: su_session_opened
event.type_id: auth_su_session_opened
auth_su_session_closed:
strategy: dissect
patterns:
- "session closed for user %{user.target.name:notspace}"
ecs:
static:
event.dataset: auth
event.category: session
event.type: end
event.action: su_session_closed
event.type_id: auth_su_session_closed
# =================== systemd-logind ===================
auth_logind_new_session:
strategy: dissect
patterns:
# New session 1811 of user summersoc.
- "New session %{session.id:notspace} of user %{user.name:notspace}."
ecs:
static:
event.dataset: auth
event.category: session
event.type: start
event.action: logind_new_session
event.type_id: auth_logind_new_session
auth_logind_session_logout:
strategy: dissect
patterns:
# Session 1811 logged out. Waiting for processes to exit.
- "Session %{session.id:notspace} logged out.%{?rest}"
ecs:
static:
event.dataset: auth
event.category: session
event.type: end
event.action: logind_session_logout
event.type_id: auth_logind_session_logout
auth_logind_removed_session:
strategy: dissect
patterns:
# Removed session 1811.
- "Removed session %{session.id:notspace}."
ecs:
static:
event.dataset: auth
event.category: session
event.action: logind_removed_session
event.type_id: auth_logind_removed_session
# =================== systemd-user ===================
auth_systemd_user_session_opened:
strategy: dissect
patterns:
- "session opened for user %{user.name:notspace}(%{user.id}) by %{user.effective.name:notspace}(%{user.effective.id})"
ecs:
static:
event.dataset: auth
event.category: session
event.type: start
event.action: systemd_user_session_opened
event.type_id: auth_systemd_user_session_opened
auth_systemd_user_session_closed:
strategy: dissect
patterns:
- "session closed for user %{user.name:notspace}"
ecs:
static:
event.dataset: auth
event.category: session
event.type: end
event.action: systemd_user_session_closed
event.type_id: auth_systemd_user_session_closed
# =================== login ===================
auth_login_session_opened:
strategy: dissect
patterns:
- "session opened for user %{user.name:notspace}(%{user.id}) by %{user.effective.name:notspace}(%{user.effective.id})"
ecs:
static:
event.dataset: auth
event.category: session
event.type: start
event.action: login_session_opened
event.type_id: auth_login_session_opened
# =================== System / Boot ===================
auth_logind_new_seat:
strategy: dissect
patterns: []
ecs:
static:
event.dataset: auth
event.category: host
event.action: new_seat
event.type_id: auth_logind_new_seat
auth_polkitd:
strategy: dissect
patterns: []
ecs:
static:
event.dataset: auth
event.category: host
event.action: polkitd
event.type_id: auth_polkitd
auth_pam_module_error:
strategy: dissect
patterns: []
ecs:
static:
event.dataset: auth
event.category: host
event.action: pam_module_error
event.outcome: failure
event.type_id: auth_pam_module_error
generic_parser:
enabled: true
strategy: regex
patterns:
- name: generic_auth
regex: '(?P<process>[^\[]+)\[(?P<pid>\d+)\]: (?P<message>.*)'
ecs:
process: process.name
pid: process.pid
message: message
raw_ingestion:
enabled: true
preserve_original: true
fields:
- event.original
- message
- host.name
- process.name
- process.pid
syslog:
bsd_format:
timestamp_fields: 3
hostname_offset: 3
process_offset: 4
iso_format:
timestamp_fields: 1
hostname_offset: 1
process_offset: 2