1 | <!-- OSSEC example config --> |
---|
2 | |
---|
3 | <ossec_config> |
---|
4 | <global> |
---|
5 | <!-- |
---|
6 | <email_notification>no</email_notification> |
---|
7 | <email_to>daniel.cid@xxx.com</email_to> |
---|
8 | <smtp_server>smtp.xxx.com.</smtp_server> |
---|
9 | <email_from>ossecm@ossec.xxx.com.</email_from> |
---|
10 | <email_maxperhour>1</email_maxperhour> |
---|
11 | --> |
---|
12 | |
---|
13 | <!-- to specify GeoIP database file location --> |
---|
14 | <!-- |
---|
15 | <geoip_db_path>/etc/GeoLiteCity.dat</geoip_db_path> |
---|
16 | <geoip6_db_path>/etc/GeoLiteCityv6.dat</geoip6_db_path> |
---|
17 | --> |
---|
18 | <!-- enable picviz link: http://ossec-docs.readthedocs.org/en/latest/manual/output/picviz-output.html?highlight=picviz --> |
---|
19 | <picviz_output>yes</picviz_output> |
---|
20 | <picviz_socket>/var/ossec/picviz.socket</picviz_socket> |
---|
21 | |
---|
22 | </global> |
---|
23 | |
---|
24 | <rules> |
---|
25 | <include>rules_config.xml</include> |
---|
26 | <include>pam_rules.xml</include> |
---|
27 | <include>sshd_rules.xml</include> |
---|
28 | <include>telnetd_rules.xml</include> |
---|
29 | <include>syslog_rules.xml</include> |
---|
30 | <include>arpwatch_rules.xml</include> |
---|
31 | <include>symantec-av_rules.xml</include> |
---|
32 | <include>symantec-ws_rules.xml</include> |
---|
33 | <include>pix_rules.xml</include> |
---|
34 | <include>named_rules.xml</include> |
---|
35 | <include>smbd_rules.xml</include> |
---|
36 | <include>vsftpd_rules.xml</include> |
---|
37 | <include>pure-ftpd_rules.xml</include> |
---|
38 | <include>proftpd_rules.xml</include> |
---|
39 | <include>ms_ftpd_rules.xml</include> |
---|
40 | <include>ftpd_rules.xml</include> |
---|
41 | <include>hordeimp_rules.xml</include> |
---|
42 | <include>roundcube_rules.xml</include> |
---|
43 | <include>wordpress_rules.xml</include> |
---|
44 | <include>cimserver_rules.xml</include> |
---|
45 | <include>vpopmail_rules.xml</include> |
---|
46 | <include>vmpop3d_rules.xml</include> |
---|
47 | <include>courier_rules.xml</include> |
---|
48 | <include>web_rules.xml</include> |
---|
49 | <include>web_appsec_rules.xml</include> |
---|
50 | <include>apache_rules.xml</include> |
---|
51 | <include>nginx_rules.xml</include> |
---|
52 | <include>php_rules.xml</include> |
---|
53 | <include>mysql_rules.xml</include> |
---|
54 | <include>postgresql_rules.xml</include> |
---|
55 | <include>ids_rules.xml</include> |
---|
56 | <include>squid_rules.xml</include> |
---|
57 | <include>firewall_rules.xml</include> |
---|
58 | <include>cisco-ios_rules.xml</include> |
---|
59 | <include>netscreenfw_rules.xml</include> |
---|
60 | <include>sonicwall_rules.xml</include> |
---|
61 | <include>postfix_rules.xml</include> |
---|
62 | <include>sendmail_rules.xml</include> |
---|
63 | <include>imapd_rules.xml</include> |
---|
64 | <include>mailscanner_rules.xml</include> |
---|
65 | <include>dovecot_rules.xml</include> |
---|
66 | <include>ms-exchange_rules.xml</include> |
---|
67 | <include>racoon_rules.xml</include> |
---|
68 | <include>vpn_concentrator_rules.xml</include> |
---|
69 | <include>spamd_rules.xml</include> |
---|
70 | <include>msauth_rules.xml</include> |
---|
71 | <include>mcafee_av_rules.xml</include> |
---|
72 | <include>trend-osce_rules.xml</include> |
---|
73 | <include>ms-se_rules.xml</include> |
---|
74 | <!-- <include>policy_rules.xml</include> --> |
---|
75 | <include>zeus_rules.xml</include> |
---|
76 | <include>solaris_bsm_rules.xml</include> |
---|
77 | <include>vmware_rules.xml</include> |
---|
78 | <include>ms_dhcp_rules.xml</include> |
---|
79 | <include>asterisk_rules.xml</include> |
---|
80 | <include>ossec_rules.xml</include> |
---|
81 | <include>attack_rules.xml</include> |
---|
82 | <include>local_rules.xml</include> |
---|
83 | <include>local_rules_mac.xml</include> |
---|
84 | <decoder>/opt/local/var/ossec/etc/decoder.xml</decoder> |
---|
85 | <decoder>/opt/local/var/ossec/etc/decoder_local_mac.xml</decoder> |
---|
86 | <!-- |
---|
87 | <decoder>/opt/local/var/ossec/etc/local_decoder.xml</decoder> |
---|
88 | --> |
---|
89 | </rules> |
---|
90 | |
---|
91 | |
---|
92 | <syscheck> |
---|
93 | <disabled>yes</disabled> |
---|
94 | <!-- Frequency that syscheck is executed -- default every 20 hours --> |
---|
95 | <frequency>72000</frequency> |
---|
96 | |
---|
97 | <!-- Directories to check (perform all possible verifications) --> |
---|
98 | <directories check_all="yes">/usr/bin,/usr/sbin</directories> |
---|
99 | <directories check_all="yes">/bin,/sbin</directories> |
---|
100 | <directories check_all="yes">/private/etc</directories> |
---|
101 | <directories check_all="yes">/Applications</directories> |
---|
102 | <directories check_all="yes">/System,/Network,/Library</directories> |
---|
103 | <directories check_all="yes">/Developer</directories> |
---|
104 | <directories check_all="yes">/opt/local/etc,/opt/local/bin,/opt/local/sbin</directories> |
---|
105 | <directories check_all="yes">/home</directories> |
---|
106 | <directories check_all="yes">/Library/Preferences</directories> |
---|
107 | <directories check_all="yes">/Users/Shared</directories> |
---|
108 | |
---|
109 | <!-- Startup items + user-defined one? --> |
---|
110 | <directories check_all="yes">/System/Library/LaunchDaemons,/System/Library/LaunchAgents,/Library/LaunchDaemons,/Library/LaunchAgents,/Library/Preferences/com.apple.loginwindow.plist,/System/Library/XPCServices</directories> |
---|
111 | |
---|
112 | <!-- User files --> |
---|
113 | <directories check_all="yes">/Users/*/Library/Preferences</directories> |
---|
114 | <directories check_all="yes">/Users/*/Library/Logs</directories> |
---|
115 | <directories check_all="yes">/Users/*/Library/Preferences/com.apple.loginitems.plist</directories> |
---|
116 | <directories check_all="yes">/Users/*/Library/Mail/V2/MailData/Accounts.plist</directories> |
---|
117 | <directories check_all="yes">/Users/*/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2</directories> |
---|
118 | |
---|
119 | <!-- coredump directory (disabled by default on macos) --> |
---|
120 | <directories check_all="yes">/cores</directories> |
---|
121 | |
---|
122 | <!-- Apple web server --> |
---|
123 | <directories check_all="yes">/Library/WebServer/Documents</directories> |
---|
124 | |
---|
125 | <!-- macports web server --> |
---|
126 | <!-- |
---|
127 | <directories check_all="yes">/opt/local/www</directories> |
---|
128 | --> |
---|
129 | <!-- Doing realtime monitoring for sensitive scripts on webserver --> |
---|
130 | <!-- Note: NOT REPORTING ON NEW FILE: see http://tonyonsecurity.com/2013/07/27/ossec-detecting-new-files-understanding-how-it-works/ --> |
---|
131 | <directories realtime="yes" report_changes="yes" restrict=".php|.js|.asp|.pl|.exe|.ht*">/opt/local/www</directories> |
---|
132 | <!-- |
---|
133 | <alert_new_files>yes</alert_new_files> |
---|
134 | <scan_on_start>no</scan_on_start> |
---|
135 | <auto_ignore>no</auto_ignore> |
---|
136 | --> |
---|
137 | |
---|
138 | <!-- Files/directories to ignore --> |
---|
139 | <!-- |
---|
140 | <ignore>/etc/mtab</ignore> |
---|
141 | <ignore>/etc/hosts.deny</ignore> |
---|
142 | <ignore>/etc/mail/statistics</ignore> |
---|
143 | <ignore>/etc/random-seed</ignore> |
---|
144 | <ignore>/etc/adjtime</ignore> |
---|
145 | <ignore>/etc/httpd/logs</ignore> |
---|
146 | --> |
---|
147 | <ignore>/Library/Caches</ignore> |
---|
148 | <ignore>/System/Library/Caches</ignore> |
---|
149 | <ignore>/Volumes</ignore> |
---|
150 | <ignore>/private/tmp</ignore> |
---|
151 | <ignore>/private/var/tmp</ignore> |
---|
152 | <ignore>/opt/tmp</ignore> |
---|
153 | <!-- Apple Malware definitions file (auto-updated) --> |
---|
154 | <ignore>/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.plist</ignore> |
---|
155 | <ignore>/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist</ignore> |
---|
156 | <ignore>/Library/Managed Preferences/Guest/com.apple.familycontrols.contentfilter.plist</ignore> |
---|
157 | <!-- Google Chrome just auto update too much ... just keeping main executable: 'Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary' --> |
---|
158 | <ignore>/Applications/Google Chrome Canary.app/Contents/Resources/</ignore> |
---|
159 | <ignore>/Applications/Google Chrome Canary.app/Contents/Info.plist</ignore> |
---|
160 | <ignore>/Applications/Google Chrome Canary.app/Contents/_CodeSignature/CodeResources</ignore> |
---|
161 | </syscheck> |
---|
162 | |
---|
163 | <rootcheck> |
---|
164 | <rootkit_files>/opt/local/var/ossec/etc/shared/rootkit_files.txt</rootkit_files> |
---|
165 | <rootkit_trojans>/opt/local/var/ossec/etc/shared/rootkit_trojans.txt</rootkit_trojans> |
---|
166 | </rootcheck> |
---|
167 | |
---|
168 | <global> |
---|
169 | <white_list>127.0.0.1</white_list> |
---|
170 | </global> |
---|
171 | |
---|
172 | <!-- For Server install: remoted daemon listening for agent --> |
---|
173 | <remote> |
---|
174 | <connection>secure</connection> |
---|
175 | </remote> |
---|
176 | |
---|
177 | <alerts> |
---|
178 | <log_alert_level>1</log_alert_level> |
---|
179 | <email_alert_level>7</email_alert_level> |
---|
180 | |
---|
181 | <!-- to add GeoIP info in alerts --> |
---|
182 | <!-- |
---|
183 | <use_geoip>yes</use_geoip> |
---|
184 | --> |
---|
185 | </alerts> |
---|
186 | |
---|
187 | <command> |
---|
188 | <name>host-deny</name> |
---|
189 | <executable>host-deny.sh</executable> |
---|
190 | <expect>srcip</expect> |
---|
191 | <timeout_allowed>yes</timeout_allowed> |
---|
192 | </command> |
---|
193 | |
---|
194 | <command> |
---|
195 | <name>firewall-drop</name> |
---|
196 | <executable>firewall-drop.sh</executable> |
---|
197 | <expect>srcip</expect> |
---|
198 | <timeout_allowed>yes</timeout_allowed> |
---|
199 | </command> |
---|
200 | |
---|
201 | <command> |
---|
202 | <name>disable-account</name> |
---|
203 | <executable>disable-account.sh</executable> |
---|
204 | <expect>user</expect> |
---|
205 | <timeout_allowed>yes</timeout_allowed> |
---|
206 | </command> |
---|
207 | |
---|
208 | |
---|
209 | <!-- Active Response Config --> |
---|
210 | <active-response> |
---|
211 | <!-- This response is going to execute the host-deny |
---|
212 | - command for every event that fires a rule with |
---|
213 | - level (severity) >= 6. |
---|
214 | - The IP is going to be blocked for 600 seconds. |
---|
215 | --> |
---|
216 | <command>host-deny</command> |
---|
217 | <location>local</location> |
---|
218 | <level>6</level> |
---|
219 | <timeout>600</timeout> |
---|
220 | </active-response> |
---|
221 | |
---|
222 | <active-response> |
---|
223 | <!-- Firewall Drop response. Block the IP for |
---|
224 | - 600 seconds on the firewall (iptables, |
---|
225 | - ipfilter, etc). |
---|
226 | --> |
---|
227 | <command>firewall-drop</command> |
---|
228 | <location>local</location> |
---|
229 | <level>6</level> |
---|
230 | <timeout>600</timeout> |
---|
231 | </active-response> |
---|
232 | |
---|
233 | <!-- Files to monitor (localfiles) --> |
---|
234 | |
---|
235 | <!-- can be multiline --> |
---|
236 | <localfile> |
---|
237 | <log_format>syslog</log_format> |
---|
238 | <location>/private/var/log/system.log</location> |
---|
239 | </localfile> |
---|
240 | |
---|
241 | <localfile> |
---|
242 | <log_format>syslog</log_format> |
---|
243 | <location>/private/var/log/authd.log</location> |
---|
244 | </localfile> |
---|
245 | |
---|
246 | <localfile> |
---|
247 | <log_format>syslog</log_format> |
---|
248 | <location>/private/var/log/appfirewall.log</location> |
---|
249 | </localfile> |
---|
250 | |
---|
251 | <localfile> |
---|
252 | <log_format>syslog</log_format> |
---|
253 | <location>/private/var/log/alf.log</location> |
---|
254 | </localfile> |
---|
255 | |
---|
256 | <!-- can be multiline --> |
---|
257 | <localfile> |
---|
258 | <log_format>syslog</log_format> |
---|
259 | <location>/private/var/log/appstore.log</location> |
---|
260 | </localfile> |
---|
261 | |
---|
262 | <!-- can be multiline --> |
---|
263 | <localfile> |
---|
264 | <log_format>syslog</log_format> |
---|
265 | <location>/private/var/log/install.log</location> |
---|
266 | </localfile> |
---|
267 | |
---|
268 | <localfile> |
---|
269 | <log_format>syslog</log_format> |
---|
270 | <location>/private/var/log/mail.log</location> |
---|
271 | </localfile> |
---|
272 | |
---|
273 | <localfile> |
---|
274 | <log_format>syslog</log_format> |
---|
275 | <location>/private/var/log/notifyd.log</location> |
---|
276 | </localfile> |
---|
277 | |
---|
278 | <localfile> |
---|
279 | <log_format>syslog</log_format> |
---|
280 | <location>/private/var/log/opendirectoryd.log</location> |
---|
281 | </localfile> |
---|
282 | |
---|
283 | <localfile> |
---|
284 | <log_format>syslog</log_format> |
---|
285 | <location>/private/var/log/shutdown_monitor.log</location> |
---|
286 | </localfile> |
---|
287 | |
---|
288 | <localfile> |
---|
289 | <log_format>syslog</log_format> |
---|
290 | <location>/private/var/log/wifi.log</location> |
---|
291 | </localfile> |
---|
292 | |
---|
293 | <!-- Apache2 from Apple --> |
---|
294 | <!-- |
---|
295 | <localfile> |
---|
296 | <log_format>apache</log_format> |
---|
297 | <location>/private/var/log/apache2/access_log</location> |
---|
298 | </localfile> |
---|
299 | |
---|
300 | <localfile> |
---|
301 | <log_format>apache</log_format> |
---|
302 | <location>/private/var/log/apache2/error_log</location> |
---|
303 | </localfile> |
---|
304 | --> |
---|
305 | |
---|
306 | <!-- Macports log --> |
---|
307 | |
---|
308 | <localfile> |
---|
309 | <log_format>syslog</log_format> |
---|
310 | <location>/opt/local/var/log/php55/php-fpm.log</location> |
---|
311 | </localfile> |
---|
312 | |
---|
313 | <localfile> |
---|
314 | <log_format>apache</log_format> |
---|
315 | <location>/opt/local/var/log/nginx/access.log</location> |
---|
316 | </localfile> |
---|
317 | |
---|
318 | <!-- Custom commands --> |
---|
319 | |
---|
320 | <!-- monitor network listen access --> |
---|
321 | <localfile> |
---|
322 | <log_format>full_command</log_format> |
---|
323 | <command>netstat -tan |awk '/LISTEN/ && !/(127.0.0.1|::1)/'</command> |
---|
324 | </localfile> |
---|
325 | |
---|
326 | <!-- monitor disk occupation --> |
---|
327 | <localfile> |
---|
328 | <log_format>command</log_format> |
---|
329 | <command>df -h</command> |
---|
330 | </localfile> |
---|
331 | |
---|
332 | <!-- monitor last logged users --> |
---|
333 | <localfile> |
---|
334 | <log_format>command</log_format> |
---|
335 | <command>last -5</command> |
---|
336 | </localfile> |
---|
337 | |
---|
338 | <!-- monitor ipfw rules --> |
---|
339 | <localfile> |
---|
340 | <log_format>command</log_format> |
---|
341 | <command>ipfw -t list</command> |
---|
342 | </localfile> |
---|
343 | |
---|
344 | <!-- monitor user list --> |
---|
345 | <localfile> |
---|
346 | <log_format>command</log_format> |
---|
347 | <command>dscl . list /users</command> |
---|
348 | </localfile> |
---|
349 | |
---|
350 | <!-- monitor active launchd sons --> |
---|
351 | <localfile> |
---|
352 | <log_format>command</log_format> |
---|
353 | <command>launchctl list</command> |
---|
354 | </localfile> |
---|
355 | |
---|
356 | <!-- monitor shared memory --> |
---|
357 | <localfile> |
---|
358 | <log_format>command</log_format> |
---|
359 | <command>ipcs -m</command> |
---|
360 | </localfile> |
---|
361 | |
---|
362 | </ossec_config> |
---|