]> source.dussan.org Git - rspamd.git/commitdiff
Add global trusted keys option
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 15 Feb 2016 15:12:40 +0000 (15:12 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 15 Feb 2016 15:12:40 +0000 (15:12 +0000)
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c
src/libserver/cfg_utils.c

index 44e838dd653f4755694d8293c36b707279b0f0a1..8fb0075bcfd07392b0e3e980158609ce6a0201aa 100644 (file)
@@ -350,6 +350,8 @@ struct rspamd_config {
 
        struct rspamd_re_cache *re_cache;                               /**< static regexp cache                                                                */
 
+       GHashTable *trusted_keys;                                               /**< list of trusted public keys                                                */
+
        ref_entry_t ref;                                                                /**< reference counter                                                                  */
 };
 
index 9b05c1396b0b71e51f3ff7015ecc71cd8f82bc69..cae9317d622ca3bd4ea05a1a86844fc8deb37794 100644 (file)
@@ -1675,7 +1675,12 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
                        G_STRUCT_OFFSET (struct rspamd_config, local_addrs),
                        0,
                        "Use the specified addresses as local ones (alias for `local_addrs`)");
-
+       rspamd_rcl_add_default_handler (sub,
+                       "trusted_keys",
+                       rspamd_rcl_parse_struct_string_list,
+                       G_STRUCT_OFFSET (struct rspamd_config, trusted_keys),
+                       RSPAMD_CL_FLAG_STRING_LIST_HASH,
+                       "List of trusted public keys used for signatures in base32 encoding");
        /* New DNS configuration */
        ssub = rspamd_rcl_add_section_doc (&sub->subsections, "dns", NULL, NULL,
                        UCL_OBJECT, FALSE, TRUE,
index 5bd4c0668727d9a6224db8107ddf487a4dad26c9..1b924859f357c97bd5c5d9d2547a006ee3c329f9 100644 (file)
@@ -128,6 +128,8 @@ rspamd_config_new (void)
        cfg->debug_modules = g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
        cfg->explicit_modules = g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
        cfg->wrk_parsers = g_hash_table_new (g_int_hash, g_int_equal);
+       cfg->trusted_keys = g_hash_table_new (rspamd_str_hash,
+                               rspamd_str_equal);
 
        cfg->map_timeout = DEFAULT_MAP_TIMEOUT;
 
@@ -182,6 +184,7 @@ rspamd_config_free (struct rspamd_config *cfg)
        g_hash_table_unref (cfg->debug_modules);
        g_hash_table_unref (cfg->explicit_modules);
        g_hash_table_unref (cfg->wrk_parsers);
+       g_hash_table_unref (cfg->trusted_keys);
 
        if (cfg->checksum) {
                g_free (cfg->checksum);