<?xml version="1.0" encoding="UTF-8"?>
<rspamd>
-<!-- Main section -->
-<tempdir>/tmp</tempdir>
-<pidfile>/var/run/rspamd/rspamd.pid</pidfile>
-<filters>regexp,surbl,chartable,fuzzy_check,spf</filters>
-<statfile_pool_size>262144000</statfile_pool_size>
-<raw_mode>yes</raw_mode>
+<!-- Global section -->
<lua src="@ETC_PREFIX@/rspamd/lua/rspamd.lua" />
-<!-- End of main section -->
+
+<!-- Options -->
+<options>
+ <!-- Temporary directory -->
+ <tempdir>/tmp</tempdir>
+ <!-- Path to pid file -->
+ <pidfile>/var/run/rspamd/rspamd.pid</pidfile>
+ <!-- Turned on C filters -->
+ <filters>regexp,surbl,chartable,fuzzy_check,spf</filters>
+ <!-- Maximum size of statistics mapped in memory -->
+ <statfile_pool_size>250M</statfile_pool_size>
+ <!-- Raw mode is non-utf mode. In utf mode all messages are converted to utf8 (if possible) -->
+ <raw_mode>yes</raw_mode>
+ <!-- Check text attachements as ordinary text parts -->
+ <check_attachements>no</check_attachements>
+ <!-- If a rule has been met several times do not add additional score -->
+ <one_shot>no</one_shot>
+ <!-- DNS requests global timeout -->
+ <dns_timeout>1s</dns_timeout>
+ <!-- DNS retransmits count -->
+ <dns_retransmits>5</dns_retransmits>
+ <!-- File for saving settings of symbols cache -->
+ <cache_file>/var/run/rspamd/symbols.cache</cache_file>
+</options>
+<!-- End of options section -->
<!-- Logging section -->
<logging>
enum xml_config_section {
XML_SECTION_MAIN,
+ XML_SECTION_OPTIONS,
XML_SECTION_LOGGING,
XML_SECTION_WORKER,
XML_SECTION_METRIC,
},
NULL_DEF_ATTR
},
+ { XML_SECTION_OPTIONS, {
+ {
+ "statfile_pool_size",
+ xml_handle_size,
+ G_STRUCT_OFFSET (struct config_file, max_statfile_size),
+ NULL
+ },
+ {
+ "user_settings",
+ handle_user_settings,
+ 0,
+ NULL
+ },
+ {
+ "domain_settings",
+ handle_domain_settings,
+ 0,
+ NULL
+ },
+ {
+ "cache_file",
+ xml_handle_string,
+ G_STRUCT_OFFSET (struct config_file, cache_filename),
+ NULL
+ },
+ {
+ "dns_timeout",
+ xml_handle_seconds,
+ G_STRUCT_OFFSET (struct config_file, dns_timeout),
+ NULL
+ },
+ {
+ "dns_retransmits",
+ xml_handle_uint32,
+ G_STRUCT_OFFSET (struct config_file, dns_retransmits),
+ NULL
+ },
+ {
+ "raw_mode",
+ xml_handle_boolean,
+ G_STRUCT_OFFSET (struct config_file, raw_mode),
+ NULL
+ },
+ {
+ "one_shot",
+ xml_handle_boolean,
+ G_STRUCT_OFFSET (struct config_file, one_shot_mode),
+ NULL
+ },
+ {
+ "check_attachements",
+ xml_handle_boolean,
+ G_STRUCT_OFFSET (struct config_file, check_text_attachements),
+ NULL
+ },
+ {
+ "tempdir",
+ xml_handle_string,
+ G_STRUCT_OFFSET (struct config_file, temp_dir),
+ NULL
+ },
+ {
+ "pidfile",
+ xml_handle_string,
+ G_STRUCT_OFFSET (struct config_file, pid_file),
+ NULL
+ },
+ {
+ "filters",
+ xml_handle_string,
+ G_STRUCT_OFFSET (struct config_file, filters_str),
+ NULL
+ },
+ NULL_ATTR
+ },
+ NULL_DEF_ATTR
+ },
{ XML_SECTION_LOGGING, {
{
"type",
return "read param";
case XML_READ_MODULE:
return "read module section";
+ case XML_READ_OPTIONS:
+ return "read options section";
case XML_READ_MODULES:
return "read modules section";
case XML_READ_CLASSIFIER:
else if (g_ascii_strcasecmp (element_name, "modules") == 0) {
ud->state = XML_READ_MODULES;
}
+ else if (g_ascii_strcasecmp (element_name, "options") == 0) {
+ ud->state = XML_READ_OPTIONS;
+ }
else if (g_ascii_strcasecmp (element_name, "logging") == 0) {
ud->state = XML_READ_LOGGING;
}
case XML_READ_WORKER:
case XML_READ_LOGGING:
case XML_READ_VIEW:
+ case XML_READ_OPTIONS:
rspamd_strlcpy (ud->section_name, element_name, sizeof (ud->section_name));
/* Save attributes */
ud->cur_attrs = process_attrs (ud->cfg, attribute_names, attribute_values);
case XML_READ_MODULES:
CHECK_TAG ("modules", FALSE);
break;
+ case XML_READ_OPTIONS:
+ CHECK_TAG ("options", FALSE);
+ break;
case XML_READ_METRIC:
CHECK_TAG ("metric", FALSE);
if (res) {
ud->state = XML_ERROR;
}
break;
+ case XML_READ_OPTIONS:
+ if (!call_param_handler (ud, ud->section_name, val, cfg, XML_SECTION_OPTIONS)) {
+ *error = g_error_new (xml_error_quark (), XML_EXTRA_ELEMENT, "cannot parse tag '%s' data: %s", ud->section_name, val);
+ ud->state = XML_ERROR;
+ }
+ break;
case XML_READ_CLASSIFIER:
if (!call_param_handler (ud, ud->section_name, val, ud->section_pointer, XML_SECTION_CLASSIFIER)) {
*error = g_error_new (xml_error_quark (), XML_EXTRA_ELEMENT, "cannot parse tag '%s' data: %s", ud->section_name, val);