Imported Upstream version 2.3
[ossec-hids.git] / src / analysisd / config.c
1 /* @(#) $Id: config.c,v 1.32 2009/11/04 15:18:59 dcid Exp $ */
2
3 /* Copyright (C) 2009 Trend Micro Inc.
4  * All rights reserved.
5  *
6  * This program is a free software; you can redistribute it
7  * and/or modify it under the terms of the GNU General Public
8  * License (version 3) as published by the FSF - Free Software
9  * Foundation.
10  *
11  * License details at the LICENSE file included with OSSEC or 
12  * online at: http://www.ossec.net/en/licensing.html
13  */
14
15
16 /* Functions to handle the configuration files
17  */
18
19
20 #include "shared.h"
21
22 #include "os_xml/os_xml.h"
23 #include "os_regex/os_regex.h"
24
25 #include "analysisd.h"
26 #include "config.h"
27
28
29 /* GlobalConf vv0.2: 2005/03/03
30  * v0.2: Changing to support the new OS_XML
31  */
32 int GlobalConf(char * cfgfile)
33 {
34     int modules = 0;
35
36
37     /* Default values */
38     Config.logall = 0;
39     Config.stats = 4;
40     Config.integrity = 8;
41     Config.rootcheck = 8;
42     Config.hostinfo = 8;
43     Config.picviz = 0;
44     Config.prelude = 0;
45     Config.memorysize = 1024;
46     Config.mailnotify = -1;
47     Config.keeplogdate = 0;
48     Config.syscheck_alert_new = 0;
49     Config.syscheck_auto_ignore = 1;
50     Config.ar = 0;
51
52     Config.syscheck_ignore = NULL;
53     Config.white_list = NULL;
54     Config.hostname_white_list = NULL;
55     
56     /* Default actions -- only log above level 1 */
57     Config.mailbylevel = 7;
58     Config.logbylevel  = 1;
59
60     Config.includes = NULL;
61
62     modules|= CGLOBAL;
63     modules|= CRULES;
64     modules|= CALERTS;
65
66
67     /* Reading config */
68     if(ReadConfig(modules, cfgfile, &Config, NULL)< 0)
69     {
70         return(OS_INVALID);
71     }
72
73     /* Minimum memory size */
74     if(Config.memorysize < 64)
75         Config.memorysize = 64;
76         
77
78     return(0);
79 }
80
81
82
83 /* EOF */