OpenVPN
auth_token.c
Go to the documentation of this file.
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#endif
4
5#include "syshead.h"
6
7#include "base64.h"
8#include "buffer.h"
9#include "crypto.h"
10#include "openvpn.h"
11#include "ssl_common.h"
12#include "auth_token.h"
13#include "push.h"
14#include "integer.h"
15#include "ssl.h"
16#include "ssl_verify.h"
17#include <inttypes.h>
18
19const char *auth_token_pem_name = "OpenVPN auth-token server key";
20
21#define AUTH_TOKEN_SESSION_ID_LEN 12
22#define AUTH_TOKEN_SESSION_ID_BASE64_LEN (OPENVPN_BASE64_LENGTH(AUTH_TOKEN_SESSION_ID_LEN))
23
24/* We want our token to be a multiple of 3 bytes to avoid the base64 padding */
25static_assert(AUTH_TOKEN_SESSION_ID_LEN % 3 == 0, "AUTH_TOKEN_SESSION_ID_LEN must be multiple of 3");
26
27#define AUTH_TOKEN_HMAC_LEN SHA256_DIGEST_LENGTH
28/* Size of the data of the token (not b64 encoded and without prefix) */
29#define TOKEN_DATA_LEN (2 * sizeof(int64_t) + AUTH_TOKEN_SESSION_ID_LEN + AUTH_TOKEN_HMAC_LEN)
30#define TOKEN_DATA_BASE64_LEN (OPENVPN_BASE64_LENGTH(TOKEN_DATA_LEN))
31
32
33#define TOTAL_SESSION_TOKEN_LEN (strlen(SESSION_ID_PREFIX) + TOKEN_DATA_BASE64_LEN)
34
35/* Ensure that TOKEN_DATA_LEN is a multiple of 3 so the we avoid the base64
36 * padding */
37static_assert(TOKEN_DATA_LEN % 3 == 0, "TOKEN_DATA_LEN is not a multiple of 3");
38
39bool
40is_auth_token(const char *password)
41{
42 if (strlen(password) != TOTAL_SESSION_TOKEN_LEN)
43 {
44 return false;
45 }
46
47 return (memcmp_constant_time(SESSION_ID_PREFIX, password, strlen(SESSION_ID_PREFIX)) == 0);
48}
49
50static struct key_type
52{
53 return create_kt("none", "SHA256", "auth-gen-token");
54}
55
56void
58 const struct user_pass *up)
59{
60 if (!multi->opt.auth_token_generate)
61 {
62 return;
63 }
64
65 int auth_token_state_flags = session->key[KS_PRIMARY].auth_token_state_flags;
66
67 const char *state;
68
69 if (!is_auth_token(up->password))
70 {
71 state = "Initial";
72 }
73 else if (auth_token_state_flags & AUTH_TOKEN_HMAC_OK)
74 {
75 switch (auth_token_state_flags & (AUTH_TOKEN_VALID_EMPTYUSER | AUTH_TOKEN_EXPIRED))
76 {
77 case 0:
78 state = "Authenticated";
79 break;
80
82 state = "Expired";
83 break;
84
86 state = "AuthenticatedEmptyUser";
87 break;
88
90 state = "ExpiredEmptyUser";
91 break;
92
93 default:
94 /* Silence compiler warning, all four possible combinations are covered */
95 ASSERT(0);
96 }
97 }
98 else
99 {
100 state = "Invalid";
101 }
102
103 setenv_str(session->opt->es, "session_state", state);
104
105 /* We had a valid session id before */
106 const char *session_id_source;
107 if (auth_token_state_flags & AUTH_TOKEN_HMAC_OK
108 && !(auth_token_state_flags & AUTH_TOKEN_EXPIRED))
109 {
110 session_id_source = up->password;
111 }
112 else
113 {
114 /*
115 * No session before, generate a new session token for the new session
116 */
117 if (!multi->auth_token_initial)
118 {
119 generate_auth_token(up, multi);
120 }
121 session_id_source = multi->auth_token_initial;
122 }
123 /*
124 * In the auth-token the auth token is already base64 encoded
125 * and being a multiple of 4 ensure that it a multiple of bytes
126 * in the encoding
127 */
128 char session_id[AUTH_TOKEN_SESSION_ID_LEN * 2] = { 0 };
129 memcpy(session_id, session_id_source + strlen(SESSION_ID_PREFIX),
131
132 setenv_str(session->opt->es, "session_id", session_id);
133}
134
135void
137{
139}
140
141void
142auth_token_init_secret(struct key_ctx *key_ctx, const char *key_file, bool key_inline)
143{
144 struct key_type kt = auth_token_kt();
145
146 struct buffer server_secret_key = alloc_buf(2048);
147
148 bool key_loaded = false;
149 if (key_file)
150 {
151 key_loaded =
152 read_pem_key_file(&server_secret_key, auth_token_pem_name, key_file, key_inline);
153 }
154 else
155 {
156 key_loaded = generate_ephemeral_key(&server_secret_key, auth_token_pem_name);
157 }
158
159 if (!key_loaded)
160 {
161 msg(M_FATAL, "ERROR: Cannot load auth-token secret");
162 }
163
164 struct key key;
165
166 if (!buf_read(&server_secret_key, &key, sizeof(key)))
167 {
168 msg(M_FATAL, "ERROR: not enough data in auth-token secret");
169 }
170
171 struct key_parameters key_params;
172 key_parameters_from_key(&key_params, &key);
173 init_key_ctx(key_ctx, &key_params, &kt, false, "auth-token secret");
174
175 secure_memzero(&key, sizeof(key));
176 secure_memzero(&key_params, sizeof(key_params));
177 buf_clear(&server_secret_key);
178 free_buf(&server_secret_key);
179}
180
181void
182generate_auth_token(const struct user_pass *up, struct tls_multi *multi)
183{
184 struct gc_arena gc = gc_new();
185
186 int64_t timestamp = htonll((uint64_t)now);
187 int64_t initial_timestamp = timestamp;
188
189 hmac_ctx_t *ctx = multi->opt.auth_token_key.hmac;
190 ASSERT(hmac_ctx_size(ctx) == 256 / 8);
191
192 uint8_t sessid[AUTH_TOKEN_SESSION_ID_LEN];
193
194 if (multi->auth_token_initial)
195 {
196 /* Just enough space to fit 8 bytes + 1 extra to decode a non-padded
197 * base64 string (multiple of 3 bytes). 9 bytes => 12 bytes base64
198 * bytes
199 */
200 char old_tstamp_decode[9];
201
202 /* Make a copy of the string to not modify multi->auth_token_initial */
203 char *initial_token_copy = string_alloc(multi->auth_token_initial, &gc);
204
205 char *old_sessid = initial_token_copy + strlen(SESSION_ID_PREFIX);
206 char *old_tstamp_initial = old_sessid + AUTH_TOKEN_SESSION_ID_BASE64_LEN;
207
208 /*
209 * We null terminate the old token just after the session ID to let
210 * our base64 decode function only decode the session ID
211 */
212 old_tstamp_initial[12] = '\0';
213 ASSERT(openvpn_base64_decode(old_tstamp_initial, old_tstamp_decode, 9) == 9);
214
215 memcpy(&initial_timestamp, &old_tstamp_decode, sizeof(initial_timestamp));
216
217 old_tstamp_initial[0] = '\0';
220 }
221 else if (!rand_bytes(sessid, AUTH_TOKEN_SESSION_ID_LEN))
222 {
223 msg(M_FATAL, "Failed to get enough randomness for "
224 "authentication token");
225 }
226
227 /* Calculate the HMAC */
228 /* We enforce up->username to be \0 terminated in ssl.c.. Allowing username
229 * with \0 in them is asking for troubles in so many ways anyway that we
230 * ignore that corner case here
231 */
232 uint8_t hmac_output[256 / 8];
233
234 hmac_ctx_reset(ctx);
235
236 /*
237 * If the token was only valid for the empty user, also generate
238 * a new token with the empty username since we do not want to loose
239 * the information that the username cannot be trusted
240 */
241 const struct key_state *ks = &multi->session[TM_ACTIVE].key[KS_PRIMARY];
243 {
244 hmac_ctx_update(ctx, (const uint8_t *)"", 0);
245 }
246 else
247 {
248 hmac_ctx_update(ctx, (uint8_t *)up->username, (int)strlen(up->username));
249 }
251 hmac_ctx_update(ctx, (uint8_t *)&initial_timestamp, sizeof(initial_timestamp));
252 hmac_ctx_update(ctx, (uint8_t *)&timestamp, sizeof(timestamp));
253 hmac_ctx_final(ctx, hmac_output);
254
255 /* Construct the unencoded session token */
256 struct buffer token =
257 alloc_buf_gc(2 * sizeof(uint64_t) + AUTH_TOKEN_SESSION_ID_LEN + 256 / 8, &gc);
258
259 ASSERT(buf_write(&token, sessid, sizeof(sessid)));
260 ASSERT(buf_write(&token, &initial_timestamp, sizeof(initial_timestamp)));
261 ASSERT(buf_write(&token, &timestamp, sizeof(timestamp)));
262 ASSERT(buf_write(&token, hmac_output, sizeof(hmac_output)));
263
264 char *b64output = NULL;
265 openvpn_base64_encode(BPTR(&token), BLEN(&token), &b64output);
266
267 struct buffer session_token =
268 alloc_buf_gc(strlen(SESSION_ID_PREFIX) + strlen(b64output) + 1, &gc);
269
270 ASSERT(buf_write(&session_token, SESSION_ID_PREFIX, strlen(SESSION_ID_PREFIX)));
271 ASSERT(buf_write(&session_token, b64output, (int)strlen(b64output)));
272 ASSERT(buf_write_u8(&session_token, 0));
273
274 free(b64output);
275
276 /* free the auth-token if defined, we will replace it with a new one */
277 free(multi->auth_token);
278 multi->auth_token = strdup((char *)BPTR(&session_token));
279
280 dmsg(D_SHOW_KEYS, "Generated token for client: %s (%s)", multi->auth_token, up->username);
281
282 if (!multi->auth_token_initial)
283 {
284 /*
285 * Save the initial auth token to continue using the same session ID
286 * and timestamp in updates
287 */
288 multi->auth_token_initial = strdup(multi->auth_token);
289 }
290
291 gc_free(&gc);
292}
293
294
295static bool
296check_hmac_token(hmac_ctx_t *ctx, const uint8_t *b64decoded, const char *username)
297{
298 ASSERT(hmac_ctx_size(ctx) == 256 / 8);
299
300 uint8_t hmac_output[256 / 8];
301
302 hmac_ctx_reset(ctx);
303 hmac_ctx_update(ctx, (uint8_t *)username, (int)strlen(username));
304 hmac_ctx_update(ctx, b64decoded, TOKEN_DATA_LEN - 256 / 8);
305 hmac_ctx_final(ctx, hmac_output);
306
307 const uint8_t *hmac = b64decoded + TOKEN_DATA_LEN - 256 / 8;
308 return memcmp_constant_time(&hmac_output, hmac, AUTH_TOKEN_HMAC_LEN) == 0;
309}
310
311unsigned int
312verify_auth_token(struct user_pass *up, struct tls_multi *multi, struct tls_session *session)
313{
314 /*
315 * Base64 is <= input and input is < USER_PASS_LEN, so using USER_PASS_LEN
316 * is safe here but a bit overkill
317 */
318 ASSERT(up && !up->protected);
319 uint8_t b64decoded[USER_PASS_LEN];
320 int decoded_len =
322
323 /*
324 * Ensure that the decoded data is the size of the
325 * timestamp + hmac + session id
326 */
327 if (decoded_len != TOKEN_DATA_LEN)
328 {
329 msg(M_WARN, "ERROR: --auth-token wrong size (%d!=%d)", decoded_len, (int)TOKEN_DATA_LEN);
330 return 0;
331 }
332
333 unsigned int ret = 0;
334
335 const uint8_t *sessid = b64decoded;
336 const uint8_t *tstamp_initial = sessid + AUTH_TOKEN_SESSION_ID_LEN;
337 const uint8_t *tstamp = tstamp_initial + sizeof(uint64_t);
338
339 /* tstamp, tstamp_initial might not be aligned to an uint64, use memcpy
340 * to avoid unaligned access */
341 uint64_t timestamp = 0, timestamp_initial = 0;
342 memcpy(&timestamp, tstamp, sizeof(uint64_t));
343 timestamp = ntohll(timestamp);
344
345 memcpy(&timestamp_initial, tstamp_initial, sizeof(uint64_t));
346 timestamp_initial = ntohll(timestamp_initial);
347
348 hmac_ctx_t *ctx = multi->opt.auth_token_key.hmac;
349 if (check_hmac_token(ctx, b64decoded, up->username))
350 {
351 ret |= AUTH_TOKEN_HMAC_OK;
352 }
353 else if (check_hmac_token(ctx, b64decoded, ""))
354 {
355 ret |= AUTH_TOKEN_HMAC_OK;
357 /* overwrite the username of the client with the empty one */
358 strcpy(up->username, "");
359 }
360 else
361 {
362 msg(M_WARN, "--auth-gen-token: HMAC on token from client failed (%s)", up->username);
363 return 0;
364 }
365
366 /* Accept session tokens only if their timestamp is in the acceptable range
367 * for renegotiations.
368 * Cast is required for systems with 32bit time_t, e.g. Windows x86.
369 */
370 const time_t token_reneg_deadline = (time_t)timestamp + 2 * session->opt->auth_token_renewal;
371 bool in_renegotiation_time = now >= (time_t)timestamp && now < token_reneg_deadline;
372
373 if (!in_renegotiation_time)
374 {
375 msg(M_WARN, "Timestamp (%" PRIu64 ") of auth-token is out of the renewal window",
376 timestamp);
377 ret |= AUTH_TOKEN_EXPIRED;
378 }
379
380 /* Sanity check the initial timestamp */
381 if (timestamp < timestamp_initial)
382 {
383 msg(M_WARN,
384 "Initial timestamp (%" PRIu64 ") in token from client earlier than "
385 "current timestamp %" PRIu64 ". Broken/unsynchronised clock?",
386 timestamp_initial, timestamp);
387 ret |= AUTH_TOKEN_EXPIRED;
388 }
389
390 const time_t token_eol = (time_t)timestamp_initial + multi->opt.auth_token_lifetime;
391 if (multi->opt.auth_token_lifetime && now > token_eol)
392 {
393 ret |= AUTH_TOKEN_EXPIRED;
394 }
395
396 if (ret & AUTH_TOKEN_EXPIRED)
397 {
398 /* Tell client that the session token is expired */
399 auth_set_client_reason(multi, "SESSION: token expired");
400 msg(M_INFO, "--auth-gen-token: auth-token from client expired");
401 }
402
403 /* Check that we do have the same session ID in the token as in our stored
404 * auth-token to ensure that it did not change.
405 * This also compares the prefix and session part of the
406 * tokens, which should be identical if the session ID stayed the same */
407 if (multi->auth_token_initial
410 {
411 msg(M_WARN, "--auth-gen-token: session id in token changed (Rejecting "
412 "token.");
413 ret = 0;
414 }
415 return ret;
416}
417
418void
420{
421 if (multi)
422 {
423 if (multi->auth_token)
424 {
425 secure_memzero(multi->auth_token, strlen(multi->auth_token));
426 free(multi->auth_token);
427 }
428 if (multi->auth_token_initial)
429 {
431 free(multi->auth_token_initial);
432 }
433 multi->auth_token = NULL;
434 multi->auth_token_initial = NULL;
435 }
436}
437
438void
440{
441 struct tls_multi *multi = c->c2.tls_multi;
442 struct tls_session *session = &multi->session[TM_ACTIVE];
443
444 if (get_primary_key(multi)->state < S_GENERATED_KEYS
445 || get_primary_key(multi)->authenticated != KS_AUTH_TRUE)
446 {
447 /* the currently active session is still in renegotiation or another
448 * not fully authorized state. We are either very close to a
449 * renegotiation or have deauthorized the client. In both cases
450 * we just ignore the request to send another token
451 */
452 return;
453 }
454
455 if (!multi->auth_token_initial)
456 {
457 msg(D_SHOW_KEYS, "initial auth-token not generated yet, skipping "
458 "auth-token renewal.");
459 return;
460 }
461
462 if (!multi->locked_username)
463 {
464 msg(D_SHOW_KEYS, "username not locked, skipping auth-token renewal.");
465 return;
466 }
467
468 struct user_pass up;
469 CLEAR(up);
470 strlcpy(up.username, multi->locked_username, sizeof(up.username));
471
472 generate_auth_token(&up, multi);
473
475}
476
477void
479{
480 /*
481 * Auth token already sent to client, update auth-token on client.
482 * The initial auth-token is sent as part of the push message, for this
483 * update we need to schedule an extra push message.
484 *
485 * Otherwise, the auth-token get pushed out as part of the "normal"
486 * push-reply
487 */
488 if (multi->auth_token_initial)
489 {
490 /*
491 * We do not explicitly reschedule the sending of the
492 * control message here. This might delay this reply
493 * a few seconds but this message is not time critical
494 */
496 }
497}
void auth_token_write_server_key_file(const char *filename)
Generate a auth-token server secret key, and write to file.
Definition auth_token.c:136
static bool check_hmac_token(hmac_ctx_t *ctx, const uint8_t *b64decoded, const char *username)
Definition auth_token.c:296
void auth_token_init_secret(struct key_ctx *key_ctx, const char *key_file, bool key_inline)
Loads an HMAC secret from a file or if no file is present generates a epheremal secret for the run ti...
Definition auth_token.c:142
void generate_auth_token(const struct user_pass *up, struct tls_multi *multi)
Generate an auth token based on username and timestamp.
Definition auth_token.c:182
#define AUTH_TOKEN_SESSION_ID_LEN
Definition auth_token.c:21
#define TOTAL_SESSION_TOKEN_LEN
Definition auth_token.c:33
unsigned int verify_auth_token(struct user_pass *up, struct tls_multi *multi, struct tls_session *session)
Verifies the auth token to be in the format that generate_auth_token create and checks if the token i...
Definition auth_token.c:312
static struct key_type auth_token_kt(void)
Definition auth_token.c:51
#define AUTH_TOKEN_SESSION_ID_BASE64_LEN
Definition auth_token.c:22
void add_session_token_env(struct tls_session *session, struct tls_multi *multi, const struct user_pass *up)
Put the session id, and auth token status into the environment if auth-token is enabled.
Definition auth_token.c:57
const char * auth_token_pem_name
Definition auth_token.c:19
#define TOKEN_DATA_LEN
Definition auth_token.c:29
void check_send_auth_token(struct context *c)
Checks if the timer to resend the auth-token has expired and if a new auth-token should be send to th...
Definition auth_token.c:439
#define AUTH_TOKEN_HMAC_LEN
Definition auth_token.c:27
void wipe_auth_token(struct tls_multi *multi)
Wipes the authentication token out of the memory, frees and cleans up related buffers and flags.
Definition auth_token.c:419
void resend_auth_token_renegotiation(struct tls_multi *multi, struct tls_session *session)
Checks if a client should be sent a new auth token to update its current auth-token.
Definition auth_token.c:478
bool is_auth_token(const char *password)
Return if the password string has the format of an auth token.
Definition auth_token.c:40
#define SESSION_ID_PREFIX
The prefix given to auth tokens start with, this prefix is special cased to not show up in log files ...
Definition auth_token.h:109
void free_buf(struct buffer *buf)
Free the memory allocated for a buffer.
Definition buffer.c:169
void buf_clear(struct buffer *buf)
Zeroise and reset a buffer.
Definition buffer.c:148
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
Allocate a buffer of the given size under garbage collection.
Definition buffer.c:77
struct buffer alloc_buf(size_t size)
Allocate a buffer of the given size.
Definition buffer.c:60
char * string_alloc(const char *str, struct gc_arena *gc)
Duplicate a string, allocating memory under garbage collection.
Definition buffer.c:601
Buffer management functions and garbage collection.
#define BPTR(buf)
Return a pointer to the start of the buffer content.
Definition buffer.h:139
static bool buf_read(struct buffer *src, void *dest, int size)
Read bytes from the front of a buffer into a caller-supplied destination.
Definition buffer.h:1451
static void secure_memzero(void *data, size_t len)
Securely zeroise memory.
Definition buffer.h:748
static bool buf_write(struct buffer *dest, const void *src, size_t size)
Append data to a buffer.
Definition buffer.h:1239
static bool buf_write_u8(struct buffer *dest, uint8_t data)
Append a uint8_t to a buffer.
Definition buffer.h:1283
#define BLEN(buf)
Return the length of the buffer content in bytes.
Definition buffer.h:151
static void gc_free(struct gc_arena *a)
Free all allocations in a garbage collection arena.
Definition buffer.h:1965
static struct gc_arena gc_new(void)
Allocate and return a new, empty garbage collection arena.
Definition buffer.h:1949
size_t strlcpy(char *dest, const char *src, size_t maxlen)
void init_key_ctx(struct key_ctx *ctx, const struct key_parameters *key, const struct key_type *kt, int enc, const char *prefix)
Definition crypto.c:996
bool read_pem_key_file(struct buffer *key, const char *pem_name, const char *key_file, bool key_inline)
Read key material from a PEM encoded files into the key structure.
Definition crypto.c:1844
bool generate_ephemeral_key(struct buffer *key, const char *key_name)
Generate ephermal key material into the key structure.
Definition crypto.c:1826
void write_pem_key_file(const char *filename, const char *pem_name)
Generate a server key with enough randomness to fill a key struct and write to file.
Definition crypto.c:1789
void key_parameters_from_key(struct key_parameters *key_params, const struct key *key)
Converts a struct key representation into a struct key_parameters representation.
Definition crypto.c:1158
Data Channel Cryptography Module.
int memcmp_constant_time(const void *a, const void *b, size_t size)
As memcmp(), but constant-time.
static struct key_type create_kt(const char *cipher, const char *md, const char *optname)
Creates and validates an instance of struct key_type with the provided algs.
Definition crypto.h:684
void hmac_ctx_update(hmac_ctx_t *ctx, const uint8_t *src, int src_len)
void hmac_ctx_reset(hmac_ctx_t *ctx)
void hmac_ctx_final(hmac_ctx_t *ctx, uint8_t *dst)
int hmac_ctx_size(hmac_ctx_t *ctx)
int rand_bytes(uint8_t *output, int len)
Wrapper for secure random number generator.
struct hmac_ctx hmac_ctx_t
void setenv_str(struct env_set *es, const char *name, const char *value)
Definition env_set.c:305
#define D_SHOW_KEYS
Definition errlevel.h:120
#define M_INFO
Definition errlevel.h:54
#define KS_PRIMARY
Primary key state index.
Definition ssl_common.h:472
#define TM_ACTIVE
Active tls_session.
Definition ssl_common.h:552
#define S_GENERATED_KEYS
The data channel keys have been generated The TLS session is fully authenticated when reaching this s...
Definition ssl_common.h:105
#define ntohll(x)
Definition integer.h:36
#define htonll(x)
Definition integer.h:29
#define USER_PASS_LEN
Definition misc.h:67
#define CLEAR(x)
Definition basic.h:32
#define M_FATAL
Definition error.h:90
#define dmsg(flags,...)
Definition error.h:164
#define msg(flags,...)
Definition error.h:152
#define ASSERT(x)
Definition error.h:221
#define M_WARN
Definition error.h:92
time_t now
Definition otime.c:33
void send_push_reply_auth_token(struct tls_multi *multi)
Sends a push reply message only containin the auth-token to update the auth-token on the client.
Definition push.c:842
int openvpn_base64_decode(const char *str, void *data, int size)
Definition base64.c:160
int openvpn_base64_encode(const void *data, int size, char **str)
Definition base64.c:51
Control Channel SSL/Data channel negotiation module.
Control Channel Common Data Structures.
#define AUTH_TOKEN_HMAC_OK
Auth-token sent from client has valid hmac.
Definition ssl_common.h:694
#define AUTH_TOKEN_EXPIRED
Auth-token sent from client has expired.
Definition ssl_common.h:696
@ KS_AUTH_TRUE
Key state is authenticated.
Definition ssl_common.h:157
static const struct key_state * get_primary_key(const struct tls_multi *multi)
gets an item of key_state objects in the order they should be scanned by data channel modules.
Definition ssl_common.h:771
#define AUTH_TOKEN_VALID_EMPTYUSER
Auth-token is only valid for an empty username and not the username actually supplied from the client...
Definition ssl_common.h:704
void auth_set_client_reason(struct tls_multi *multi, const char *client_reason)
Sets the reason why authentication of a client failed.
Definition ssl_verify.c:812
Control Channel Verification Module.
Wrapper structure for dynamically allocated memory.
Definition buffer.h:71
struct tls_multi * tls_multi
TLS state structure for this VPN tunnel.
Definition openvpn.h:324
Contains all state information for one tunnel.
Definition openvpn.h:471
struct context_2 c2
Level 2 context.
Definition openvpn.h:516
Garbage collection arena used to keep track of dynamically allocated memory.
Definition buffer.h:127
Container for one set of cipher and/or HMAC contexts.
Definition crypto.h:202
hmac_ctx_t * hmac
Generic HMAC context.
Definition crypto.h:204
internal structure similar to struct key that holds key information but is not represented on wire an...
Definition crypto.h:163
Security parameter state of one TLS and data channel key session.
Definition ssl_common.h:208
unsigned int auth_token_state_flags
The state of the auth-token sent from the client.
Definition ssl_common.h:211
Container for unidirectional cipher and HMAC key material.
Definition crypto.h:152
Security parameter state for a single VPN tunnel.
Definition ssl_common.h:619
char * auth_token_initial
The first auth-token we sent to a client.
Definition ssl_common.h:691
char * locked_username
The locked username is the username we assume the client is using.
Definition ssl_common.h:657
struct tls_options opt
Definition ssl_common.h:624
struct tls_session session[TM_SIZE]
Array of tls_session objects representing control channel sessions with the remote peer.
Definition ssl_common.h:721
char * auth_token
If server sends a generated auth-token, this is the token to use for future user/pass authentications...
Definition ssl_common.h:686
struct key_ctx auth_token_key
Definition ssl_common.h:412
unsigned int auth_token_lifetime
Definition ssl_common.h:409
bool auth_token_generate
Generate auth-tokens on successful user/pass auth,seet via options->auth_token_generate.
Definition ssl_common.h:405
Security parameter state of a single session within a VPN tunnel.
Definition ssl_common.h:497
struct key_state key[KS_SIZE]
Definition ssl_common.h:532
bool protected
Definition misc.h:61
char password[USER_PASS_LEN]
Definition misc.h:71
char username[USER_PASS_LEN]
Definition misc.h:70
struct gc_arena gc
Definition test_ssl.c:138