Go to the documentation of this file.
31 #include <systemd/sd-daemon.h>
67 #define CF_LOAD_PERSISTED_PACKET_ID (1<<0)
68 #define CF_INIT_TLS_MULTI (1<<1)
69 #define CF_INIT_TLS_AUTH_STANDALONE (1<<2)
115 const char *dev_type,
117 const char *ifconfig_local,
118 const char *ifconfig_remote,
120 const char *signal_text,
121 const char *script_type,
145 if (!ifconfig_remote)
147 ifconfig_remote =
"";
160 arg, tun_mtu, ifconfig_local, ifconfig_remote,
context);
164 msg(
M_FATAL,
"ERROR: up/down plugin call failed");
177 ifconfig_local, ifconfig_remote,
context);
208 #ifdef ENABLE_MANAGEMENT
218 if (
streq(p[1],
"NONE"))
222 else if (p[2] && p[3])
224 if (
streq(p[1],
"HTTP"))
229 msg(
M_WARN,
"HTTP proxy support only works for TCP based connections");
238 else if (
streq(p[1],
"SOCKS"))
308 const char *parameters)
311 size_t len = strlen(command) + 1 + strlen(parameters) + 1;
359 char *out = malloc(len);
368 msg(
M_WARN,
"Out of bounds index in management query for remote entry: index = %u", index);
383 if (!strcmp(p[1],
"ACCEPT"))
388 else if (!strcmp(p[1],
"SKIP"))
394 else if (!strcmp(p[1],
"MOD") && p[2] && p[3])
427 int ce_changed =
true;
480 for (i = 0; i < l->
len; ++i)
567 int advance_count = 1;
591 msg(
M_FATAL,
"No usable connection profiles are present");
606 #ifdef ENABLE_MANAGEMENT
625 }
while (!ce_defined);
631 msg(
M_FATAL,
"All connections have been connect-retry-max (%d) times unsuccessful, exiting",
653 #ifdef ENABLE_MANAGEMENT
688 bool did_http =
false;
738 #if defined(ENABLE_PKCS11)
742 pkcs11_initialize(
true, c->
options.pkcs11_pin_cache_period);
745 pkcs11_addProvider(c->
options.pkcs11_providers[i], c->
options.pkcs11_protected_authentication[i],
746 c->
options.pkcs11_private_mode[i], c->
options.pkcs11_cert_private[i]);
758 strcpy(up.
username,
"Please insert your cryptographic token");
765 #ifdef ENABLE_SYSTEMD
770 sd_notifyf(0,
"READY=1\nSTATUS=Pre-connection initialization successful\nMAINPID=%lu",
771 (
unsigned long) getpid());
787 close_port_share(
void)
791 port_share_close(port_share);
797 init_port_share(
struct context *c)
799 if (!port_share && (c->
options.port_share_host && c->
options.port_share_port))
801 port_share = port_share_open(c->
options.port_share_host,
804 c->
options.port_share_journal_dir);
805 if (port_share == NULL)
807 msg(
M_FATAL,
"Fatal error: Port sharing failed");
821 crypto_init_dmalloc();
832 if (!gettimeofday(&tv, NULL))
834 const unsigned int seed = (
unsigned int) tv.tv_sec ^ tv.tv_usec;
845 #ifdef OPENVPN_DEBUG_COMMAND_LINE
848 for (i = 0; i < argc; ++i)
864 #ifdef IFCONFIG_POOL_TEST
865 ifconfig_pool_test(0x0A010004, 0x0A0100FF);
877 const char *fn = gen_path(
"foo",
886 #ifdef STATUS_PRINTF_TEST
895 msg(
M_WARN,
"STATUS_PRINTF_TEST: %s: write error", tmp_file);
905 mstats_open(
"/dev/shm/mstats.dat");
906 for (i = 0; i < 30; ++i)
908 mmap_stats->n_clients += 1;
909 mmap_stats->link_write_bytes += 8;
910 mmap_stats->link_read_bytes += 16;
934 #if defined(MEASURE_TLS_HANDSHAKE_STATS)
935 show_tls_performance_stats();
1027 msg(
M_USAGE,
"Using --genkey type with --secret filename is "
1028 "not supported. Use --genkey type filename instead.");
1036 msg(
M_USAGE,
"You must provide a filename to either --genkey "
1037 "or --secret, not both");
1046 msg(
M_WARN,
"WARNING: Using --genkey --secret filename is "
1047 "DEPRECATED. Use --genkey secret filename instead.");
1052 if (nbits_written < 0)
1058 "Randomly generated %d bit key written to %s", nbits_written,
1072 "--genkey tls-crypt-v2-client requires a server key to be set via --tls-crypt-v2 to create a client key");
1111 "options --mktun or --rmtun should only be used together with --dev");
1114 #if defined(ENABLE_DCO)
1126 msg(
M_WARN,
"Note: --mktun does not support DCO. Creating TUN interface.");
1133 #ifdef ENABLE_FEATURE_TUN_PERSIST
1145 "options --mktun and --rmtun are not available on your operating "
1146 "system. Please check 'man tun' (or 'tap'), whether your system "
1147 "supports using 'ifconfig %s create' / 'destroy' to create/remove "
1148 "persistent tunnel interfaces.",
options->
dev );
1162 #ifdef ENABLE_SYSTEMD
1164 if (sd_notify(0,
"READY=0") > 0)
1174 #if defined(__APPLE__) && defined(__clang__)
1175 #pragma clang diagnostic push
1176 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
1180 msg(
M_ERR,
"daemon() failed or unsupported");
1182 #if defined(__APPLE__) && defined(__clang__)
1183 #pragma clang diagnostic pop
1202 static const char why_not[] =
"will be delayed because of --client, --pull, or --up-delay";
1216 msg(
M_INFO,
"NOTE: chroot %s", why_not);
1231 msg(
M_INFO,
"NOTE: UID/GID downgrade %s", why_not);
1235 #ifdef ENABLE_MEMSTATS
1238 mstats_open(c->
options.memstats_fn);
1242 #ifdef ENABLE_SELINUX
1249 if (c->
options.selinux_context)
1253 if (-1 == setcon(c->
options.selinux_context))
1255 msg(
M_ERR,
"setcon to '%s' failed; is /proc accessible?", c->
options.selinux_context);
1264 msg(
M_INFO,
"NOTE: setcon %s", why_not);
1472 const char *gw = NULL;
1518 const char *gw = NULL;
1542 char *opt_list[] = {
"::/3",
"2000::/4",
"3000::/4",
"fc00::/7", NULL };
1545 for (i = 0; opt_list[i]; i++)
1573 static const char message[] =
"Initialization Sequence Completed";
1587 msg(
M_INFO,
"%s With Errors ( see http://openvpn.net/faq.html#dhcpclientserv )", message);
1589 #ifdef ENABLE_SYSTEMD
1590 sd_notifyf(0,
"STATUS=Failed to start up: %s With Errors\nERRNO=1", message);
1597 #ifdef ENABLE_SYSTEMD
1598 sd_notifyf(0,
"STATUS=%s", message);
1613 #ifdef ENABLE_MANAGEMENT
1617 in_addr_t *tun_local = NULL;
1618 struct in6_addr *tun_local6 = NULL;
1621 socklen_t sa_len =
sizeof(local);
1622 const char *detail =
"SUCCESS";
1630 #if defined(_WIN32) || defined(ENABLE_SITNL)
1633 detail =
"ROUTE_ERROR";
1639 remote = actual->
dest;
1641 #if ENABLE_IP_PKTINFO
1644 switch (local.
addr.
sa.sa_family)
1647 #if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST)
1648 local.
addr.
in4.sin_addr = actual->pi.in4.ipi_spec_dst;
1650 local.
addr.
in4.sin_addr = actual->pi.in4;
1655 local.
addr.
in6.sin6_addr = actual->pi.in6.ipi6_addr;
1701 #ifdef ENABLE_MANAGEMENT
1712 msg(
M_WARN,
"WARNING: route-up plugin call failed");
1780 #ifdef TARGET_ANDROID
1804 BOOL dns_only = !block_local;
1829 msg(
M_FATAL,
"WFP: deinitialization failed");
1844 #ifdef TARGET_ANDROID
1869 msg(
D_ROUTE,
"interactive service msg_channel=%" PRIuPTR,
1912 #ifdef TARGET_ANDROID
1972 msg(
M_INFO,
"Preserving previous TUN/TAP instance: %s",
2049 unsigned long adapter_index = 0;
2058 #ifdef ENABLE_MANAGEMENT
2194 msg(
D_DCO,
"Cannot set parameters for DCO peer (id=%u): %s",
2210 if (
buf_len(buf) > strlen(header))
2227 uint8_t line[1024] = { 0 };
2233 buf_printf(&out,
"Data Channel: cipher '%s'",
2238 buf_printf(&out,
"Data Channel: cipher '%s', auth '%s'",
2248 if (c->
c2.comp_context)
2250 buf_printf(&out,
", compression: '%s'", c->
c2.comp_context->alg.name);
2258 const char *header =
"Timers: ";
2299 if (
buf_len(&out) > strlen(header))
2305 header =
"Protocol options: ";
2333 if (
buf_len(&out) > strlen(header))
2350 struct frame *frame_fragment = NULL;
2351 #ifdef ENABLE_FRAGMENT
2372 do_up(
struct context *c,
bool pulled_options,
unsigned int option_types_found)
2374 int error_flags = 0;
2405 msg(
M_INFO,
"NOTE: Pulled options changed on restart, will need to close and reopen TUN/TAP device.");
2412 msg(
M_NONFATAL,
"dco-win doesn't yet support reopening TUN device");
2441 msg(
D_DCO,
"Cannot add peer to DCO: %s (%d)", strerror(-ret), ret);
2465 msg(
D_TLS_ERRORS,
"ERROR: Failed to apply P2P negotiated protocol options");
2473 msg(
D_TLS_ERRORS,
"ERROR: Failed to apply DCO keepalive or MSS fix parameters");
2518 unsigned int flags =
2566 "--data-ciphers-fallback not enabled. No usable "
2567 "data channel cipher");
2571 struct frame *frame_fragment = NULL;
2572 #ifdef ENABLE_FRAGMENT
2598 msg(
D_PUSH,
"OPTIONS IMPORT: --verb and/or --mute level changed");
2610 msg(
D_PUSH,
"OPTIONS IMPORT: --explicit-exit-notify can only be used with --proto udp");
2615 msg(
D_PUSH_DEBUG,
"OPTIONS IMPORT: explicit notify parm(s) modified");
2624 "settings that are not allowed and will result "
2625 "in a non-working connection. "
2626 "See also allow-compression in the manual.");
2631 comp_uninit(c->
c2.comp_context);
2638 msg(
D_PUSH,
"OPTIONS IMPORT: traffic shaper enabled");
2644 msg(
D_PUSH,
"OPTIONS IMPORT: --sndbuf/--rcvbuf options modified");
2650 msg(
D_PUSH,
"OPTIONS IMPORT: --socket-flags option modified");
2656 msg(
D_PUSH,
"OPTIONS IMPORT: --persist options modified");
2660 msg(
D_PUSH,
"OPTIONS IMPORT: --ifconfig/up options modified");
2664 msg(
D_PUSH,
"OPTIONS IMPORT: route options modified");
2668 msg(
D_PUSH,
"OPTIONS IMPORT: route-related options modified");
2672 msg(
D_PUSH,
"OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified");
2676 msg(
D_PUSH,
"OPTIONS IMPORT: environment modified");
2699 "with data channel offload. Use --disable-dco to connect to "
2716 "tun-mtu-max %d in the client configuration",
2732 #ifdef ENABLE_MANAGEMENT
2767 if (GREMLIN_CONNECTION_FLOOD_LEVEL(c->
options.gremlin))
2937 msg(
D_MTU_DEBUG,
"MTU: adding %zu buffer tailroom for compression for %zu "
2980 #ifdef ENABLE_PREDICTION_RESISTANCE
2981 if (c->
options.use_prediction_resistance)
2983 rand_ctx_enable_prediction_resistance();
3030 msg(
M_INFO,
"Re-using pre-shared static key");
3054 msg(
M_FATAL,
"ERROR: tls-auth enabled, but no valid --auth "
3063 "Control Channel Authentication",
"tls-auth",
3103 msg(
M_WARN,
"ERROR: tls-crypt-v2 client key too large to work with "
3104 "requested --max-packet-size %d, requires at least "
3105 "--max-packet-size %d. Packets will ignore requested "
3135 msg(
M_FATAL,
"Error: private key password verification failed");
3220 bool packet_id_long_form;
3249 if (packet_id_long_form)
3322 #ifdef ENABLE_X509ALTUSERNAME
3336 #ifdef ENABLE_MANAGEMENT
3359 #ifdef ENABLE_MANAGEMENT
3367 #ifdef HAVE_EXPORT_KEYING_MATERIAL
3368 if (
options->keying_material_exporter_label)
3454 "Control Channel MTU parms");
3464 "TLS-Auth MTU parms");
3484 "******* WARNING *******: All encryption and authentication features "
3485 "disabled -- All data will be tunnelled as clear text and will not be "
3486 "protected against man-in-the-middle changes. "
3487 "PLEASE DO RECONSIDER THIS CONFIGURATION!");
3525 #if defined(ENABLE_FRAGMENT)
3532 "WARNING: using --fragment and --mtu-test together may produce an inaccurate MTU test result");
3536 #ifdef ENABLE_FRAGMENT
3539 msg(
M_WARN,
"WARNING: if you use --mssfix and --fragment, you should "
3540 "set --fragment (%d) larger or equal than --mssfix (%d)",
3546 msg(
M_WARN,
"WARNING: if you use --mssfix and --fragment, you should "
3547 "use the \"mtu\" flag for both or none of of them.");
3559 msg(
M_WARN,
"WARNING: --ping should normally be used with --ping-restart or --ping-exit");
3563 #ifdef ENABLE_SELINUX
3564 || o->selinux_context
3570 msg(
M_WARN,
"WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail");
3576 msg(
M_WARN,
"WARNING: you are using chroot without specifying user and group -- this may cause the chroot jail to be insecure");
3581 msg(
M_WARN,
"WARNING: using --pull/--client and --ifconfig together is probably not what you want");
3586 msg(
M_WARN,
"NOTE: when bridging your LAN adapter with the TAP adapter, note that the new bridge adapter will often take on its own IP address that is different from what the LAN adapter was previously set to");
3593 msg(
M_WARN,
"WARNING: using --duplicate-cn and --client-config-dir together is probably not what you want");
3597 msg(
M_WARN,
"WARNING: --ifconfig-pool-persist will not work with --duplicate-cn");
3601 msg(
M_WARN,
"WARNING: --keepalive option is missing from server config");
3616 msg(
M_WARN,
"WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.");
3620 msg(
M_WARN,
"WARNING: --ns-cert-type is DEPRECATED. Use --remote-cert-tls instead.");
3628 msg(
M_WARN,
"NOTE: the current --script-security setting may allow this configuration to call user-defined scripts");
3632 msg(
M_WARN,
"WARNING: the current --script-security setting may allow passwords to be passed to scripts via environmental variables");
3636 msg(
M_WARN,
"NOTE: starting with " PACKAGE_NAME " 2.1, '--script-security 2' or higher is required to call user-defined scripts or executables");
3660 b->decompress_buf =
alloc_buf(buf_size);
3698 #ifdef ENABLE_FRAGMENT
3739 #ifdef ENABLE_FRAGMENT
3743 "Fragmentation MTU parms");
3766 msg(
D_SHOW_OCC,
"Expected Remote Options String (VER=%s): '%s'",
3945 #ifdef ENABLE_FRAGMENT
3966 bool need_us_timeout)
3968 unsigned int flags = 0;
3974 if (need_us_timeout)
4091 msg(
M_INFO,
"NOTE: --fast-io is disabled since we are running on Windows");
4095 msg(
M_INFO,
"NOTE: --fast-io is disabled since we are not using UDP");
4101 msg(
M_INFO,
"NOTE: --fast-io is disabled since we are using --shaper");
4125 #ifdef ENABLE_PLUGIN
4151 for (i = 0; i < config.
n; ++i)
4153 unsigned int option_types_found = 0;
4160 &option_types_found,
4197 #ifdef ENABLE_MANAGEMENT
4212 msg(msglevel,
"END");
4214 msg(msglevel,
"ERROR: Sorry, this command is currently only implemented on Windows");
4218 #ifdef TARGET_ANDROID
4220 management_callback_network_change(
void *arg,
bool samenetwork)
4262 #ifdef ENABLE_MANAGEMENT
4273 #ifdef TARGET_ANDROID
4274 cb.network_change = management_callback_network_change;
4283 #ifdef ENABLE_MANAGEMENT
4332 msg(
M_WARN,
"Signal received from management interface, exiting");
4360 #ifdef ENABLE_MANAGEMENT
4371 #ifdef ENABLE_MANAGEMENT
4493 #ifdef ENABLE_PLUGIN
4547 #ifdef ENABLE_FRAGMENT
4557 unsigned int crypto_flags = 0;
4597 #ifdef ENABLE_FRAGMENT
4615 int error_flags = 0;
4637 #ifdef ENABLE_PLUGIN
4674 #ifdef ENABLE_PLUGIN
4722 if (c->
c2.comp_context)
4724 comp_uninit(c->
c2.comp_context);
4725 c->
c2.comp_context = NULL;
4748 #ifdef ENABLE_MANAGEMENT
4755 #ifdef ENABLE_PLUGIN
4766 #ifdef ENABLE_FRAGMENT
4827 #ifdef ENABLE_PLUGIN
4909 dest->
c2.comp_context = NULL;
4950 unsigned int pid = 0;
4954 msg(
M_ERR,
"Open error on pid file %s", filename);
4959 fprintf(fp,
"%u\n", pid);
4962 msg(
M_ERR,
"Close error on pid file %s", filename);
const char * tls_crypt_file
struct status_output * status_open(const char *filename, const int refresh_freq, const int msglevel, const struct virtual_output *vout, const unsigned int flags)
struct openvpn_plugin_string_list * list[MAX_PLUGINS]
struct tuntap * init_tun(const char *dev, const char *dev_type, int topology, const char *ifconfig_local_parm, const char *ifconfig_remote_netmask_parm, const char *ifconfig_ipv6_local_parm, int ifconfig_ipv6_netbits_parm, const char *ifconfig_ipv6_remote_parm, struct addrinfo *local_public, struct addrinfo *remote_public, const bool strict_warn, struct env_set *es, openvpn_net_ctx_t *ctx, struct tuntap *tt)
static void do_close_ifconfig_pool_persist(struct context *c)
unsigned int pull_permission_mask(const struct context *c)
struct event_timeout route_wakeup
void tun_standby_init(struct tuntap *tt)
bool do_test_crypto(const struct options *o)
struct tls_auth_standalone * tls_auth_standalone
TLS state structure required for the initial authentication of a client's connection attempt.
enum genkey_type genkey_type
struct plugin_list * plugin_list_init(const struct plugin_option_list *list)
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)
static void do_close_plugins(struct context *c)
int write_key_file(const int nkeys, const char *filename)
Write nkeys 1024-bits keys to file.
volatile int signal_received
void do_ifconfig_setenv(const struct tuntap *tt, struct env_set *es)
static void do_init_server_poll_timeout(struct context *c)
void tls_init_control_channel_frame_parameters(struct frame *frame, int tls_mtu)
static void next_connection_entry(struct context *c)
#define CE_MAN_QUERY_REMOTE_MOD
union openvpn_sockaddr::@14 addr
struct verify_hash_list * verify_hash
#define OPENVPN_PLUGIN_UP
void tls_crypt_v2_init_server_key(struct key_ctx *key_ctx, bool encrypt, const char *key_file, bool key_inline)
Initialize a tls-crypt-v2 server key (used to encrypt/decrypt client keys).
const char * config_ncp_ciphers
void management_post_tunnel_open(struct management *man, const in_addr_t tun_local_ip)
static void do_close_tls(struct context *c)
void fragment_frame_init(struct fragment_master *f, const struct frame *frame)
Allocate internal packet buffers for a fragment_master structure.
void notnull(const char *arg, const char *description)
const char * verify_x509_name
struct static_challenge_info sc_info
#define OPENVPN_PLUGIN_DOWN
struct key2 original_wrap_keydata
original key data to be xored in to the key for dynamic tls-crypt.
const struct link_socket * accept_from
bool enable_ncp_fallback
If defined fall back to ciphername if NCP fails.
void add_route_ipv6_to_option_list(struct route_ipv6_option_list *l, const char *prefix, const char *gateway, const char *metric)
static struct gc_arena gc_new(void)
struct fragment_master * fragment_init(struct frame *frame)
Allocate and initialize a fragment_master structure.
void do_ifconfig(struct tuntap *tt, const char *ifname, int tun_mtu, const struct env_set *es, openvpn_net_ctx_t *ctx)
do_ifconfig - configure the tunnel interface
int connect_retry_seconds
int explicit_exit_notification
struct tls_multi * tls_multi
TLS state structure for this VPN tunnel.
bool open_management(struct context *c)
void fragment_free(struct fragment_master *f)
Free a fragment_master structure and its internal packet buffers.
static bool key_ctx_bi_defined(const struct key_ctx_bi *key)
struct context_persist persist
Persistent context.
int len
Length in bytes of the actual content within the allocated memory.
void restore_signal_state(void)
void frame_print(const struct frame *frame, int level, const char *prefix)
const char * socks_proxy_server
int set_lladdr(openvpn_net_ctx_t *ctx, const char *ifname, const char *lladdr, const struct env_set *es)
void open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt, openvpn_net_ctx_t *ctx)
static void init_connection_list(struct context *c)
void packet_id_init(struct packet_id *p, int seq_backtrack, int time_backtrack, const char *name, int unit)
bool management_hold(struct management *man, int holdtime)
bool tls_item_in_cipher_list(const char *item, const char *list)
Return true iff item is present in the colon-separated zero-terminated cipher list.
void init_query_passwords(const struct context *c)
Query for private key and auth-user-pass username/passwords.
void env_set_destroy(struct env_set *es)
const char * auth_token_secret_file
#define EVENT_METHOD_US_TIMEOUT
enum windows_driver_type windows_driver
char * options_string(const struct options *o, const struct frame *frame, struct tuntap *tt, openvpn_net_ctx_t *ctx, bool remote, struct gc_arena *gc)
struct tuntap * tuntap
Tun/tap virtual network interface.
bool tls_crypt_file_inline
static void set_check_status_error_delay(unsigned int milliseconds)
const char * proto2ascii(int proto, sa_family_t af, bool display_form)
int64_t inactivity_minimum_bytes
void packet_id_persist_load(struct packet_id_persist *p, const char *filename)
static void do_close_free_buf(struct context *c)
const struct buffer * tls_crypt_v2_wkc
Wrapped client key, sent to server.
static int occ_reset_op(void)
void management_sleep(const int n)
A sleep function that services the management layer for n seconds rather than doing nothing.
bool tuntap_owned
Whether the tun/tap interface should be cleaned up when this context is cleaned up.
static void do_open_status_output(struct context *c)
Contains all state information for one tunnel.
static void do_setup_fast_io(struct context *c)
bool management_open(struct management *man, const char *addr, const char *port, const char *pass_file, const char *client_user, const char *client_group, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size, const int remap_sigusr1, const unsigned int flags)
bool init_route_ipv6_list(struct route_ipv6_list *rl6, const struct route_ipv6_option_list *opt6, const char *remote_endpoint, int default_metric, const struct in6_addr *remote_host_ipv6, struct env_set *es, openvpn_net_ctx_t *ctx)
struct tls_session session[TM_SIZE]
Array of tls_session objects representing control channel sessions with the remote peer.
static int route_did_redirect_default_gateway(const struct route_list *rl)
struct key_ctx auth_token_key
struct link_socket_addr * lsa
struct event_timeout auth_token_renewal_interval
struct key_ctx auth_token_key
char username[USER_PASS_LEN]
long int get_random(void)
static void do_init_crypto_none(struct context *c)
static void do_print_data_channel_mtu_parms(struct context *c)
int status_file_update_freq
struct addrinfo * bind_local
struct plugin_list * plugins
List of plug-ins.
void tls_crypt_v2_init_client_key(struct key_ctx_bi *key, struct key2 *original_key, struct buffer *wkc_buf, const char *key_file, bool key_inline)
Initialize a tls-crypt-v2 client key.
static void plugin_return_init(struct plugin_return *pr)
void warn_on_use_of_common_subnets(openvpn_net_ctx_t *ctx)
const char * shared_secret_file
bool argv_printf_cat(struct argv *argres, const char *format,...)
printf() inspired argv concatenation.
bool tls_crypt_v2_force_cookie
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
static int openvpn_run_script(const struct argv *a, const struct env_set *es, const unsigned int flags, const char *hook)
Will run a script and return the exit code of the script if between 0 and 255, -1 otherwise.
bool print_openssl_info(const struct options *options)
void tls_crypt_v2_write_client_key_file(const char *filename, const char *b64_metadata, const char *server_key_file, bool server_key_inline)
Generate a tls-crypt-v2 client key, and write to file.
void argv_free(struct argv *a)
Frees all memory allocations allocated by the struct argv related functions.
#define X509_USERNAME_FIELD_DEFAULT
const char * client_crresponse_script
static bool link_socket_proto_connection_oriented(int proto)
bool set_debug_level(const int level, const unsigned int flags)
const char * special_state_msg
static void do_close_fragment(struct context *c)
@ GENKEY_TLS_CRYPTV2_CLIENT
hmac_ctx_t * session_id_hmac_init(void)
const char * dev_type_string(const char *dev, const char *dev_type)
void plugin_list_open(struct plugin_list *pl, const struct plugin_option_list *list, struct plugin_return *pr, const struct env_set *es, const int init_point)
void init_instance(struct context *c, const struct env_set *env, const unsigned int flags)
bool(* remote_cmd)(void *arg, const char **p)
const char * remote_cert_eku
int tailroom
the tailroom in the buffer.
void reset_coarse_timers(struct context *c)
static void packet_id_persist_init(struct packet_id_persist *p)
struct event_timeout inactivity_interval
void show_available_ciphers(void)
struct context_0 * c0
Level 0 context.
void buf_clear(struct buffer *buf)
#define CE_MAN_QUERY_PROXY
static void do_close_tun(struct context *c, bool force)
#define CO_FORCE_TLSCRYPTV2_COOKIE
Bit-flag indicating that we do not allow clients that do not support resending the wrapped client key...
struct connection_entry ce
struct addrinfo * current_remote
void env_set_inherit(struct env_set *es, const struct env_set *src)
static void do_close_free_key_schedule(struct context *c, bool free_ssl_ctx)
struct context_buffers * buffers
hash_algo_type verify_hash_algo
void context_gc_free(struct context *c)
void set_check_status(unsigned int info_level, unsigned int verbose_level)
size_t frame_calculate_protocol_header_size(const struct key_type *kt, const struct options *options, bool occ)
Calculates the size of the OpenVPN protocol header.
const char * genkey_extra_data
static bool management_callback_send_cc_message(void *arg, const char *command, const char *parameters)
This method sends a custom control channel message.
static void event_timeout_init(struct event_timeout *et, interval_t n, const time_t last)
Initialises a timer struct.
struct context_buffers * init_context_buffers(const struct frame *frame)
struct event_timeout route_wakeup_expire
struct buffer decrypt_buf
void argv_parse_cmd(struct argv *argres, const char *cmdstr)
Parses a command string, tokenizes it and puts each element into a separate struct argv argument slot...
static bool options_hash_changed_or_zero(const struct sha256_digest *a, const struct sha256_digest *b)
Helper for do_up().
static bool proto_is_dgram(int proto)
Return if the protocol is datagram (UDP)
md_ctx_t * pulled_options_state
void socks_proxy_close(struct socks_proxy_info *sp)
struct tls_wrap_ctx tls_wrap
TLS handshake wrapping state.
const char * config_ciphername
void window_title_save(struct window_title *wt)
static void do_inherit_plugins(struct context *c, const struct context *src)
static void do_close_packet_id(struct context *c)
const char * cipher_kt_name(const char *ciphername)
Retrieve a normalised string describing the cipher (e.g.
const char * tls_export_peer_cert_dir
interval_t renegotiate_seconds
int mode
Role of this context within the OpenVPN process.
void reset_check_status(void)
bool do_up(struct context *c, bool pulled_options, unsigned int option_types_found)
int tls_crypt_buf_overhead(void)
Returns the maximum overhead (in bytes) added to the destination buffer by tls_crypt_wrap().
struct link_socket_info * link_socket_info
This variable is used instead link_socket->info for P2MP UDP childs.
#define STATUS_OUTPUT_WRITE
Packet geometry parameters.
#define IFCONFIG_AFTER_TUN_OPEN
void setenv_routes_ipv6(struct env_set *es, const struct route_ipv6_list *rl6)
static void key_schedule_free(struct key_schedule *ks, bool free_ssl_ctx)
void setenv_int(struct env_set *es, const char *name, int value)
void interval_init(struct interval *top, int horizon, int refresh)
bool block_local_needed(const struct route_list *rl)
Get the decision whether to block traffic to local networks while the VPN is connected.
void management_show_net_callback(void *arg, const int msglevel)
#define GET_USER_PASS_MANAGEMENT
static void del_wfp_block(struct context *c, unsigned long adapter_index)
Remove any WFP block filters previously added.
void crypto_read_openvpn_key(const struct key_type *key_type, struct key_ctx_bi *ctx, const char *key_file, bool key_inline, const int key_direction, const char *key_name, const char *opt_name, struct key2 *keydata)
static void do_inherit_env(struct context *c, const struct env_set *src)
void management_notify_generic(struct management *man, const char *str)
unsigned int auth_token_renewal
struct route_ipv6_option_list * routes_ipv6
static int route_order(void)
static void do_init_route_ipv6_list(const struct options *options, struct route_ipv6_list *route_ipv6_list, const struct link_socket_info *link_socket_info, struct env_set *es, openvpn_net_ctx_t *ctx)
void show_available_tls_ciphers(const char *cipher_list, const char *cipher_list_tls13, const char *tls_cert_profile)
struct event_timeout occ_interval
static const char * np(const char *str)
struct key_ctx_bi tls_wrap_key
const char * tls_cert_profile
static void do_init_crypto_static(struct context *c, const unsigned int flags)
static int plugin_call(const struct plugin_list *pl, const int type, const struct argv *av, struct plugin_return *pr, struct env_set *es)
bool auth_token_generate
Generate auth-tokens on successful user/pass auth,seet via options->auth_token_generate.
Level 0 context containing information related to the OpenVPN process.
struct route_list * route_list
List of routing information.
struct event_timeout wait_for_connect
static bool is_tun_type_set(const struct tuntap *tt)
void test_crypto(struct crypto_options *co, struct frame *frame)
bool auth_user_pass_file_inline
void man_persist_client_stats(struct management *man, struct context *c)
static void do_init_first_time(struct context *c)
enum multi_status multi_state
struct context_2 c2
Level 2 context.
const char * cipher_list_tls13
struct ifconfig_pool_persist * ifconfig_pool_persist_init(const char *filename, int refresh_freq)
void free_key_ctx_bi(struct key_ctx_bi *ctx)
static void do_close_tun_simple(struct context *c)
#define TM_ACTIVE
Active tls_session.
struct tls_root_ctx ssl_ctx
static void do_init_route_list(const struct options *options, struct route_list *route_list, const struct link_socket_info *link_socket_info, struct env_set *es, openvpn_net_ctx_t *ctx)
char * string_alloc(const char *str, struct gc_arena *gc)
struct gc_arena gc
Garbage collection arena for allocations done in the level 2 scope of this context_2 structure.
static void do_compute_occ_strings(struct context *c)
const char * socks_proxy_port
struct crypto_options opt
Crypto state.
@ CAS_RECONNECT_PENDING
session has already successful established (CAS_CONNECT_DONE) but has a reconnect and needs to redo s...
#define OPENVPN_PLUGIN_INIT_POST_DAEMON
struct in6_addr local_ipv6
const char * management_port
struct key_ctx tls_crypt_v2_server_key
Decrypts client keys.
void string_clear(char *str)
struct remote_host_store * rh_store
int connect_retry_seconds_max
static bool ce_management_query_remote(struct context *c)
const char * auth_user_pass_file
#define PULL_DEFINED(opt)
struct tls_root_ctx ssl_ctx
struct verify_hash_list * verify_hash
struct key_ctx tls_crypt_v2_server_key
struct gc_arena gc
Garbage collection arena for allocations done in the scope of this context structure.
#define OPENVPN_PLUGIN_INIT_PRE_DAEMON
const char * md_kt_name(const char *mdname)
Retrieve a string describing the digest digest (e.g.
openvpn_net_ctx_t * net_ctx
void packet_id_persist_save(struct packet_id_persist *p)
const struct x509_track * x509_track
#define CE_MAN_QUERY_REMOTE_SKIP
const struct x509_track * x509_track
enum windows_driver_type windows_driver
struct link_socket_addr link_socket_addr
Local and remote addresses on the external network.
bool shared_secret_file_inline
static void init_proxy(struct context *c)
const char * management_client_group
static void do_link_socket_new(struct context *c)
struct key_type tls_auth_key_type
void delete_routes(struct route_list *rl, struct route_ipv6_list *rl6, const struct tuntap *tt, unsigned int flags, const struct env_set *es, openvpn_net_ctx_t *ctx)
bool plugins_owned
Whether the plug-ins should be cleaned up when this context is cleaned up.
void open_plugins(struct context *c, const bool import_options, int init_point)
struct socks_proxy_info * socks_proxy
int ifconfig_ipv6_netbits
const char * export_peer_cert_dir
void management_notify_client_close(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
const char * digest
Message digest static parameters.
int extra_tun
Maximum number of bytes in excess of the tun/tap MTU that might be read from or written to the virtua...
struct compress_options comp
int payload_size
the maximum size that a payload that our buffers can hold from either tun device or network link.
unsigned int imported_protocol_flags
static unsigned int management_callback_remote_entry_count(void *arg)
#define OPT_P_NCP
Negotiable crypto parameters.
bool auth_user_pass_verify_script_via_file
void plugin_list_close(struct plugin_list *pl)
static void update_time(void)
struct tuntap_options options
struct buffer work
Work buffer (only for –tls-crypt)
int push_peer_info_detail
The detail of info we push in peer info.
bool tls_ctx_initialised(struct tls_root_ctx *ctx)
Checks whether the given TLS context is initialised.
const char * tls_crypt_v2_file
bool ovpn_dco_init(int mode, dco_context_t *dco)
bool first_time
True on the first iteration of OpenVPN's main loop.
void plugin_return_free(struct plugin_return *pr)
static bool do_open_tun(struct context *c, int *error_flags)
void init_management_callback_p2p(struct context *c)
void md_ctx_cleanup(md_ctx_t *ctx)
void frame_calculate_dynamic(struct frame *frame, struct key_type *kt, const struct options *options, struct link_socket_info *lsi)
Set the –mssfix option.
int management_state_buffer_size
#define CE_MAN_QUERY_REMOTE_MASK
#define CE_MAN_QUERY_REMOTE_ACCEPT
void close_instance(struct context *c)
void enable_auth_user_pass(void)
struct plugin_list * plugin_list_inherit(const struct plugin_list *src)
const char * tls_auth_file
static bool management_callback_remote_cmd(void *arg, const char **p)
bool tls_crypt_v2_file_inline
#define ALLOC_OBJ_CLEAR_GC(dptr, type, gc)
void init_verb_mute(struct context *c, unsigned int flags)
struct management * management_init(void)
#define OPENVPN_PLUGIN_ROUTE_UP
#define LS_MODE_TCP_ACCEPT_FROM
struct options options
Options loaded from command line or configuration file.
struct route_ipv6_list * route_ipv6_list
static bool management_callback_remote_entry_get(void *arg, unsigned int index, char **remote)
bool tls_crypt_v2_file_inline
const char * route_predown_script
bool do_deferred_options(struct context *c, const unsigned int found)
bool tls_auth_file_inline
bool auth_token_secret_file_inline
struct event_timeout ping_send_interval
static void add_delim_if_non_empty(struct buffer *buf, const char *header)
Helper function for tls_print_deferred_options_results Adds the ", " delimitor if there already some ...
void status_printf(struct status_output *so, const char *format,...)
const char * tls_crypt_v2_file
#define CO_MUTE_REPLAY_WARNINGS
Bit-flag indicating not to display replay warnings.
#define OPENVPN_STATE_CONNECTING
#define IFCONFIG_BEFORE_TUN_OPEN
bool auth_user_pass_file_inline
static void frame_finalize_options(struct context *c, const struct options *o)
void tls_ctx_free(struct tls_root_ctx *ctx)
Frees the library-specific TLSv1 context.
int dco_peer_id
This is the handle that DCO uses to identify this session with the kernel.
unsigned int(* remote_entry_count)(void *arg)
static void do_env_set_destroy(struct context *c)
void options_string_import(struct options *options, const char *config, const int msglevel, const unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
const char * verify_command
const char * management_addr
const char * tls_crypt_v2_verify_script
static bool can_preserve_tun(struct tuntap *tt)
#define PRE_PULL_INITIAL_PING_RESTART
static int dco_p2p_add_new_peer(struct context *c)
#define CF_INIT_TLS_MULTI
void write_pid_file(const char *filename, const char *chroot_dir)
#define OCC_MTU_LOAD_INTERVAL_SECONDS
struct platform_state_group platform_state_group
#define OPENVPN_PLUGIN_INIT_POST_UID_CHANGE
static bool get_user_pass(struct user_pass *up, const char *auth_file, const char *prefix, const unsigned int flags)
Retrieves the user credentials from various sources depending on the flags.
void(* show_net)(void *arg, const int msglevel)
static void gc_detach(struct gc_arena *a)
const char * guess_tuntap_dev(const char *dev, const char *dev_type, const char *dev_node, struct gc_arena *gc)
static void do_startup_pause(struct context *c)
const struct in6_addr * link_socket_current_remote_ipv6(const struct link_socket_info *info)
struct frame frame_fragment
bool did_we_daemonize
Whether demonization has already taken place.
bool cipher_kt_mode_aead(const char *ciphername)
Check if the supplied cipher is a supported AEAD mode cipher.
int renegotiate_seconds_min
const char * format_common_name(struct context *c, struct gc_arena *gc)
hmac_ctx_t * session_id_hmac
the HMAC we use to generate and verify our syn cookie like session ids from the server.
void management_up_down(struct management *man, const char *updown, const struct env_set *es)
bool win_wfp_block(const NET_IFINDEX index, const HANDLE msg_channel, BOOL dns_only)
void tls_crypt_init_key(struct key_ctx_bi *key, struct key2 *keydata, const char *key_file, bool key_inline, bool tls_server)
Initialize a key_ctx_bi structure for use with –tls-crypt.
static void dco_remove_peer(struct context *c)
static struct link_socket_info * get_link_socket_info(struct context *c)
#define CE_MAN_QUERY_REMOTE_SHIFT
const char * client_crresponse_script
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...
bool tls_session_update_crypto_params(struct tls_multi *multi, struct tls_session *session, struct options *options, struct frame *frame, struct frame *frame_fragment, struct link_socket_info *lsi)
Update TLS session crypto parameters (cipher and auth) and derive data channel keys based on the supp...
Wrapper structure for dynamically allocated memory.
@ GENKEY_TLS_CRYPTV2_SERVER
void pre_setup(const struct options *options)
#define TLS_MULTI_HORIZON
static bool proto_is_udp(int proto)
Returns if the protocol being used is UDP.
const char * verify_x509_name
static struct context * static_context
#define DCO_DEFAULT_METRIC
static bool p2p_set_dco_keepalive(struct context *c)
static void do_close_status_output(struct context *c)
static void clear_remote_addrlist(struct link_socket_addr *lsa, bool free)
const char * route_ipv6_default_gateway
#define LS_MODE_TCP_LISTEN
static void tls_print_deferred_options_results(struct context *c)
Prints the results of options imported for the data channel.
int dco_set_peer(dco_context_t *dco, unsigned int peerid, int keepalive_interval, int keepalive_timeout, int mss)
#define WSO_FORCE_CONSOLE
const char * exit_event_name
char * options_string_remote
static bool plugin_return_defined(const struct plugin_return *pr)
void close_tun(struct tuntap *tt, openvpn_net_ctx_t *ctx)
bool set_mute_cutoff(const int cutoff)
#define CO_USE_DYNAMIC_TLS_CRYPT
Bit-flag indicating that renegotiations are using tls-crypt with a TLS-EKM derived key.
void window_title_generate(const char *title)
struct link_socket_info info
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)
unsigned remote_cert_ku[MAX_PARMS]
static void do_uid_gid_chroot(struct context *c, bool no_delay)
void init_management(void)
char * x509_username_field[2]
void show_available_engines(void)
struct link_socket_actual actual
void pre_init_signal_catch(void)
void auth_token_write_server_key_file(const char *filename)
Generate a auth-token server secret key, and write to file.
struct event_set * event_set
bool link_socket_update_flags(struct link_socket *ls, unsigned int sockflags)
struct buffer read_link_buf
Security parameter state of a single session within a VPN tunnel.
struct env_set * env_set_create(struct gc_arena *gc)
void(* status)(void *arg, const int version, struct status_output *so)
#define EVENT_METHOD_FAST
void management_event_loop_n_seconds(struct management *man, int sec)
struct http_proxy_options * init_http_proxy_options_once(struct http_proxy_options **hpo, struct gc_arena *gc)
void show_adapters(int msglev)
bool status_close(struct status_output *so)
struct link_socket * link_socket
static void init_crypto_pre(struct context *c, const unsigned int flags)
bool server_bridge_proxy_dhcp
static void do_init_fragment(struct context *c)
const struct static_challenge_info * sci
static void do_init_frame(struct context *c)
int restart_sleep_seconds
unsigned int management_flags
void show_available_digests(void)
int management_echo_buffer_size
unsigned int unsuccessful_attempts
struct connection_entry ** array
void inherit_context_child(struct context *dest, const struct context *src)
static void add_wfp_block(struct context *c)
Add WFP filters to block traffic to local networks.
bool cipher_kt_mode_ofb_cfb(const char *ciphername)
Check if the supplied cipher is a supported OFB or CFB mode cipher.
void show_routes(int msglev)
void tls_auth_standalone_free(struct tls_auth_standalone *tas)
Frees a standalone tls-auth verification object.
const char * auth_user_pass_file
bool ifconfig_pool_persist_owned
hash_algo_type verify_hash_algo
const char * client_config_dir
struct http_proxy_info * http_proxy
Garbage collection arena used to keep track of dynamically allocated memory.
const char * genkey_filename
const char * auth_user_pass_verify_script
struct signal_info * sig
Internal error signaling object.
void context_clear_2(struct context *c)
bool(* remote_entry_get)(void *arg, unsigned int index, char **remote)
void setenv_str(struct env_set *es, const char *name, const char *value)
#define MODE_POINT_TO_POINT
static void buf_set_write(struct buffer *buf, uint8_t *data, int size)
struct buffer tls_crypt_v2_wkc
Wrapped client key.
void fork_register_dns_action(struct tuntap *tt)
const char * cipher
const name of the cipher
bool do_genkey(const struct options *options)
int daemon(int nochdir, int noclose)
bool auth_token_call_auth
bool possibly_become_daemon(const struct options *options)
#define P2P_ERROR_DELAY_MS
void pem_password_setup(const char *auth_file)
bool check_compression_settings_valid(struct compress_options *info, int msglevel)
Checks if the compression settings are valid.
struct http_proxy_options * http_proxy_options
void init_tun_post(struct tuntap *tt, const struct frame *frame, const struct tuntap_options *options)
struct tls_auth_standalone * tls_auth_standalone_init(struct tls_options *tls_options, struct gc_arena *gc)
static void strncpynt(char *dest, const char *src, size_t maxlen)
void tls_multi_free(struct tls_multi *multi, bool clear)
Cleanup a tls_multi structure and free associated memory allocations.
struct event_timeout occ_mtu_load_test_interval
void uninit_management_callback(void)
static void do_alloc_route_list(struct context *c)
void ifconfig_pool_persist_close(struct ifconfig_pool_persist *persist)
struct man_def_auth_context * mda_context
unsigned int auth_token_lifetime
#define CE_MAN_QUERY_REMOTE_QUERY
struct plugin_option_list * plugin_list
struct argv argv_new(void)
Allocates a new struct argv and ensures it is initialised.
void inherit_context_top(struct context *dest, const struct context *src)
bool priv_key_file_inline
void free_context_buffers(struct context_buffers *b)
static void update_options_ce_post(struct options *options)
static bool dco_enabled(const struct options *o)
Returns whether the current configuration has dco enabled.
bool argv_printf(struct argv *argres, const char *format,...)
printf() variant which populates a struct argv.
struct tls_wrap_ctx tls_wrap
void free_buf(struct buffer *buf)
void free_key_ctx(struct key_ctx *ctx)
const char * client_config_dir_exclusive
unsigned int crypto_max_overhead(void)
Return the worst-case OpenVPN crypto overhead (in bytes)
static void do_init_crypto_tls_c1(struct context *c)
static bool check_debug_level(unsigned int level)
struct env_set * es
Set of environment variables.
void plugin_return_get_column(const struct plugin_return *src, struct plugin_return *dest, const char *colname)
int management_log_history_cache
void options_detach(struct options *o)
#define CC_HARD_USR1_TO_HUP
void shaper_msg(struct shaper *s)
const char * socks_proxy_authfile
void management_pre_tunnel_close(struct management *man)
static void event_free(struct event_set *es)
struct event_timeout packet_id_persist_interval
void tls_multi_init_finalize(struct tls_multi *multi, int tls_mtu)
Finalize initialization of a tls_multi structure.
bool(* send_cc_message)(void *arg, const char *message, const char *parameter)
static bool management_query_proxy_enabled(const struct management *man)
void md_ctx_free(md_ctx_t *ctx)
static void run_up_down(const char *command, const struct plugin_list *plugins, int plugin_type, const char *arg, DWORD adapter_index, const char *dev_type, int tun_mtu, const char *ifconfig_local, const char *ifconfig_remote, const char *context, const char *signal_text, const char *script_type, struct env_set *es)
struct tls_multi * tls_multi_init(struct tls_options *tls_options)
Allocate and initialize a tls_multi structure.
static int buf_len(const struct buffer *buf)
static void * test_crypto_thread(void *arg)
bool exit_event_initial_state
static void do_open_ifconfig_pool_persist(struct context *c)
#define CF_INIT_TLS_AUTH_STANDALONE
void link_socket_init_phase1(struct context *c, int mode)
bool connection_established
struct man_def_auth_context mda_context
static void uninit_proxy(struct context *c)
uint16_t mss_fix
The actual MSS value that should be written to the payload packets.
void set_std_files_to_null(bool stdin_only)
static bool addr_defined(const struct openvpn_sockaddr *addr)
void init_instance_handle_signals(struct context *c, const struct env_set *env, const unsigned int flags)
bool(* proxy_cmd)(void *arg, const char **p)
#define ROUTE_OPTION_FLAGS(o)
struct fragment_master * fragment
static int max_int(int x, int y)
static void uninit_proxy_dowork(struct context *c)
void ssl_purge_auth(const bool auth_user_pass_only)
static void do_init_crypto(struct context *c, const unsigned int flags)
void init_options_dev(struct options *options)
const char * tls_crypt_v2_verify_script
const char * key_pass_file
static SERVICE_STATUS status
bool do_route(const struct options *options, struct route_list *route_list, struct route_ipv6_list *route_ipv6_list, const struct tuntap *tt, const struct plugin_list *plugins, struct env_set *es, openvpn_net_ctx_t *ctx)
bool tun_mtu_extra_defined
#define OPENVPN_STATE_CONNECTED
const char * packet_id_file
#define CO_PACKET_ID_LONG_FORM
Bit-flag indicating whether to use OpenVPN's long packet ID format.
void packet_id_persist_load_obj(const struct packet_id_persist *p, struct packet_id *pid)
static int min_int(int x, int y)
static void gc_free(struct gc_arena *a)
struct key2 original_wrap_keydata
original tls-crypt key preserved to xored into the tls_crypt renegotiation key
struct event_set * event_set_init(int *maxevents, unsigned int flags)
#define WSO_FORCE_SERVICE
static const char * saved_pid_file_name
int tun_max_mtu
the maximum tun-mtu size the buffers are are sized for.
static void do_close_link_socket(struct context *c)
bool check_pull_client_ncp(struct context *c, const int found)
Checks whether the cipher negotiation is in an acceptable state and we continue to connect or should ...
struct connection_list * connection_list
struct socks_proxy_info * socks_proxy_new(const char *server, const char *port, const char *authfile)
static void do_signal_on_tls_errors(struct context *c)
const char * ifconfig_remote_netmask
void show_available_curves(void)
struct route_option_list * routes
#define GET_USER_PASS_NEED_OK
static void init_proxy_dowork(struct context *c)
void management_close(struct management *man)
struct crypto_options crypto_options
Security parameters and crypto state used by the Data Channel Crypto module to process data channel p...
#define ALLOC_OBJ_CLEAR(dptr, type)
struct link_socket * link_socket_new(void)
struct key_ctx_bi key_ctx_bi
OpenSSL cipher and HMAC contexts for both sending and receiving directions.
struct sha256_digest pulled_options_digest
struct sha256_digest pulled_options_digest_save
Hash of option strings received from the remote OpenVPN server.
struct buffer encrypt_buf
void argv_msg(const int msglev, const struct argv *a)
Write the arguments stored in a struct argv via the msg() command.
#define SHAPER_DEFINED(opt)
bool do_persist_tuntap(struct options *options, openvpn_net_ctx_t *ctx)
struct platform_state_user platform_state_user
struct status_output * status_output
#define OPENVPN_PLUGIN_FUNC_SUCCESS
static void do_init_tls_wrap_key(struct context *c)
void do_preresolve(struct context *c)
void init_plugins(struct context *c)
bool win_wfp_uninit(const NET_IFINDEX index, const HANDLE msg_channel)
static int ifconfig_order(void)
struct ifconfig_pool_persist * ifconfig_pool_persist
unsigned int crypto_flags
static void gc_init(struct gc_arena *a)
const char * ifconfig_pool_persist_filename
#define OCC_INTERVAL_SECONDS
bool auth_user_pass_verify_script_via_file
struct packet_id_persist pid_persist
void context_clear(struct context *c)
static void socket_restart_pause(struct context *c)
const char * options_string_version(const char *s, struct gc_arena *gc)
static bool do_deferred_options_part2(struct context *c)
This function is expected to be invoked after open_tun() was performed.
void management_set_callback(struct management *man, const struct management_callback *cb)
bool mute_replay_warnings
void management_clear_callback(struct management *man)
#define IA_EMPTY_IF_UNDEF
in_addr_t link_socket_current_remote(const struct link_socket_info *info)
interval_t packet_timeout
static void do_init_buffers(struct context *c)
unsigned remote_cert_ku[MAX_PARMS]
#define OPENVPN_PLUGIN_ROUTE_PREDOWN
const char * ifconfig_ipv6_local
void link_socket_update_buffer_sizes(struct link_socket *ls, int rcvbuf, int sndbuf)
char password[USER_PASS_LEN]
static void check_malloc_return(void *p)
struct event_timeout server_poll_interval
void print_status(struct context *c, struct status_output *so)
void init_key_type(struct key_type *kt, const char *ciphername, const char *authname, bool tls_mode, bool warn)
Initialize a key_type structure with.
static void do_init_traffic_shaper(struct context *c)
void pre_connect_restore(struct options *o, struct gc_arena *gc)
bool md_valid(const char *digest)
Return if a message digest parameters is valid given the name of the digest.
bool plugin_defined(const struct plugin_list *pl, const int type)
Wrapper struct to pass around SHA256 digests.
struct packet_id packet_id
Current packet ID state for both sending and receiving directions.
char * options_string_local
static size_t get_frame_mtu(struct context *c, const struct options *o)
struct event_timeout session_interval
void tuncfg(const char *dev, const char *dev_type, const char *dev_node, int persist_mode, const char *username, const char *groupname, const struct tuntap_options *options, openvpn_net_ctx_t *ctx)
#define CF_LOAD_PERSISTED_PACKET_ID
static bool management_callback_proxy_cmd(void *arg, const char **p)
void win32_signal_open(struct win32_signal *ws, int force, const char *exit_event_name, bool exit_event_initial_state)
#define OPT_P_ROUTE_EXTRAS
struct openvpn_sockaddr dest
static void event_timeout_clear(struct event_timeout *et)
Clears the timeout and reset all values to 0.
void remap_signal(struct context *c)
static void do_init_tun(struct context *c)
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.
void crypto_init_lib_engine(const char *engine_name)
unsigned int flags
Bit-flags determining behavior of security operation functions.
void tls_multi_init_set_options(struct tls_multi *multi, const char *local, const char *remote)
void auth_user_pass_setup(const char *auth_file, bool is_inline, const struct static_challenge_info *sci)
struct buffer read_tun_buf
const char * route_script
#define CO_USE_TLS_KEY_MATERIAL_EXPORT
Bit-flag indicating that data channel key derivation is done using TLS keying material export [RFC570...
static bool do_hold(int holdtime)
struct tuntap_options tuntap_options
void context_clear_1(struct context *c)
void post_init_signal_catch(void)
static void do_event_set_init(struct context *c, bool need_us_timeout)
struct buffer alloc_buf(size_t size)
struct packet_id_persist * pid_persist
Persistent packet ID state for keeping state between successive OpenVPN process startups.
const char * ifconfig_local
struct event_timeout ping_rec_interval
void packet_id_free(struct packet_id *p)
int ping_rec_timeout_action
static void do_init_crypto_tls(struct context *c, const unsigned int flags)
const char * management_client_user
enum tls_wrap_ctx::@17 mode
Control channel wrapping mode.
time_t coarse_timer_wakeup
void packet_id_persist_close(struct packet_id_persist *p)
void context_clear_all_except_first_time(struct context *c)
void setenv_routes(struct env_set *es, const struct route_list *rl)
#define OPT_P_EXPLICIT_NOTIFY
const char title_string[]
static bool ce_management_query_proxy(struct context *c)
const char * get_p2p_ncp_cipher(struct tls_session *session, const char *peer_info, struct gc_arena *gc)
Determines the best common cipher from both peers IV_CIPHER lists.
bool auth_token_call_auth
always call normal authentication
struct http_proxy_info * http_proxy_new(const struct http_proxy_options *o)
#define CO_USE_CC_EXIT_NOTIFY
Bit-flag indicating that explicit exit notifies should be sent via the control channel instead of usi...
bool add_routes(struct route_list *rl, struct route_ipv6_list *rl6, const struct tuntap *tt, unsigned int flags, const struct env_set *es, openvpn_net_ctx_t *ctx)
static void do_close_event_set(struct context *c)
void remove_pid_file(void)
bool dco_enabled
Whether keys have to be installed in DCO or not.
void context_init_1(struct context *c)
const char * auth_user_pass_verify_script
void undo_ifconfig(struct tuntap *tt, openvpn_net_ctx_t *ctx)
undo_ifconfig - undo configuration of the tunnel interface
static void do_init_frame_tls(struct context *c)
void link_socket_init_phase2(struct context *c)
bool init_route_list(struct route_list *rl, const struct route_option_list *opt, const char *remote_endpoint, int default_metric, in_addr_t remote_host, struct env_set *es, openvpn_net_ctx_t *ctx)
int ifconfig_pool_persist_refresh_freq
int tun_mtu
the (user) configured tun-mtu.
void persist_client_stats(struct context *c)
const char * ifconfig_ipv6_remote
void link_socket_close(struct link_socket *sock)
static bool dco_check_pull_options(int msglevel, const struct options *o)
bool buf_printf(struct buffer *buf, const char *format,...)
struct key_ctx_bi static_key
bool server_bridge_defined
static bool management_query_remote_enabled(const struct management *man)
static void do_init_timers(struct context *c, bool deferred)
void init_ssl(const struct options *options, struct tls_root_ctx *new_ctx, bool in_chroot)
Build master SSL context object that serves for the whole of OpenVPN instantiation.
static void do_option_warnings(struct context *c)
int script_security(void)
void initialization_sequence_completed(struct context *c, const unsigned int flags)
int headroom
the headroom in the buffer, this is choosen to allow all potential header to be added before the pack...
#define ALLOC_OBJ_GC(dptr, type, gc)
static void shaper_init(struct shaper *s, int bytes_per_second)
const struct plugin_list * plugins
#define TLS_MULTI_REFRESH
static bool tuntap_is_dco_win(struct tuntap *tt)
const char * management_user_pass
#define NS_CERT_CHECK_SERVER
Do not perform Netscape certificate type verification.
struct addrinfo * remote_list
const char * remote_cert_eku
char * basename(char *filename)
struct context_1 c1
Level 1 context.
void tls_crypt_v2_write_server_key_file(const char *filename)
Generate a tls-crypt-v2 server key, and write to file.
const char * tls_common_name(const struct tls_multi *multi, const bool null)
Returns the common name field for the given tunnel.
void close_context(struct context *c, int sig, unsigned int flags)
int dev_type_enum(const char *dev, const char *dev_type)
struct man_persist persist
static bool do_deferred_p2p_ncp(struct context *c)
const char * signal_description(const int signum, const char *sigtext)
void http_proxy_close(struct http_proxy_info *hp)
static void management_callback_status_p2p(void *arg, const int version, struct status_output *so)
bool send_control_channel_string(struct context *c, const char *str, int msglevel)
const char * route_default_gateway
void close_management(void)
openvpn_net_ctx_t net_ctx
Networking API opaque context.