mirror of
https://github.com/rspamd/rspamd.git
synced 2024-09-13 15:45:47 +02:00
Allow static key for a server
This commit is contained in:
parent
a28e2fa052
commit
8c8f20b0e6
@ -40,6 +40,7 @@ static guint cache_size = 10;
|
|||||||
static guint nworkers = 1;
|
static guint nworkers = 1;
|
||||||
static gboolean openssl_mode = FALSE;
|
static gboolean openssl_mode = FALSE;
|
||||||
static GHashTable *maps = NULL;
|
static GHashTable *maps = NULL;
|
||||||
|
static ghcar *key = NULL;
|
||||||
static struct rspamd_keypair_cache *c;
|
static struct rspamd_keypair_cache *c;
|
||||||
static gpointer server_key;
|
static gpointer server_key;
|
||||||
static struct timeval io_tv = {
|
static struct timeval io_tv = {
|
||||||
@ -56,6 +57,8 @@ static GOptionEntry entries[] = {
|
|||||||
"Number of workers to start (default: 1)", NULL},
|
"Number of workers to start (default: 1)", NULL},
|
||||||
{"openssl", 'o', 0, G_OPTION_ARG_NONE, &openssl_mode,
|
{"openssl", 'o', 0, G_OPTION_ARG_NONE, &openssl_mode,
|
||||||
"Use openssl crypto", NULL},
|
"Use openssl crypto", NULL},
|
||||||
|
{"key", 'k', 0, G_OPTION_ARG_STRING, &key,
|
||||||
|
"Use static keypair instead of new one (base32 encoded sk || pk)", NULL},
|
||||||
{NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}
|
{NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -270,10 +273,20 @@ main (int argc, gchar **argv)
|
|||||||
g_assert (rspamd_cryptobox_openssl_mode (TRUE));
|
g_assert (rspamd_cryptobox_openssl_mode (TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
server_key = rspamd_http_connection_gen_key ();
|
if (key == NULL) {
|
||||||
b32_key = rspamd_http_connection_print_key (server_key,
|
server_key = rspamd_http_connection_gen_key ();
|
||||||
RSPAMD_KEYPAIR_PUBKEY | RSPAMD_KEYPAIR_BASE32);
|
b32_key = rspamd_http_connection_print_key (server_key,
|
||||||
rspamd_printf ("key: %v\n", b32_key);
|
RSPAMD_KEYPAIR_PUBKEY | RSPAMD_KEYPAIR_BASE32);
|
||||||
|
rspamd_printf ("key: %v\n", b32_key);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
server_key = rspamd_http_connection_make_key (key, strlen (key));
|
||||||
|
|
||||||
|
if (server_key == NULL) {
|
||||||
|
rspamd_fprintf (stderr, "cannot load key %s\n", key);
|
||||||
|
exit (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cache_size > 0) {
|
if (cache_size > 0) {
|
||||||
c = rspamd_keypair_cache_new (cache_size);
|
c = rspamd_keypair_cache_new (cache_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user