-
Notifications
You must be signed in to change notification settings - Fork 0
/
a100672aaaf58d52c71d3599452b15c9d74498bd2004a799fac342d3f3fadeb7.lua
372 lines (313 loc) · 12.1 KB
/
a100672aaaf58d52c71d3599452b15c9d74498bd2004a799fac342d3f3fadeb7.lua
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
---------------------------------------------------------------------------
-- Snort++ configuration
---------------------------------------------------------------------------
-- there are over 200 modules available to tune your policy.
-- many can be used with defaults w/o any explicit configuration.
-- use this conf as a template for your specific configuration.
-- 1. configure defaults
-- 2. configure inspection
-- 3. configure bindings
-- 4. configure performance
-- 5. configure detection
-- 6. configure filters
-- 7. configure outputs
-- 8. configure tweaks
---------------------------------------------------------------------------
-- 1. configure defaults
---------------------------------------------------------------------------
-- HOME_NET and EXTERNAL_NET must be set now
-- setup the network addresses you are protecting
-- HOME_NET = 'any'
HOME_NET = [[ 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12 ]]
-- set up the external network addresses.
-- (leave as "any" in most situations)
EXTERNAL_NET = 'any'
include 'snort_defaults.lua'
include 'file_magic.lua'
---------------------------------------------------------------------------
-- 2. configure inspection
---------------------------------------------------------------------------
-- mod = { } uses internal defaults
-- you can see them with snort --help-module mod
-- mod = default_mod uses external defaults
-- you can see them in snort_defaults.lua
-- the following are quite capable with defaults:
stream = { }
stream_ip = { }
stream_icmp = { }
stream_tcp = { }
stream_udp = { }
stream_user = { }
stream_file = { }
arp_spoof = { }
back_orifice = { }
dnp3 = { }
dns = { }
http_inspect = { }
http2_inspect = { }
imap = { }
modbus = { }
normalizer = { }
pop = { }
rpc_decode = { }
sip = { }
ssh = { }
ssl = { }
telnet = { }
dce_smb = { }
dce_tcp = { }
dce_udp = { }
dce_http_proxy = { }
dce_http_server = { }
-- see snort_defaults.lua for default_*
gtp_inspect = default_gtp
port_scan = default_med_port_scan
smtp = default_smtp
ftp_server = default_ftp_server
ftp_client = { }
ftp_data = { }
-- see file_magic.lua for file id rules
-- file_id = { file_rules = file_magic }
file_id =
{
enable_type = true,
enable_signature = true,
file_rules = file_magic,
file_policy =
{
{ use = { verdict = 'log', enable_file_type = true, enable_file_signature = true } }
}
}
-- the following require additional configuration to be fully effective:
appid =
{
-- appid requires this to use appids in rules
app_detector_dir = APPID_PATH,
log_stats = true,
app_stats_period = 300
}
reputation =
{
-- configure one or both of these, then uncomment reputation
blacklist = BLOCK_LIST_PATH .. '/ip-blocklist',
whitelist = PASS_LIST_PATH .. '/ip-passlist'
}
---------------------------------------------------------------------------
-- 3. configure bindings
---------------------------------------------------------------------------
wizard = default_wizard
binder =
{
-- port bindings required for protocols without wizard support
{ when = { proto = 'udp', ports = '53', role='server' }, use = { type = 'dns' } },
{ when = { proto = 'tcp', ports = '53', role='server' }, use = { type = 'dns' } },
{ when = { proto = 'tcp', ports = '111', role='server' }, use = { type = 'rpc_decode' } },
{ when = { proto = 'tcp', ports = '502', role='server' }, use = { type = 'modbus' } },
{ when = { proto = 'tcp', ports = '2123 2152 3386', role='server' }, use = { type = 'gtp_inspect' } },
{ when = { proto = 'tcp', service = 'dcerpc' }, use = { type = 'dce_tcp' } },
{ when = { proto = 'udp', service = 'dcerpc' }, use = { type = 'dce_udp' } },
{ when = { service = 'netbios-ssn' }, use = { type = 'dce_smb' } },
{ when = { service = 'dce_http_server' }, use = { type = 'dce_http_server' } },
{ when = { service = 'dce_http_proxy' }, use = { type = 'dce_http_proxy' } },
{ when = { service = 'dnp3' }, use = { type = 'dnp3' } },
{ when = { service = 'dns' }, use = { type = 'dns' } },
{ when = { service = 'ftp' }, use = { type = 'ftp_server' } },
{ when = { service = 'ftp-data' }, use = { type = 'ftp_data' } },
{ when = { service = 'gtp' }, use = { type = 'gtp_inspect' } },
{ when = { service = 'imap' }, use = { type = 'imap' } },
{ when = { service = 'http' }, use = { type = 'http_inspect' } },
{ when = { service = 'http2' }, use = { type = 'http2_inspect' } },
{ when = { service = 'modbus' }, use = { type = 'modbus' } },
{ when = { service = 'pop3' }, use = { type = 'pop' } },
{ when = { service = 'ssh' }, use = { type = 'ssh' } },
{ when = { service = 'sip' }, use = { type = 'sip' } },
{ when = { service = 'smtp' }, use = { type = 'smtp' } },
{ when = { service = 'ssl' }, use = { type = 'ssl' } },
{ when = { service = 'sunrpc' }, use = { type = 'rpc_decode' } },
{ when = { service = 'telnet' }, use = { type = 'telnet' } },
{ use = { type = 'wizard' } }
}
---------------------------------------------------------------------------
-- 4. configure performance
---------------------------------------------------------------------------
-- use latency to monitor / enforce packet and rule thresholds
--latency = { }
-- use these to capture perf data for analysis and tuning
--profiler = { }
--perf_monitor = { }
---------------------------------------------------------------------------
-- 5. configure detection
---------------------------------------------------------------------------
references = default_references
classifications = default_classifications
ips =
{
mode = tap,
-- use this to enable decoder and inspector alerts
--enable_builtin_rules = true,
-- use include for rules files; be sure to set your path
-- note that rules files can include other rules files
--include = 'snort3-community.rules'
-- The following include syntax is only valid for BUILD_243 (13-FEB-2018) and later
-- RULE_PATH is typically set in snort_defaults.lua
rules = [[
include $RULE_PATH/local.rules
include $RULE_PATH/snort3-app-detect.rules
include $RULE_PATH/snort3-browser-chrome.rules
include $RULE_PATH/snort3-browser-firefox.rules
include $RULE_PATH/snort3-browser-ie.rules
include $RULE_PATH/snort3-browser-other.rules
include $RULE_PATH/snort3-browser-plugins.rules
include $RULE_PATH/snort3-browser-webkit.rules
include $RULE_PATH/snort3-content-replace.rules
include $RULE_PATH/snort3-exploit-kit.rules
include $RULE_PATH/snort3-file-executable.rules
include $RULE_PATH/snort3-file-flash.rules
include $RULE_PATH/snort3-file-identify.rules
include $RULE_PATH/snort3-file-image.rules
include $RULE_PATH/snort3-file-java.rules
include $RULE_PATH/snort3-file-multimedia.rules
include $RULE_PATH/snort3-file-office.rules
include $RULE_PATH/snort3-file-other.rules
include $RULE_PATH/snort3-file-pdf.rules
include $RULE_PATH/snort3-indicator-compromise.rules
include $RULE_PATH/snort3-indicator-obfuscation.rules
include $RULE_PATH/snort3-indicator-scan.rules
include $RULE_PATH/snort3-indicator-shellcode.rules
include $RULE_PATH/snort3-malware-backdoor.rules
include $RULE_PATH/snort3-malware-cnc.rules
include $RULE_PATH/snort3-malware-other.rules
include $RULE_PATH/snort3-malware-tools.rules
include $RULE_PATH/snort3-netbios.rules
include $RULE_PATH/snort3-os-linux.rules
include $RULE_PATH/snort3-os-mobile.rules
include $RULE_PATH/snort3-os-other.rules
include $RULE_PATH/snort3-os-solaris.rules
include $RULE_PATH/snort3-os-windows.rules
include $RULE_PATH/snort3-policy-multimedia.rules
include $RULE_PATH/snort3-policy-other.rules
include $RULE_PATH/snort3-policy-social.rules
include $RULE_PATH/snort3-policy-spam.rules
include $RULE_PATH/snort3-protocol-dns.rules
include $RULE_PATH/snort3-protocol-finger.rules
include $RULE_PATH/snort3-protocol-ftp.rules
include $RULE_PATH/snort3-protocol-icmp.rules
include $RULE_PATH/snort3-protocol-imap.rules
include $RULE_PATH/snort3-protocol-nntp.rules
include $RULE_PATH/snort3-protocol-other.rules
include $RULE_PATH/snort3-protocol-pop.rules
include $RULE_PATH/snort3-protocol-rpc.rules
include $RULE_PATH/snort3-protocol-scada.rules
include $RULE_PATH/snort3-protocol-services.rules
include $RULE_PATH/snort3-protocol-snmp.rules
include $RULE_PATH/snort3-protocol-telnet.rules
include $RULE_PATH/snort3-protocol-tftp.rules
include $RULE_PATH/snort3-protocol-voip.rules
include $RULE_PATH/snort3-pua-adware.rules
include $RULE_PATH/snort3-pua-other.rules
include $RULE_PATH/snort3-pua-p2p.rules
include $RULE_PATH/snort3-pua-toolbars.rules
include $RULE_PATH/snort3-server-apache.rules
include $RULE_PATH/snort3-server-iis.rules
include $RULE_PATH/snort3-server-mail.rules
include $RULE_PATH/snort3-server-mssql.rules
include $RULE_PATH/snort3-server-mysql.rules
include $RULE_PATH/snort3-server-oracle.rules
include $RULE_PATH/snort3-server-other.rules
include $RULE_PATH/snort3-server-samba.rules
include $RULE_PATH/snort3-server-webapp.rules
include $RULE_PATH/snort3-sql.rules
include $RULE_PATH/snort3-x11.rules
]]
}
rewrite = { }
-- use these to configure additional rule actions
-- react = { }
-- reject = { }
-- use this to enable payload injection utility
-- payload_injector = { }
---------------------------------------------------------------------------
-- 6. configure filters
---------------------------------------------------------------------------
-- below are examples of filters
-- each table is a list of records
--[[
suppress =
{
-- don't want to any of see these
{ gid = 1, sid = 1 },
-- don't want to see these for a given server
{ gid = 1, sid = 2, track = 'by_dst', ip = '1.2.3.4' },
}
--]]
--[[
event_filter =
{
-- reduce the number of events logged for some rules
{ gid = 1, sid = 1, type = 'limit', track = 'by_src', count = 2, seconds = 10 },
{ gid = 1, sid = 2, type = 'both', track = 'by_dst', count = 5, seconds = 60 },
}
--]]
--[[
rate_filter =
{
-- alert on connection attempts from clients in SOME_NET
{ gid = 135, sid = 1, track = 'by_src', count = 5, seconds = 1,
new_action = 'alert', timeout = 4, apply_to = '[$SOME_NET]' },
-- alert on connections to servers over threshold
{ gid = 135, sid = 2, track = 'by_dst', count = 29, seconds = 3,
new_action = 'alert', timeout = 1 },
}
--]]
---------------------------------------------------------------------------
-- 7. configure outputs
---------------------------------------------------------------------------
-- event logging
-- you can enable with defaults from the command line with -A <alert_type>
-- uncomment below to set non-default configs
--alert_csv = { }
--alert_fast = { }
--alert_full = { }
--alert_sfsocket = { }
--alert_syslog = { }
--unified2 = { }
-- packet logging
-- you can enable with defaults from the command line with -L <log_type>
--log_codecs = { }
--log_hext = { }
--log_pcap = { }
-- additional logs
--packet_capture = { }
--file_log = { }
alert_fast =
{
file = true
}
file_log =
{
log_pkt_time = true,
log_sys_time = false
}
data_log =
{
key = 'http_request_header_event',
limit = 100
}
alert_syslog =
{
facility = local7,
level = alert,
options = pid
}
alert_json =
{
file = true,
limit = 100,
fields = 'timestamp iface src_addr src_port dst_addr dst_port proto action msg priority class sid'
}
---------------------------------------------------------------------------
-- 8. configure tweaks
---------------------------------------------------------------------------
if ( tweaks ~= nil ) then
include(tweaks .. '.lua')
end