mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-13 18:12:03 +08:00
Added the rekey-method config option.
This commit is contained in:
@@ -90,6 +90,7 @@ static struct cfg_options available_options[] = {
|
||||
{ .name = "output-buffer", .type = OPTION_NUMERIC, .mandatory = 0 },
|
||||
{ .name = "cookie-validity", .type = OPTION_NUMERIC, .mandatory = 1 },
|
||||
{ .name = "rekey-time", .type = OPTION_NUMERIC, .mandatory = 0 },
|
||||
{ .name = "rekey-method", .type = OPTION_STRING, .mandatory = 0 },
|
||||
{ .name = "auth-timeout", .type = OPTION_NUMERIC, .mandatory = 0 },
|
||||
{ .name = "idle-timeout", .type = OPTION_NUMERIC, .mandatory = 0 },
|
||||
{ .name = "mobile-idle-timeout", .type = OPTION_NUMERIC, .mandatory = 0 },
|
||||
@@ -251,6 +252,7 @@ unsigned j, mand;
|
||||
char** auth = NULL;
|
||||
unsigned auth_size = 0;
|
||||
unsigned prefix = 0;
|
||||
char *tmp;
|
||||
unsigned force_cert_auth;
|
||||
|
||||
pov = configFileLoad(file);
|
||||
@@ -393,6 +395,18 @@ unsigned force_cert_auth;
|
||||
config->rekey_time = 24*60*60;
|
||||
}
|
||||
|
||||
tmp = NULL;
|
||||
READ_STRING("rekey-method", tmp);
|
||||
if (tmp == NULL || strcmp(tmp, "ssl") == 0)
|
||||
config->rekey_method = REKEY_METHOD_SSL;
|
||||
else if (strcmp(tmp, "new-tunnel") == 0)
|
||||
config->rekey_method = REKEY_METHOD_NEW_TUNNEL;
|
||||
else {
|
||||
fprintf(stderr, "Unknown rekey method '%s'\n", tmp);
|
||||
exit(1);
|
||||
}
|
||||
free(tmp); tmp = NULL;
|
||||
|
||||
READ_NUMERIC("auth-timeout", config->auth_timeout);
|
||||
READ_NUMERIC("idle-timeout", config->idle_timeout);
|
||||
|
||||
|
||||
@@ -206,6 +206,15 @@ cookie-validity = 86400
|
||||
# this amount of seconds is elapsed. Set to zero to disable.
|
||||
rekey-time = 172800
|
||||
|
||||
# ReKey method
|
||||
# Valid options: ssl, new-tunnel
|
||||
# ssl: Will perform an efficient rehandshake on the channel allowing
|
||||
# a seamless connection during rekey.
|
||||
# new-tunnel: Will instruct the client to discard and re-establish the channel.
|
||||
# Use this option only if the connecting clients have issues with the ssl
|
||||
# option.
|
||||
rekey-method = ssl
|
||||
|
||||
# Script to call when a client connects and obtains an IP
|
||||
# Parameters are passed on the environment.
|
||||
# REASON, USERNAME, GROUPNAME, HOSTNAME (the hostname selected by client),
|
||||
|
||||
@@ -59,6 +59,9 @@
|
||||
#define AC_PKT_COMPRESSED 8 /* Compressed data */
|
||||
#define AC_PKT_TERM_SERVER 9 /* Server kick */
|
||||
|
||||
#define REKEY_METHOD_SSL 1
|
||||
#define REKEY_METHOD_NEW_TUNNEL 2
|
||||
|
||||
extern int syslog_open;
|
||||
|
||||
/* the first is generic, for the methods that require a username password */
|
||||
@@ -199,7 +202,10 @@ struct cfg_st {
|
||||
|
||||
char* socket_file_prefix;
|
||||
time_t cookie_validity; /* in seconds */
|
||||
|
||||
time_t rekey_time; /* in seconds */
|
||||
unsigned rekey_method; /* REKEY_METHOD_ */
|
||||
|
||||
time_t min_reauth_time; /* after a failed auth, how soon one can reauthenticate -> in seconds */
|
||||
unsigned auth_timeout; /* timeout of HTTP auth */
|
||||
unsigned idle_timeout; /* timeout when idle */
|
||||
|
||||
+5
-4
@@ -1286,7 +1286,8 @@ static int connect_handler(worker_st * ws)
|
||||
(unsigned)(ws->config->rekey_time));
|
||||
SEND_ERR(ret);
|
||||
|
||||
ret = tls_puts(ws->session, "X-CSTP-Rekey-Method: ssl\r\n");
|
||||
ret = tls_printf(ws->session, "X-CSTP-Rekey-Method: %s\r\n",
|
||||
(ws->config->rekey_method == REKEY_METHOD_SSL)?"ssl":"new-tunnel");
|
||||
SEND_ERR(ret);
|
||||
} else {
|
||||
ret = tls_puts(ws->session, "X-CSTP-Rekey-Method: none\r\n");
|
||||
@@ -1378,11 +1379,11 @@ static int connect_handler(worker_st * ws)
|
||||
(unsigned)(ws->config->rekey_time+10));
|
||||
SEND_ERR(ret);
|
||||
|
||||
/* This is our private extension */
|
||||
if (ws->config->rekey_method == REKEY_METHOD_SSL) {
|
||||
ret = tls_puts(ws->session, "X-DTLS-Rekey-Method: ssl\r\n");
|
||||
SEND_ERR(ret);
|
||||
} else {
|
||||
ret = tls_puts(ws->session, "X-DTLS-Rekey-Method: none\r\n");
|
||||
SEND_ERR(ret);
|
||||
}
|
||||
}
|
||||
|
||||
ret =
|
||||
|
||||
Reference in New Issue
Block a user