OpenVPN
push.c
Go to the documentation of this file.
1/*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
7 *
8 * Copyright (C) 2002-2025 OpenVPN Inc <sales@openvpn.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifdef HAVE_CONFIG_H
24#include "config.h"
25#endif
26
27#include "syshead.h"
28
29#include "push.h"
30#include "options.h"
31#include "crypto.h"
32#include "ssl.h"
33#include "ssl_verify.h"
34#include "ssl_ncp.h"
35#include "manage.h"
36
37#include "memdbg.h"
38#include "ssl_util.h"
39#include "options_util.h"
40
41/*
42 * Auth username/password
43 *
44 * Client received an authentication failed message from server.
45 * Runs on client.
46 */
47void
48receive_auth_failed(struct context *c, const struct buffer *buffer)
49{
50 msg(M_VERB0, "AUTH: Received control message: %s", BSTR(buffer));
51 c->options.no_advance = true;
52
53 if (!c->options.pull)
54 {
55 return;
56 }
57
58 struct buffer buf = *buffer;
59
60 /* If the AUTH_FAIL message ends with a , it is an extended message that
61 * contains further flags */
62 bool authfail_extended = buf_string_compare_advance(&buf, "AUTH_FAILED,");
63
64 const char *reason = NULL;
65 if (authfail_extended && BLEN(&buf))
66 {
67 reason = BSTR(&buf);
68 }
69
71 {
72 parse_auth_failed_temp(&c->options, reason + strlen("TEMP"));
73 register_signal(c->sig, SIGUSR1, "auth-temp-failure (server temporary reject)");
74 }
75
76 /* Before checking how to react on AUTH_FAILED, first check if the
77 * failed auth might be the result of an expired auth-token.
78 * Note that a server restart will trigger a generic AUTH_FAILED
79 * instead an AUTH_FAILED,SESSION so handle all AUTH_FAILED message
80 * identical for this scenario */
81 else if (ssl_clean_auth_token())
82 {
83 /* SOFT-SIGUSR1 -- Auth failure error */
84 register_signal(c->sig, SIGUSR1, "auth-failure (auth-token)");
85 c->options.no_advance = true;
86 }
87 else
88 {
89 switch (auth_retry_get())
90 {
91 case AR_NONE:
92 /* SOFT-SIGTERM -- Auth failure error */
93 register_signal(c->sig, SIGTERM, "auth-failure");
94 break;
95
96 case AR_INTERACT:
97 ssl_purge_auth(false);
98 /* Intentional [[fallthrough]]; */
99
100 case AR_NOINTERACT:
101 /* SOFT-SIGTUSR1 -- Auth failure error */
102 register_signal(c->sig, SIGUSR1, "auth-failure");
103 break;
104
105 default:
106 ASSERT(0);
107 }
108 }
109#ifdef ENABLE_MANAGEMENT
110 if (management)
111 {
113 }
114 /*
115 * Save the dynamic-challenge text even when management is defined
116 */
117 if (authfail_extended && buf_string_match_head_str(&buf, "CRV1:") && BLEN(&buf))
118 {
120 }
121#endif /* ifdef ENABLE_MANAGEMENT */
122}
123
124/*
125 * Act on received restart message from server
126 */
127void
128server_pushed_signal(struct context *c, const struct buffer *buffer, const bool restart,
129 const int adv)
130{
131 if (c->options.pull)
132 {
133 struct buffer buf = *buffer;
134 const char *m = "";
135 if (buf_advance(&buf, adv) && buf_read_u8(&buf) == ',' && BLEN(&buf))
136 {
137 m = BSTR(&buf);
138 }
139
140 /* preserve cached passwords? */
141 /* advance to next server? */
142 {
143 bool purge = true;
144
145 if (m[0] == '[')
146 {
147 int i;
148 for (i = 1; m[i] != '\0' && m[i] != ']'; ++i)
149 {
150 if (m[i] == 'P')
151 {
152 purge = false;
153 }
154 else if (m[i] == 'N')
155 {
156 /* next server? */
157 c->options.no_advance = false;
158 }
159 }
160 }
161 if (purge)
162 {
163 ssl_purge_auth(true);
164 }
165 }
166
167 if (restart)
168 {
169 msg(D_STREAM_ERRORS, "Connection reset command was pushed by server ('%s')", m);
170 /* SOFT-SIGUSR1 -- server-pushed connection reset */
171 register_signal(c->sig, SIGUSR1, "server-pushed-connection-reset");
172 }
173 else
174 {
175 msg(D_STREAM_ERRORS, "Halt command was pushed by server ('%s')", m);
176 /* SOFT-SIGTERM -- server-pushed halt */
177 register_signal(c->sig, SIGTERM, "server-pushed-halt");
178 }
179#ifdef ENABLE_MANAGEMENT
180 if (management)
181 {
182 management_notify(management, "info", c->sig->signal_text, m);
183 }
184#endif
185 }
186}
187
188void
190{
191 dmsg(D_STREAM_ERRORS, "CC-EEN exit message received by peer");
192 /* With control channel exit notification, we want to give the session
193 * enough time to handle retransmits and acknowledgment, so that eventual
194 * retries from the client to resend the exit or ACKs will not trigger
195 * a new session (we already forgot the session but the packet's HMAC
196 * is still valid). This could happen for the entire period that the
197 * HMAC timeslot is still valid, but waiting five seconds here does not
198 * hurt much, takes care of the retransmits, and is easier code-wise.
199 *
200 * This does not affect OCC exit since the HMAC session code will
201 * ignore DATA packets
202 * */
203 if (c->options.mode == MODE_SERVER)
204 {
205 if (!schedule_exit(c))
206 {
207 /* Return early when we don't need to notify management */
208 return;
209 }
210 }
211 else
212 {
213 register_signal(c->sig, SIGUSR1, "remote-exit");
214 }
215#ifdef ENABLE_MANAGEMENT
216 if (management)
217 {
218 management_notify(management, "info", "remote-exit", "EXIT");
219 }
220#endif
221}
222
223
224void
225server_pushed_info(const struct buffer *buffer, const int adv)
226{
227 const char *m = "";
228 struct buffer buf = *buffer;
229
230 if (buf_advance(&buf, adv) && buf_read_u8(&buf) == ',' && BLEN(&buf))
231 {
232 m = BSTR(&buf);
233 }
234
235#ifdef ENABLE_MANAGEMENT
236 struct gc_arena gc;
237 if (management)
238 {
239 gc = gc_new();
240
241 /*
242 * We use >INFOMSG here instead of plain >INFO since INFO is used to
243 * for management greeting and we don't want to confuse the client
244 */
245 struct buffer out = alloc_buf_gc(256, &gc);
246 if (buf_printf(&out, ">%s:%s", "INFOMSG", m))
247 {
249 }
250 else
251 {
253 "WARNING: Received INFO command is too long, won't notify management client.");
254 }
255
256 gc_free(&gc);
257 }
258#endif
259 msg(D_PUSH, "Info command was pushed by server ('%s')", m);
260}
261
262void
264{
265 struct buffer buf = *buffer;
266 const char *m = "";
267
268 if (buf_advance(&buf, 11) && buf_read_u8(&buf) == ',' && BLEN(&buf))
269 {
270 m = BSTR(&buf);
271 }
272#ifdef ENABLE_MANAGEMENT
274 struct man_def_auth_context *mda = session->opt->mda_context;
275 struct env_set *es = session->opt->es;
276 unsigned int mda_key_id = get_primary_key(c->c2.tls_multi)->mda_key_id;
277
278 management_notify_client_cr_response(mda_key_id, mda, es, m);
279#endif
280#if ENABLE_PLUGIN
282#endif
284 msg(D_PUSH, "CR response was sent by client ('%s')", m);
285}
286
294static void
295parse_auth_pending_keywords(const struct buffer *buffer, unsigned int *server_timeout)
296{
297 struct buffer buf = *buffer;
298
299 /* does the buffer start with "AUTH_PENDING," ? */
300 if (!buf_advance(&buf, strlen("AUTH_PENDING")) || !(buf_read_u8(&buf) == ',') || !BLEN(&buf))
301 {
302#ifdef ENABLE_MANAGEMENT
303 if (management)
304 {
306 NULL);
307 }
308#endif
309
310 return;
311 }
312
313 /* parse the keywords in the same way that push options are parsed */
315
316#ifdef ENABLE_MANAGEMENT
317 /* Need to do the management notification with the keywords before
318 * buf_parse is called, as it will insert \0 bytes into the buffer */
319 if (management)
320 {
322 NULL);
323 }
324#endif
325
326 while (buf_parse(&buf, ',', line, sizeof(line)))
327 {
328 if (sscanf(line, "timeout %u", server_timeout) != 1)
329 {
330 msg(D_PUSH, "ignoring AUTH_PENDING parameter: %s", line);
331 }
332 }
333}
334
335void
337{
338 if (!c->options.pull)
339 {
340 return;
341 }
342
343 /* Cap the increase at the maximum time we are willing stay in the
344 * pending authentication state */
345 unsigned int max_timeout =
346 max_uint(c->options.renegotiate_seconds / 2, c->options.handshake_window);
347
348 /* try to parse parameter keywords, default to hand-winow timeout if the
349 * server does not supply a timeout */
350 unsigned int server_timeout = c->options.handshake_window;
352
353 msg(D_PUSH,
354 "AUTH_PENDING received, extending handshake timeout from %us "
355 "to %us",
356 c->options.handshake_window, min_uint(max_timeout, server_timeout));
357
358 const struct key_state *ks = get_primary_key(c->c2.tls_multi);
359 c->c2.push_request_timeout = ks->established + min_uint(max_timeout, server_timeout);
360}
361
376static bool push_option_fmt(struct gc_arena *gc, struct push_list *push_list,
377 msglvl_t msglevel, const char *fmt, ...)
378#ifdef __GNUC__
379#if __USE_MINGW_ANSI_STDIO
380 __attribute__((format(gnu_printf, 4, 5)))
381#else
382 __attribute__((format(__printf__, 4, 5)))
383#endif
384#endif
385 ;
386
387/*
388 * Send auth failed message from server to client.
389 *
390 * Does nothing if an exit is already scheduled
391 */
392void
393send_auth_failed(struct context *c, const char *client_reason)
394{
395 if (!schedule_exit(c))
396 {
397 msg(D_TLS_DEBUG, "exit already scheduled for context");
398 return;
399 }
400
401 struct gc_arena gc = gc_new();
402 static const char auth_failed[] = "AUTH_FAILED";
403 size_t len;
404
405 len = (client_reason ? strlen(client_reason) + 1 : 0) + sizeof(auth_failed);
406 if (len > PUSH_BUNDLE_SIZE)
407 {
408 len = PUSH_BUNDLE_SIZE;
409 }
410
411 {
412 struct buffer buf = alloc_buf_gc(len, &gc);
413 buf_printf(&buf, auth_failed);
414 if (client_reason)
415 {
416 buf_printf(&buf, ",%s", client_reason);
417 }
418
419 /* We kill the whole session, send the AUTH_FAILED to any TLS session
420 * that might be active */
421 send_control_channel_string_dowork(&c->c2.tls_multi->session[TM_INITIAL], BSTR(&buf),
422 D_PUSH);
423 send_control_channel_string_dowork(&c->c2.tls_multi->session[TM_ACTIVE], BSTR(&buf),
424 D_PUSH);
425
427 }
428
429 gc_free(&gc);
430}
431
432#if defined(__GNUC__) || defined(__clang__)
433#pragma GCC diagnostic push
434#pragma GCC diagnostic ignored "-Wconversion"
435#endif
436
437bool
439 const char *extra, unsigned int timeout)
440{
441 struct key_state *ks = &session->key[KS_PRIMARY];
442
443 static const char info_pre[] = "INFO_PRE,";
444
445 const char *const peer_info = tls_multi->peer_info;
446 unsigned int proto = extract_iv_proto(peer_info);
447
448
449 /* Calculate the maximum timeout and subtract the time we already waited */
450 unsigned int max_timeout =
452 max_timeout = max_timeout - (now - ks->initial);
453 timeout = min_uint(max_timeout, timeout);
454
455 struct gc_arena gc = gc_new();
456 if ((proto & IV_PROTO_AUTH_PENDING_KW) == 0)
457 {
459 }
460 else
461 {
462 static const char auth_pre[] = "AUTH_PENDING,timeout ";
463 /* Assume a worst case of 8 byte uint64 in decimal which */
464 /* needs 20 bytes */
465 size_t len = 20 + 1 + sizeof(auth_pre);
466 struct buffer buf = alloc_buf_gc(len, &gc);
467 buf_printf(&buf, auth_pre);
468 buf_printf(&buf, "%u", timeout);
470 }
471
472 size_t len = strlen(extra) + 1 + sizeof(info_pre);
473 if (len > PUSH_BUNDLE_SIZE)
474 {
475 gc_free(&gc);
476 return false;
477 }
478
479 struct buffer buf = alloc_buf_gc(len, &gc);
480 buf_printf(&buf, info_pre);
481 buf_printf(&buf, "%s", extra);
483
484 ks->auth_deferred_expire = now + timeout;
485
486 gc_free(&gc);
487 return true;
488}
489
490/*
491 * Send restart message from server to client.
492 */
493void
494send_restart(struct context *c, const char *kill_msg)
495{
498}
499
500/*
501 * Push/Pull
502 */
503
504void
506{
507 struct gc_arena gc = gc_new();
508 unsigned int option_types_found = 0;
509
510 msg(D_PUSH, "PUSH: Received control message: '%s'",
512
514 &option_types_found);
515
516 if (status == PUSH_MSG_ERROR)
517 {
518 msg(D_PUSH_ERRORS, "WARNING: Received bad push/pull message: %s",
520 }
523 {
524 c->options.push_option_types_found |= option_types_found;
525
526 /* delay bringing tun/tap up until --push parms received from remote */
528 {
530 {
531 goto error;
532 }
533 if (status == PUSH_MSG_REPLY)
534 {
535 if (!do_up(c, true, c->options.push_option_types_found))
536 {
537 msg(D_PUSH_ERRORS, "Failed to open tun/tap interface");
538 goto error;
539 }
540 }
541 else
542 {
543 /* Clear push_update_options_found for next PUSH_UPDATE sequence */
545
546 /* Use accumulated option_types_found for the entire PUSH_UPDATE sequence */
548 {
549 msg(M_WARN, "No updatable options found in incoming PUSH_UPDATE message");
550 }
552 {
553 msg(D_PUSH_ERRORS, "Failed to update options");
554 goto error;
555 }
556 }
557 }
560 }
561
562 goto cleanup;
563
564error:
565 register_signal(c->sig, SIGUSR1, "process-push-msg-failed");
566cleanup:
567 gc_free(&gc);
568}
569
570bool
572{
573 const struct key_state *ks = get_primary_key(c->c2.tls_multi);
574
575 /* We timeout here under two conditions:
576 * a) we reached the hard limit of push_request_timeout
577 * b) we have not seen anything from the server in hand_window time
578 *
579 * for non auth-pending scenario, push_request_timeout is the same as
580 * hand_window timeout. For b) every PUSH_REQUEST is a acknowledged by
581 * the server by a P_ACK_V1 packet that reset the keepalive timer
582 */
583
586 {
587 return send_control_channel_string(c, "PUSH_REQUEST", D_PUSH);
588 }
589 else
590 {
591 msg(D_STREAM_ERRORS, "No reply from server to push requests in %ds",
592 (int)(now - ks->established));
593 /* SOFT-SIGUSR1 -- server-pushed connection reset */
594 register_signal(c->sig, SIGUSR1, "no-push-reply");
595 return false;
596 }
597}
598
605void
607 struct push_list *push_list)
608{
609 /*
610 * If server uses --auth-gen-token and we have an auth token
611 * to send to the client
612 */
614 {
616
617 char *base64user = NULL;
619 (int)strlen(tls_multi->locked_username), &base64user);
620 if (ret < USER_PASS_LEN && ret > 0)
621 {
622 push_option_fmt(gc, push_list, M_USAGE, "auth-token-user %s", base64user);
623 }
624 free(base64user);
625 }
626}
627
637bool
639{
640 struct tls_multi *tls_multi = c->c2.tls_multi;
641 struct options *o = &c->options;
642
643 /* ipv6 */
645 {
646 push_option_fmt(gc, push_list, M_USAGE, "ifconfig-ipv6 %s/%d %s",
650 }
651
652 /* ipv4 */
655 {
658 {
660 }
661 push_option_fmt(gc, push_list, M_USAGE, "ifconfig %s %s",
664 }
665
667 {
669 }
670 /*
671 * If server uses --auth-gen-token and we have an auth token
672 * to send to the client
673 */
675
676 /*
677 * Push the selected cipher, at this point the cipher has been
678 * already negotiated and been fixed.
679 *
680 * We avoid pushing the cipher to clients not supporting NCP
681 * to avoid error messages in their logs
682 */
684 {
685 push_option_fmt(gc, push_list, M_USAGE, "cipher %s", o->ciphername);
686 }
687
688 struct buffer proto_flags = alloc_buf_gc(128, gc);
689
690 if (o->imported_protocol_flags & CO_USE_CC_EXIT_NOTIFY)
691 {
692 buf_printf(&proto_flags, " cc-exit");
693
694 /* if the cc exit flag is supported, pushing tls-ekm via protocol-flags
695 * is also supported */
696 if (o->imported_protocol_flags & CO_USE_TLS_KEY_MATERIAL_EXPORT)
697 {
698 buf_printf(&proto_flags, " tls-ekm");
699 }
700 }
701 else if (o->imported_protocol_flags & CO_USE_TLS_KEY_MATERIAL_EXPORT)
702 {
703 push_option_fmt(gc, push_list, M_USAGE, "key-derivation tls-ekm");
704 }
705
706 if (o->imported_protocol_flags & CO_USE_DYNAMIC_TLS_CRYPT)
707 {
708 buf_printf(&proto_flags, " dyn-tls-crypt");
709 }
710
711 if (o->imported_protocol_flags & CO_EPOCH_DATA_KEY_FORMAT)
712 {
713 buf_printf(&proto_flags, " aead-epoch");
714 }
715
716 if (buf_len(&proto_flags) > 0)
717 {
718 push_option_fmt(gc, push_list, M_USAGE, "protocol-flags%s", buf_str(&proto_flags));
719 }
720
721 /* Push our mtu to the peer if it supports pushable MTUs */
722 int client_max_mtu = 0;
723 const char *iv_mtu = extract_var_peer_info(tls_multi->peer_info, "IV_MTU=", gc);
724
725 if (iv_mtu && sscanf(iv_mtu, "%d", &client_max_mtu) == 1)
726 {
727 push_option_fmt(gc, push_list, M_USAGE, "tun-mtu %d", o->ce.tun_mtu);
728 if (client_max_mtu < o->ce.tun_mtu)
729 {
730 msg(M_WARN,
731 "Warning: reported maximum MTU from client (%d) is lower "
732 "than MTU used on the server (%d). Add tun-mtu-max %d "
733 "to client configuration.",
734 client_max_mtu, o->ce.tun_mtu, o->ce.tun_mtu);
735 }
736 }
737
738 return true;
739}
740
741static bool
742send_push_options(struct context *c, struct buffer *buf, struct push_list *push_list, int safe_cap,
743 bool *push_sent, bool *multi_push)
744{
745 struct push_entry *e = push_list->head;
746
747 while (e)
748 {
749 if (e->enable)
750 {
751 const int l = strlen(e->option);
752 if (BLEN(buf) + l >= safe_cap)
753 {
754 buf_printf(buf, ",push-continuation 2");
755 {
756 const bool status = send_control_channel_string(c, BSTR(buf), D_PUSH);
757 if (!status)
758 {
759 return false;
760 }
761 *push_sent = true;
762 *multi_push = true;
763 buf_reset_len(buf);
764 buf_printf(buf, "%s", push_reply_cmd);
765 }
766 }
767 if (BLEN(buf) + l >= safe_cap)
768 {
769 msg(M_WARN, "--push option is too long");
770 return false;
771 }
772 buf_printf(buf, ",%s", e->option);
773 }
774 e = e->next;
775 }
776 return true;
777}
778
779#if defined(__GNUC__) || defined(__clang__)
780#pragma GCC diagnostic pop
781#endif
782
783void
785{
786 struct gc_arena gc = gc_new();
787 struct push_list push_list = { 0 };
788 struct tls_session *session = &multi->session[TM_ACTIVE];
789
791
792 /* prepare auth token should always add the auth-token option */
793 struct push_entry *e = push_list.head;
794 ASSERT(e && e->enable);
795
796 /* Construct a mimimal control channel push reply message */
797 struct buffer buf = alloc_buf_gc(PUSH_BUNDLE_SIZE, &gc);
798 buf_printf(&buf, "%s,%s", push_reply_cmd, e->option);
800 gc_free(&gc);
801}
802
803bool
805{
806 struct gc_arena gc = gc_new();
807 struct buffer buf = alloc_buf_gc(PUSH_BUNDLE_SIZE, &gc);
808 bool multi_push = false;
809 const int extra = 84; /* extra space for possible trailing ifconfig and push-continuation */
810 const int safe_cap = BCAP(&buf) - extra;
811 bool push_sent = false;
812
813 buf_printf(&buf, "%s", push_reply_cmd);
814
815 /* send options which are common to all clients */
816 if (!send_push_options(c, &buf, &c->options.push_list, safe_cap, &push_sent, &multi_push))
817 {
818 goto fail;
819 }
820
821 /* send client-specific options */
823 {
824 goto fail;
825 }
826
827 if (multi_push)
828 {
829 buf_printf(&buf, ",push-continuation 1");
830 }
831
832 if (BLEN(&buf) > sizeof(push_reply_cmd) - 1)
833 {
834 const bool status = send_control_channel_string(c, BSTR(&buf), D_PUSH);
835 if (!status)
836 {
837 goto fail;
838 }
839 push_sent = true;
840 }
841
842 /* If nothing have been pushed, send an empty push,
843 * as the client is expecting a response
844 */
845 if (!push_sent)
846 {
847 bool status = false;
848
849 buf_reset_len(&buf);
850 buf_printf(&buf, "%s", push_reply_cmd);
852 if (!status)
853 {
854 goto fail;
855 }
856 }
857
858 gc_free(&gc);
859 return true;
860
861fail:
862 gc_free(&gc);
863 return false;
864}
865
866static void
867push_option_ex(struct gc_arena *gc, struct push_list *push_list, const char *opt, bool enable,
868 msglvl_t msglevel)
869{
870 if (!string_class(opt, CC_ANY, CC_COMMA))
871 {
872 msg(msglevel, "PUSH OPTION FAILED (illegal comma (',') in string): '%s'", opt);
873 }
874 else
875 {
876 struct push_entry *e;
877 ALLOC_OBJ_CLEAR_GC(e, struct push_entry, gc);
878 e->enable = true;
879 e->option = opt;
880 if (push_list->head)
881 {
883 push_list->tail->next = e;
884 push_list->tail = e;
885 }
886 else
887 {
889 push_list->head = e;
890 push_list->tail = e;
891 }
892 }
893}
894
895void
896push_option(struct options *o, const char *opt, msglvl_t msglevel)
897{
898 push_option_ex(&o->gc, &o->push_list, opt, true, msglevel);
899}
900
901void
903{
904 if (o->push_list.head)
905 {
906 const struct push_entry *e = o->push_list.head;
907 push_reset(o);
908 while (e)
909 {
910 push_option_ex(&o->gc, &o->push_list, string_alloc(e->option, &o->gc), true, M_FATAL);
911 e = e->next;
912 }
913 }
914}
915
916void
917push_options(struct options *o, char **p, msglvl_t msglevel, struct gc_arena *gc)
918{
919 const char **argv = make_extended_arg_array(p, false, gc);
920 char *opt = print_argv(argv, gc, 0);
921 push_option(o, opt, msglevel);
922}
923
924static bool
926 msglvl_t msglevel, const char *format, ...)
927{
928 va_list arglist;
929 char tmp[256] = { 0 };
930 int len;
931 va_start(arglist, format);
932 len = vsnprintf(tmp, sizeof(tmp), format, arglist);
933 va_end(arglist);
934 if (len > sizeof(tmp) - 1)
935 {
936 return false;
937 }
938 push_option_ex(gc, push_list, string_alloc(tmp, gc), true, msglevel);
939 return true;
940}
941
942void
944{
945 CLEAR(o->push_list);
946}
947
948void
949push_remove_option(struct options *o, const char *p)
950{
951 msg(D_PUSH_DEBUG, "PUSH_REMOVE searching for: '%s'", p);
952
953 /* ifconfig is special, as not part of the push list */
954 if (streq(p, "ifconfig"))
955 {
957 return;
958 }
959
960 /* ifconfig-ipv6 is special, as not part of the push list */
961 if (streq(p, "ifconfig-ipv6"))
962 {
964 return;
965 }
966
967 if (o && o->push_list.head)
968 {
969 struct push_entry *e = o->push_list.head;
970
971 /* cycle through the push list */
972 while (e)
973 {
974 if (e->enable && strncmp(e->option, p, strlen(p)) == 0)
975 {
976 msg(D_PUSH_DEBUG, "PUSH_REMOVE removing: '%s'", e->option);
977 e->enable = false;
978 }
979
980 e = e->next;
981 }
982 }
983}
984
985int
987{
988 int ret = PUSH_MSG_ERROR;
989
990
993 {
994 const char *client_reason = tls_client_reason(c->c2.tls_multi);
995 send_auth_failed(c, client_reason);
997 }
1000 {
1001 time_t now;
1002
1003 openvpn_time(&now);
1004 if (c->c2.sent_push_reply_expiry > now)
1005 {
1007 }
1008 else
1009 {
1010 /* per-client push options - peer-id, cipher, ifconfig, ipv6-ifconfig */
1011 struct push_list push_list = { 0 };
1012 struct gc_arena gc = gc_new();
1013
1015 {
1016 ret = PUSH_MSG_REQUEST;
1017 c->c2.sent_push_reply_expiry = now + 30;
1018 }
1019 gc_free(&gc);
1020 }
1021 }
1022 else
1023 {
1025 }
1026
1027 return ret;
1028}
1029
1030static void
1031push_update_digest(md_ctx_t *ctx, struct buffer *buf, const struct options *opt)
1032{
1033 char line[OPTION_PARM_SIZE];
1034 while (buf_parse(buf, ',', line, sizeof(line)))
1035 {
1036 /* peer-id and auth-token might change on restart and this should not
1037 * trigger reopening tun
1038 * Also other options that only affect the control channel should
1039 * not trigger a reopen of the tun device
1040 */
1041 if (strprefix(line, "peer-id ")
1042 || strprefix(line, "auth-token ")
1043 || strprefix(line, "auth-token-user")
1044 || strprefix(line, "protocol-flags ")
1045 || strprefix(line, "key-derivation ")
1046 || strprefix(line, "explicit-exit-notify ")
1047 || strprefix(line, "ping ")
1048 || strprefix(line, "ping-restart ")
1049 || strprefix(line, "ping-timer "))
1050 {
1051 continue;
1052 }
1053 /* tun reopen only needed if cipher change can change tun MTU */
1054 if (strprefix(line, "cipher ") && opt->ce.tun_mtu_defined)
1055 {
1056 continue;
1057 }
1058 md_ctx_update(ctx, (const uint8_t *)line, strlen(line) + 1);
1059 }
1060}
1061
1062static int
1063process_incoming_push_reply(struct context *c, unsigned int permission_mask,
1064 unsigned int *option_types_found, struct buffer *buf)
1065{
1066 int ret = PUSH_MSG_ERROR;
1067 const int ch = buf_read_u8(buf);
1068 if (ch == ',')
1069 {
1070 struct buffer buf_orig = (*buf);
1071 if (!c->c2.pulled_options_digest_init_done)
1072 {
1073 c->c2.pulled_options_state = md_ctx_new();
1074 md_ctx_init(c->c2.pulled_options_state, "SHA256");
1075 c->c2.pulled_options_digest_init_done = true;
1076 }
1077 if (apply_push_options(c, &c->options, buf, permission_mask, option_types_found, c->c2.es,
1078 false))
1079 {
1080 push_update_digest(c->c2.pulled_options_state, &buf_orig, &c->options);
1081 switch (c->options.push_continuation)
1082 {
1083 case 0:
1084 case 1:
1085 md_ctx_final(c->c2.pulled_options_state, c->c2.pulled_options_digest.digest);
1086 md_ctx_cleanup(c->c2.pulled_options_state);
1087 md_ctx_free(c->c2.pulled_options_state);
1088 c->c2.pulled_options_state = NULL;
1089 c->c2.pulled_options_digest_init_done = false;
1090 ret = PUSH_MSG_REPLY;
1091 break;
1092
1093 case 2:
1095 break;
1096 }
1097 }
1098 else
1099 {
1100 throw_signal_soft(SIGUSR1, "Offending option received from server");
1101 }
1102 }
1103 else if (ch == '\0')
1104 {
1105 ret = PUSH_MSG_REPLY;
1106 }
1107 /* show_settings (&c->options); */
1108 return ret;
1109}
1110
1111int
1113 bool honor_received_options, unsigned int permission_mask,
1114 unsigned int *option_types_found)
1115{
1116 struct buffer buf = *buffer;
1117
1118 if (buf_string_compare_advance(&buf, "PUSH_REQUEST"))
1119 {
1120 c->c2.push_request_received = true;
1122 }
1124 {
1125 return process_incoming_push_reply(c, permission_mask, option_types_found, &buf);
1126 }
1128 {
1129 if (dco_enabled(&c->options))
1130 {
1131 msg(M_WARN, "WARN: PUSH_UPDATE messages cannot currently be processed in client mode while DCO is enabled, ignoring."
1132 " To be able to process PUSH_UPDATE messages, be sure to use the --disable-dco option.");
1133 return PUSH_MSG_ERROR;
1134 }
1135 return process_push_update(c, &c->options, permission_mask, option_types_found, &buf, false);
1136 }
1137 else
1138 {
1139 return PUSH_MSG_ERROR;
1140 }
1141}
1142
1143
1144/*
1145 * Remove iroutes from the push_list.
1146 */
1147void
1149{
1150 if (o && o->push_list.head && (o->iroutes || o->iroutes_ipv6))
1151 {
1152 struct gc_arena gc = gc_new();
1153 struct push_entry *e = o->push_list.head;
1154
1155 /* cycle through the push list */
1156 while (e)
1157 {
1158 char *p[MAX_PARMS + 1];
1159 bool enable = true;
1160
1161 /* parse the push item */
1162 CLEAR(p);
1163 if (e->enable
1164 && parse_line(e->option, p, SIZE(p) - 1, "[PUSH_ROUTE_REMOVE]", 1, D_ROUTE_DEBUG,
1165 &gc))
1166 {
1167 /* is the push item a route directive? */
1168 if (p[0] && !strcmp(p[0], "route") && !p[3] && o->iroutes)
1169 {
1170 /* get route parameters */
1171 bool status1, status2;
1172 const in_addr_t network = getaddr(GETADDR_HOST_ORDER, p[1], 0, &status1, NULL);
1173 const in_addr_t netmask = getaddr(
1174 GETADDR_HOST_ORDER, p[2] ? p[2] : "255.255.255.255", 0, &status2, NULL);
1175
1176 /* did route parameters parse correctly? */
1177 if (status1 && status2)
1178 {
1179 const struct iroute *ir;
1180
1181 /* does route match an iroute? */
1182 for (ir = o->iroutes; ir != NULL; ir = ir->next)
1183 {
1184 if (network == ir->network
1185 && netmask
1186 == netbits_to_netmask(ir->netbits >= 0 ? ir->netbits : 32))
1187 {
1188 enable = false;
1189 break;
1190 }
1191 }
1192 }
1193 }
1194 else if (p[0] && !strcmp(p[0], "route-ipv6") && !p[2] && o->iroutes_ipv6)
1195 {
1196 /* get route parameters */
1197 struct in6_addr network;
1198 unsigned int netbits;
1199
1200 /* parse route-ipv6 arguments */
1201 if (get_ipv6_addr(p[1], &network, &netbits, D_ROUTE_DEBUG))
1202 {
1203 struct iroute_ipv6 *ir;
1204
1205 /* does this route-ipv6 match an iroute-ipv6? */
1206 for (ir = o->iroutes_ipv6; ir != NULL; ir = ir->next)
1207 {
1208 if (!memcmp(&network, &ir->network, sizeof(network))
1209 && netbits == ir->netbits)
1210 {
1211 enable = false;
1212 break;
1213 }
1214 }
1215 }
1216 }
1217
1218 /* should we copy the push item? */
1219 e->enable = enable;
1220 if (!enable)
1221 {
1222 msg(D_PUSH, "REMOVE PUSH ROUTE: '%s'", e->option);
1223 }
1224 }
1225
1226 e = e->next;
1227 }
1228
1229 gc_free(&gc);
1230 }
1231}
bool buf_string_compare_advance(struct buffer *src, const char *match)
Definition buffer.c:788
bool buf_printf(struct buffer *buf, const char *format,...)
Definition buffer.c:241
bool string_class(const char *str, const unsigned int inclusive, const unsigned int exclusive)
Definition buffer.c:1026
char * print_argv(const char **p, struct gc_arena *gc, const unsigned int flags)
Definition buffer.c:716
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
Definition buffer.c:89
bool buf_parse(struct buffer *buf, const int delim, char *line, const int size)
Definition buffer.c:824
char * string_alloc(const char *str, struct gc_arena *gc)
Definition buffer.c:648
bool buf_string_match_head_str(const struct buffer *src, const char *match)
Definition buffer.c:777
#define CC_COMMA
comma
Definition buffer.h:898
#define BSTR(buf)
Definition buffer.h:128
#define CC_ANY
any character
Definition buffer.h:877
static bool buf_advance(struct buffer *buf, int size)
Definition buffer.h:616
static int buf_len(const struct buffer *buf)
Definition buffer.h:253
#define ALLOC_OBJ_CLEAR_GC(dptr, type, gc)
Definition buffer.h:1101
static int buf_read_u8(struct buffer *buf)
Definition buffer.h:786
#define BLEN(buf)
Definition buffer.h:126
static void buf_reset_len(struct buffer *buf)
Definition buffer.h:312
#define BCAP(buf)
Definition buffer.h:129
static void gc_free(struct gc_arena *a)
Definition buffer.h:1025
static char * buf_str(const struct buffer *buf)
Definition buffer.h:297
static bool strprefix(const char *str, const char *prefix)
Return true iff str starts with prefix.
Definition buffer.h:969
static struct gc_arena gc_new(void)
Definition buffer.h:1017
#define PUSH_BUNDLE_SIZE
Definition common.h:89
Data Channel Cryptography Module.
#define CO_USE_TLS_KEY_MATERIAL_EXPORT
Bit-flag indicating that data channel key derivation is done using TLS keying material export [RFC570...
Definition crypto.h:359
#define CO_USE_DYNAMIC_TLS_CRYPT
Bit-flag indicating that renegotiations are using tls-crypt with a TLS-EKM derived key.
Definition crypto.h:375
#define CO_EPOCH_DATA_KEY_FORMAT
Bit-flag indicating the epoch the data format.
Definition crypto.h:379
#define CO_USE_CC_EXIT_NOTIFY
Bit-flag indicating that explicit exit notifies should be sent via the control channel instead of usi...
Definition crypto.h:371
md_ctx_t * md_ctx_new(void)
void md_ctx_update(md_ctx_t *ctx, const uint8_t *src, size_t src_len)
void md_ctx_cleanup(md_ctx_t *ctx)
void md_ctx_final(md_ctx_t *ctx, uint8_t *dst)
void md_ctx_init(md_ctx_t *ctx, const char *mdname)
Initialises the given message digest context.
void md_ctx_free(md_ctx_t *ctx)
mbedtls_md_context_t md_ctx_t
Generic message digest context.
#define D_PUSH
Definition errlevel.h:82
#define M_VERB0
Definition errlevel.h:52
#define D_ROUTE_DEBUG
Definition errlevel.h:132
#define D_PUSH_DEBUG
Definition errlevel.h:149
#define D_STREAM_ERRORS
Definition errlevel.h:62
#define D_PUSH_ERRORS
Definition errlevel.h:66
#define D_TLS_DEBUG
Definition errlevel.h:164
void reschedule_multi_process(struct context *c)
Reschedule tls_multi_process.
Definition forward.c:391
bool send_control_channel_string(struct context *c, const char *str, msglvl_t msglevel)
Definition forward.c:398
bool schedule_exit(struct context *c)
Definition forward.c:528
bool send_control_channel_string_dowork(struct tls_session *session, const char *str, msglvl_t msglevel)
Definition forward.c:370
#define TM_INITIAL
As yet un-trusted tls_session \ being negotiated.
Definition ssl_common.h:547
#define KS_PRIMARY
Primary key state index.
Definition ssl_common.h:466
#define TM_ACTIVE
Active tls_session.
Definition ssl_common.h:546
bool do_update(struct context *c, unsigned int option_types_found)
A simplified version of the do_up() function.
Definition init.c:2467
bool do_up(struct context *c, bool pulled_options, unsigned int option_types_found)
Definition init.c:2332
unsigned int pull_permission_mask(const struct context *c)
Definition init.c:2520
static unsigned int min_uint(unsigned int x, unsigned int y)
Definition integer.h:66
static unsigned int max_uint(unsigned int x, unsigned int y)
Definition integer.h:53
static SERVICE_STATUS status
Definition interactive.c:51
static void event_timeout_clear(struct event_timeout *et)
Clears the timeout and reset all values to 0.
Definition interval.h:153
void management_auth_failure(struct management *man, const char *type, const char *reason)
Definition manage.c:3117
void management_set_state(struct management *man, const int state, const char *detail, const in_addr_t *tun_local_ip, const struct in6_addr *tun_local_ip6, const struct openvpn_sockaddr *local, const struct openvpn_sockaddr *remote)
Definition manage.c:2789
void management_notify_generic(struct management *man, const char *str)
Definition manage.c:2940
void management_notify_client_cr_response(unsigned mda_key_id, const struct man_def_auth_context *mdac, const struct env_set *es, const char *response)
Definition manage.c:2996
void management_notify(struct management *man, const char *severity, const char *type, const char *text)
Definition manage.c:2934
#define OPENVPN_STATE_AUTH_PENDING
Definition manage.h:462
const char ** make_extended_arg_array(char **p, bool is_inline, struct gc_arena *gc)
Definition misc.c:626
const char * sanitize_control_message(const char *src, struct gc_arena *gc)
Definition misc.c:656
#define CLEAR(x)
Definition basic.h:32
#define SIZE(x)
Definition basic.h:29
#define M_USAGE
Definition error.h:107
#define M_FATAL
Definition error.h:90
#define dmsg(flags,...)
Definition error.h:172
#define msg(flags,...)
Definition error.h:152
unsigned int msglvl_t
Definition error.h:77
#define ASSERT(x)
Definition error.h:219
#define M_WARN
Definition error.h:92
bool options_postprocess_pull(struct options *o, struct env_set *es)
Definition options.c:4301
int auth_retry_get(void)
Definition options.c:4799
#define MODE_SERVER
Definition options.h:264
#define streq(x, y)
Definition options.h:726
#define AR_INTERACT
Definition options.h:971
static bool dco_enabled(const struct options *o)
Returns whether the current configuration has dco enabled.
Definition options.h:992
int parse_line(const char *line, char *p[], const int n, const char *file, const int line_num, msglvl_t msglevel, struct gc_arena *gc)
#define OPTION_PARM_SIZE
Definition options.h:56
bool apply_push_options(struct context *c, struct options *options, struct buffer *buf, unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es, bool is_update)
#define AR_NONE
Definition options.h:970
#define AR_NOINTERACT
Definition options.h:972
#define MAX_PARMS
Definition options.h:51
#define OPTION_LINE_SIZE
Definition options.h:57
const char * parse_auth_failed_temp(struct options *o, const char *reason)
time_t now
Definition otime.c:33
static time_t openvpn_time(time_t *t)
Definition otime.h:97
int process_incoming_push_request(struct context *c)
Definition push.c:986
void receive_auth_pending(struct context *c, const struct buffer *buffer)
Parses an AUTH_PENDING message and if in pull mode extends the timeout.
Definition push.c:336
void push_option(struct options *o, const char *opt, msglvl_t msglevel)
Definition push.c:896
void receive_auth_failed(struct context *c, const struct buffer *buffer)
Definition push.c:48
void send_restart(struct context *c, const char *kill_msg)
Definition push.c:494
void server_pushed_signal(struct context *c, const struct buffer *buffer, const bool restart, const int adv)
Definition push.c:128
void push_reset(struct options *o)
Definition push.c:943
void receive_cr_response(struct context *c, const struct buffer *buffer)
Definition push.c:263
void push_options(struct options *o, char **p, msglvl_t msglevel, struct gc_arena *gc)
Definition push.c:917
void send_auth_failed(struct context *c, const char *client_reason)
Definition push.c:393
void clone_push_list(struct options *o)
Definition push.c:902
void receive_exit_message(struct context *c)
Definition push.c:189
void prepare_auth_token_push_reply(struct tls_multi *tls_multi, struct gc_arena *gc, struct push_list *push_list)
Prepare push option for auth-token.
Definition push.c:606
static void push_option_ex(struct gc_arena *gc, struct push_list *push_list, const char *opt, bool enable, msglvl_t msglevel)
Definition push.c:867
static int process_incoming_push_reply(struct context *c, unsigned int permission_mask, unsigned int *option_types_found, struct buffer *buf)
Definition push.c:1063
bool send_push_request(struct context *c)
Definition push.c:571
bool send_auth_pending_messages(struct tls_multi *tls_multi, struct tls_session *session, const char *extra, unsigned int timeout)
Sends the auth pending control messages to a client.
Definition push.c:438
void push_remove_option(struct options *o, const char *p)
Definition push.c:949
void incoming_push_message(struct context *c, const struct buffer *buffer)
Definition push.c:505
bool prepare_push_reply(struct context *c, struct gc_arena *gc, struct push_list *push_list)
Prepare push options, based on local options.
Definition push.c:638
static bool push_option_fmt(struct gc_arena *gc, struct push_list *push_list, msglvl_t msglevel, const char *fmt,...)
Add an option to the given push list by providing a format string.
Definition push.c:925
static void push_update_digest(md_ctx_t *ctx, struct buffer *buf, const struct options *opt)
Definition push.c:1031
static bool send_push_options(struct context *c, struct buffer *buf, struct push_list *push_list, int safe_cap, bool *push_sent, bool *multi_push)
Definition push.c:742
void remove_iroutes_from_push_route_list(struct options *o)
Definition push.c:1148
static void parse_auth_pending_keywords(const struct buffer *buffer, unsigned int *server_timeout)
Parse the keyword for the AUTH_PENDING request.
Definition push.c:295
int process_incoming_push_msg(struct context *c, const struct buffer *buffer, bool honor_received_options, unsigned int permission_mask, unsigned int *option_types_found)
Definition push.c:1112
bool send_push_reply(struct context *c, struct push_list *per_client_push_list)
Definition push.c:804
void server_pushed_info(const struct buffer *buffer, const int adv)
Definition push.c:225
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:784
#define PUSH_MSG_REQUEST
Definition push.h:29
int process_push_update(struct context *c, struct options *o, unsigned int permission_mask, unsigned int *option_types_found, struct buffer *buf, bool msg_sender)
Handles the receiving of a push-update message and applies updates to the specified options.
Definition push_util.c:14
#define PUSH_MSG_REQUEST_DEFERRED
Definition push.h:31
#define PUSH_MSG_ERROR
Definition push.h:28
#define PUSH_MSG_REPLY
Definition push.h:30
#define PUSH_MSG_UPDATE
Definition push.h:35
#define push_update_cmd
Definition push.h:38
#define push_reply_cmd
Definition push.h:37
#define PUSH_MSG_AUTH_FAILURE
Definition push.h:32
#define PUSH_MSG_CONTINUATION
Definition push.h:33
#define PUSH_MSG_ALREADY_REPLIED
Definition push.h:34
static in_addr_t netbits_to_netmask(const int netbits)
Definition route.h:401
void throw_signal_soft(const int signum, const char *signal_text)
Throw a soft global signal.
Definition sig.c:204
void register_signal(struct signal_info *si, int signum, const char *signal_text)
Register a soft signal in the signal_info struct si respecting priority.
Definition sig.c:228
bool get_ipv6_addr(const char *hostname, struct in6_addr *network, unsigned int *netbits, msglvl_t msglevel)
Translate an IPv6 addr or hostname from string form to in6_addr.
Definition socket.c:229
in_addr_t getaddr(unsigned int flags, const char *hostname, int resolve_retry_seconds, bool *succeeded, struct signal_info *sig_info)
Translate an IPv4 addr or hostname from string form to in_addr_t.
Definition socket.c:202
const char * print_in6_addr(struct in6_addr a6, unsigned int flags, struct gc_arena *gc)
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)
#define GETADDR_HOST_ORDER
int openvpn_base64_encode(const void *data, int size, char **str)
Definition base64.c:51
void ssl_purge_auth(const bool auth_user_pass_only)
Definition ssl.c:381
void ssl_put_auth_challenge(const char *cr_str)
Definition ssl.c:406
bool ssl_clean_auth_token(void)
Definition ssl.c:370
Control Channel SSL/Data channel negotiation module.
#define IV_PROTO_AUTH_PENDING_KW
Supports signaling keywords with AUTH_PENDING, e.g.
Definition ssl.h:90
@ CAS_CONNECT_DONE
Definition ssl_common.h:595
@ CAS_FAILED
Option import failed or explicitly denied the client.
Definition ssl_common.h:587
#define UP_TYPE_AUTH
Definition ssl_common.h:41
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:757
bool tls_peer_supports_ncp(const char *peer_info)
Returns whether the client supports NCP either by announcing IV_NCP>=2 or the IV_CIPHERS list.
Definition ssl_ncp.c:79
Control Channel SSL/Data dynamic negotiation Module This file is split from ssl.h to be able to unit ...
char * extract_var_peer_info(const char *peer_info, const char *var, struct gc_arena *gc)
Extracts a variable from peer info, the returned string will be allocated using the supplied gc_arena...
Definition ssl_util.c:31
unsigned int extract_iv_proto(const char *peer_info)
Extracts the IV_PROTO variable and returns its value or 0 if it cannot be extracted.
Definition ssl_util.c:60
SSL utility functions.
void verify_crresponse_plugin(struct tls_multi *multi, const char *cr_response)
Call the plugin OPENVPN_PLUGIN_CLIENT_CRRESPONSE.
enum tls_auth_status tls_authentication_status(struct tls_multi *multi)
Return current session authentication state of the tls_multi structure This will return TLS_AUTHENTIC...
void verify_crresponse_script(struct tls_multi *multi, const char *cr_response)
Runs the –client-crresponse script if one is defined.
Control Channel Verification Module.
@ TLS_AUTHENTICATION_SUCCEEDED
Definition ssl_verify.h:75
@ TLS_AUTHENTICATION_FAILED
Definition ssl_verify.h:76
static const char * tls_client_reason(struct tls_multi *multi)
Definition ssl_verify.h:278
Definition argv.h:35
Wrapper structure for dynamically allocated memory.
Definition buffer.h:60
int len
Length in bytes of the actual content within the allocated memory.
Definition buffer.h:65
bool tun_mtu_defined
Definition options.h:131
bool push_ifconfig_ipv6_defined
Definition openvpn.h:431
bool push_ifconfig_defined
Definition openvpn.h:425
struct env_set * es
Definition openvpn.h:420
time_t push_request_timeout
Definition openvpn.h:437
struct event_timeout wait_for_connect
Definition openvpn.h:282
struct event_timeout push_request_interval
Definition openvpn.h:436
struct tls_multi * tls_multi
TLS state structure for this VPN tunnel.
Definition openvpn.h:323
time_t sent_push_reply_expiry
Definition openvpn.h:426
struct in6_addr push_ifconfig_ipv6_remote
Definition openvpn.h:434
int push_ifconfig_ipv6_netbits
Definition openvpn.h:433
struct in6_addr push_ifconfig_ipv6_local
Definition openvpn.h:432
in_addr_t push_ifconfig_local_alias
Definition openvpn.h:429
in_addr_t push_ifconfig_remote_netmask
Definition openvpn.h:428
in_addr_t push_ifconfig_local
Definition openvpn.h:427
Contains all state information for one tunnel.
Definition openvpn.h:471
struct signal_info * sig
Internal error signaling object.
Definition openvpn.h:500
struct context_2 c2
Level 2 context.
Definition openvpn.h:514
struct options options
Options loaded from command line or configuration file.
Definition openvpn.h:472
Garbage collection arena used to keep track of dynamically allocated memory.
Definition buffer.h:116
struct iroute_ipv6 * next
Definition route.h:271
unsigned int netbits
Definition route.h:270
struct in6_addr network
Definition route.h:269
in_addr_t network
Definition route.h:262
int netbits
Definition route.h:263
struct iroute * next
Definition route.h:264
Security parameter state of one TLS and data channel key session.
Definition ssl_common.h:208
time_t established
Definition ssl_common.h:228
unsigned int mda_key_id
Definition ssl_common.h:263
time_t initial
Definition ssl_common.h:227
time_t peer_last_packet
Definition ssl_common.h:231
time_t auth_deferred_expire
Definition ssl_common.h:260
unsigned int push_option_types_found
Definition options.h:557
unsigned int push_update_options_found
Definition options.h:558
bool push_ifconfig_ipv6_blocked
Definition options.h:524
int handshake_window
Definition options.h:652
const char * ifconfig_local
Definition options.h:326
struct connection_entry ce
Definition options.h:293
struct iroute_ipv6 * iroutes_ipv6
Definition options.h:511
struct push_list push_list
Definition options.h:486
const char * ciphername
Definition options.h:573
bool pull
Definition options.h:555
struct gc_arena gc
Definition options.h:256
struct iroute * iroutes
Definition options.h:510
bool no_advance
Definition options.h:298
bool push_ifconfig_ipv4_blocked
Definition options.h:519
Definition pushlist.h:29
struct push_entry * next
Definition pushlist.h:30
bool enable
Definition pushlist.h:31
const char * option
Definition pushlist.h:32
struct push_entry * head
Definition pushlist.h:37
struct push_entry * tail
Definition pushlist.h:38
Security parameter state for a single VPN tunnel.
Definition ssl_common.h:613
char * peer_info
A multi-line string of general-purpose info received from peer over control channel.
Definition ssl_common.h:674
char * locked_username
The locked username is the username we assume the client is using.
Definition ssl_common.h:651
enum multi_status multi_state
Definition ssl_common.h:634
struct tls_options opt
Definition ssl_common.h:618
struct tls_session session[TM_SIZE]
Array of tls_session objects representing control channel sessions with the remote peer.
Definition ssl_common.h:713
uint32_t peer_id
Definition ssl_common.h:701
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:680
bool use_peer_id
Definition ssl_common.h:702
interval_t renegotiate_seconds
Definition ssl_common.h:348
int handshake_window
Definition ssl_common.h:341
Security parameter state of a single session within a VPN tunnel.
Definition ssl_common.h:491
#define SIGTERM
Definition syshead.h:59
#define SIGUSR1
Definition syshead.h:57
uint32_t in_addr_t
Definition syshead.h:52
__attribute__((unused))
Definition test.c:42
struct env_set * es
static int cleanup(void **state)
struct gc_arena gc
Definition test_ssl.c:131