config: use config file in sysconfdir by default.

remotes/origin/master
Eric Leblond 13 years ago committed by Victor Julien
parent 8dfddd0a0f
commit 2d22f667c2

@ -5,6 +5,9 @@ noinst_HEADERS = action-globals.h \
suricata-common.h threadvars.h util-binsearch.h \
util-atomic.h util-validate.h
bin_PROGRAMS = suricata
AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\"
suricata_SOURCES = suricata.c suricata.h \
runmodes.c runmodes.h \
runmode-pcap.c runmode-pcap.h \

@ -1202,6 +1202,12 @@ int main(int argc, char **argv)
/* load the pattern matchers */
MpmTableSetup();
if (run_mode != RUNMODE_UNITTEST &&
!list_keywords &&
!list_app_layer_protocols) {
conf_filename = DEFAULT_CONF_FILE;
}
/** \todo we need an api for these */
/* Load yaml configuration file if provided. */
if (conf_filename != NULL) {
@ -1229,13 +1235,6 @@ int main(int argc, char **argv)
}
}
}
} else if (run_mode != RUNMODE_UNITTEST &&
!list_keywords &&
!list_app_layer_protocols) {
SCLogError(SC_ERR_OPENING_FILE, "Configuration file has not been provided");
usage(argv[0]);
exit(EXIT_FAILURE);
}
AppLayerDetectProtoThreadInit();

@ -73,6 +73,15 @@
#define PROG_NAME "Suricata"
#define PROG_VER "1.3dev"
/* workaround SPlint error (don't know __gnuc_va_list) */
#ifdef S_SPLINT_S
# include <err.h>
# define CONFIG_DIR "/etc/suricata"
#endif
#define DEFAULT_CONF_FILE CONFIG_DIR "/suricata.yaml"
/* runtime engine control flags */
#define SURICATA_STOP 0x01 /**< gracefully stop the engine: process all
outstanding packets first */

@ -41,7 +41,7 @@
#define DETECT_CLASSCONFIG_REGEX "^\\s*config\\s*classification\\s*:\\s*([a-zA-Z][a-zA-Z0-9-_]*)\\s*,\\s*(.+)\\s*,\\s*(\\d+)\\s*$"
/* Default path for the classification.config file */
#define SC_CLASS_CONF_DEF_CONF_FILEPATH "classification.config"
#define SC_CLASS_CONF_DEF_CONF_FILEPATH CONFIG_DIR "/classification.config"
/* Holds a pointer to the default path for the classification.config file */
static const char *default_file_path = SC_CLASS_CONF_DEF_CONF_FILEPATH;

@ -39,7 +39,7 @@
#define SC_RCONF_REGEX "^\\s*config\\s+reference\\s*:\\s*([a-zA-Z][a-zA-Z0-9-_]*)\\s+(.+)\\s*$"
/* Default path for the reference.conf file */
#define SC_RCONF_DEFAULT_FILE_PATH "reference.config"
#define SC_RCONF_DEFAULT_FILE_PATH CONFIG_DIR "/reference.config"
/* Holds a pointer to the default path for the reference.config file */
static const char *file_path = SC_RCONF_DEFAULT_FILE_PATH;

@ -75,7 +75,7 @@ typedef enum ThresholdRuleType {
#define DETECT_SUPPRESS_REGEX "^,\\s*track\\s*(by_dst|by_src)\\s*,\\s*ip\\s*([\\d.:/]+)*\\s*$"
/* Default path for the threshold.config file */
#define THRESHOLD_CONF_DEF_CONF_FILEPATH "threshold.config"
#define THRESHOLD_CONF_DEF_CONF_FILEPATH CONFIG_DIR "/threshold.config"
static pcre *regex_base = NULL;
static pcre_extra *regex_base_study = NULL;

Loading…
Cancel
Save