1 /* Copyright (C) 2009 Trend Micro Inc. 2 * All rights reserved. 3 * 4 * This program is a free software; you can redistribute it 5 * and/or modify it under the terms of the GNU General Public 6 * License (version 2) as published by the FSF - Free Software 7 * Foundation. 8 */ 9 10 /* Functions to handle the configuration files */ 11 12 #include "shared.h" 13 #include "os_xml/os_xml.h" 14 #include "os_regex/os_regex.h" 15 #include "analysisd.h" 16 #include "config.h" 17 18 long int __crt_ftell; /* Global ftell pointer */ 19 _Config Config; /* Global Config structure */ 20 GlobalConf(const char * cfgfile)21int GlobalConf(const char *cfgfile) 22 { 23 int modules = 0; 24 25 /* Default values */ 26 Config.logall = 0; 27 Config.logall_json = 0; 28 Config.stats = 4; 29 Config.integrity = 8; 30 Config.rootcheck = 8; 31 Config.hostinfo = 8; 32 Config.prelude = 0; 33 Config.zeromq_output = 0; 34 Config.zeromq_output_uri = NULL; 35 Config.zeromq_output_server_cert = NULL; 36 Config.zeromq_output_client_cert = NULL; 37 Config.jsonout_output = 0; 38 Config.memorysize = 8192; 39 Config.mailnotify = -1; 40 Config.keeplogdate = 0; 41 Config.syscheck_alert_new = 0; 42 Config.syscheck_auto_ignore = 1; 43 Config.ar = 0; 44 45 Config.syscheck_ignore = NULL; 46 Config.allow_list = NULL; 47 Config.hostname_allow_list = NULL; 48 49 /* Default actions -- only log above level 1 */ 50 Config.mailbylevel = 7; 51 Config.logbylevel = 1; 52 53 Config.custom_alert_output = 0; 54 Config.custom_alert_output_format = NULL; 55 56 Config.includes = NULL; 57 Config.lists = NULL; 58 Config.decoders = NULL; 59 60 modules |= CGLOBAL; 61 modules |= CRULES; 62 modules |= CALERTS; 63 64 /* Read config */ 65 if (ReadConfig(modules, cfgfile, &Config, NULL) < 0) { 66 return (OS_INVALID); 67 } 68 69 /* Minimum memory size */ 70 if (Config.memorysize < 2048) { 71 Config.memorysize = 2048; 72 } 73 74 return (0); 75 } 76