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