logger.info("Using data-directory %s.", data_directory)
_config[DATA_DIRECTORY_KEY] = data_directory
+ # Fixup the default locations for Suricata-Update configuration files, but only if
+ # they exist, otherwise keep the defaults.
+ if "sysconfdir" in build_info:
+ configs = (
+ ("disable-conf", "disable.conf"),
+ ("enable-conf", "enable.conf"),
+ ("drop-conf", "drop.conf"),
+ ("modify-conf", "modify.conf"),
+ )
+ sysconfdir = build_info["sysconfdir"]
+ for key, filename in configs:
+ config_path = os.path.join(sysconfdir, "suricata", filename)
+ logger.debug("Looking for {}".format(config_path))
+ if os.path.exists(config_path):
+ logger.debug("Found {}".format(config_path))
+ val = getattr(args, key.replace("-", "_"), None)
+ if val is None:
+ logger.debug("Changing default for {} to {}".format(key, config_path))
+ _config[key] = config_path
+
# If suricata-conf not provided on the command line or in the
# configuration file, look for it.
if not "suricata-conf" in _config: