Keep track of cookies internally.

That allows to restrict the cookie validity time to the absolutely minimum
required to establish and reconnect a recently disconnected session.
That deprecates the cookie-validity option and introduces the cookie-timeout
option.
This commit is contained in:
Nikos Mavrogiannopoulos
2014-05-27 16:00:57 +02:00
parent a2728265b3
commit 25fbdfbf70
11 changed files with 242 additions and 51 deletions
+6 -2
View File
@@ -35,6 +35,7 @@
#include <auth/plain.h>
#include <vpn.h>
#include <cookies.h>
#include <main.h>
#include <ctl.h>
#include <tlslib.h>
@@ -100,7 +101,7 @@ static struct cfg_options available_options[] = {
{ .name = "mtu", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "net-priority", .type = OPTION_STRING, .mandatory = 0 },
{ .name = "output-buffer", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "cookie-validity", .type = OPTION_NUMERIC, .mandatory = 1 },
{ .name = "cookie-timeout", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "rekey-time", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "rekey-method", .type = OPTION_STRING, .mandatory = 0 },
{ .name = "auth-timeout", .type = OPTION_NUMERIC, .mandatory = 0 },
@@ -476,7 +477,6 @@ unsigned force_cert_auth;
config->tx_per_sec /= 1000;
READ_TF("deny-roaming", config->deny_roaming, 0);
READ_NUMERIC("cookie-validity", config->cookie_validity);
config->rekey_time = -1;
READ_NUMERIC("rekey-time", config->rekey_time);
@@ -496,6 +496,10 @@ unsigned force_cert_auth;
}
talloc_free(tmp); tmp = NULL;
READ_NUMERIC("cookie-timeout", config->cookie_timeout);
if (config->cookie_timeout == 0)
config->cookie_timeout = DEFAULT_COOKIE_RECON_TIMEOUT;
READ_NUMERIC("auth-timeout", config->auth_timeout);
READ_NUMERIC("idle-timeout", config->idle_timeout);