Repository navigation
Expand file tree
/
Copy pathmaltrail.conf
More file actions
514 lines (432 loc) · 29.7 KB
/
Copy pathmaltrail.conf
File metadata and controls
514 lines (432 loc) · 29.7 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
# [Server]
# Listen address of (reporting) HTTP server
HTTP_ADDRESS 0.0.0.0
#HTTP_ADDRESS ::
#HTTP_ADDRESS fe80::12c3:7bff:fe6d:cf9b%eno1
# Listen port of (reporting) HTTP server
HTTP_PORT 8338
# Optional location of THIS monitored network (decimal degrees). If set, the reporting UI's attack map draws arcs
# from each source country to this "home" point (air-gapped installs can't auto-locate, hence it's manual/opt-in)
#HOME_LAT 45.8150
#HOME_LON 15.9819
# The reporting UI decorates public IPs with a country flag and an ASN tooltip, which the server
# looks up at RIPEstat (stat.ripe.net) through its /ripe endpoint and caches. Set this on a server
# that must make no outbound requests: /ripe then answers immediately with nothing, and flags fall
# back to the local RIR table shipped with Maltrail. (The lookup used to be done by the browser
# instead, which is why the reporting UI's CSP once had to allow scripts from stat.ripe.net.)
#DISABLE_RIPE_LOOKUPS false
# Use SSL/TLS
USE_SSL false
# SSL/TLS (private key + certificate) PEM file. Generate your own; Maltrail deliberately ships
# no PEM, because a private key in a public repository is a private key everybody already has:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes -subj '/O=Maltrail CA/C=EU'
#SSL_PEM /etc/maltrail/server.pem
# User entries (username:password_field:UID:filter_netmask(s))
# Note(s): password_field is generated with: python3 server.py --hash-password
# (salted PBKDF2: reading this file does not let anyone log in). The old sha256(password)
# form still works, but its stored value logs in as well as the password does.
# UID >= 1000 have only rights to display results (Note: this moment only functionality implemented at the client side)
# filter_netmask(s) is/are used to filter results
USERS
admin:pbkdf2-sha256$50000$48064bc72efb58c16ea3e4a83e60b71e$972456dc95d582a111187883dd6c3e7bd5743f20e12ec200574c6a039a5c77a5:0: # changeme!
# local:pbkdf2-sha256$50000$48064bc72efb58c16ea3e4a83e60b71e$972456dc95d582a111187883dd6c3e7bd5743f20e12ec200574c6a039a5c77a5:1000:192.168.0.0/16 # changeme!
# Mask custom trail names for non-admin users (UID >= 1000)
ENABLE_MASK_CUSTOM true
# Listen address of (log collecting) UDP server
#UDP_ADDRESS 0.0.0.0
#UDP_ADDRESS ::
#UDP_ADDRESS fe80::12c3:7bff:fe6d:cf9b%eno1
# Listen port of (log collecting) UDP server
#UDP_PORT 8337
# Should server do the trail updates too (to support UPDATE_SERVER directive in [Sensor] parameters)
USE_SERVER_UPDATE_TRAILS false
# Concurrent HTTP request handlers. Connections beyond this get 503 rather than a thread, so a
# flood costs the server a bounded amount of memory instead of an unbounded one. Each handler
# reserves 1MB of stack, so this is also roughly the interface's worst-case thread memory in MB.
#MAX_REQUEST_THREADS 100
# How many of those handlers may be held open by live event streams (/live) at once - one per
# dashboard tab with Live on. Kept below MAX_REQUEST_THREADS so streams cannot starve ordinary
# requests. A refused stream falls back to polling in the browser, so nothing breaks; raise it for
# a console with many simultaneous viewers.
#MAX_LIVE_STREAMS 30
# Seconds a retro-hunt (/hunt) may spend scanning before it returns what it has. A day the budget
# cuts short is reported separately and is NOT counted as a complete day. Raise it when event logs
# live on slow or network storage.
#HUNT_TIME_BUDGET 10.0
# Aliases used in client's web browser interface to describe the src_ip and/or dst_ip column entries
#IP_ALIASES
# 8.8.8.8:google
# 8.8.4.4:google
# Option to change the top-left logo with a custom image/text
#HEADER_LOGO <img src="https://i.imgur.com/JxYJ5yX.png" style="width: 26px"> XYZ
# Regular expression to be used in external /fail2ban calls for extraction of attacker source IPs
#
# Point fail2ban at the endpoint rather than at the event log: /fail2ban returns the source
# addresses directly, already filtered by this expression, so there is no log format for a
# failregex to drift against. A jail action that curls it is the whole integration:
#
# curl -s http://127.0.0.1:8338/fail2ban
#
# (the repository used to carry a filter.d regex for scraping the log instead; it duplicated this
# option, and a log-format change would have silently stopped it matching)
# Matched against the WHOLE log line, so each alternative has to be specific enough that it cannot
# fire on a trail NAME. It used to read 'attacker|reputation|...|spammer|...', and 39 trails in the
# current content contain one of those words - attackerman.ddns.net, hightreputation.top,
# spammer-apps471-info.bid. Those are OUTBOUND detections, so field 4 of the line is one of YOUR
# hosts, and fail2ban would have firewalled the machine it is meant to protect. Every emitter
# writes the full phrase ('known attacker', 'bad reputation (tor node)'), so requiring it costs no
# detection; 'spammer' is a whole info on its own and gets a boundary guard instead.
# 'potential iot-malware download' is NOT in it: since #19622 that event fires only when the source
# is one of OUR hosts fetching a dropper, so banning its source firewalls the infected machine.
FAIL2BAN_REGEX known attacker|bad reputation|potential[^"]*(web scan|directory traversal|injection|remote code)|(?<![\w./-])spammer(?![\w./-])|mass scanner
# Only allow /fail2ban endpoint from these IPv4 sources
# If unset/empty, /fail2ban will be blocked
FAIL2BAN_ALLOWLIST 127.0.0.1, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
# Who may pull /blacklist (same syntax as FAIL2BAN_ALLOWLIST). Unset -> FAIL2BAN_ALLOWLIST is
# used; if that is unset too, /blacklist is blocked. An authenticated session is always allowed,
# so this only governs unauthenticated pullers such as firewall automation.
#BLACKLIST_ALLOWLIST 127.0.0.1, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
# To take a remediated host off /blacklist and /fail2ban WITHOUT whitelisting it forever, list it
# in LOG_DIR/cleared.txt - one per line, optionally with the moment it was cleared:
# 10.13.13.37 (cleared as of that file's last modification)
# 10.13.13.99 2026-08-11 09:30:00
# Earlier events for that host are then ignored; any NEW detection puts it straight back, which a
# whitelist entry would not.
# Blacklist generation rules
# BLACKLIST
# src_ip !~ ^192.168. and dst_port ~ ^22$
# src_ip ~ ^192.168. and filter ~ malware
# [Sensor]
# Expose Prometheus metrics on this address (sensor only; unset = disabled)
# Alert on 'maltrail_capture_dropped_total' (a non-zero rate means missed detections) and on
# 'maltrail_trail_generation' failing to advance (trails have stopped refreshing)
#STATS_ADDRESS 127.0.0.1:9114
# Use feeds (too) in trail updates
USE_FEED_UPDATES true
# Disable (retrieval from) specified feeds (Note: respective .py files inside /trails/feeds; turris and ciarmy/cinsscore seem to be too "noisy" lately; policeman is old and produces lots of false positives)
DISABLED_FEEDS turris, ciarmy, policeman, myip, alienvault
# Ignore IPs that appear on lower than IP_MINIMUM_FEEDS number of feeds (Note: static IP trails are always included)
IP_MINIMUM_FEEDS 3
# Disable trails based on the following regular expression run against the corresponding info
#DISABLED_TRAILS_INFO_REGEX known attacker|tor exit node
# Update trails after every given period (seconds)
UPDATE_PERIOD 86400
# Use remote custom feed (too) in trail updates
#CUSTOM_TRAILS_URL http://www.test.com/custom.txt
# Auth-Key for the abuse.ch feeds that require one (URLhaus). It is free: https://auth.abuse.ch/
# Without it those feeds are skipped, and trail updates say so once; everything else is unaffected.
#ABUSE_CH_AUTH_KEY
# Location of directory with custom trails (*.txt) files
# Note: keep this OUTSIDE the installation directory. It used to default to ./trails/custom, inside
# the git checkout, which is why the installer can never run `git clean` - an operator's own
# indicators were sitting in a tree that upgrades reset.
#CUSTOM_TRAILS_DIR /etc/maltrail/custom
# Where to fetch the static trail set from. Static trails (~1.6M indicators) live in their own
# repository and are distributed as one assembled file, so updating detection no longer means
# pulling code. The result is cached next to TRAILS_FILE, which is what makes an offline or
# air-gapped run work.
#
# The trail set is NOT MIT like this engine. Defending your own network with it is free; putting it
# in a product, a service you sell, or a redistributed feed is not. See LICENSE.md in
# stamparm/trails.
STATIC_TRAILS_URL https://github.com/stamparm/trails/releases/latest/download/trails.csv.gz
# Optional checkout of that content repository. Only used to show a trail's source citation
# ("# Reference:" header) in the dashboard's trail drawer; detection does not need it, and the
# provenance sidecar below covers the same thing without a checkout.
#STATIC_TRAILS_DIR /opt/trails
# Fetch the provenance sidecar, so the trail drawer can cite where an indicator came from - the
# report it was extracted from, and the file it lives in. The SERVER downloads it (~18 MB when the
# content changes); a sensor never renders anything, so it never fetches it. Set false on a server
# where the bandwidth matters more than the citations.
#STATIC_TRAILS_PROVENANCE false
# Interface used for monitoring (e.g. eth0, eth1)
#
# 'any' is a Linux pseudo-device that libpcap synthesises, and it is the right default there.
# It does NOT exist on Windows, macOS or the BSDs - name a real interface on those. `-T` lists
# the ones this machine has when it cannot find the configured one; on Windows they look like
# \Device\NPF_{GUID} and Npcap must be installed for any of them to appear.
MONITOR_INTERFACE any
# Network capture filter (e.g. ip)
# Note(s): more info about filters can be found at: https://danielmiessler.com/study/tcpdump/
# The default passes what detections come from and keeps bulk out of the kernel's capture ring:
# of TCP only SYNs, TLS handshake records and the proxy/HTTP ports; of QUIC (UDP/443) only the
# long-header packets (Initial, which carries the SNI, and the rest of the handshake), not the
# short-header data packets after it (first byte 01xxxxxx, RFC 9000). On a real transit link QUIC
# is about half of everything this filter would otherwise pass.
#
# Two more kinds of TCP/443 packet pass, both small: the second segment of a ClientHello (a
# browser's is ~2 KB since post-quantum key shares, and its SNI is in that second segment about
# half of the time), recognized as client data under 1400 bytes that does not start a TLS record,
# so bulk uploads and requests stay out. libpcap's tcp[] reads IPv4 only, so IPv6 TCP is spelled
# with ip6[] offsets; without that IPv6 SYNs and TLS handshakes never reached the sensor.
#CAPTURE_FILTER ip or ip6
CAPTURE_FILTER (udp and not ((ip and udp port 443 and udp[8] & 0xc0 == 0x40) or (ip6 and ip6[6] == 17 and udp port 443 and ip6[48] & 0xc0 == 0x40))) or icmp or (tcp and (port 80 or port 1080 or port 3128 or port 8000 or port 8080 or port 8118)) or (ip and tcp and (tcp[tcpflags] == tcp-syn or (port 443 and tcp[((tcp[12]&0xf0)>>2)] = 0x16) or (dst port 443 and ip[2:2] < 1400 and ip[2:2] > ((ip[0]&0xf)<<2) + ((tcp[12]&0xf0)>>2) and tcp[((tcp[12]&0xf0)>>2):2] & 0xfcff != 0x1403))) or (ip6 and ip6[6] == 6 and (ip6[53] == 0x02 or (port 443 and ip6[40 + ((ip6[52]&0xf0)>>2)] = 0x16) or (dst port 443 and ip6[4:2] < 1360 and ip6[4:2] > ((ip6[52]&0xf0)>>2) and ip6[40 + ((ip6[52]&0xf0)>>2):2] & 0xfcff != 0x1403)))
# Match the server name (SNI) of TLS ClientHellos and QUIC Initials against the domain trails
# (sensor only). With DNS over HTTPS or TLS the query never crosses the wire in clear, and the
# SNI is where the domain is still visible. The handshake is parsed anyway for JA3/JA4, so this
# costs one domain lookup per connection.
#CHECK_TLS_SNI true
# Match TLS fingerprints against the trail set (sensor only): the SHA-1 of a server's certificate
# and the JA3/JA4 of a client's ClientHello. A fingerprint outlives a C2's address and domain, so
# it keeps matching after those rotate; feeds such as abuse.ch SSLBL publish ~10,000 of them.
# Certificate findings are rated 'suspicious' (medium), not malware, because a few listings are
# dual-use remote-administration tooling. Formerly CHECK_TLS_CERTIFICATES, still read when this
# is absent.
#
# The CAPTURE_FILTER below admits TLS HANDSHAKE records on 443 for this
# (tcp[((tcp[12]&0xf0)>>2)] = 0x16 tests the TLS content type at the start of the TCP payload).
# That is handshakes only, never bulk TLS, so the added volume is a few packets per connection.
# Remove that clause from the filter to opt out of the capture cost entirely.
#
# TLS 1.3 encrypts the certificate, so certificates match on 1.2 and below - which is what the
# implants these fingerprints identify actually negotiate. JA3/JA4 match on every version.
#CHECK_TLS_FINGERPRINTS true
# Condensed observable store (LOG_DIR/meta.sqlite): one cumulative row per domain/IP ever seen,
# with first_seen/last_seen/count. Feeds the server's novelty and retro-hunt views. ON by default;
# turn it off on a very high-rate link if you do not use those views.
#USE_CONDENSED_STORAGE true
# --- Rust sensor tuning -------------------------------------------------------------------
# All optional, all with working defaults - listed here so they are discoverable rather than only
# documented in sensor/docs/.
# Capture workers, each with its own socket (Linux: joined in one PACKET_FANOUT group). Default 1,
# fast enough for ~1.1M packets/s; an integer = that many, 'auto' = one per CPU core. With more
# than one, packets are distributed by source address (CAPTURE_FANOUT_MODE source, below), so a
# scanner stays on one worker and no scan-heuristic alert is lost. Raise it only when
# 'maltrail_capture_dropped_total' climbs. Formerly CAPTURE_FANOUT, still read when this is absent.
#CAPTURE_WORKERS 1
# libpcap ring per capture socket - how much traffic can burst in before the KERNEL drops it,
# and a dropped packet is never seen by any detection. Defaults to 10% of physical memory, at
# least 64MB and at most 256MB, because this is locked kernel memory PER WORKER; on a host with
# under 1GB of RAM, 10% of it. Set it explicitly to go higher, up to 1GB. (The old CAPTURE_BUFFER
# is still read in place of the 10% when present.)
# Raise it when maltrail_capture_dropped_total climbs; 'maltrail-sensor -T' prints the total
# across all workers.
#CAPTURE_BUFFER_SIZE 64MB
# Bytes captured per packet (default 2000) and how long libpcap waits before returning a batch,
# in milliseconds (default 100). CAPTURE_IMMEDIATE delivers each packet as it arrives - lower
# latency, higher syscall cost.
#CAPTURE_SNAPLEN 2000
#CAPTURE_TIMEOUT 100
#CAPTURE_IMMEDIATE false
# PACKET_FANOUT details: distribution mode (hash|lb|cpu|rollover|random|qm|source, default source),
# kernel-side defragmentation, and a fixed group id when several sensors share one interface.
#
# "source" is the DEFAULT whenever more than one worker is configured, and the setting only has
# any effect there (a single worker forms no fanout group). "hash" splits traffic by FLOW, while
# the scan heuristics count by SOURCE, so a scanner walking ephemeral ports is a new flow on every
# probe and its evidence is spread across every worker until none of them reaches the threshold.
# Measured over the detection corpus, of the heuristic alerts one worker raises: 91% survive at 2
# workers with "hash", 87% at 4, 66% at 8 - and 100% at every count with "source". Exact trail
# matching is a stateless per-packet decision and is unaffected either way.
#
# "source" attaches a small classic-BPF program (PACKET_FANOUT_CBPF) and needs Linux 4.5+. It asks
# for no privileges beyond the ones capture already requires. A kernel that refuses it makes the
# sensor say so and stop, rather than fall back and quietly reinstate the loss above - set "hash"
# here to accept that trade deliberately.
#CAPTURE_FANOUT_MODE source
# Kernel reassembly of IPv4 fragments (on Linux; a single worker joins a group of its own for
# it). Off means a fragmented packet - a standard evasion - is never inspected.
#CAPTURE_FANOUT_DEFRAG true
#CAPTURE_FANOUT_GROUP 41234
# Timestamp source for '-r' replay: 'pcap' (default, the record's own time) or 'wallclock' (the
# time the packet is processed). 'pcap' is what you want to replay a capture and have the events
# carry the times the traffic actually happened.
#OFFLINE_TIMESTAMPS pcap
# Seconds between the sensor's own metrics lines (default 3600). See also STATS_ADDRESS.
#METRICS_INTERVAL 3600
# Event-log throttling. 'summarize' (default) writes EVENT_THROTTLE_BURST events per (ip, trail)
# per EVENT_THROTTLE_WINDOW seconds and then ONE aggregated line, so nothing is silently dropped;
# 'legacy' reproduces core/log.py's bucket byte for byte; 'off' disables throttling entirely.
# EVENT_THROTTLE_MAX_KEYS bounds the tracking table. At the cap the least-recently-seen keys are
# evicted to make room, which flushes their summaries EARLY - nothing is lost, but those events
# are aggregated sooner than EVENT_THROTTLE_WINDOW. Watch maltrail_throttle_evictions_total; a
# sustained rate means the table is too small for the number of distinct (source, trail) pairs.
#EVENT_THROTTLE_MODE summarize
# 'legacy' only: core/log.py's bucket is `sec // PROCESS_COUNT` (default: the CPU count).
#PROCESS_COUNT 16
#EVENT_THROTTLE_WINDOW 60
#EVENT_THROTTLE_BURST 3
#EVENT_THROTTLE_MAX_KEYS 50000
# Per-worker domain result cache (default 1000). Purely a cache - the size changes how often a
# verdict is recomputed, never the verdict. Raising it measured SLOWER under a DGA flood.
#DOMAIN_CACHE_ENTRIES 1000
# Opt out of the sensor's own trail refresh, for hosts where trails.csv is delivered externally
# (a configuration-management system, a read-only image, an air-gapped copy). Off by default, i.e.
# the sensor keeps its own trail set up to date. With this on, nothing else will.
#DISABLE_TRAIL_UPDATES false
# Salvage wildcard trail patterns that arrived truncated in a feed instead of dropping them.
# On by default. Set false to drop them instead, which is the stricter reading of a malformed
# feed row and loses the detections those patterns would have provided.
#REPAIR_TRUNCATED_TRAILS true
# Sensor name to appear in produced logs
SENSOR_NAME $HOSTNAME
# Remote Maltrail server instance to send log entries (Note: listening at <UDP_ADDRESS>:<UDP_PORT>)
#LOG_SERVER 192.168.2.107:8337
#LOG_SERVER [fe80::12c3:7bff:fe6d:cf9b%eno1]:8337
# Shared secret authenticating LOG_SERVER datagrams. The event listener is otherwise open by
# protocol design: anything that can reach <UDP_ADDRESS>:<UDP_PORT> can append to the log an
# operator reasons from, and that /events, /counts and /fail2ban all parse. Forged detections are
# a worse problem for an IDS than eavesdropping.
#
# Set the SAME value on every sensor and on the server. The server then accepts only datagrams
# carrying a valid MAC and silently drops the rest; sensors sign every event they send. Leave it
# unset and behaviour is exactly as before, with no authentication.
#
# It authenticates, it does not encrypt: the event is still readable on the wire. Run the traffic
# inside WireGuard or IPsec if it crosses a network you do not trust to read it.
#
# Use a long random value, not a password: openssl rand -hex 32
#LOG_SERVER_SECRET 3f9c1e...
# How far a signed event's timestamp may be from the server's clock, in seconds. Default 900.
# This bounds replay: a captured datagram cannot be replayed once it falls outside the window.
#
# It is NOT about time zones. The signed timestamp is an epoch second, which is absolute, so a
# sensor in Tokyo and a server in Zagreb agree on it exactly. It is about clock SKEW - a host with
# no NTP, a board with no RTC that boots before the network has come up, a VM resumed from a
# snapshot. Widen it for a fleet you cannot keep synchronised; set 0 to accept any timestamp and
# give up replay bounding.
#
# Get this wrong and the failure is total rather than partial: every event from a skewed sensor is
# refused, and a sensor that looks healthy with a log that stays empty is the hardest fault to see.
# Run the server with debug output to print the reason for each drop.
#
# An OFFLINE replay of an old capture is refused for the same reason. Run the sensor with
# '--timestamps wallclock' when feeding historical pcaps to a collector.
#LOG_SERVER_SKEW 900
# Seconds between the liveness datagrams the sensor sends to LOG_SERVER. Default 300; 0 turns them
# off; values below 10 are raised to 10. Ignored when there is no LOG_SERVER.
#
# Without these, a sensor that has stopped and a sensor with nothing to report are the same thing
# on the server - both send nothing - so a broken sensor is only found by going and looking at it.
# A heartbeat carries the sensor name, its version and its uptime, and the server shows them under
# the menu's "Sensors" entry. They are never written to the event log: liveness is not a detection.
#
# They are signed exactly like events when LOG_SERVER_SECRET is set. Without the secret, anything
# that can reach the port can invent a sensor name, so the list is only as trustworthy as the
# channel underneath it.
#HEARTBEAT_PERIOD 300
# Remote address to send Syslog events. Used by the sensor for detections, and by the server for
# login attempts ("Accepted"/"Failed password for <user> from <ip> port <port>"), so brute force
# against the reporting interface is visible to a SIEM and not only in the local auth log.
# Several may be given, separated by commas, to feed redundant collectors:
# SYSLOG_SERVER host1:port, host2:port
#SYSLOG_SERVER 192.168.2.107:514
# Remote address to send JSON events (e.g. Logstash)
# Several may be given, separated by commas, to feed redundant collectors:
# LOGSTASH_SERVER host1:port, host2:port
#LOGSTASH_SERVER 192.168.2.107:5000
# Regular expression used for calculating severity attribute when sending events to SYSLOG_SERVER or LOGSTASH_SERVER
REMOTE_SEVERITY_REGEX (?P<high>(remote )?custom\)|malwaredomainlist|malware(?! (distribution|site))|adversary|ransomware)|(?P<medium>potential malware site|malware distribution|c2 cert|iot-malware|potential infection)|(?P<low>mass scanner|reputation|attacker|spammer|compromised|crawler|scanning|\(suspicious\) \(heuristic\))
# HTTP POST an alert for each matching event (empty = off). The server tails its event log, so this
# covers events from local and remote sensors alike. Any endpoint that accepts a POST will do: a
# Slack or Mattermost incoming webhook, a Discord webhook, a SIEM collector, your own script.
# NOTE: a literal Slack webhook URL here - even one made of placeholders - is rejected by GitHub's
# push protection as a leaked secret, so the example is deliberately generic.
#ALERT_WEBHOOK_URL https://alerts.example.com/maltrail
# Minimum severity worth a message, as calculated by REMOTE_SEVERITY_REGEX above:
# high named malware, ransomware, adversary, custom trails - "one of our hosts contacted known
# malware", which is the page-someone event
# medium also exploit kits, web skimmers, browser lockers, C2 frameworks
# low also inbound scan noise (attacker, reputation, spammer, crawler) - that is what
# FAIL2BAN_REGEX and /fail2ban are for, and it will fire all day on a healthy host
ALERT_SEVERITY high
# The request body, as a Python format string - there is no webhook standard, and you know your
# receiver. Available: %(timestamp)s %(sensor)s %(severity)s %(src_ip)s %(src_port)s %(dst_ip)s
# %(dst_port)s %(proto)s %(type)s %(trail)s %(info)s %(reference)s and %(json)s, which is the exact
# payload LOGSTASH_SERVER sends.
# Discord: {"content": "..."}
# SIEM / a script: %(json)s
ALERT_FORMAT {"text": "%(severity)s: %(src_ip)s -> %(trail)s (%(info)s) [%(type)s]"}
# Seconds to suppress a repeat of the same (source, trail) pair, so a beacon checking in every 30
# seconds is one message per interval rather than 2,880 a day. 0 disables the suppression.
ALERT_THROTTLE 300
# Set only (!) in cases when LOG_SERVER should be exclusively used for log storage
DISABLE_LOCAL_LOG_STORAGE false
# Format of the event log written under LOG_DIR (default text).
#
# text one space-separated line per event, quoted the way it always has been
# json one JSON object per line, for a SIEM that would otherwise need a bespoke decoder
#
# The JSON is the same object LOGSTASH_SERVER sends, plus a "time" field carrying the local
# timestamp with microseconds. Only the file changes: LOG_SERVER, SYSLOG_SERVER, LOGSTASH_SERVER
# and the console output keep their own formats.
#
# Changing this does NOT rewrite existing logs, and it does not have to: the dashboard, the retro
# hunt, the event index, /blacklist and /fail2ban all decide the format per line, so a directory
# holding both reads correctly - including a single day's file that changed format mid-way.
#
# Anything reading the files directly does need to know. fail2ban and Wazuh decoders are written
# against the text format, which is why that stays the default.
#LOCAL_LOG_FORMAT text
# Remote address for pulling (latest) trail definitions (e.g. http://192.168.2.107:8338/trails). USE_SERVER_UPDATE_TRAILS directive should be active in [Server] parameters.
#UPDATE_SERVER http://192.168.2.107:8338/trails
# Use heuristic methods
USE_HEURISTICS true
# Sliding-window length (seconds) for the scan heuristics (port/web/infection scan). State is kept
# for this long instead of being cleared every ~1s, so SLOW scans (probes spread out to dodge a
# 1-second bucket, e.g. nmap -T2/-T3) are still caught. Longer = catches slower scans but retains
# more state (bounded internally). Default 30. (Stealth NULL/FIN/XMAS scans are always covered.)
#SCAN_WINDOW 30
# DNS tunneling is deliberately hard to trip, because a tunnel and an antivirus reputation lookup
# are near-indistinguishable from query shape: <sha256>.avqs.mcafee.com and every DNSBL query send
# long, high-entropy, never-repeated labels to one zone in volume, which also describes exfiltration.
# So it reports at most once per (source, zone) per 15 minutes, and only when ALL of these hold:
# 150+ queries, 95%+ of them distinct, 90%+ carrying a long high-entropy label, 6 KB+ of encoded
# subdomain, and at least two minutes between the first and the last - a session, not a burst.
# Zones in HASH_LABEL_SERVICE_ZONES (core/settings.py) and anything whitelisted are exempt outright.
# Mute it with: DISABLED_HEURISTICS dns_tunneling
#
# ICMP tunneling (icmpsh, ptunnel): ping tools send a fixed payload (Windows a..w, Linux/BSD/macOS
# a timestamp then counting bytes, monitoring tools zeros or one constant string), a tunnel sends
# data. Reported once per (source, destination) per SCAN_WINDOW when more than 10 DISTINCT echo
# payloads match none of those patterns. Mute it with: DISABLED_HEURISTICS icmp_tunneling
#
# IDN homographs: a queried name whose xn-- label, decoded and with its Cyrillic/Greek/Armenian
# lookalike letters read as Latin, becomes a domain in data/whitelist.txt that it is not
# (xn--pple-43d.com = "аpple.com"). Accented letters are not mapped, so münchen.de and the like
# never fire. Mute it with: DISABLED_HEURISTICS idn_homograph
#
# Mute individual (noisy / low-value) heuristics without turning USE_HEURISTICS off entirely.
# Comma-separated names: port_scanning, udp_scanning, infection, web_scanning, dns_exhaustion,
# long_domain, beaconing, dns_tunneling, icmp_tunneling, idn_homograph.
# Unset = all enabled. E.g. silence the chattiest ones: DISABLED_HEURISTICS port_scanning, dns_exhaustion
#DISABLED_HEURISTICS port_scanning, dns_exhaustion
# Capture HTTP requests with missing Host header (introducing potential false positives)
CHECK_MISSING_HOST false
# Check values in Host header (along with standard non-HTTP checks) for malicious DNS trails (introducing greater number of events)
CHECK_HOST_DOMAINS false
# Location of file with whitelisted entries (i.e. IP addresses, domain names, etc.) (note: take a look into 'data/whitelist.txt')
#USER_WHITELIST
# Location of file with ignore event rules. Example under data/ignore_events.txt
#
# One rule per line, "src_ip;src_port;dst_ip;dst_port", with '*' meaning any. Address fields also
# accept a network (192.168.1.0/24, 2001:db8::/64) or a range (10.0.0.1-10.0.0.15, or the
# last-octet shorthand 10.0.0.1-15), and port fields a range (8000-8100). Ranges are inclusive and
# the four fields are combined with AND.
#USER_IGNORELIST data/ignore_events.txt
# Regular expression to be used against the whole event entry to be ignored
#IGNORE_EVENTS_REGEX sql injection|long domain|117.21.225.3|sinkhole
# [All]
# Show debug messages (in console output)
SHOW_DEBUG false
# Directory used for log storage
LOG_DIR $SYSTEM_LOG_DIR/maltrail
# HTTP(s) proxy address
#PROXY_ADDRESS http://192.168.5.101:8118
# Skip the startup check for capture privileges (root, or CAP_NET_RAW from 'setcap' or the systemd
# unit), for a setup that grants them in a way the check cannot see
#DISABLE_CHECK_SUDO true
# Override default location for trail storage (~/.maltrail/trails.csv)
# Note: for a service install use a path the service user owns, e.g. the systemd unit's
# StateDirectory: TRAILS_FILE /var/lib/maltrail/trails.csv
#TRAILS_FILE /etc/maltrail.csv
# Refuse to start when the trail set is empty (a sensor with no trails detects nothing while
# reporting itself healthy). Set true only where an empty set is genuinely expected
#ALLOW_EMPTY_TRAILS false
# Smallest fraction of the current trail count a RELOAD may produce and still be accepted, so a
# truncated or half-written trails.csv cannot silently replace a good set. 0 disables the check
#TRAIL_RELOAD_MIN_RATIO 0.5
# Bounds on the per-worker capture ring, packet snap length and capture poll timeout are
# enforced at load: out-of-range values are clamped and reported by 'maltrail-sensor -T', which
# also prints the EFFECTIVE configuration and the total capture-ring memory across all workers
# (CAPTURE_BUFFER_SIZE is per worker, so N workers want N times that much)