33#ifdef HAVE_CONFIG_VERSION_H
34#include "config-version.h"
71#ifdef CONFIGURE_GIT_REVISION
72 " [git:" CONFIGURE_GIT_REVISION CONFIGURE_GIT_FLAGS
"]"
75#if defined(ENABLE_CRYPTO_MBEDTLS)
77#elif defined(ENABLE_CRYPTO_OPENSSL)
89#ifdef ENABLE_COMP_STUB
96#ifdef PRODUCT_TAP_DEBUG
103#if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST)
105#elif defined(IP_RECVDSTADDR)
113#ifdef CONFIGURE_GIT_REVISION
114 " built on " __DATE__
124 "--config file : Read configuration options from file.\n"
125 "--help : Show options.\n"
126 "--version : Show copyright and version information.\n"
129 "--local host|* [port]: Local host name or IP address and port for bind.\n"
130 " If specified, OpenVPN will bindto this address. If unspecified,\n"
131 " OpenVPN will bind to all interfaces. '*' can be used as hostname\n"
132 " and means 'any host' (OpenVPN will listen on what is returned by the OS).\n"
133 " On a client, or in point-to-point mode, this can only be specified once (1 socket).\n"
134 " On an OpenVPN setup running as ``--server``, this can be specified multiple times\n"
135 " to open multiple listening sockets on different addresses and/or different ports.\n"
136 " In order to specify multiple listen ports without specifying an address, use '*'\n"
137 " to signal 'use what the operating system gives you as default', for\n"
138 " 'all IPv4 addresses' use '0.0.0.0', for 'all IPv6 addresses' use '::'.\n"
139 " ``--local`` implies ``--bind``.\n"
140 "--remote host [port] : Remote host name or ip address.\n"
141 "--remote-random : If multiple --remote options specified, choose one randomly.\n"
142 "--remote-random-hostname : Add a random string to remote DNS name.\n"
143 "--mode m : Major mode, m = 'p2p' (default, point-to-point) or 'server'.\n"
144 "--proto p : Use protocol p for communicating with peer.\n"
145 " p = udp (default), tcp-server, tcp-client\n"
146 " udp4, tcp4-server, tcp4-client\n"
147 " udp6, tcp6-server, tcp6-client\n"
148 "--proto-force p : only consider protocol p in list of connection profiles.\n"
150 "--connect-retry n [m] : For client, number of seconds to wait between\n"
151 " connection retries (default=%d). On repeated retries\n"
152 " the wait time is exponentially increased to a maximum of m\n"
154 "--connect-retry-max n : Maximum connection attempt retries, default infinite.\n"
155 "--http-proxy s p [up] [auth] : Connect to remote host\n"
156 " through an HTTP proxy at address s and port p.\n"
157 " If proxy authentication is required,\n"
158 " up is a file containing username/password on 2 lines, or\n"
159 " 'stdin' to prompt from console. Add auth='ntlm2' if\n"
160 " the proxy requires NTLM authentication.\n"
161 "--http-proxy s p 'auto[-nct]' : Like the above directive, but automatically\n"
162 " determine auth method and query for username/password\n"
163 " if needed. auto-nct disables weak proxy auth methods.\n"
164 "--http-proxy-option type [parm] : Set extended HTTP proxy options.\n"
165 " Repeat to set multiple options.\n"
166 " VERSION version (default=1.0)\n"
167 " AGENT user-agent\n"
168 "--socks-proxy s [p] [up] : Connect to remote host through a Socks5 proxy at\n"
169 " address s and port p (default port = 1080).\n"
170 " If proxy authentication is required,\n"
171 " up is a file containing username/password on 2 lines, or\n"
172 " 'stdin' to prompt for console.\n"
173 "--socks-proxy-retry : Retry indefinitely on Socks proxy errors.\n"
174 "--resolv-retry n: If hostname resolve fails for --remote, retry\n"
175 " resolve for n seconds before failing (disabled by default).\n"
176 " Set n=\"infinite\" to retry indefinitely.\n"
177 "--float : Allow remote to change its IP address/port, such as through\n"
178 " DHCP (this is the default if --remote is not used).\n"
179 "--ipchange cmd : Run command cmd on remote ip address initial\n"
180 " setting or change -- execute as: cmd ip-address port#\n"
181 "--port port : TCP/UDP port # for both local and remote.\n"
182 "--lport port : TCP/UDP port # for local (default=%s). Implies --bind.\n"
183 "--rport port : TCP/UDP port # for remote (default=%s).\n"
184 "--bind : Bind to local address and port. (This is the default unless\n"
185 " --proto tcp-client"
189 "--nobind : Do not bind to local address and port.\n"
190 "--dev tunX|tapX : tun/tap device (X can be omitted for dynamic device.\n"
191 "--dev-type dt : Which device type are we using? (dt = tun or tap) Use\n"
192 " this option only if the tun/tap device used with --dev\n"
193 " does not begin with \"tun\" or \"tap\".\n"
194 "--dev-node node : Explicitly set the device node rather than using\n"
195 " /dev/net/tun, /dev/tun, /dev/tap, etc.\n"
196#if defined(ENABLE_DCO)
197 "--disable-dco : Do not attempt using Data Channel Offload.\n"
199 "--lladdr hw : Set the link layer address of the tap device.\n"
200 "--topology t : Set --dev tun topology: 'net30', 'p2p', or 'subnet'.\n"
202 "--iproute cmd : Use this command instead of default " IPROUTE_PATH
".\n"
204 "--ifconfig l rn : TUN: configure device to use IP address l as a local\n"
205 " endpoint and rn as a remote endpoint. l & rn should be\n"
206 " swapped on the other peer. l & rn must be private\n"
207 " addresses outside of the subnets used by either peer.\n"
208 " TAP: configure device to use IP address l as a local\n"
209 " endpoint and rn as a subnet mask.\n"
210 "--ifconfig-ipv6 l r : configure device to use IPv6 address l as local\n"
211 " endpoint (as a /64) and r as remote endpoint\n"
212 "--ifconfig-noexec : Don't actually execute ifconfig/netsh command, instead\n"
213 " pass --ifconfig parms by environment to scripts.\n"
214 "--ifconfig-nowarn : Don't warn if the --ifconfig option on this side of the\n"
215 " connection doesn't match the remote side.\n"
217 "--route-table table_id : Specify a custom routing table for use with --route(-ipv6).\n"
218 " If not specified, the id of the default routing table will be used.\n"
220 "--route network [netmask] [gateway] [metric] :\n"
221 " Add route to routing table after connection\n"
222 " is established. Multiple routes can be specified.\n"
223 " netmask default: 255.255.255.255\n"
224 " gateway default: taken from --route-gateway or --ifconfig\n"
225 " Specify default by leaving blank or setting to \"default\".\n"
226 "--route-ipv6 network/bits [gateway] [metric] :\n"
227 " Add IPv6 route to routing table after connection\n"
228 " is established. Multiple routes can be specified.\n"
229 " gateway default: taken from --route-ipv6-gateway or 'remote'\n"
230 " in --ifconfig-ipv6\n"
231 "--route-gateway gw|'dhcp' : Specify a default gateway for use with --route.\n"
232 "--route-ipv6-gateway gw : Specify a default gateway for use with --route-ipv6.\n"
233 "--route-metric m : Specify a default metric for use with --route.\n"
234 "--route-delay n [w] : Delay n seconds after connection initiation before\n"
235 " adding routes (may be 0). If not specified, routes will\n"
236 " be added immediately after tun/tap open. On Windows, wait\n"
237 " up to w seconds for TUN/TAP adapter to come up.\n"
238 "--route-up cmd : Run command cmd after routes are added.\n"
239 "--route-pre-down cmd : Run command cmd before routes are removed.\n"
240 "--route-noexec : Don't add routes automatically. Instead pass routes to\n"
241 " --route-up script using environmental variables.\n"
242 "--route-nopull : When used with --client or --pull, accept options pushed\n"
243 " by server EXCEPT for routes, dns, and dhcp options.\n"
244 "--allow-pull-fqdn : Allow client to pull DNS names from server for\n"
245 " --ifconfig, --route, and --route-gateway.\n"
246 "--redirect-gateway [flags]: Automatically execute routing\n"
247 " commands to redirect all outgoing IP traffic through the\n"
248 " VPN. Add 'local' flag if both " PACKAGE_NAME
" servers are directly\n"
249 " connected via a common subnet, such as with WiFi.\n"
250 " Add 'def1' flag to set default route using using 0.0.0.0/1\n"
251 " and 128.0.0.0/1 rather than 0.0.0.0/0. Add 'bypass-dhcp'\n"
252 " flag to add a direct route to DHCP server, bypassing tunnel.\n"
253 " Add 'bypass-dns' flag to similarly bypass tunnel for DNS.\n"
254 "--redirect-private [flags]: Like --redirect-gateway, but omit actually changing\n"
255 " the default gateway. Useful when pushing private subnets.\n"
256 "--block-ipv6 : (Client) Instead sending IPv6 to the server generate\n"
257 " ICMPv6 host unreachable messages on the client.\n"
258 " (Server) Instead of forwarding IPv6 packets send\n"
259 " ICMPv6 host unreachable packets to the client.\n"
260 "--client-nat snat|dnat network netmask alias : on client add 1-to-1 NAT rule.\n"
261 "--push-peer-info : (client only) push client info to server.\n"
262 "--setenv name value : Set a custom environmental variable to pass to script.\n"
263 "--setenv FORWARD_COMPATIBLE 1 : Relax config file syntax checking to allow\n"
264 " directives for future OpenVPN versions to be ignored.\n"
265 "--ignore-unknown-option opt1 opt2 ...: Relax config file syntax. Allow\n"
266 " these options to be ignored when unknown\n"
267 "--script-security level: Where level can be:\n"
268 " 0 -- strictly no calling of external programs\n"
269 " 1 -- (default) only call built-ins such as ifconfig\n"
270 " 2 -- allow calling of built-ins and scripts\n"
271 " 3 -- allow password to be passed to scripts via env\n"
272 "--shaper n : Restrict output to peer to n bytes per second.\n"
273 "--keepalive n m : Helper option for setting timeouts in server mode. Send\n"
274 " ping once every n seconds, restart if ping not received\n"
276 "--inactive n [bytes] : Exit after n seconds of activity on tun/tap device\n"
277 " produces a combined in/out byte count < bytes.\n"
278 "--session-timeout n: Limit connection time to n seconds.\n"
279 "--ping-exit n : Exit if n seconds pass without reception of remote ping.\n"
280 "--ping-restart n: Restart if n seconds pass without reception of remote ping.\n"
281 "--ping-timer-rem: Run the --ping-exit/--ping-restart timer only if we have a\n"
283 "--ping n : Ping remote once every n seconds over TCP/UDP port.\n"
285 "--multihome : Configure a multi-homed UDP server.\n"
287 "--fast-io : Optimize TUN/TAP/UDP writes.\n"
288 "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n"
289 "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n"
290 "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
291 "--persist-local-ip : Keep local IP address across SIGUSR1 or --ping-restart.\n"
292#if PASSTOS_CAPABILITY
293 "--passtos : TOS passthrough (applies to IPv4 only).\n"
295 "--tun-mtu n : Take the tun/tap device MTU to be n and derive the\n"
296 " TCP/UDP MTU from it (default=%d).\n"
297 "--tun-mtu-extra n : Assume that tun/tap device might return as many\n"
298 " as n bytes more than the tun-mtu size on read\n"
299 " (default TUN=0 TAP=%d).\n"
300 "--link-mtu n : Take the TCP/UDP device MTU to be n and derive the tun MTU\n"
302 "--mtu-disc type : Should we do Path MTU discovery on TCP/UDP channel?\n"
303 " 'no' -- Never send DF (Don't Fragment) frames\n"
304 " 'maybe' -- Use per-route hints\n"
305 " 'yes' -- Always DF (Don't Fragment)\n"
306 "--mtu-test : Empirically measure and report MTU.\n"
307#ifdef ENABLE_FRAGMENT
308 "--fragment max : Enable internal datagram fragmentation so that no UDP\n"
309 " datagrams are sent which are larger than max bytes.\n"
310 " Adds 4 bytes of overhead per datagram.\n"
312 "--mssfix [n] : Set upper bound on TCP MSS, default = tun-mtu size\n"
313 " or --fragment max value, whichever is lower.\n"
314 "--sndbuf size : Set the TCP/UDP send buffer size.\n"
315 "--rcvbuf size : Set the TCP/UDP receive buffer size.\n"
316#if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK
317 "--mark value : Mark encrypted packets being sent with value. The mark value\n"
318 " can be matched in policy routing and packetfilter rules.\n"
319 "--bind-dev dev : Bind to the given device when making connection to a peer or\n"
320 " listening for connections. This allows sending encrypted packets\n"
321 " via a VRF present on the system.\n"
323 "--txqueuelen n : Set the tun/tap TX queue length to n (Linux only).\n"
324#ifdef ENABLE_MEMSTATS
325 "--memstats file : Write live usage stats to memory mapped binary file.\n"
327 "--mlock : Disable Paging -- ensures key material and tunnel\n"
328 " data will never be written to disk.\n"
329 "--up cmd : Run command cmd after successful tun device open.\n"
330 " Execute as: cmd tun/tap-dev tun-mtu link-mtu \\\n"
331 " ifconfig-local-ip ifconfig-remote-ip\n"
332 " (pre --user or --group UID/GID change)\n"
333 "--up-delay : Delay tun/tap open and possible --up script execution\n"
334 " until after TCP/UDP connection establishment with peer.\n"
335 "--down cmd : Run command cmd after tun device close.\n"
336 " (post --user/--group UID/GID change and/or --chroot)\n"
337 " (command parameters are same as --up option)\n"
338 "--down-pre : Run --down command before TUN/TAP close.\n"
339 "--up-restart : Run up/down commands for all restarts including those\n"
340 " caused by --ping-restart or SIGUSR1\n"
341 "--user user : Set UID to user after initialization.\n"
342 "--group group : Set GID to group after initialization.\n"
343 "--chroot dir : Chroot to this directory after initialization.\n"
345 "--setcon context: Apply this SELinux context after initialization.\n"
347 "--cd dir : Change to this directory before initialization.\n"
348 "--daemon [name] : Become a daemon after initialization.\n"
349 " The optional 'name' parameter will be passed\n"
350 " as the program name to the system logger.\n"
351 "--syslog [name] : Output to syslog, but do not become a daemon.\n"
352 " See --daemon above for a description of the 'name' parm.\n"
353 "--log file : Output log to file which is created/truncated on open.\n"
354 "--log-append file : Append log to file, or create file if nonexistent.\n"
355 "--suppress-timestamps : Don't log timestamps to stdout/stderr.\n"
356 "--machine-readable-output : Always log timestamp, message flags to stdout/stderr.\n"
357 "--writepid file : Write main process ID to file.\n"
358 "--nice n : Change process priority (>0 = lower, <0 = higher).\n"
359 "--echo [parms ...] : Echo parameters to log output.\n"
360 "--verb n : Set output verbosity to n (default=%d):\n"
361 " (Level 3 is recommended if you want a good summary\n"
362 " of what's happening without being swamped by output).\n"
363 " : 0 -- no output except fatal errors\n"
364 " : 1 -- startup info + connection initiated messages +\n"
365 " non-fatal encryption & net errors\n"
366 " : 2,3 -- show TLS negotiations & route info\n"
367 " : 4 -- show parameters\n"
368 " : 5 -- show 'RrWw' chars on console for each packet sent\n"
369 " and received from TCP/UDP (caps) or tun/tap (lc)\n"
370 " : 6 to 11 -- debug messages of increasing verbosity\n"
371 "--mute n : Log at most n consecutive messages in the same category.\n"
372 "--status file [n] : Write operational status to file every n seconds.\n"
373 "--status-version [n] : Choose the status file format version number.\n"
374 " Currently, n can be 1, 2, or 3 (default=1).\n"
375 "--disable-occ : (DEPRECATED) Disable options consistency check between peers.\n"
377 "--gremlin mask : Special stress testing mode (for debugging only).\n"
380 "--compress alg : Use compression algorithm alg\n"
381 "--allow-compression: Specify whether compression should be allowed\n"
382#if defined(ENABLE_LZO)
383 "--comp-lzo : Use LZO compression -- may add up to 1 byte per\n"
384 " packet for incompressible data.\n"
385 "--comp-noadapt : Don't use adaptive compression when --comp-lzo\n"
389#ifdef ENABLE_MANAGEMENT
390 "--management ip port [pass] : Enable a TCP server on ip:port to handle\n"
391 " management functions. pass is a password file\n"
392 " or 'stdin' to prompt from console.\n"
394 " To listen on a unix domain socket, specific the pathname\n"
395 " in place of ip and use 'unix' as the port number.\n"
397 "--management-client : Management interface will connect as a TCP client to\n"
398 " ip/port rather than listen as a TCP server.\n"
399 "--management-query-passwords : Query management channel for private key\n"
400 " and auth-user-pass passwords.\n"
401 "--management-query-proxy : Query management channel for proxy information.\n"
402 "--management-query-remote : Query management channel for --remote directive.\n"
403 "--management-hold : Start " PACKAGE_NAME
" in a hibernating state, until a client\n"
404 " of the management interface explicitly starts it.\n"
405 "--management-signal : Issue SIGUSR1 when management disconnect event occurs.\n"
406 "--management-forget-disconnect : Forget passwords when management disconnect\n"
408 "--management-up-down : Report tunnel up/down events to management interface.\n"
409 "--management-log-cache n : Cache n lines of log file history for usage\n"
410 " by the management channel.\n"
412 "--management-client-user u : When management interface is a unix socket, only\n"
413 " allow connections from user u.\n"
414 "--management-client-group g : When management interface is a unix socket, only\n"
415 " allow connections from group g.\n"
417 "--management-client-auth : gives management interface client the responsibility\n"
418 " to authenticate clients after their client certificate\n"
419 " has been verified.\n"
422 "--plugin m [str]: Load plug-in module m passing str as an argument\n"
423 " to its initialization function.\n"
425 "--vlan-tagging : Enable 802.1Q-based VLAN tagging.\n"
426 "--vlan-accept tagged|untagged|all : Set VLAN tagging mode. Default is 'all'.\n"
427 "--vlan-pvid v : Sets the Port VLAN Identifier. Defaults to 1.\n"
429 "Multi-Client Server options (when --mode server is used):\n"
430 "--server network netmask : Helper option to easily configure server mode.\n"
431 "--server-ipv6 network/bits : Configure IPv6 server mode.\n"
432 "--server-bridge [IP netmask pool-start-IP pool-end-IP] : Helper option to\n"
433 " easily configure ethernet bridging server mode.\n"
434 "--push \"option\" : Push a config file option back to the peer for remote\n"
435 " execution. Peer must specify --pull in its config file.\n"
436 "--push-reset : Don't inherit global push list for specific\n"
437 " client instance.\n"
438 "--push-remove opt : Remove options matching 'opt' from the push list for\n"
439 " a specific client instance.\n"
440 "--ifconfig-pool start-IP end-IP [netmask] : Set aside a pool of subnets\n"
441 " to be dynamically allocated to connecting clients.\n"
442 "--ifconfig-pool-persist file [seconds] : Persist/unpersist ifconfig-pool\n"
443 " data to file, at seconds intervals (default=600).\n"
444 " If seconds=0, file will be treated as read-only.\n"
445 "--ifconfig-ipv6-pool base-IP/bits : set aside an IPv6 network block\n"
446 " to be dynamically allocated to connecting clients.\n"
447 "--ifconfig-push local remote-netmask : Push an ifconfig option to remote,\n"
448 " overrides --ifconfig-pool dynamic allocation.\n"
449 " Only valid in a client-specific config file.\n"
450 "--ifconfig-ipv6-push local/bits remote : Push an ifconfig-ipv6 option to\n"
451 " remote, overrides --ifconfig-ipv6-pool allocation.\n"
452 " Only valid in a client-specific config file.\n"
453 "--iroute network [netmask] : Route subnet to client.\n"
454 "--iroute-ipv6 network/bits : Route IPv6 subnet to client.\n"
455 " Sets up internal routes only.\n"
456 " Only valid in a client-specific config file.\n"
457 "--disable : Client is disabled.\n"
458 " Only valid in a client-specific config file.\n"
459 "--override-username: Overrides the client-specific username to be used.\n"
460 " Only valid in a client-specific config file.\n"
461 "--verify-client-cert [none|optional|require] : perform no, optional or\n"
462 " mandatory client certificate verification.\n"
463 " Default is to require the client to supply a certificate.\n"
464 "--username-as-common-name : For auth-user-pass authentication, use\n"
465 " the authenticated username as the common name,\n"
466 " rather than the common name from the client cert.\n"
467 "--auth-user-pass-verify cmd method: Query client for username/password and\n"
468 " run command cmd to verify. If method='via-env', pass\n"
469 " user/pass via environment, if method='via-file', pass\n"
470 " user/pass via temporary file.\n"
471 "--auth-gen-token [lifetime] Generate a random authentication token which is pushed\n"
472 " to each client, replacing the password. Useful when\n"
473 " OTP based two-factor auth mechanisms are in use and\n"
474 " --reneg-* options are enabled. Optionally a lifetime in seconds\n"
475 " for generated tokens can be set.\n"
476 "--opt-verify : (DEPRECATED) Clients that connect with options that are incompatible\n"
477 " with those of the server will be disconnected.\n"
478 "--auth-user-pass-optional : Allow connections by clients that don't\n"
479 " specify a username/password.\n"
480 "--no-name-remapping : (DEPRECATED) Allow Common Name and X509 Subject to include\n"
481 " any printable character.\n"
482 "--client-to-client : Internally route client-to-client traffic.\n"
483 "--duplicate-cn : Allow multiple clients with the same common name to\n"
484 " concurrently connect.\n"
485 "--client-connect cmd : Run command cmd on client connection.\n"
486 "--client-disconnect cmd : Run command cmd on client disconnection.\n"
487 "--client-config-dir dir : Directory for custom client config files.\n"
488 "--ccd-exclusive : Refuse connection unless custom client config is found.\n"
489 "--tmp-dir dir : Temporary directory, used for --client-connect return file and plugin communication.\n"
490 "--hash-size r v : Set the size of the real address hash table to r and the\n"
491 " virtual address table to v.\n"
492 "--bcast-buffers n : Allocate n broadcast buffers.\n"
493 "--tcp-queue-limit n : Maximum number of queued TCP output packets.\n"
494 "--tcp-nodelay : Macro that sets TCP_NODELAY socket flag on the server\n"
495 " as well as pushes it to connecting clients.\n"
496 "--learn-address cmd : Run command cmd to validate client virtual addresses.\n"
497 "--connect-freq n s : Allow a maximum of n new connections per s seconds.\n"
498 "--connect-freq-initial n s : Allow a maximum of n replies for initial connections attempts per s seconds.\n"
499 "--max-clients n : Allow a maximum of n simultaneously connected clients.\n"
500 "--max-routes-per-client n : Allow a maximum of n internal routes per client.\n"
501 "--stale-routes-check n [t] : Remove routes with a last activity timestamp\n"
502 " older than n seconds. Run this check every t\n"
503 " seconds (defaults to n).\n"
504 "--explicit-exit-notify [n] : In UDP server mode send [RESTART] command on exit/restart to connected\n"
505 " clients. n = 1 - reconnect to same server,\n"
506 " 2 - advance to next server, default=1.\n"
508 "--port-share host port [dir] : When run in TCP mode, proxy incoming HTTPS\n"
509 " sessions to a web server at host:port. dir specifies an\n"
510 " optional directory to write origin IP:port data.\n"
513 "Client options (when connecting to a multi-client server):\n"
514 "--client : Helper option to easily configure client mode.\n"
515 "--auth-user-pass [up] : Authenticate with server using username/password.\n"
516 " up is a file containing the username on the first line,\n"
517 " and a password on the second. If either the password or both\n"
518 " the username and the password are omitted OpenVPN will prompt\n"
519 " for them from console.\n"
520 "--pull : Accept certain config file options from the peer as if they\n"
521 " were part of the local config file. Must be specified\n"
522 " when connecting to a '--mode server' remote host.\n"
523 "--pull-filter accept|ignore|reject t : Filter each option received from the\n"
524 " server if it starts with the text t. The action flag accept,\n"
525 " ignore or reject causes the option to be allowed, removed or\n"
526 " rejected with error. May be specified multiple times, and\n"
527 " each filter is applied in the order of appearance.\n"
528 "--dns server <n> <option> <value> [value ...] : Configure option for DNS server #n\n"
529 " Valid options are :\n"
530 " address <addr[:port]> [addr[:port] ...] : server addresses 4/6\n"
531 " resolve-domains <domain> [domain ...] : split domains\n"
532 " dnssec <yes|no|optional> : option to use DNSSEC\n"
533 " transport <DoH|DoT> : query server over HTTPS / TLS\n"
534 " sni <domain> : DNS server name indication\n"
535 "--dns search-domains <domain> [domain ...]:\n"
536 " Add domains to DNS domain search list\n"
537 "--dns-updown cmd|force|disable : Run cmd as user defined dns config command,\n"
538 " force running the default script or disable running it.\n"
539 "--auth-retry t : How to handle auth failures. Set t to\n"
540 " none (default), interact, or nointeract.\n"
541 "--static-challenge t e [<scrv1|concat>]: Enable static challenge/response protocol using\n"
542 " challenge text t, with e indicating echo flag (0|1)\n"
543 " and optional argument scrv1 or concat to use SCRV1 protocol or"
544 " concatenate response with password. Default is scrv1.\n"
545 "--connect-timeout n : when polling possible remote servers to connect to\n"
546 " in a round-robin fashion, spend no more than n seconds\n"
547 " waiting for a response before trying the next server.\n"
548 "--allow-recursive-routing : When this option is set, OpenVPN will not drop\n"
549 " incoming tun packets with same destination as host.\n"
550 "--explicit-exit-notify [n] : On exit/restart, send exit signal to\n"
551 " server/remote. n = # of retries, default=1.\n"
553 "Data Channel Encryption Options (must be compatible between peers):\n"
554 "(These options are meaningful for both Static Key & TLS-mode)\n"
555 "--auth alg : Authenticate packets with HMAC using message\n"
556 " digest algorithm alg (default=%s).\n"
557 " (usually adds 16 or 20 bytes per packet)\n"
558 " Set alg=none to disable authentication.\n"
559 "--cipher alg : Encrypt packets with cipher algorithm alg.\n"
560 " You should usually use --data-ciphers instead.\n"
561 " Set alg=none to disable encryption.\n"
562 "--data-ciphers list : List of ciphers that are allowed to be negotiated.\n"
563#ifndef ENABLE_CRYPTO_MBEDTLS
564 "--engine [name] : Enable OpenSSL hardware crypto engine functionality.\n"
566 "--mute-replay-warnings : Silence the output of replay warnings to log file.\n"
567 "--replay-window n [t] : Use a replay protection sliding window of size n\n"
568 " and a time window of t seconds.\n"
569 " Default n=%d t=%d\n"
570 "--replay-persist file : Persist replay-protection state across sessions\n"
572 "--test-crypto : Run a self-test of crypto features enabled.\n"
573 " For debugging only.\n"
574#ifdef ENABLE_PREDICTION_RESISTANCE
575 "--use-prediction-resistance: Enable prediction resistance on the random\n"
576 " number generator.\n"
579 "TLS Key Negotiation Options:\n"
580 "(These options are meaningful only for TLS-mode)\n"
581 "--tls-server : Enable TLS and assume server role during TLS handshake.\n"
582 "--tls-client : Enable TLS and assume client role during TLS handshake.\n"
583 "--ca file : Certificate authority file in .pem format containing\n"
584 " root certificate.\n"
585#ifndef ENABLE_CRYPTO_MBEDTLS
586 "--capath dir : A directory of trusted certificates (CAs"
589 "--dh file : File containing Diffie Hellman parameters\n"
590 " in .pem format (for --tls-server only).\n"
591 " Use \"openssl dhparam -out dh1024.pem 1024\" to generate.\n"
592 "--cert file : Local certificate in .pem format or a URI -- must be signed\n"
593 " by a Certificate Authority in --ca file used by the peer.\n"
594 "--extra-certs file : one or more PEM certs that complete the cert chain.\n"
595 "--key file : Local private key in .pem format or a URI.\n"
596 "--tls-version-min <version> ['or-highest'] : sets the minimum TLS version we\n"
597 " will accept from the peer. If version is unrecognized and 'or-highest'\n"
598 " is specified, require max TLS version supported by SSL implementation.\n"
599 "--tls-version-max <version> : sets the maximum TLS version we will use.\n"
600#ifndef ENABLE_CRYPTO_MBEDTLS
601 "--pkcs12 file : PKCS#12 file containing local private key, local certificate\n"
602 " and optionally the root CA certificate.\n"
604#ifdef ENABLE_X509ALTUSERNAME
605 "--x509-username-field : Field in x509 certificate containing the username.\n"
606 " Default is CN in the Subject field.\n"
608 "--verify-hash hash [algo] : Specify fingerprint for level-1 certificate.\n"
609 " Valid algo flags are SHA1 and SHA256. \n"
611 "--cryptoapicert select-string : Load the certificate and private key from the\n"
612 " Windows Certificate System Store.\n"
614 "--tls-cipher l : A list l of allowable TLS ciphers separated by : (optional).\n"
615 "--tls-ciphersuites l: A list of allowed TLS 1.3 cipher suites separated by : (optional)\n"
616 " : Use --show-tls to see a list of supported TLS ciphers (suites).\n"
617 "--tls-cert-profile p : Set the allowed certificate crypto algorithm profile\n"
618 " (default=legacy).\n"
619 "--providers l : A list l of OpenSSL providers to load.\n"
620 "--tls-timeout n : Packet retransmit timeout on TLS control channel\n"
621 " if no ACK from remote within n seconds (default=%d).\n"
622 "--reneg-bytes n : Renegotiate data chan. key after n bytes sent and recvd.\n"
623 "--reneg-pkts n : Renegotiate data chan. key after n packets sent and recvd.\n"
624 "--reneg-sec max [min] : Renegotiate data chan. key after at most max (default=%d)\n"
625 " and at least min (defaults to 90%% of max on servers and equal\n"
626 " to max on clients).\n"
627 "--hand-window n : Data channel key exchange must finalize within n seconds\n"
628 " of handshake initiation by any peer (default=%d).\n"
629 "--tran-window n : Transition window -- old key can live this many seconds\n"
630 " after new key renegotiation begins (default=%d).\n"
631 "--single-session: Allow only one session (reset state on restart).\n"
632 "--tls-exit : Exit on TLS negotiation failure.\n"
633 "--tls-auth f [d]: Add an additional layer of authentication on top of the TLS\n"
634 " control channel to protect against attacks on the TLS stack\n"
635 " and DoS attacks.\n"
636 " f (required) is a shared-secret key file.\n"
637 " The optional d parameter controls key directionality.\n"
638 "--tls-crypt key : Add an additional layer of authenticated encryption on top\n"
639 " of the TLS control channel to hide the TLS certificate,\n"
640 " provide basic post-quantum security and protect against\n"
641 " attacks on the TLS stack and DoS attacks.\n"
642 " key (required) provides the pre-shared key file.\n"
643 "--tls-crypt-v2 key : For clients: use key as a client-specific tls-crypt key.\n"
644 " For servers: use key to decrypt client-specific keys. For\n"
645 " key generation (--genkey tls-crypt-v2-client): use key to\n"
646 " encrypt generated client-specific key. (See --tls-crypt.)\n"
647 "--genkey tls-crypt-v2-client [keyfile] [base64 metadata]: Generate a\n"
648 " fresh tls-crypt-v2 client key, and store to\n"
649 " keyfile. If supplied, include metadata in wrapped key.\n"
650 "--genkey tls-crypt-v2-server [keyfile] [base64 metadata]: Generate a\n"
651 " fresh tls-crypt-v2 server key, and store to keyfile\n"
652 "--tls-crypt-v2-verify cmd : Run command cmd to verify the metadata of the\n"
653 " client-supplied tls-crypt-v2 client key\n"
654 "--askpass [file]: Get PEM password from controlling tty before we daemonize.\n"
655 "--auth-nocache : Don't cache --askpass or --auth-user-pass passwords.\n"
656 "--crl-verify crl ['dir']: Check peer certificate against a CRL.\n"
657 "--tls-verify cmd: Run command cmd to verify the X509 name of a\n"
658 " pending TLS connection that has otherwise passed all other\n"
659 " tests of certification. cmd should return 0 to allow\n"
660 " TLS handshake to proceed, or 1 to fail. (cmd is\n"
661 " executed as 'cmd certificate_depth subject')\n"
662 "--verify-x509-name name: Accept connections only from a host with X509 subject\n"
663 " DN name. The remote host must also pass all other tests\n"
664 " of verification.\n"
665#ifndef ENABLE_CRYPTO_MBEDTLS
666 "--ns-cert-type t: (DEPRECATED) Require that peer certificate was signed with \n"
667 " an explicit nsCertType designation t = 'client' | 'server'.\n"
669 "--x509-track x : Save peer X509 attribute x in environment for use by\n"
670 " plugins and management interface.\n"
671 "--keying-material-exporter label len : Save Exported Keying Material (RFC5705)\n"
672 " of len bytes (min. 16 bytes) using label in environment for use by plugins.\n"
673 "--remote-cert-ku v ... : Require that the peer certificate was signed with\n"
674 " explicit key usage, you can specify more than one value.\n"
675 " value should be given in hex format.\n"
676 "--remote-cert-eku oid : Require that the peer certificate was signed with\n"
677 " explicit extended key usage. Extended key usage can be encoded\n"
678 " as an object identifier or OpenSSL string representation.\n"
679 "--remote-cert-tls t: Require that peer certificate was signed with explicit\n"
680 " key usage and extended key usage based on RFC3280 TLS rules.\n"
681 " t = 'client' | 'server'.\n"
685 "--pkcs11-providers provider ... : PKCS#11 provider to load.\n"
686 "--pkcs11-protected-authentication [0|1] ... : Use PKCS#11 protected authentication\n"
687 " path. Set for each provider.\n"
688 "--pkcs11-private-mode hex ... : PKCS#11 private key mode mask.\n"
689 " 0 : Try to determine automatically (default).\n"
691 " 2 : Use SignRecover.\n"
692 " 4 : Use Decrypt.\n"
694 "--pkcs11-cert-private [0|1] ... : Set if login should be performed before\n"
695 " certificate can be accessed. Set for each provider.\n"
696 "--pkcs11-pin-cache seconds : Number of seconds to cache PIN. The default is -1\n"
697 " cache until token is removed.\n"
698 "--pkcs11-id-management : Acquire identity from management interface.\n"
699 "--pkcs11-id serialized-id 'id' : Identity to use, get using standalone --show-pkcs11-ids\n"
702 "SSL Library information:\n"
703 "--show-ciphers : Show cipher algorithms to use with --cipher option.\n"
704 "--show-digests : Show message digest algorithms to use with --auth option.\n"
705 "--show-engines : Show hardware crypto accelerator engines (if available).\n"
706 "--show-tls : Show all TLS ciphers (TLS used only as a control channel).\n"
709 "Windows Specific:\n"
710 "--win-sys path : Pathname of Windows system directory. Default is the pathname\n"
711 " from SystemRoot environment variable.\n"
712 "--ip-win32 method : When using --ifconfig on Windows, set TAP-Windows adapter\n"
713 " IP address using method = manual, netsh, ipapi,\n"
714 " dynamic, or adaptive (default = adaptive).\n"
715 " Dynamic method allows two optional parameters:\n"
716 " offset: DHCP server address offset (> -256 and < 256).\n"
717 " If 0, use network address, if >0, take nth\n"
718 " address forward from network address, if <0,\n"
719 " take nth address backward from broadcast\n"
722 " lease-time: Lease time in seconds.\n"
723 " Default is one year.\n"
724 "--route-method : Which method to use for adding routes on Windows?\n"
725 " adaptive (default) -- Try ipapi then fall back to exe.\n"
726 " ipapi -- Use IP helper API.\n"
727 " exe -- Call the route.exe shell command.\n"
728 "--dhcp-option type [parm] : Set extended TAP-Windows properties, must\n"
729 " be used with --ip-win32 dynamic. For options\n"
730 " which allow multiple addresses,\n"
731 " --dhcp-option must be repeated.\n"
732 " DOMAIN name : Set DNS suffix\n"
733 " DOMAIN-SEARCH entry : Add entry to DNS domain search list\n"
734 " DNS addr : Set domain name server address(es) (IPv4 and IPv6)\n"
735 " NTP : Set NTP server address(es)\n"
736 " NBDD : Set NBDD server address(es)\n"
737 " WINS addr : Set WINS server address(es)\n"
738 " NBT type : Set NetBIOS over TCP/IP Node type\n"
739 " 1: B, 2: P, 4: M, 8: H\n"
740 " NBS id : Set NetBIOS scope ID\n"
741 " DISABLE-NBT : Disable Netbios-over-TCP/IP.\n"
742 "--dhcp-renew : Ask Windows to renew the TAP adapter lease on startup.\n"
743 "--dhcp-pre-release : Ask Windows to release the previous TAP adapter lease on\n"
745 "--register-dns : Run ipconfig /flushdns and ipconfig /registerdns\n"
746 " on connection initiation.\n"
747 "--tap-sleep n : Sleep for n seconds after TAP adapter open before\n"
748 " attempting to set adapter properties.\n"
749 "--pause-exit : When run from a console window, pause before exiting.\n"
750 "--service ex [0|1] : For use when " PACKAGE_NAME
" is being instantiated by a\n"
751 " service, and should not be used directly by end-users.\n"
752 " ex is the name of an event object which, when\n"
753 " signaled, will cause " PACKAGE_NAME
" to exit. A second\n"
754 " optional parameter controls the initial state of ex.\n"
755 "--show-net-up : Show " PACKAGE_NAME
"'s view of routing table and net adapter list\n"
756 " after TAP adapter is up and routes have been added.\n"
757 "--block-outside-dns : Block DNS on other network adapters to prevent DNS leaks\n"
758 "Windows Standalone Options:\n"
760 "--show-adapters : Show all TAP-Windows adapters.\n"
761 "--show-net : Show " PACKAGE_NAME
"'s view of routing table and net adapter list.\n"
762 "--show-valid-subnets : Show valid subnets for --dev tun emulation.\n"
763 "--allow-nonadmin [TAP-adapter] : Allow " PACKAGE_NAME
" running without admin privileges\n"
764 " to access TAP adapter.\n"
767 "Generate a new key :\n"
768 "--genkey tls-auth file : Generate a new random key of type and write to file\n"
769 " (for use with --tls-auth or --tls-crypt)."
770#ifdef ENABLE_FEATURE_TUN_PERSIST
772 "Tun/tap config mode (available with linux 2.4+):\n"
773 "--mktun : Create a persistent tunnel.\n"
774 "--rmtun : Remove a persistent tunnel.\n"
775 "--dev tunX|tapX : tun/tap device\n"
776 "--dev-type dt : Device type. See tunnel options above for details.\n"
777 "--user user : User to set privilege to.\n"
778 "--group group : Group to set privilege to.\n"
782 "PKCS#11 standalone options:\n"
783#ifdef DEFAULT_PKCS11_MODULE
784 "--show-pkcs11-ids [provider] [cert_private] : Show PKCS#11 available ids.\n"
786 "--show-pkcs11-ids provider [cert_private] : Show PKCS#11 available ids.\n"
788 " --verb option can be added *BEFORE* this.\n"
791 "General Standalone Options:\n"
793 "--show-gateway [address]: Show info about gateway [to v4/v6 address].\n"
817 o->
ce.
af = AF_UNSPEC;
842#ifdef ENABLE_MANAGEMENT
847#ifdef ENABLE_FEATURE_TUN_PERSIST
880#ifdef ENABLE_PREDICTION_RESISTANCE
881 o->use_prediction_resistance =
false;
891#ifdef ENABLE_X509ALTUSERNAME
895 o->pkcs11_pin_cache_period = -1;
910 msg(
M_USAGE,
"Could not find a suitable temporary directory."
911 " (GetTempPath() failed). Consider using --tmp-dir");
927#ifdef ENABLE_DNS_UPDOWN_BY_DEFAULT
952#define PUF_TYPE_UNDEF 0
953#define PUF_TYPE_ACCEPT 1
954#define PUF_TYPE_IGNORE 2
955#define PUF_TYPE_REJECT 3
991#define SHOW_PARM(name, value, format) msg(D_SHOW_PARMS, " " #name " = " format, (value))
992#define SHOW_STR(var) SHOW_PARM(var, (o->var ? o->var : "[UNDEF]"), "'%s'")
993#define SHOW_STR_INLINE(var) SHOW_PARM(var, \
994 o->var ## _inline ? "[INLINE]" : \
995 (o->var ? o->var : "[UNDEF]"), \
997#define SHOW_INT(var) SHOW_PARM(var, o->var, "%d")
998#define SHOW_UINT(var) SHOW_PARM(var, o->var, "%u")
999#define SHOW_INT64(var) SHOW_PARM(var, o->var, "%" PRIi64)
1000#define SHOW_UNSIGNED(var) SHOW_PARM(var, o->var, "0x%08x")
1001#define SHOW_BOOL(var) SHOW_PARM(var, (o->var ? "ENABLED" : "DISABLED"), "%s");
1080 good &=
buf_printf(&name,
"foreign_option_%d",
o->foreign_option_index + 1);
1081 ++
o->foreign_option_index;
1082 for (
i = 0;
i <
len; ++
i)
1100 msg(
M_WARN,
"foreign_option: name/value overflow");
1135 const char *end =
strchr(addr,
'/');
1143 size_t len = end - addr;
1153 struct in6_addr t_addr;
1154 unsigned int t_bits;
1162 char *ret = (
char *)
gc_malloc(strlen(src) + 1,
true,
gc);
1192 const char *cp = str;
1200 while (*cp && i < nbytes)
1203 if (!isxdigit(cp[0])
1205 || (cp[2] !=
':' && cp[2] !=
'\0')
1206 || sscanf(cp,
"%x", &
byte) != 1)
1208 msg(msglevel,
"format error in hash fingerprint: %s", str);
1212 ret->
hash[i++] = (uint8_t)
byte;
1223 msg(msglevel,
"hash fingerprint is wrong length - expected %d bytes, got %d: %s", nbytes, i, str);
1225 else if (term !=
'\0')
1227 msg(msglevel,
"hash fingerprint too long - expected only %d bytes: %s", nbytes, str);
1252 while ((line =
strsep(&lines,
"\n")))
1255 while (isspace(*line))
1260 if (strlen(line) == 0 || *line ==
'#' || *line ==
';')
1289 for (i = 0; i < len; ++i)
1300 for (i = 0; i < len; ++i)
1339 struct in6_addr addr;
1342 msg(msglevel,
"--dhcp-option DNS: maximum of %d IPv6 dns servers can be specified",
1347 dns6_list[(*len)++] = addr;
1355 msg(msglevel,
"--dhcp-option %s: maximum of %d %s servers can be specified",
1365 const in_addr_t addr =
get_ip_addr(parm, msglevel, &error);
1368 array[(*len)++] = addr;
1373 msg(msglevel,
"dhcp-option parameter %s '%s' must be an IP address", name, parm);
1425 SHOW_STR(ifconfig_pool_persist_filename);
1426 SHOW_INT(ifconfig_pool_persist_refresh_freq);
1429 SHOW_INT(ifconfig_ipv6_pool_netbits);
1436 SHOW_STR(client_disconnect_script);
1437 SHOW_STR(client_crresponse_script);
1455 SHOW_STR(auth_user_pass_verify_script);
1456 SHOW_BOOL(auth_user_pass_verify_script_via_file);
1480 const char *network_str,
1481 const char *netmask_str,
1497 msg(msglevel,
"in --iroute %s %s : Bad network/subnet specification",
1510 const char *prefix_str,
1519 msg(msglevel,
"in --iroute-ipv6 %s: Bad IPv6 prefix specification",
1637#ifdef ENABLE_FRAGMENT
1644 SHOW_INT(explicit_exit_notification);
1661 for (
i = 0;
i <
l->len; ++
i)
1703#ifdef ENABLE_FEATURE_TUN_PERSIST
1725#if defined(ENABLE_DCO)
1757#if PASSTOS_CAPABILITY
1768#ifdef ENABLE_SELINUX
1794#if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK
1829#ifdef ENABLE_MANAGEMENT
1833 SHOW_INT(management_log_history_cache);
1834 SHOW_INT(management_echo_buffer_size);
1851#ifndef ENABLE_CRYPTO_MBEDTLS
1859#ifdef ENABLE_PREDICTION_RESISTANCE
1870 SHOW_PARM(
"cert_file",
"EXTERNAL_CERT",
"%s");
1880 SHOW_PARM(
"priv_key_file",
"EXTERNAL_PRIVATE_KEY",
"%s");
1886#ifndef ENABLE_CRYPTO_MBEDTLS
1889#ifdef ENABLE_CRYPTOAPI
1896 SHOW_STR(tls_export_peer_cert_dir);
1946 for (i = 0; i<
MAX_PARMS && o->pkcs11_providers[i] != NULL; i++)
1948 SHOW_PARM(pkcs11_providers, o->pkcs11_providers[i],
"%s");
1955 SHOW_PARM(pkcs11_protected_authentication, o->pkcs11_protected_authentication[i] ?
"ENABLED" :
"DISABLED",
"%s");
1962 SHOW_PARM(pkcs11_private_mode, o->pkcs11_private_mode[i],
"%08x");
1969 SHOW_PARM(pkcs11_cert_private, o->pkcs11_cert_private[i] ?
"ENABLED" :
"DISABLED",
"%s");
1993#ifdef ENABLE_MANAGEMENT
2007 if (flags && !strcmp(flags,
"nct"))
2031 for (
i = 0;
i <
l->len; ++
i)
2042 for (i = 0; i < l->
len; ++i)
2053 msg(
M_WARN,
"Note: option http-proxy-override ignored because no TCP-based connection profiles are defined");
2078 const int new_cap = l->
capacity + 1;
2079 const size_t elem_size =
sizeof(*l->
array);
2084 msg(msglevel,
"Unable to process more local options: out of memory. Number of entries = %d", l->
len);
2088 l->
array = new_array;
2121 msg(msglevel,
"Unable to process more connection options: out of memory. Number of entries = %d", l->
len);
2154 msg(msglevel,
"Unable to process more remote options: out of memory. Number of entries = %d", l->
len);
2221 if (key_file && *key_file && !(*key_inline))
2237#ifdef ENABLE_CRYPTO_MBEDTLS
2240 msg(
M_USAGE,
"Parameter --capath cannot be used with the mbed TLS version of OpenVPN.");
2255 const char *
const str =
"You must define CA file (--ca)"
2256#ifndef ENABLE_CRYPTO_MBEDTLS
2257 " or CA path (--capath)"
2259 " and/or peer fingerprint verification (--peer-fingerprint)";
2263#define MUST_BE_UNDEF(parm, parm_name) \
2264 if (options->parm != defaults.parm) { msg(M_USAGE, use_err, parm_name); }
2265#define MUST_BE_FALSE(condition, parm_name) \
2266 if (condition) { msg(M_USAGE, use_err, parm_name); }
2299 "--proto tcp is ambiguous in this context. Please specify "
2300 "--proto tcp-server or --proto tcp-client");
2309 msg(
M_USAGE,
"multiple --local statements only allowed in --server mode");
2314 msg(
M_USAGE,
"--lladdr can only be used in --dev tap mode");
2322 msg(
M_USAGE,
"only one of --tun-mtu or --link-mtu may be defined");
2327 msg(
M_USAGE,
"--mtu-test only makes sense with --proto udp");
2341 "--local and --remote addresses must be distinct from --ifconfig "
2349 "local and remote/netmask --ifconfig addresses must be different");
2354 msg(
M_USAGE,
"--bind and --nobind can't be used together");
2360 "--lport and --nobind don't make sense when used together");
2365 msg(
M_USAGE,
"--nobind doesn't make sense unless used with --remote");
2376 msg(
M_USAGE,
"--remote and one of the --local addresses are the same");
2382 msg(
M_USAGE,
"--local addresses must be distinct from --ifconfig addresses");
2387 msg(
M_USAGE,
"--local and --nobind don't make sense when used together");
2394#ifdef ENABLE_MANAGEMENT
2399 msg(
M_USAGE,
"--management is not specified, however one or more options which modify the behavior of --management were specified");
2405 msg(
M_USAGE,
"--management-client-(user|group) can only be used on unix domain sockets");
2412 msg(
M_WARN,
"WARNING: Using --management on a TCP port WITHOUT "
2413 "passwords is STRONGLY discouraged and considered insecure");
2418#if !defined(HAVE_XKEY_PROVIDER)
2424 msg(
M_FATAL,
"management-external-key with TLS 1.3 or later requires "
2425 "nopadding argument/support");
2435 msg(
M_USAGE,
"On Windows, --ifconfig is required when --dev tun is used");
2441 msg(
M_USAGE,
"On Windows, --ip-win32 doesn't make sense unless --ifconfig is also used");
2446 const char *prefix =
"Some --dhcp-option or --dns options require DHCP server";
2449 msg(
M_USAGE,
"%s, which is not supported by the selected %s driver",
2455 msg(
M_USAGE,
"%s, which requires --ip-win32 dynamic or adaptive",
2465#ifdef ENABLE_FRAGMENT
2468 msg(
M_USAGE,
"--fragment can only be used with --proto udp");
2474 msg(
M_USAGE,
"--remote MUST be used in TCP Client mode");
2480 "--http-proxy MUST be used in TCP Client mode (i.e. --proto "
2487 "--http-proxy not specified but other http proxy options present");
2493 "--http-proxy can not be used together with --socks-proxy");
2498 msg(
M_USAGE,
"--socks-proxy can not be used in TCP Server mode");
2503 msg(
M_USAGE,
"TCP server mode allows at most one --remote address");
2511 const char use_err[] =
"--%s cannot be used with --mode server.";
2513#define USAGE_VALID_SERVER_PROTOS "--mode server currently only supports " \
2514 "--proto values of udp, tcp-server, tcp4-server, or tcp6-server"
2515#ifdef TARGET_ANDROID
2516 msg(
M_FATAL,
"--mode server not supported on Android");
2520 msg(
M_USAGE,
"--mode server only works with --dev tun or --dev tap");
2525 msg(
M_WARN,
"--pull-filter ignored for --mode server");
2535 msg(
M_USAGE,
"--port-share only works in TCP server mode "
2536 "(--proto values of tcp-server, tcp4-server, or tcp6-server)");
2541 msg(
M_USAGE,
"--mode server requires --tls-server");
2553 msg(
M_USAGE,
"<connection> cannot be used with --mode server");
2560 "--ipchange cannot be used with --mode server (use "
2561 "--client-connect instead)");
2569 msg(
M_USAGE,
"--connect-freq only works with --mode server --proto udp. Try --max-clients instead.");
2573 msg(
M_USAGE,
"The third parameter to --ifconfig-pool (netmask) is only valid in --dev tap mode");
2577 msg(
M_USAGE,
"--redirect-gateway cannot be used with --mode server (however --push \"redirect-gateway\" is fine)");
2586 "--ifconfig-pool-persist must be used with --ifconfig-pool or --ifconfig-ipv6-pool");
2590 msg(
M_USAGE,
"--ifconfig-ipv6-pool needs --ifconfig-ipv6");
2592 MUST_BE_UNDEF(allow_recursive_routing,
"allow-recursive-routing");
2595 msg(
M_USAGE,
"--auth-user-pass cannot be used with --mode server (it should be used on the client side only)");
2599 msg(
M_USAGE,
"--ccd-exclusive must be used with --client-config-dir");
2603 msg(
M_USAGE,
"--auth-gen-token needs a non-infinite "
2604 "--renegotiate_seconds setting");
2609 msg(
M_USAGE,
"--auth-gen-token renewal time needs to be at least "
2610 " two times --hand-window (%d).",
2618 const char *use_err =
"--%s must be used with --management-client-auth, an --auth-user-pass-verify script, or plugin";
2622 "verify-client-cert none|optional");
2624 "username-as-common-name");
2626 "auth-user-pass-optional");
2631 msg(
M_USAGE,
"--vlan-tagging must be used with --dev tap");
2635 const char use_err[] =
"--%s requires --vlan-tagging";
2642 const char use_err[] =
"--%s requires --mode server";
2648 MUST_BE_UNDEF(ifconfig_pool_persist_filename,
"ifconfig-pool-persist");
2649 MUST_BE_UNDEF(ifconfig_ipv6_pool_defined,
"ifconfig-ipv6-pool");
2654 MUST_BE_UNDEF(client_crresponse_script,
"client-crresponse");
2655 MUST_BE_UNDEF(client_disconnect_script,
"client-disconnect");
2664 "verify-client-cert");
2670 msg(
M_WARN,
"WARNING: setting tcp-nodelay on the client side will not "
2671 "affect the server. To have TCP_NODELAY in both direction use "
2672 "tcp-nodelay in the server configuration instead.");
2674 MUST_BE_UNDEF(auth_user_pass_verify_script,
"auth-user-pass-verify");
2679 msg(
M_USAGE,
"--port-share requires TCP server mode (--mode server --proto tcp-server)");
2682 MUST_BE_UNDEF(stale_routes_check_interval,
"stale-routes-check");
2686 MUST_BE_UNDEF(force_key_material_export,
"force-key-material-export");
2695 msg(
M_USAGE,
"specify only one of --tls-server, --tls-client, or --secret");
2706 msg(msglevel,
"DEPRECATION: No tls-client or tls-server option in "
2707 "configuration detected. OpenVPN 2.8 will remove the "
2708 "functionality to run a VPN without TLS. "
2709 "See the examples section in the manual page for "
2710 "examples of a similar quick setup with peer-fingerprint. "
2711 "OpenVPN 2.7 allows using this configuration when using "
2712 "--allow-deprecated-insecure-static-crypto but you should move "
2713 "to a proper configuration using TLS as soon as possible."
2719 msg(
M_WARN,
"WARNING: POTENTIALLY DANGEROUS OPTION "
2720 "--verify-client-cert none|optional "
2721 "may accept clients which do not present a certificate");
2727 const int tls_version_min =
2733 msg(
M_USAGE,
"--tls-version-min bigger than --tls-version-max");
2742 msg(
M_WARN,
"Option pkcs11-id is ignored as no pkcs11-providers are specified");
2744 else if (!
options->pkcs11_providers[0] &&
options->pkcs11_id_management)
2746 msg(
M_WARN,
"Option pkcs11-id-management is ignored as no pkcs11-providers are specified");
2749 if (
options->pkcs11_providers[0])
2753 msg(
M_USAGE,
"Parameter --pkcs11-id cannot be used when --pkcs11-id-management is also specified.");
2755 if (!
options->pkcs11_id_management &&
options->pkcs11_id == NULL)
2757 msg(
M_USAGE,
"Parameter --pkcs11-id or --pkcs11-id-management should be specified.");
2759 const char use_err[] =
"Parameter --%s cannot be used when --pkcs11-provider is also specified.";
2765#ifdef ENABLE_CRYPTOAPI
2771#ifdef ENABLE_CRYPTOAPI
2774 const char use_err[] =
"Parameter --%s cannot be used when --cryptoapicert is also specified.";
2785#ifdef ENABLE_CRYPTO_MBEDTLS
2786 msg(
M_USAGE,
"Parameter --pkcs12 cannot be used with the mbed TLS version of OpenVPN.");
2788 const char use_err[] =
"Parameter --%s cannot be used when --pkcs12 is also specified.";
2800 msg(
M_USAGE,
"--key and --management-external-key are mutually exclusive");
2806 msg(
M_USAGE,
"--cert and --management-external-cert are mutually exclusive");
2810 msg(
M_USAGE,
"--management-external-cert must be used with --management-external-key");
2824 msg(
M_USAGE,
"No client-side authentication method is "
2825 "specified. You must use either "
2826 "--cert/--key, --pkcs12, or "
2827 "--auth-user-pass");
2832 msg(
M_USAGE,
"If you use one of --cert or --key, you must use them both");
2849 msg(
M_USAGE,
"--tls-auth and --tls-crypt are mutually exclusive");
2854 msg(
M_USAGE,
"--tls-crypt-v2, --tls-auth and --tls-crypt are mutually exclusive in client mode");
2864 const char use_err[] =
"Parameter %s can only be specified in TLS-mode, "
2865 "i.e. where --tls-server or --tls-client is also specified.";
2872#ifndef ENABLE_CRYPTO_MBEDTLS
2899 MUST_BE_UNDEF(pkcs11_private_mode[0],
"pkcs11-private-mode");
2911 msg(
M_USAGE,
"--auth-user-pass requires --pull");
2980 if (ce->
af == AF_INET6)
2982 msg(
M_INFO,
"WARNING: '--proto udp6' is not compatible with "
2983 "'--socks-proxy' today. Forcing IPv4 mode." );
2987 msg(
M_INFO,
"NOTICE: dual-stack mode for '--proto udp' does not "
2988 "work correctly with '--socks-proxy' today. Forcing IPv4." );
3015#ifdef ENABLE_FRAGMENT
3075 msg(
M_WARN,
"NOTICE: --explicit-exit-notify ignored for --proto tcp");
3106 msg(
M_INFO,
"Flag 'def1' added to --redirect-gateway (iservice is in use)");
3279#ifdef DEFAULT_PKCS11_MODULE
3283 if (!
options->pkcs11_providers[0]
3286 options->pkcs11_providers[0] = DEFAULT_PKCS11_MODULE;
3311 msg(
M_WARN,
"Note: --client-to-client has no effect when using data "
3312 "channel offload: packets are always sent to the VPN "
3313 "interface and then routed based on the system routing table");
3343 msg(
M_INFO,
"Note: --cipher is not set. OpenVPN versions before 2.5 "
3344 "defaulted to BF-CBC as fallback when cipher negotiation "
3345 "failed in this case. If you need this fallback please add "
3346 "'--data-ciphers-fallback BF-CBC' to your configuration "
3347 "and/or add BF-CBC to --data-ciphers. E.g. "
3353 msg(
M_WARN,
"DEPRECATED OPTION: --cipher set to '%s' but missing in "
3354 "--data-ciphers (%s). OpenVPN ignores --cipher for cipher "
3391 if (tls_ver_min == 0)
3400 else if (tls_ver_max == 0 || tls_ver_max >=
TLS_VER_1_2)
3461 "supported by the TLS library. Your system does not support this "
3462 "calculation anymore or your security policy (e.g. FIPS 140-2) "
3463 "forbids it. Connections will only work with peers running "
3464 "OpenVPN 2.6.0 or higher)");
3467 msg(
M_WARN,
"Automatically enabling option "
3468 "--force-tls-key-material-export");
3475#if defined(_WIN32) || defined(TARGET_ANDROID)
3493 assert(
sizeof(
dhcp->dns) ==
sizeof(tt->
dns));
3494 assert(
sizeof(
dhcp->dns6) ==
sizeof(tt->
dns6));
3529 msg(
M_WARN,
"WARNING: couldn't copy all --dns search-domains to TUN/TAP");
3535 bool non_standard_server_port =
false;
3540 non_standard_server_port =
true;
3546 || non_standard_server_port)
3553 bool overflow =
false;
3571 msg(
M_WARN,
"WARNING: couldn't copy all --dns server addresses to TUN/TAP");
3602 const int fo_count =
o->foreign_option_index;
3603 o->foreign_option_index = 0;
3627 buf_printf(&name,
"foreign_option_%d", ++
o->foreign_option_index);
3638 if (
dhcp->dns_len ||
dhcp->dns6_len)
3646 for (
size_t i = 0; i <
dhcp->domain_search_list_len; ++i)
3650 new->
name =
dhcp->domain_search_list[i];
3655 const size_t max_addrs =
SIZE(server->
addr);
3656 for (
size_t i = 0; i <
dhcp->dns_len && server->
addr_count < max_addrs; ++i)
3662 for (
size_t i = 0; i <
dhcp->dns6_len && server->
addr_count < max_addrs; ++i)
3673 const char *p[] = {
"dhcp-option", NULL, NULL };
3674 size_t p_len =
sizeof(p) /
sizeof(p[0]);
3681 setenv_foreign_option(o, (
const char **)p, p_len,
es);
3688 bool non_standard_server_port =
false;
3693 non_standard_server_port =
true;
3699 || non_standard_server_port)
3718 setenv_foreign_option(o, (
const char **)p, p_len,
es);
3751 msg(
M_USAGE,
"--data-ciphers list contains unsupported ciphers or is too long.");
3760 for (
i = 0;
i <
rl->len; ++
i)
3832 msg(
M_WARN,
"WARNING: Ignoring option 'dh' in tls-client mode, please only "
3833 "include this in your server configuration");
3836#if ENABLE_MANAGEMENT
3845 msg(
M_INFO,
"Using certificate fingerprint to verify peer (no CA "
3852 msg(
M_USAGE,
"Options 'config stdin' and 'remap-usr1 SIGHUP' are "
3853 "incompatible with each other.");
3878 msg(
M_WARN,
"Option --windows-driver ovpn-dco is ignored because Data Channel Offload is disabled");
3889 msg(
M_WARN,
"Note: ignoring --dev-node as it has no effect when using "
3890 "data channel offload");
3911#if defined(_WIN32) || defined(TARGET_ANDROID)
3914 dhcp_options_postprocess_dns(o,
es);
3930#define CHKACC_FILE (1<<0)
3931#define CHKACC_DIRPATH (1<<1)
3932#define CHKACC_FILEXSTWR (1<<2)
3933#define CHKACC_ACPTSTDIN (1<<3)
3934#define CHKACC_PRIVATE (1<<4)
3935#define CHKACC_ACCEPT_URI (1<<5)
3961 if (!strncmp(file,
"file:", 5))
3965 else if (!strchr(file,
'/') || strchr(file,
'/') > strchr(file,
':'))
3975 char *dirpath =
dirname(fullpath);
4010 if (st.st_mode & (S_IRWXG|S_IRWXO))
4012 msg(
M_WARN,
"WARNING: file '%s' is group or others accessible", file);
4025 return (errcode != 0 ?
true :
false);
4067 const int type,
const char *file,
4068 const int mode,
const char *opt)
4084 const int mode,
const char *opt)
4191 "--crl-verify directory");
4198 R_OK,
"--crl-verify");
4205 W_OK,
"--tls-export-cert");
4238#ifdef ENABLE_MANAGEMENT
4241 "--management user/password file");
4246 "--auth-user-pass");
4249 R_OK|X_OK,
"--chroot directory");
4251 R_OK|W_OK,
"--writepid");
4255 R_OK|W_OK,
"--status");
4259 R_OK|X_OK,
"--client-config-dir");
4261 R_OK|W_OK|X_OK,
"Temporary directory (--tmp-dir)");
4265 msg(
M_USAGE,
"Please correct these errors.");
4296#if defined(_WIN32) || defined(TARGET_ANDROID)
4299 dhcp_options_postprocess_dns(o,
es);
4371 if (
o->ce.occ_mtu != 0)
4401 o->ifconfig_remote_netmask,
4402 o->ifconfig_ipv6_local,
4403 o->ifconfig_ipv6_netbits,
4404 o->ifconfig_ipv6_remote,
4438#ifdef ENABLE_FRAGMENT
4445#define TLS_CLIENT (o->tls_client)
4446#define TLS_SERVER (o->tls_server)
4503#ifdef ENABLE_PREDICTION_RESISTANCE
4504 if (o->use_prediction_resistance)
4506 buf_printf(&out,
",use-prediction-resistance");
4636 msg(msglevel,
"WARNING: '%s' is used inconsistently, %s='%s', %s='%s'",
4648 msg(msglevel,
"WARNING: '%s' is present in %s config but missing in %s config, %s='%s'",
4715 actual[actual_n - 1] = 0;
4716 if (strncmp(actual, expected, 2))
4718 msg(
D_SHOW_OCC,
"NOTE: Options consistency check may be skewed by version differences");
4723 ret = !strcmp(actual, expected);
4759 const char *end =
strchr(
p,
',');
4795 msg(msglevel,
"--topology must be net30, p2p, or subnet");
4837 if (
streq(option,
"interact"))
4841 else if (
streq(option,
"nointeract"))
4845 else if (
streq(option,
"none"))
4851 msg(msglevel,
"--auth-retry method must be 'interact', 'nointeract', or 'none'");
4866 return "nointeract";
4886 fprintf(fp,
"Usage message not available\n");
4942#define LZO_LIB_VER_STR ", LZO ", lzo_version_string()
4944#define LZO_LIB_VER_STR "", ""
4950#undef LZO_LIB_VER_STR
4965#ifdef CONFIGURE_DEFINES
4968#ifdef CONFIGURE_SPECIAL_BUILD
4980 msg(
M_USAGE,
"You must define %s", description);
4989 return !strcmp(s1, s2);
4999ping_rec_err(
int msglevel)
5001 msg(msglevel,
"only one of --ping-exit or --ping-restart options may be specified");
5009 unsigned int val = 0;
5010 sscanf(str,
"%u", &val);
5018 return c ==
'\0' || isspace(c);
5030 const int STATE_INITIAL = 0;
5031 const int STATE_READING_QUOTED_PARM = 1;
5032 const int STATE_READING_UNQUOTED_PARM = 2;
5033 const int STATE_DONE = 3;
5034 const int STATE_READING_SQUOTED_PARM = 4;
5036 const char *error_prefix =
"";
5039 const char *c = line;
5040 int state = STATE_INITIAL;
5041 bool backslash =
false;
5045 unsigned int parm_len = 0;
5047 msglevel &= ~M_OPTERR;
5051 error_prefix =
"ERROR: ";
5059 if (!backslash && in ==
'\\' && state != STATE_READING_SQUOTED_PARM)
5065 if (state == STATE_INITIAL)
5069 if (in ==
';' || in ==
'#')
5073 if (!backslash && in ==
'\"')
5075 state = STATE_READING_QUOTED_PARM;
5077 else if (!backslash && in ==
'\'')
5079 state = STATE_READING_SQUOTED_PARM;
5084 state = STATE_READING_UNQUOTED_PARM;
5088 else if (state == STATE_READING_UNQUOTED_PARM)
5090 if (!backslash &&
space(in))
5099 else if (state == STATE_READING_QUOTED_PARM)
5101 if (!backslash && in ==
'\"')
5110 else if (state == STATE_READING_SQUOTED_PARM)
5121 if (state == STATE_DONE)
5125 memcpy(p[ret], parm, parm_len);
5126 p[ret][parm_len] =
'\0';
5127 state = STATE_INITIAL;
5132 if (backslash && out)
5134 if (!(out ==
'\\' || out ==
'\"' ||
space(out)))
5137 msg(msglevel,
"%sOptions warning: Bad backslash ('\\') usage in %s:%d", error_prefix, file, line_num);
5139 msg(msglevel,
"%sOptions warning: Bad backslash ('\\') usage in %s:%d: remember that backslashes are treated as shell-escapes and if you need to pass backslash characters as part of a Windows filename, you should use double backslashes such as \"c:\\\\" PACKAGE
"\\\\static.key\"", error_prefix, file, line_num);
5150 if (parm_len >=
SIZE(parm))
5152 parm[
SIZE(parm) - 1] = 0;
5153 msg(msglevel,
"%sOptions error: Parameter at %s:%d is too long (%d chars max): %s",
5154 error_prefix, file, line_num, (
int)
SIZE(parm), parm);
5157 parm[parm_len++] = out;
5166 }
while (*c++ !=
'\0');
5168 if (state == STATE_READING_QUOTED_PARM)
5170 msg(msglevel,
"%sOptions error: No closing quotation (\") in %s:%d", error_prefix, file, line_num);
5173 if (state == STATE_READING_SQUOTED_PARM)
5175 msg(msglevel,
"%sOptions error: No closing single quotation (\') in %s:%d", error_prefix, file, line_num);
5178 if (state != STATE_INITIAL)
5180 msg(msglevel,
"%sOptions error: Residual parse state (%d) in %s:%d", error_prefix, state, file, line_num);
5186 for (i = 0; i < ret; ++i)
5198 if (strlen(*p) >= 3 && !strncmp(*p,
"--", 2))
5206#define IS_TYPE_BUF 2
5290 if (arg[0] ==
'<' && arg[
strlen(arg)-1] ==
'>')
5294 arg[
strlen(arg) - 1] =
'\0';
5333 const unsigned int permission_mask,
5334 unsigned int *option_types_found,
5341 const char *top_file,
5344 const unsigned int permission_mask,
5345 unsigned int *option_types_found,
5348 const int max_recursive_levels = 10;
5355 if (level <= max_recursive_levels)
5357 if (
streq(file,
"stdin"))
5368 while (fgets(line,
sizeof(line),
fp))
5375 msg(msglevel,
"In %s:%d: Maximum option line length (%d) exceeded, line starts with %s",
5380 if (line_num == 1 && strncmp(line,
"\xEF\xBB\xBF", 3) == 0)
5389 msglevel, permission_mask, option_types_found,
5391 line_num += lines_inline;
5401 msg(msglevel,
"In %s:%d: Error opening configuration file: %s", top_file, top_line, file);
5406 msg(msglevel,
"In %s:%d: Maximum recursive include levels exceeded in include attempt of file %s -- probably you have a configuration file that tries to include itself.", top_file, top_line, file);
5417 const unsigned int permission_mask,
5418 unsigned int *option_types_found,
5451 unsigned int *option_types_found,
5468 option_types_found,
es);
5473 for (
int i = 1;
i < argc; ++
i)
5480 msg(msglevel,
"I'm trying to parse \"%s\" as an --option parameter but I don't see a leading '--'",
p[0]);
5504 option_types_found,
es);
5529 while (isspace(*line))
5538 msg(
D_LOW,
"Pushed option accepted by filter: '%s'", line);
5543 msg(
D_PUSH,
"Pushed option removed by filter: '%s'", line);
5549 msg(
M_WARN,
"Pushed option rejected by filter: '%s'. Restarting.", line);
5561 unsigned int permission_mask,
5562 unsigned int *option_types_found,
5567 const char *file =
"[PUSH-OPTIONS]";
5570 while (
buf_parse(buf,
',', line,
sizeof(line)))
5582 permission_mask, option_types_found,
es);
5590 const char *filename,
5592 unsigned int permission_mask,
5593 unsigned int *option_types_found,
5596 msg(
D_PUSH,
"OPTIONS IMPORT: reading client specific options from: %s", filename);
5612 const unsigned int permission_mask,
5613 unsigned int *option_types_found,
5619#define VERIFY_PERMISSION(mask) { \
5620 if (!verify_permission(p[0], file, line, (mask), permission_mask, \
5621 option_types_found, msglevel, options, is_inline)) \
5631 const unsigned int type,
5632 const unsigned int allowed,
5633 unsigned int *found,
5638 if (!(
type & allowed))
5640 msg(msglevel,
"option '%s' cannot be used in this context (%s)", name, file);
5646 msg(msglevel,
"option '%s' is not expected to be inline (%s:%d)", name,
5669 msg(
M_WARN,
"Option '%s' in %s:%d is ignored by previous <connection> blocks ", name, file, line);
5673 msg(
M_WARN,
"Option '%s' is ignored by previous <connection> blocks", name);
5685#define NM_QUOTE_HINT (1<<0)
5691 const unsigned int flags)
5702 msg(msglevel,
"the --%s directive should have at most %d parameter%s.%s",
5705 max >= 3 ?
"s" :
"",
5706 (flags &
NM_QUOTE_HINT) ?
" To pass a list of arguments as one of the parameters, try enclosing them in double quotes (\"\")." :
"");
5723 const char **script,
5724 const char *new_script,
5730 msg(
M_WARN,
"Multiple --%s scripts defined. "
5731 "The previously configured script is overridden.",
type);
5733 *script = new_script;
5738 char script_name[100];
5739 snprintf(script_name,
sizeof(script_name),
5740 "--%s script",
type);
5756 msg(
M_WARN,
"WARNING: Compression for receiving enabled. "
5757 "Compression has been used in the past to break encryption. "
5758 "Compression support is deprecated and we recommend to disable "
5769 ret = ret || (
options->pkcs11_providers[0] != NULL);
5771#ifdef ENABLE_CRYPTOAPI
5786 const unsigned int permission_mask,
5787 unsigned int *option_types_found,
5804 p[2] =
"setenv opt";
5812 file =
"[CMD-LINE]";
5815 if (
streq(p[0],
"help"))
5821 msg(msglevel,
"--help does not accept any parameters");
5825 if (
streq(p[0],
"version") && !p[1])
5830 else if (
streq(p[0],
"config") && p[1] && !p[2])
5842#if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL)
5843 else if (
streq(p[0],
"show-gateway") && !p[2])
5847 in_addr_t remote_ipv4 = 0;
5848 struct in6_addr remote_ipv6 = IN6ADDR_ANY_INIT;
5867 else if (
streq(p[0],
"echo") ||
streq(p[0],
"parameter"))
5891 if (
p[1] &&
strncmp(
p[1],
"msg", 3) == 0)
5897#ifdef ENABLE_MANAGEMENT
5906 msg(
M_WARN,
"echo/parameter option overflow");
5909#ifdef ENABLE_MANAGEMENT
5910 else if (
streq(
p[0],
"management") &&
p[1] &&
p[2] && !
p[4])
5915#if UNIX_SOCK_SUPPORT
5918 msg(msglevel,
"MANAGEMENT: this platform does not support unix domain sockets");
5930 else if (
streq(
p[0],
"management-client-user") &&
p[1] && !
p[2])
5935 else if (
streq(
p[0],
"management-client-group") &&
p[1] && !
p[2])
5940 else if (
streq(
p[0],
"management-query-passwords") && !
p[1])
5945 else if (
streq(
p[0],
"management-query-remote") && !
p[1])
5950 else if (
streq(
p[0],
"management-query-proxy") && !
p[1])
5955 else if (
streq(
p[0],
"management-hold") && !
p[1])
5960 else if (
streq(
p[0],
"management-signal") && !
p[1])
5965 else if (
streq(
p[0],
"management-forget-disconnect") && !
p[1])
5970 else if (
streq(
p[0],
"management-up-down") && !
p[1])
5975 else if (
streq(
p[0],
"management-client") && !
p[1])
5980 else if (
streq(
p[0],
"management-external-key"))
5989 else if (
streq(
p[
j],
"pkcs1"))
5997 else if (
streq(
p[
j],
"digest"))
6003 msg(msglevel,
"Unknown management-external-key flag: %s",
p[
j]);
6017 else if (
streq(
p[0],
"management-external-cert") &&
p[1] && !
p[2])
6023 else if (
streq(
p[0],
"management-client-auth") && !
p[1])
6028 else if (
streq(
p[0],
"management-log-cache") &&
p[1] && !
p[2])
6036 msg(msglevel,
"--management-log-cache parameter is out of range");
6043 else if (
streq(
p[0],
"plugin") &&
p[1])
6052 msg(msglevel,
"plugin add failed: %s",
p[1]);
6057 else if (
streq(
p[0],
"mode") &&
p[1] && !
p[2])
6064 else if (
streq(
p[1],
"server"))
6070 msg(msglevel,
"Bad --mode parameter: %s",
p[1]);
6074 else if (
streq(
p[0],
"dev") &&
p[1] && !
p[2])
6079 else if (
streq(
p[0],
"dev-type") &&
p[1] && !
p[2])
6085 else if (
streq(
p[0],
"windows-driver") &&
p[1] && !
p[2])
6088 msg(
M_WARN,
"DEPRECATED OPTION: windows-driver: In OpenVPN 2.7, the default Windows driver is ovpn-dco. "
6089 "If incompatible options are used, OpenVPN will fall back to tap-windows6. Wintun support has been removed.");
6092 else if (
streq(
p[0],
"disable-dco"))
6096 else if (
streq(
p[0],
"dev-node") &&
p[1] && !
p[2])
6101 else if (
streq(
p[0],
"lladdr") &&
p[1] && !
p[2])
6110 msg(msglevel,
"lladdr parm '%s' must be a MAC address",
p[1]);
6114 else if (
streq(
p[0],
"topology") &&
p[1] && !
p[2])
6119 else if (
streq(
p[0],
"tun-ipv6") && !
p[1])
6123 msg(
M_WARN,
"Note: option tun-ipv6 is ignored because modern operating systems do not need special IPv6 tun handling anymore.");
6126#ifdef ENABLE_IPROUTE
6127 else if (
streq(
p[0],
"iproute") &&
p[1] && !
p[2])
6133 else if (
streq(
p[0],
"ifconfig") &&
p[1] &&
p[2] && !
p[3])
6143 msg(msglevel,
"ifconfig parms '%s' and '%s' must be valid addresses",
p[1],
p[2]);
6147 else if (
streq(
p[0],
"ifconfig-ipv6") &&
p[1] &&
p[2] && !
p[3])
6149 unsigned int netbits;
6157 msg( msglevel,
"ifconfig-ipv6: /netbits must be between 64 and 124, not '/%d'", netbits );
6167 msg(msglevel,
"ifconfig-ipv6 parms '%s' and '%s' must be valid addresses",
p[1],
p[2]);
6171 else if (
streq(
p[0],
"ifconfig-noexec") && !
p[1])
6176 else if (
streq(
p[0],
"ifconfig-nowarn") && !
p[1])
6181 else if (
streq(
p[0],
"local") &&
p[1] && !
p[4])
6193 if (strcmp(p[1],
"*") != 0)
6208 else if (
streq(p[0],
"remote-random") && !p[1])
6213 else if (
streq(p[0],
"connection") && p[1] && !p[3])
6227 msg(msglevel,
"Each 'connection' block must contain exactly one 'remote' directive");
6243 else if (
streq(p[0],
"ignore-unknown-option") && p[1])
6248 const char **ignore;
6252 for (i = 1; p[i]; i++)
6274 for (j = 1; p[j]; j++)
6277 if (p[j][0]==
'-' && p[j][1]==
'-')
6290#if ENABLE_MANAGEMENT
6291 else if (
streq(p[0],
"http-proxy-override") && p[1] && p[2] && !p[4])
6301 else if (
streq(p[0],
"remote") && p[1] && !p[4])
6320 "remote: bad protocol associated with host %s: '%s'",
6342 else if (
streq(p[0],
"resolv-retry") && p[1] && !p[2])
6345 if (
streq(p[1],
"infinite"))
6354 else if ((
streq(p[0],
"preresolve") ||
streq(p[0],
"ip-remote-hint")) && !p[2])
6365 else if (
streq(p[0],
"connect-retry") && p[1] && !p[3])
6376 msg(
M_WARN,
"connect retry wait interval truncated to %d",
6386 else if ((
streq(p[0],
"connect-timeout") ||
streq(p[0],
"server-poll-timeout"))
6392 else if (
streq(p[0],
"connect-retry-max") && p[1] && !p[2])
6397 else if (
streq(p[0],
"ipchange") && p[1])
6409 else if (
streq(p[0],
"float") && !p[1])
6415 else if (
streq(p[0],
"gremlin") && p[1] && !p[2])
6421 else if (
streq(p[0],
"chroot") && p[1] && !p[2])
6426 else if (
streq(p[0],
"cd") && p[1] && !p[2])
6431 msg(
M_ERR,
"cd to '%s' failed", p[1]);
6436#ifdef ENABLE_SELINUX
6437 else if (
streq(p[0],
"setcon") && p[1] && !p[2])
6440 options->selinux_context = p[1];
6443 else if (
streq(p[0],
"writepid") && p[1] && !p[2])
6448 else if (
streq(p[0],
"up") && p[1])
6457 else if (
streq(p[0],
"down") && p[1])
6466 else if (
streq(p[0],
"down-pre") && !p[1])
6471 else if (
streq(p[0],
"up-delay") && !p[1])
6476 else if (
streq(p[0],
"up-restart") && !p[1])
6481 else if (
streq(p[0],
"syslog") && !p[2])
6486 else if (
streq(p[0],
"daemon") && !p[2])
6499 msg(
M_WARN,
"WARNING: Multiple --daemon directives specified, ignoring --daemon %s. (Note that initscripts sometimes add their own --daemon directive.)", p[1]);
6504 else if (
streq(p[0],
"log") && p[1] && !p[2])
6510 else if (
streq(p[0],
"suppress-timestamps") && !p[1])
6516 else if (
streq(p[0],
"machine-readable-output") && !p[1])
6522 else if (
streq(p[0],
"log-append") && p[1] && !p[2])
6528#ifdef ENABLE_MEMSTATS
6529 else if (
streq(p[0],
"memstats") && p[1] && !p[2])
6535 else if (
streq(p[0],
"mlock") && !p[1])
6540#if ENABLE_IP_PKTINFO
6541 else if (
streq(p[0],
"multihome") && !p[1])
6547 else if (
streq(p[0],
"verb") && p[1] && !p[2])
6557#if !defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL)
6561 msg(
M_WARN,
"NOTE: debug verbosity (--verb %d) is enabled but this build lacks debug support.",
6566 else if (
streq(p[0],
"mute") && p[1] && !p[2])
6571 else if (
streq(p[0],
"errors-to-stderr") && !p[1])
6576 else if (
streq(p[0],
"status") && p[1] && !p[3])
6585 else if (
streq(p[0],
"status-version") && p[1] && !p[2])
6591 if (version < 1 || version > 3)
6593 msg(msglevel,
"--status-version must be 1 to 3");
6598 else if (
streq(p[0],
"remap-usr1") && p[1] && !p[2])
6601 if (
streq(p[1],
"SIGHUP"))
6605 else if (
streq(p[1],
"SIGTERM"))
6611 msg(msglevel,
"--remap-usr1 parm must be 'SIGHUP' or 'SIGTERM'");
6615 else if ((
streq(p[0],
"link-mtu") ||
streq(p[0],
"udp-mtu")) && p[1] && !p[2])
6621 else if (
streq(p[0],
"tun-mtu") && p[1] && !p[3])
6635 else if (
streq(p[0],
"tun-mtu-max") && p[1] && !p[3])
6639 if (max_mtu < 68 || max_mtu > 65536)
6641 msg(msglevel,
"--tun-mtu-max value '%s' is invalid", p[1]);
6648 else if (
streq(p[0],
"tun-mtu-extra") && p[1] && !p[2])
6654 else if (
streq(p[0],
"max-packet-size") && p[1] && !p[2])
6662 msg(
M_WARN,
"Note: max-packet-size value outside of allowed "
6663 "control channel packet size (%d to %d), will use %d "
6673#ifdef ENABLE_FRAGMENT
6674 else if (
streq(p[0],
"mtu-dynamic"))
6677 msg(msglevel,
"--mtu-dynamic has been replaced by --fragment");
6680 else if (
streq(p[0],
"fragment") && p[1] && !p[3])
6687 msg(msglevel,
"--fragment needs to be at least 68");
6691 if (p[2] &&
streq(p[2],
"mtu"))
6697 msg(msglevel,
"Unknown parameter to --fragment: %s", p[2]);
6701 else if (
streq(p[0],
"mtu-disc") && p[1] && !p[2])
6706 else if (
streq(p[0],
"mtu-test") && !p[1])
6711 else if (
streq(p[0],
"nice") && p[1] && !p[2])
6716 else if (
streq(p[0],
"rcvbuf") && p[1] && !p[2])
6721 else if (
streq(p[0],
"sndbuf") && p[1] && !p[2])
6726 else if (
streq(p[0],
"mark") && p[1] && !p[2])
6728#if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK
6733 else if (
streq(p[0],
"socket-flags"))
6739 if (
streq(p[j],
"TCP_NODELAY"))
6745 msg(msglevel,
"unknown socket flag: %s", p[j]);
6750 else if (
streq(p[0],
"bind-dev") && p[1])
6756 else if (
streq(p[0],
"txqueuelen") && p[1] && !p[2])
6762 msg(msglevel,
"--txqueuelen not supported on this OS");
6766 else if (
streq(p[0],
"shaper") && p[1] && !p[2])
6772 if (shaper < SHAPER_MIN || shaper >
SHAPER_MAX)
6774 msg(msglevel,
"Bad shaper value, must be between %d and %d",
6780 else if (
streq(p[0],
"port") && p[1] && !p[2])
6785 else if (
streq(p[0],
"lport") && p[1] && !p[2])
6790 if (!
streq(p[1],
"0"))
6796 else if (
streq(p[0],
"rport") && p[1] && !p[2])
6801 else if (
streq(p[0],
"bind") && !p[2])
6805 if (p[1] &&
streq(p[1],
"ipv6only"))
6811 else if (
streq(p[0],
"nobind") && !p[1])
6816 else if (
streq(p[0],
"fast-io") && !p[1])
6821 else if (
streq(p[0],
"inactive") && p[1] && !p[3])
6827 int64_t val = atoll(p[2]);
6831 msg(
M_WARN,
"WARNING: '--inactive' with a 'bytes' value"
6832 " >2 Gbyte was silently ignored in older versions. If "
6833 " your VPN exits unexpectedly with 'Inactivity timeout'"
6834 " in %d seconds, revisit this value.",
6839 else if (
streq(p[0],
"session-timeout") && p[1] && !p[2])
6844 else if (
streq(p[0],
"proto") && p[1] && !p[2])
6854 "Bad protocol: '%s'. Allowed protocols with --proto option: %s",
6862 else if (
streq(p[0],
"proto-force") && p[1] && !p[2])
6867 if (proto_force < 0)
6869 msg(msglevel,
"Bad --proto-force protocol: '%s'", p[1]);
6874 else if (
streq(p[0],
"http-proxy") && p[1] && !p[5])
6883 msg(msglevel,
"http-proxy port number not defined");
6897 if (
streq(p[3],
"auto"))
6901 else if (
streq(p[3],
"auto-nct"))
6921 else if (
streq(p[0],
"http-proxy-user-pass") && p[1])
6929 else if (
streq(p[0],
"http-proxy-retry") ||
streq(p[0],
"socks-proxy-retry"))
6932 msg(
M_WARN,
"DEPRECATED OPTION: http-proxy-retry and socks-proxy-retry: "
6933 "In OpenVPN 2.4 proxy connection retries are handled like regular connections. "
6934 "Use connect-retry-max 1 to get a similar behavior as before.");
6936 else if (
streq(p[0],
"http-proxy-timeout") && p[1] && !p[2])
6939 msg(
M_WARN,
"DEPRECATED OPTION: http-proxy-timeout: In OpenVPN 2.4 the timeout until a connection to a "
6940 "server is established is managed with a single timeout set by connect-timeout");
6942 else if (
streq(p[0],
"http-proxy-option") && p[1] && !p[4])
6949 if (
streq(p[1],
"VERSION") && p[2] && !p[3])
6953 else if (
streq(p[1],
"AGENT") && p[2] && !p[3])
6957 else if ((
streq(p[1],
"EXT1") ||
streq(p[1],
"EXT2") ||
streq(p[1],
"CUSTOM-HEADER"))
6982 custom_header->
name = p[2];
6983 custom_header->
content = p[3];
6988 msg(msglevel,
"Bad http-proxy-option or missing or extra parameter: '%s'", p[1]);
6991 else if (
streq(p[0],
"socks-proxy") && p[1] && !p[4])
7006 else if (
streq(p[0],
"keepalive") && p[1] && p[2] && !p[3])
7012 else if (
streq(p[0],
"ping") && p[1] && !p[2])
7017 else if (
streq(p[0],
"ping-exit") && p[1] && !p[2])
7023 else if (
streq(p[0],
"ping-restart") && p[1] && !p[2])
7029 else if (
streq(p[0],
"ping-timer-rem") && !p[1])
7034 else if (
streq(p[0],
"explicit-exit-notify") && !p[2])
7046 else if (
streq(p[0],
"persist-tun") && !p[1])
7051 else if (
streq(p[0],
"persist-key") && !p[1])
7054 msg(
M_WARN,
"DEPRECATED: --persist-key option ignored. "
7055 "Keys are now always persisted across restarts. ");
7057 else if (
streq(p[0],
"persist-local-ip") && !p[1])
7062 else if (
streq(p[0],
"persist-remote-ip") && !p[1])
7067 else if (
streq(p[0],
"client-nat") && p[1] && p[2] && p[3] && p[4] && !p[5])
7073 else if (
streq(p[0],
"route-table") && p[1] && !p[2])
7076 msg(
M_WARN,
"NOTE: --route-table is supported only on Linux when SITNL is built-in");
7081 else if (
streq(p[0],
"route") && p[1] && !p[5])
7089 msg(msglevel,
"route parameter network/IP '%s' must be a valid address", p[1]);
7094 msg(msglevel,
"route parameter netmask '%s' must be an IP address", p[2]);
7099 msg(msglevel,
"route parameter gateway '%s' must be a valid address", p[3]);
7106 else if (
streq(p[0],
"route-ipv6") && p[1] && !p[4])
7114 msg(msglevel,
"route-ipv6 parameter network/IP '%s' must be a valid address", p[1]);
7119 msg(msglevel,
"route-ipv6 parameter gateway '%s' must be a valid address", p[2]);
7126 else if (
streq(p[0],
"max-routes") && !p[2])
7128 msg(
M_WARN,
"DEPRECATED OPTION: --max-routes option ignored. "
7129 "The number of routes is unlimited as of OpenVPN 2.4. "
7130 "This option will be removed in a future version, "
7131 "please remove it from your configuration.");
7133 else if (
streq(p[0],
"route-gateway") && p[1] && !p[2])
7136 if (
streq(p[1],
"dhcp"))
7148 msg(msglevel,
"route-gateway parm '%s' must be a valid address", p[1]);
7153 else if (
streq(p[0],
"route-ipv6-gateway") && p[1] && !p[2])
7161 msg(msglevel,
"route-ipv6-gateway parm '%s' must be a valid address", p[1]);
7165 else if (
streq(p[0],
"route-metric") && p[1] && !p[2])
7170 else if (
streq(p[0],
"route-delay") && !p[3])
7187 else if (
streq(p[0],
"route-up") && p[1])
7196 else if (
streq(p[0],
"route-pre-down") && p[1])
7206 "route-pre-down",
true);
7208 else if (
streq(p[0],
"route-noexec") && !p[1])
7213 else if (
streq(p[0],
"route-nopull") && !p[1])
7218 else if (
streq(p[0],
"pull-filter") && p[1] && p[2] && !p[3])
7224 if (strcmp(
"accept", p[1]) == 0)
7228 else if (strcmp(
"ignore", p[1]) == 0)
7232 else if (strcmp(
"reject", p[1]) == 0)
7238 msg(msglevel,
"Unknown --pull-filter type: %s", p[1]);
7242 f->
size = strlen(p[2]);
7244 else if (
streq(p[0],
"allow-pull-fqdn") && !p[1])
7249 else if (
streq(p[0],
"redirect-gateway") ||
streq(p[0],
"redirect-private"))
7258 "WARNING: You have specified redirect-gateway and "
7259 "redirect-private at the same time (or the same option "
7260 "multiple times). This is not well supported and may lead to "
7261 "unexpected results");
7266 if (
streq(p[0],
"redirect-gateway"))
7270 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
7272 if (
streq(p[j],
"local"))
7276 else if (
streq(p[j],
"autolocal"))
7280 else if (
streq(p[j],
"def1"))
7284 else if (
streq(p[j],
"bypass-dhcp"))
7288 else if (
streq(p[j],
"bypass-dns"))
7292 else if (
streq(p[j],
"block-local"))
7296 else if (
streq(p[j],
"ipv6"))
7301 else if (
streq(p[j],
"!ipv4"))
7307 msg(msglevel,
"unknown --%s flag: %s", p[0], p[j]);
7316 else if (
streq(p[0],
"block-ipv6") && !p[1])
7321 else if (
streq(p[0],
"remote-random-hostname") && !p[1])
7326 else if (
streq(p[0],
"setenv") && p[1] && !p[3])
7329 if (
streq(p[1],
"REMOTE_RANDOM_HOSTNAME") && !p[2])
7333 else if (
streq(p[1],
"GENERIC_CONFIG"))
7335 msg(msglevel,
"this is a generic configuration and cannot directly be used");
7338 else if (
streq(p[1],
"PUSH_PEER_INFO") && !p[2])
7342 else if (
streq(p[1],
"SERVER_POLL_TIMEOUT") && p[2])
7348 if (
streq(p[1],
"FORWARD_COMPATIBLE") && p[2] &&
streq(p[2],
"1"))
7356 else if (
streq(p[0],
"compat-mode") && p[1] && !p[3])
7358 unsigned int major, minor, patch;
7359 if (!(sscanf(p[1],
"%u.%u.%u", &major, &minor, &patch) == 3))
7361 msg(msglevel,
"cannot parse version number for --compat-mode: %s",
7368 else if (
streq(p[0],
"setenv-safe") && p[1] && !p[3])
7373 else if (
streq(p[0],
"script-security") && p[1] && !p[2])
7378 else if (
streq(p[0],
"mssfix") && !p[3])
7387 && (mssfix < TLS_CHANNEL_MTU_MIN || mssfix > UINT16_MAX))
7389 msg(msglevel,
"--mssfix value '%s' is invalid", p[1]);
7407 if (p[2] &&
streq(p[2],
"mtu"))
7411 else if (p[2] &&
streq(p[2],
"fixed"))
7417 msg(msglevel,
"Unknown parameter to --mssfix: %s", p[2]);
7420 else if (
streq(p[0],
"disable-occ") && !p[1])
7425 else if (
streq(p[0],
"server") && p[1] && p[2] && !p[4])
7429 in_addr_t network, netmask;
7434 if (error || !network || !netmask)
7436 msg(msglevel,
"error parsing --server parameters");
7445 if (
streq(p[3],
"nopool"))
7451 msg(msglevel,
"error parsing --server: %s is not a recognized flag", p[3]);
7456 else if (
streq(p[0],
"server-ipv6") && p[1] && !p[2])
7459 struct in6_addr network;
7460 unsigned int netbits = 0;
7465 msg(msglevel,
"error parsing --server-ipv6 parameter");
7468 if (netbits < 64 || netbits > 124)
7471 "--server-ipv6 settings: network must be between /64 and /124 (not /%d)",
7480 else if (
streq(p[0],
"server-bridge") && p[1] && p[2] && p[3] && p[4] && !p[5])
7484 in_addr_t ip, netmask, pool_start, pool_end;
7491 if (error || !ip || !netmask || !pool_start || !pool_end)
7493 msg(msglevel,
"error parsing --server-bridge parameters");
7502 else if (
streq(p[0],
"server-bridge") && p[1] &&
streq(p[1],
"nogw") && !p[2])
7508 else if (
streq(p[0],
"server-bridge") && !p[1])
7513 else if (
streq(p[0],
"push") && p[1] && !p[2])
7518 else if (
streq(p[0],
"push-reset") && !p[1])
7523 else if (
streq(p[0],
"push-remove") && p[1] && !p[2])
7529 else if (
streq(p[0],
"ifconfig-pool") && p[1] && p[2] && !p[4])
7533 in_addr_t start, end, netmask = 0;
7544 msg(msglevel,
"error parsing --ifconfig-pool parameters");
7560 else if (
streq(p[0],
"ifconfig-pool-persist") && p[1] && !p[3])
7569 else if (
streq(p[0],
"ifconfig-ipv6-pool") && p[1] && !p[2])
7572 struct in6_addr network;
7573 unsigned int netbits = 0;
7578 msg(msglevel,
"error parsing --ifconfig-ipv6-pool parameters");
7581 if (netbits < 64 || netbits > 124)
7584 "--ifconfig-ipv6-pool settings: network must be between /64 and /124 (not /%d)",
7593 else if (
streq(p[0],
"hash-size") && p[1] && p[2] && !p[3])
7600 if (real < 1 ||
virtual < 1)
7602 msg(msglevel,
"--hash-size sizes must be >= 1 (preferably a power of 2)");
7608 else if (
streq(p[0],
"connect-freq") && p[1] && p[2] && !p[3])
7615 if (cf_max < 0 || cf_per < 0)
7617 msg(msglevel,
"--connect-freq parms must be > 0");
7623 else if (
streq(p[0],
"connect-freq-initial") && p[1] && p[2] && !p[3])
7625 long cf_max, cf_per;
7629 cf_max = strtol(p[1], &e1, 10);
7630 cf_per = strtol(p[2], &e2, 10);
7631 if (cf_max < 0 || cf_per < 0 || *e1 !=
'\0' || *e2 !=
'\0')
7633 msg(msglevel,
"--connect-freq-initial parameters must be integers and >= 0");
7639 else if (
streq(p[0],
"max-clients") && p[1] && !p[2])
7644 max_clients =
atoi_warn(p[1], msglevel);
7645 if (max_clients < 0)
7647 msg(msglevel,
"--max-clients must be at least 1");
7652 msg(msglevel,
"--max-clients must be less than %d",
MAX_PEER_ID);
7657 else if (
streq(p[0],
"max-routes-per-client") && p[1] && !p[2])
7662 else if (
streq(p[0],
"client-cert-not-required") && !p[1])
7665 msg(
M_FATAL,
"REMOVED OPTION: --client-cert-not-required, use '--verify-client-cert none' instead");
7667 else if (
streq(p[0],
"verify-client-cert") && !p[2])
7676 if (
streq(p[1],
"none"))
7680 else if (
streq(p[1],
"optional"))
7684 else if (!
streq(p[1],
"require"))
7686 msg(msglevel,
"parameter to --verify-client-cert must be 'none', 'optional' or 'require'");
7691 else if (
streq(p[0],
"username-as-common-name") && !p[1])
7696 else if (
streq(p[0],
"auth-user-pass-optional") && !p[1])
7701 else if (
streq(p[0],
"opt-verify") && !p[1])
7704 msg(
M_INFO,
"DEPRECATION: opt-verify is deprecated and will be removed "
7708 else if (
streq(p[0],
"auth-user-pass-verify") && p[1])
7717 if (
streq(p[2],
"via-env"))
7721 else if (
streq(p[2],
"via-file"))
7727 msg(msglevel,
"second parm to --auth-user-pass-verify must be 'via-env' or 'via-file'");
7733 msg(msglevel,
"--auth-user-pass-verify requires a second parameter ('via-env' or 'via-file')");
7738 p[1],
"auth-user-pass-verify",
true);
7740 else if (
streq(p[0],
"auth-gen-token"))
7746 for (
int i = 2; i <
MAX_PARMS && p[i] != NULL; i++)
7753 else if (
streq(p[i],
"external-auth"))
7759 msg(msglevel,
"Invalid argument to auth-gen-token: %s (%d)", p[i], i);
7764 else if (
streq(p[0],
"auth-gen-token-secret") && p[1] && !p[2])
7771 else if (
streq(p[0],
"client-connect") && p[1])
7779 p[1],
"client-connect",
true);
7781 else if (
streq(p[0],
"client-crresponse") && p[1])
7789 p[1],
"client-crresponse",
true);
7791 else if (
streq(p[0],
"client-disconnect") && p[1])
7799 p[1],
"client-disconnect",
true);
7801 else if (
streq(p[0],
"learn-address") && p[1])
7809 p[1],
"learn-address",
true);
7811 else if (
streq(p[0],
"tmp-dir") && p[1] && !p[2])
7816 else if (
streq(p[0],
"client-config-dir") && p[1] && !p[2])
7821 else if (
streq(p[0],
"ccd-exclusive") && !p[1])
7826 else if (
streq(p[0],
"bcast-buffers") && p[1] && !p[2])
7831 n_bcast_buf =
atoi_warn(p[1], msglevel);
7832 if (n_bcast_buf < 1)
7834 msg(msglevel,
"--bcast-buffers parameter must be > 0");
7838 else if (
streq(p[0],
"tcp-queue-limit") && p[1] && !p[2])
7840 int tcp_queue_limit;
7843 tcp_queue_limit =
atoi_warn(p[1], msglevel);
7844 if (tcp_queue_limit < 1)
7846 msg(msglevel,
"--tcp-queue-limit parameter must be > 0");
7851 else if (
streq(p[0],
"port-share") && p[1] && p[2] && !p[4])
7854 options->port_share_host = p[1];
7855 options->port_share_port = p[2];
7856 options->port_share_journal_dir = p[3];
7859 else if (
streq(p[0],
"client-to-client") && !p[1])
7864 else if (
streq(p[0],
"duplicate-cn") && !p[1])
7869 else if (
streq(p[0],
"iroute") && p[1] && !p[3])
7874 else if (
streq(p[0],
"iroute-ipv6") && p[1] && !p[2])
7879 else if (
streq(p[0],
"ifconfig-push") && p[1] && p[2] && !p[4])
7881 in_addr_t local, remote_netmask;
7886 if (local && remote_netmask)
7898 msg(msglevel,
"cannot parse --ifconfig-push addresses");
7902 else if (
streq(p[0],
"ifconfig-push-constraint") && p[1] && p[2] && !p[3])
7904 in_addr_t network, netmask;
7909 if (network && netmask)
7917 msg(msglevel,
"cannot parse --ifconfig-push-constraint addresses");
7921 else if (
streq(p[0],
"ifconfig-ipv6-push") && p[1] && !p[3])
7923 struct in6_addr local, remote;
7924 unsigned int netbits;
7930 msg(msglevel,
"cannot parse --ifconfig-ipv6-push addresses");
7938 msg( msglevel,
"cannot parse --ifconfig-ipv6-push addresses");
7948 msg( msglevel,
"second argument to --ifconfig-ipv6-push missing and no global --ifconfig-ipv6 address set");
7959 else if (
streq(p[0],
"disable") && !p[1])
7964 else if (
streq(p[0],
"override-username") && p[1] && !p[2])
7969 msg(msglevel,
"override-username exceeds the maximum length of %d "
7981 else if (
streq(p[0],
"tcp-nodelay") && !p[1])
7986 else if (
streq(p[0],
"stale-routes-check") && p[1] && !p[3])
7988 int ageing_time, check_interval;
7991 ageing_time =
atoi_warn(p[1], msglevel);
7994 check_interval =
atoi_warn(p[2], msglevel);
7998 check_interval = ageing_time;
8001 if (ageing_time < 1 || check_interval < 1)
8003 msg(msglevel,
"--stale-routes-check aging time and check interval must be >= 1");
8010 else if (
streq(p[0],
"client") && !p[1])
8015 else if (
streq(p[0],
"pull") && !p[1])
8020 else if (
streq(p[0],
"push-continuation") && p[1] && !p[2])
8025 else if (
streq(p[0],
"auth-user-pass") && !p[2])
8038 else if (
streq(p[0],
"auth-retry") && p[1] && !p[2])
8043#ifdef ENABLE_MANAGEMENT
8044 else if (
streq(p[0],
"static-challenge") && p[1] && p[2] && !p[4])
8052 if (p[3] &&
streq(p[3],
"concat"))
8056 else if (p[3] && !
streq(p[3],
"scrv1"))
8058 msg(msglevel,
"--static-challenge: unknown format indicator '%s'", p[3]);
8063 else if (
streq(p[0],
"msg-channel") && p[1])
8067 HANDLE process = GetCurrentProcess();
8068 HANDLE handle = (HANDLE) ((intptr_t) atoll(p[1]));
8070 FALSE, DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS))
8072 msg(msglevel,
"could not duplicate service pipe handle");
8077 msg(msglevel,
"--msg-channel is only supported on Windows");
8082 else if (
streq(p[0],
"win-sys") && p[1] && !p[2])
8085 if (
streq(p[1],
"env"))
8087 msg(
M_INFO,
"NOTE: --win-sys env is default from OpenVPN 2.3. "
8088 "This entry will now be ignored. "
8089 "Please remove this entry from your configuration file.");
8096 else if (
streq(p[0],
"route-method") && p[1] && !p[2])
8099 if (
streq(p[1],
"adaptive"))
8103 else if (
streq(p[1],
"ipapi"))
8107 else if (
streq(p[1],
"exe"))
8113 msg(msglevel,
"--route method must be 'adaptive', 'ipapi', or 'exe'");
8117 else if (
streq(p[0],
"ip-win32") && p[1] && !p[4])
8127 "Bad --ip-win32 method: '%s'. Allowed methods: %s",
8142 if (!
streq(p[2],
"default"))
8146 if (!(offset > -256 && offset < 256))
8148 msg(msglevel,
"--ip-win32 dynamic [offset] [lease-time]: offset (%d) must be > -256 and < 256", offset);
8158 const int min_lease = 30;
8161 if (lease_time < min_lease)
8163 msg(msglevel,
"--ip-win32 dynamic [offset] [lease-time]: lease time parameter (%d) must be at least %d seconds", lease_time, min_lease);
8174 else if (
streq(p[0],
"dns-updown") && p[1])
8182 if (
streq(p[1],
"disable"))
8187 else if (
streq(p[1],
"force"))
8192 dns->
updown = DEFAULT_DNS_UPDOWN;
8207 else if (
streq(p[0],
"dns") && p[1])
8211 if (
streq(p[1],
"search-domains") && p[2])
8215 else if (
streq(p[1],
"server") && p[2] && p[3] && p[4])
8220 msg(msglevel,
"--dns server: invalid priority value '%s'", p[2]);
8226 if (
streq(p[3],
"address") && p[4])
8228 for (
int i = 4; p[i]; ++i)
8232 msg(msglevel,
"--dns server %ld: malformed address or maximum exceeded '%s'",
priority, p[i]);
8237 else if (
streq(p[3],
"resolve-domains"))
8241 else if (
streq(p[3],
"dnssec") && !p[5])
8243 if (
streq(p[4],
"yes"))
8247 else if (
streq(p[4],
"no"))
8251 else if (
streq(p[4],
"optional"))
8257 msg(msglevel,
"--dns server %ld: malformed dnssec value '%s'",
priority, p[4]);
8261 else if (
streq(p[3],
"transport") && !p[5])
8263 if (
streq(p[4],
"plain"))
8267 else if (
streq(p[4],
"DoH"))
8271 else if (
streq(p[4],
"DoT"))
8277 msg(msglevel,
"--dns server %ld: malformed transport value '%s'",
priority, p[4]);
8281 else if (
streq(p[3],
"sni") && !p[5])
8287 msg(msglevel,
"--dns server %ld: unknown option type '%s' or missing or unknown parameter",
priority, p[3]);
8293 msg(msglevel,
"--dns: unknown option type '%s' or missing or unknown parameter", p[1]);
8297 else if (
streq(p[0],
"dhcp-option") && p[1])
8300#if defined(_WIN32) || defined(TARGET_ANDROID)
8305 if ((
streq(p[1],
"DOMAIN") ||
streq(p[1],
"ADAPTER_DOMAIN_SUFFIX")) && p[2] && !p[3])
8307 dhcp->domain = p[2];
8309 else if (
streq(p[1],
"DOMAIN-SEARCH") && p[2] && !p[3])
8313 dhcp->domain_search_list[
dhcp->domain_search_list_len++] = p[2];
8317 msg(msglevel,
"--dhcp-option %s: maximum of %d search entries can be specified",
8321 else if ((
streq(p[1],
"DNS") ||
streq(p[1],
"DNS6")) && p[2] && !p[3]
8324 if (strstr(p[2],
":"))
8333#if defined(_WIN32) || defined(TARGET_ANDROID)
8334 else if (
streq(p[1],
"NBS") && p[2] && !p[3])
8339 else if (
streq(p[1],
"NBT") && p[2] && !p[3])
8343 if (!(t == 1 || t == 2 || t == 4 || t == 8))
8345 msg(msglevel,
"--dhcp-option NBT: parameter (%d) must be 1, 2, 4, or 8", t);
8351 else if (
streq(p[1],
"WINS") && p[2] && !p[3])
8355 else if (
streq(p[1],
"NTP") && p[2] && !p[3])
8360 else if (
streq(p[1],
"NBDD") && p[2] && !p[3])
8365 else if (
streq(p[1],
"DISABLE-NBT") && !p[2])
8370#if defined(TARGET_ANDROID)
8371 else if (
streq(p[1],
"PROXY_HTTP") && p[3] && !p[4])
8374 o->http_proxy = p[2];
8379 msg(msglevel,
"--dhcp-option: unknown option type '%s' or missing or unknown parameter", p[1]);
8383 setenv_foreign_option(
options, (
const char **)p, 3,
es);
8387 else if (
streq(p[0],
"show-adapters") && !p[1])
8393 else if (
streq(p[0],
"show-net") && !p[1])
8400 else if (
streq(p[0],
"show-net-up") && !p[1])
8405 else if (
streq(p[0],
"tap-sleep") && p[1] && !p[2])
8410 if (s < 0 || s >= 256)
8412 msg(msglevel,
"--tap-sleep parameter must be between 0 and 255");
8417 else if (
streq(p[0],
"dhcp-renew") && !p[1])
8422 else if (
streq(p[0],
"dhcp-pre-release") && !p[1])
8428 else if (
streq(p[0],
"dhcp-release") && !p[1])
8430 msg(
M_WARN,
"Obsolete option --dhcp-release detected. This is now on by default");
8432 else if (
streq(p[0],
"dhcp-internal") && p[1] && !p[2])
8434 unsigned int adapter_index;
8437 adapter_index =
atou(p[1]);
8449 else if (
streq(p[0],
"register-dns") && !p[1])
8454 else if (
streq(p[0],
"block-outside-dns") && !p[1])
8459 else if (
streq(p[0],
"rdns-internal") && !p[1])
8475 else if (
streq(p[0],
"show-valid-subnets") && !p[1])
8481 else if (
streq(p[0],
"pause-exit") && !p[1])
8486 else if (
streq(p[0],
"service") && p[1] && !p[3])
8495 else if (
streq(p[0],
"allow-nonadmin") && !p[2])
8501 else if (
streq(p[0],
"user") && p[1] && !p[2])
8504 msg(
M_WARN,
"NOTE: --user option is not implemented on Windows");
8506 else if (
streq(p[0],
"group") && p[1] && !p[2])
8509 msg(
M_WARN,
"NOTE: --group option is not implemented on Windows");
8512 else if (
streq(p[0],
"user") && p[1] && !p[2])
8517 else if (
streq(p[0],
"group") && p[1] && !p[2])
8522 else if (
streq(p[0],
"dhcp-option") && p[1] && !p[3])
8525 setenv_foreign_option(
options, (
const char **)p, 3,
es);
8527 else if (
streq(p[0],
"route-method") && p[1] && !p[2])
8533#if PASSTOS_CAPABILITY
8534 else if (
streq(p[0],
"passtos") && !p[1])
8540 else if (
streq(p[0],
"allow-compression") && p[1] && !p[2])
8544 if (
streq(p[1],
"no"))
8550 msg(msglevel,
"'--allow-compression no' conflicts with "
8551 " enabling compression");
8557 msg(msglevel,
"Cannot set allow-compression to '%s' "
8558 "after set to 'no'", p[1]);
8561 else if (
streq(p[1],
"asym"))
8565 else if (
streq(p[1],
"yes"))
8567 msg(
M_WARN,
"DEPRECATED OPTION: \"--allow-compression yes\" has been removed. "
8568 "We will use \"asym\" mode instead. See the manual page for more information.");
8574 msg(msglevel,
"bad allow-compression option: %s -- "
8575 "must be 'yes', 'no', or 'asym'", p[1]);
8579 else if (
streq(p[0],
"comp-lzo") && !p[2])
8589 if (
streq(p[1],
"no"))
8597 else if (!(
streq(p[1],
"yes") ||
streq(p[1],
"adaptive")))
8599 msg(msglevel,
"bad comp-lzo option: %s -- must be 'yes', 'no', or 'adaptive'", p[1]);
8605 else if (
streq(p[0],
"comp-noadapt") && !p[1])
8609 else if (
streq(p[0],
"compress") && !p[2])
8612 const char *alg =
"stub";
8618 if (
streq(alg,
"stub"))
8623 else if (
streq(alg,
"stub-v2"))
8628 else if (
streq(alg,
"migrate"))
8633 else if (
streq(alg,
"lzo"))
8638 else if (
streq(alg,
"lz4"))
8643 else if (
streq(alg,
"lz4-v2"))
8649 msg(msglevel,
"bad comp option: %s", alg);
8655 else if (
streq(p[0],
"show-ciphers") && !p[1])
8660 else if (
streq(p[0],
"show-digests") && !p[1])
8665 else if (
streq(p[0],
"show-engines") && !p[1])
8670 else if (
streq(p[0],
"key-direction") && p[1] && !p[2])
8677 if (key_direction >= 0)
8693 else if (
streq(p[0],
"secret") && p[1] && !p[3])
8695 msg(
M_WARN,
"DEPRECATED OPTION: The option --secret is deprecated.");
8699 if (!is_inline && p[2])
8704 if (key_direction >= 0)
8714 else if (
streq(p[0],
"allow-deprecated-insecure-static-crypto"))
8720 else if (
streq(p[0],
"genkey") && !p[4])
8730 if (
streq(p[1],
"secret") ||
streq(p[1],
"tls-auth")
8731 ||
streq(p[1],
"tls-crypt"))
8735 else if (
streq(p[1],
"tls-crypt-v2-server"))
8739 else if (
streq(p[1],
"tls-crypt-v2-client"))
8747 else if (
streq(p[1],
"auth-token"))
8753 msg(msglevel,
"unknown --genkey type: %s", p[1]);
8762 else if (
streq(p[0],
"auth") && p[1] && !p[2])
8767 else if (
streq(p[0],
"cipher") && p[1] && !p[2])
8772 else if (
streq(p[0],
"data-ciphers-fallback") && p[1] && !p[2])
8778 else if ((
streq(p[0],
"data-ciphers") ||
streq(p[0],
"ncp-ciphers"))
8782 if (
streq(p[0],
"ncp-ciphers"))
8784 msg(
M_INFO,
"Note: Treating option '--ncp-ciphers' as "
8785 " '--data-ciphers' (renamed in OpenVPN 2.5).");
8789 else if (
streq(p[0],
"key-derivation") && p[1])
8794 if (
streq(p[1],
"tls-ekm"))
8800 msg(msglevel,
"Unknown key-derivation method %s", p[1]);
8803 else if (
streq(p[0],
"protocol-flags") && p[1])
8809 for (
size_t j = 1; j <
MAX_PARMS && p[j] != NULL; j++)
8811 if (
streq(p[j],
"cc-exit"))
8815 else if (
streq(p[j],
"tls-ekm"))
8819 else if (
streq(p[j],
"dyn-tls-crypt"))
8823 else if (
streq(p[j],
"aead-epoch"))
8829 msg(msglevel,
"Unknown protocol-flags flag: %s", p[j]);
8833 else if (
streq(p[0],
"force-tls-key-material-export"))
8838 else if (
streq(p[0],
"prng") && p[1] && !p[3])
8840 msg(
M_WARN,
"NOTICE: --prng option ignored (SSL library PRNG is used)");
8842 else if (
streq(p[0],
"no-replay") && !p[1])
8846 msg(
M_FATAL,
"--no-replay was removed in OpenVPN 2.7. "
8847 "Update your configuration.");
8849 else if (
streq(p[0],
"replay-window") && !p[3])
8856 replay_window =
atoi_warn(p[1], msglevel);
8859 msg(msglevel,
"replay-window window size parameter (%d) must be between %d and %d",
8871 replay_time =
atoi_warn(p[2], msglevel);
8874 msg(msglevel,
"replay-window time window parameter (%d) must be between %d and %d",
8885 msg(msglevel,
"replay-window option is missing window size parameter");
8889 else if (
streq(p[0],
"mute-replay-warnings") && !p[1])
8894 else if (
streq(p[0],
"replay-persist") && p[1] && !p[2])
8899 else if (
streq(p[0],
"test-crypto") && !p[1])
8904#ifndef ENABLE_CRYPTO_MBEDTLS
8905 else if (
streq(p[0],
"engine") && !p[2])
8918 else if (
streq(p[0],
"providers") && p[1])
8920 for (
size_t j = 1; j <
MAX_PARMS && p[j] != NULL; j++)
8925#ifdef ENABLE_PREDICTION_RESISTANCE
8926 else if (
streq(p[0],
"use-prediction-resistance") && !p[1])
8929 options->use_prediction_resistance =
true;
8932 else if (
streq(p[0],
"show-tls") && !p[1])
8937 else if ((
streq(p[0],
"show-curves") ||
streq(p[0],
"show-groups")) && !p[1])
8942 else if (
streq(p[0],
"ecdh-curve") && p[1] && !p[2])
8945 msg(
M_WARN,
"Consider setting groups/curves preference with "
8946 "tls-groups instead of forcing a specific curve with "
8950 else if (
streq(p[0],
"tls-server") && !p[1])
8955 else if (
streq(p[0],
"tls-client") && !p[1])
8960 else if (
streq(p[0],
"ca") && p[1] && !p[2])
8966#ifndef ENABLE_CRYPTO_MBEDTLS
8967 else if (
streq(p[0],
"capath") && p[1] && !p[2])
8973 else if (
streq(p[0],
"dh") && p[1] && !p[2])
8979 else if (
streq(p[0],
"cert") && p[1] && !p[2])
8985 else if (
streq(p[0],
"extra-certs") && p[1] && !p[2])
8991 else if ((
streq(p[0],
"verify-hash") && p[1] && !p[3])
8992 || (
streq(p[0],
"peer-fingerprint") && p[1] && !p[2]))
8996 int verify_hash_depth = 0;
8997 if (
streq(p[0],
"verify-hash"))
8999 msg(
M_WARN,
"DEPRECATED OPTION: The option --verify-hash is deprecated. "
9000 "You should switch to the either use the level 1 certificate as "
9001 "--ca option, use --tls-verify or use --peer-fingerprint");
9003 verify_hash_depth = 1;
9012 msg(msglevel,
"ERROR: Setting %s not allowed. --verify-hash and"
9013 " --peer-fingerprint are mutually exclusive", p[0]);
9017 if (
streq(p[0],
"verify-hash"))
9019 if ((!p[2] && !is_inline) || (p[2] &&
streq(p[2],
"SHA1")))
9024 else if (p[2] && !
streq(p[2],
"SHA256"))
9026 msg(msglevel,
"invalid or unsupported hashing algorithm: %s "
9027 "(only SHA1 and SHA256 are supported)", p[2]);
9047 while (listend->
next)
9049 listend = listend->
next;
9051 listend->
next = newlist;
9054#if defined(ENABLE_CRYPTOAPI) && defined(HAVE_XKEY_PROVIDER)
9055 else if (
streq(p[0],
"cryptoapicert") && p[1] && !p[2])
9061 else if (
streq(p[0],
"key") && p[1] && !p[2])
9067 else if (
streq(p[0],
"tls-version-min") && p[1] && !p[3])
9074 msg(msglevel,
"unknown tls-version-min parameter: %s", p[1]);
9078#ifdef ENABLE_CRYPTO_MBEDTLS
9081 msg(
M_WARN,
"--tls-version-min %s is not supported by mbedtls, using 1.2", p[1]);
9090 else if (
streq(p[0],
"tls-version-max") && p[1] && !p[2])
9097 msg(msglevel,
"unknown tls-version-max parameter: %s", p[1]);
9104#ifndef ENABLE_CRYPTO_MBEDTLS
9105 else if (
streq(p[0],
"pkcs12") && p[1] && !p[2])
9112 else if (
streq(p[0],
"askpass") && !p[2])
9124 else if (
streq(p[0],
"auth-nocache") && !p[1])
9129 else if (
streq(p[0],
"auth-token") && p[1] && !p[2])
9133#ifdef ENABLE_MANAGEMENT
9140 else if (
streq(p[0],
"auth-token-user") && p[1] && !p[2])
9145 else if (
streq(p[0],
"single-session") && !p[1])
9150 else if (
streq(p[0],
"push-peer-info") && !p[1])
9155 else if (
streq(p[0],
"tls-exit") && !p[1])
9160 else if (
streq(p[0],
"tls-cipher") && p[1] && !p[2])
9165 else if (
streq(p[0],
"tls-cert-profile") && p[1] && !p[2])
9170 else if (
streq(p[0],
"tls-ciphersuites") && p[1] && !p[2])
9175 else if (
streq(p[0],
"tls-groups") && p[1] && !p[2])
9180 else if (
streq(p[0],
"crl-verify") && p[1] && ((p[2] &&
streq(p[2],
"dir"))
9184 if (p[2] &&
streq(p[2],
"dir"))
9191 else if (
streq(p[0],
"tls-verify") && p[1])
9200 "tls-verify",
true);
9202 else if (
streq(p[0],
"tls-export-cert") && p[1] && !p[2])
9207 else if (
streq(p[0],
"compat-names"))
9210 msg(msglevel,
"--compat-names was removed in OpenVPN 2.5. "
9211 "Update your configuration.");
9214 else if (
streq(p[0],
"no-name-remapping") && !p[1])
9217 msg(msglevel,
"--no-name-remapping was removed in OpenVPN 2.5. "
9218 "Update your configuration.");
9221 else if (
streq(p[0],
"verify-x509-name") && p[1] && strlen(p[1]) && !p[3])
9227 if (
streq(p[2],
"subject"))
9231 else if (
streq(p[2],
"name"))
9235 else if (
streq(p[2],
"name-prefix"))
9241 msg(msglevel,
"unknown X.509 name type: %s", p[2]);
9248 else if (
streq(p[0],
"ns-cert-type") && p[1] && !p[2])
9250#ifdef ENABLE_CRYPTO_MBEDTLS
9251 msg(msglevel,
"--ns-cert-type is not available with mbedtls.");
9255 if (
streq(p[1],
"server"))
9259 else if (
streq(p[1],
"client"))
9265 msg(msglevel,
"--ns-cert-type must be 'client' or 'server'");
9270 else if (
streq(p[0],
"remote-cert-ku"))
9275 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9285 else if (
streq(p[0],
"remote-cert-eku") && p[1] && !p[2])
9290 else if (
streq(p[0],
"remote-cert-tls") && p[1] && !p[2])
9294 if (
streq(p[1],
"server"))
9299 else if (
streq(p[1],
"client"))
9306 msg(msglevel,
"--remote-cert-tls must be 'client' or 'server'");
9310 else if (
streq(p[0],
"tls-timeout") && p[1] && !p[2])
9315 else if (
streq(p[0],
"reneg-bytes") && p[1] && !p[2])
9319 long long reneg_bytes = strtoll(p[1], &end, 10);
9320 if (*end !=
'\0' || reneg_bytes < 0)
9322 msg(msglevel,
"--reneg-bytes parameter must be an integer and >= 0");
9327 else if (
streq(p[0],
"reneg-pkts") && p[1] && !p[2])
9331 long long pkt_max = strtoll(p[1], &end, 10);
9332 if (*end !=
'\0' || pkt_max < 0)
9334 msg(msglevel,
"--reneg-pkts parameter must be an integer and >= 0");
9339 else if (
streq(p[0],
"reneg-sec") && p[1] && !p[3])
9348 else if (
streq(p[0],
"hand-window") && p[1] && !p[2])
9353 else if (
streq(p[0],
"tran-window") && p[1] && !p[2])
9358 else if (
streq(p[0],
"tls-auth") && p[1] && !p[3])
9360 int key_direction = -1;
9369 if (!is_inline && p[2])
9372 if (key_direction < 0)
9386 if (!is_inline && p[2])
9389 if (key_direction < 0)
9397 else if (
streq(p[0],
"tls-crypt") && p[1] && !p[3])
9411 else if (
streq(p[0],
"tls-crypt-v2") && p[1] && !p[3])
9425 if (p[2] &&
streq(p[2],
"force-cookie"))
9429 else if (p[2] &&
streq(p[2],
"allow-noncookie"))
9435 msg(msglevel,
"Unsupported tls-crypt-v2 argument: %s", p[2]);
9438 else if (
streq(p[0],
"tls-crypt-v2-verify") && p[1] && !p[2])
9443 else if (
streq(p[0],
"x509-track") && p[1] && !p[2])
9448#ifdef ENABLE_X509ALTUSERNAME
9449 else if (
streq(p[0],
"x509-username-field") && p[1])
9452 for (
size_t j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9456 if (strncmp(
"ext:", s, 4) == 0 && !x509_username_field_ext_supported(s+4))
9458 msg(msglevel,
"Unsupported x509-username-field extension: %s", s);
9460 options->x509_username_field[j-1] = p[j];
9465 else if (
streq(p[0],
"show-pkcs11-ids") && !p[3])
9467 char *provider = p[1];
9468 bool cert_private = (p[2] == NULL ? false : (
atoi_warn(p[2], msglevel) != 0 ));
9470#ifdef DEFAULT_PKCS11_MODULE
9473 provider = DEFAULT_PKCS11_MODULE;
9478 int i = strtol(provider, &endp, 10);
9484 provider = DEFAULT_PKCS11_MODULE;
9491 msg(msglevel,
"--show-pkcs11-ids requires a provider parameter");
9498 show_pkcs11_ids(provider, cert_private);
9501 else if (
streq(p[0],
"pkcs11-providers") && p[1])
9507 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9509 options->pkcs11_providers[j-1] = p[j];
9512 else if (
streq(p[0],
"pkcs11-protected-authentication"))
9518 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9520 options->pkcs11_protected_authentication[j-1] =
atoi_warn(p[j], msglevel) != 0 ? 1 : 0;
9523 else if (
streq(p[0],
"pkcs11-private-mode") && p[1])
9529 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9531 sscanf(p[j],
"%x", &(
options->pkcs11_private_mode[j-1]));
9534 else if (
streq(p[0],
"pkcs11-cert-private"))
9540 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9545 else if (
streq(p[0],
"pkcs11-pin-cache") && p[1] && !p[2])
9550 else if (
streq(p[0],
"pkcs11-id") && p[1] && !p[2])
9555 else if (
streq(p[0],
"pkcs11-id-management") && !p[1])
9558 options->pkcs11_id_management =
true;
9561 else if (
streq(p[0],
"rmtun") && !p[1])
9567 else if (
streq(p[0],
"mktun") && !p[1])
9573 else if (
streq(p[0],
"peer-id") && p[1] && !p[2])
9579 else if (
streq(p[0],
"keying-material-exporter") && p[1] && p[2])
9585 if (strncmp(p[1],
"EXPORTER", 8))
9587 msg(msglevel,
"Keying material exporter label must begin with "
9593 msg(msglevel,
"Keying material exporter label must not be '"
9596 if (ekm_length < 16 || ekm_length > 4095)
9598 msg(msglevel,
"Invalid keying material exporter length");
9605 else if (
streq(p[0],
"allow-recursive-routing") && !p[1])
9610 else if (
streq(p[0],
"vlan-tagging") && !p[1])
9615 else if (
streq(p[0],
"vlan-accept") && p[1] && !p[2])
9618 if (
streq(p[1],
"tagged"))
9622 else if (
streq(p[1],
"untagged"))
9626 else if (
streq(p[1],
"all"))
9632 msg(msglevel,
"--vlan-accept must be 'tagged', 'untagged' or 'all'");
9636 else if (
streq(p[0],
"vlan-pvid") && p[1] && !p[2])
9644 "the parameter of --vlan-pvid parameters must be >= %u and <= %u",
9652 int msglevel_unknown = msglevel_fc;
9659 msglevel_unknown =
M_WARN;
9665 msg(msglevel_unknown,
"Unrecognized option or missing or extra parameter(s) in %s:%d: %s (%s)", file, line, p[0], PACKAGE_VERSION);
9669 msg(msglevel_unknown,
"Unrecognized option or missing or extra parameter(s): --%s (%s)", p[0], PACKAGE_VERSION);
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...
void argv_free(struct argv *a)
Frees all memory allocations allocated by the struct argv related functions.
struct argv argv_new(void)
Allocates a new struct argv and ensures it is initialised.
void free_buf(struct buffer *buf)
void buf_clear(struct buffer *buf)
bool buf_printf(struct buffer *buf, const char *format,...)
void gc_transfer(struct gc_arena *dest, struct gc_arena *src)
void * gc_realloc(void *ptr, size_t size, struct gc_arena *a)
allows to realloc a pointer previously allocated by gc_malloc or gc_realloc
char * format_hex_ex(const uint8_t *data, int size, int maxoutput, unsigned int space_break_flags, const char *separator, struct gc_arena *gc)
void * gc_malloc(size_t size, bool clear, struct gc_arena *a)
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
struct buffer alloc_buf(size_t size)
int string_array_len(const char **array)
struct buffer buffer_read_from_file(const char *filename, struct gc_arena *gc)
buffer_read_from_file - copy the content of a file into a buffer
bool buf_parse(struct buffer *buf, const int delim, char *line, const int size)
char * string_alloc(const char *str, struct gc_arena *gc)
struct buffer string_alloc_buf(const char *str, struct gc_arena *gc)
static void gc_detach(struct gc_arena *a)
static bool buf_copy(struct buffer *dest, const struct buffer *src)
#define ALLOC_ARRAY_GC(dptr, type, n, gc)
static bool buf_valid(const struct buffer *buf)
static void gc_init(struct gc_arena *a)
static bool buf_safe(const struct buffer *buf, size_t len)
static void buf_set_read(struct buffer *buf, const uint8_t *data, size_t size)
static void secure_memzero(void *data, size_t len)
Securely zeroise memory.
#define ALLOC_OBJ_CLEAR_GC(dptr, type, gc)
#define ALLOC_OBJ_GC(dptr, type, gc)
static void strncpynt(char *dest, const char *src, size_t maxlen)
static void gc_free(struct gc_arena *a)
static bool strprefix(const char *str, const char *prefix)
Return true iff str starts with prefix.
static struct gc_arena gc_new(void)
void print_client_nat_list(const struct client_nat_option_list *list, int msglevel)
void add_client_nat_to_option_list(struct client_nat_option_list *dest, const char *type, const char *network, const char *netmask, const char *foreign_network, int msglevel)
struct client_nat_option_list * new_client_nat_list(struct gc_arena *gc)
struct client_nat_option_list * clone_client_nat_option_list(const struct client_nat_option_list *src, struct gc_arena *gc)
void copy_client_nat_option_list(struct client_nat_option_list *dest, const struct client_nat_option_list *src)
#define TLS_CHANNEL_BUF_SIZE
#define TLS_CHANNEL_MTU_MIN
bool check_compression_settings_valid(struct compress_options *info, int msglevel)
Checks if the compression settings are valid.
#define COMP_F_ALLOW_STUB_ONLY
Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY we still accept other compression...
#define COMP_F_SWAP
initial command byte is swapped with last byte in buffer to preserve payload alignment
#define COMP_ALG_LZ4
LZ4 algorithm.
#define COMP_F_ALLOW_NOCOMP_ONLY
Do not allow compression framing (breaks DCO)
#define COMP_F_ALLOW_ASYM
Compression was explicitly set to allow asymetric compression.
#define COMP_ALGV2_UNCOMPRESSED
#define COMP_ALG_STUB
support compression command byte and framing without actual compression
#define COMP_ALG_LZO
LZO algorithm.
#define COMP_F_ADVERTISE_STUBS_ONLY
tell server that we only support compression stubs
#define COMP_F_MIGRATE
push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ
static bool comp_non_stub_enabled(const struct compress_options *info)
int daemon(int nochdir, int noclose)
char * dirname(char *path)
char * strsep(char **stringp, const char *delim)
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.
int ascii2keydirection(int msglevel, const char *str)
const char * keydirection2ascii(int kd, bool remote, bool humanreadable)
bool check_tls_prf_working(void)
Checks if the current TLS library supports the TLS 1.0 PRF with MD5+SHA1 that OpenVPN uses when TLS K...
void test_crypto(struct crypto_options *co, struct frame *frame)
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...
#define CO_USE_DYNAMIC_TLS_CRYPT
Bit-flag indicating that renegotiations are using tls-crypt with a TLS-EKM derived key.
#define CO_EPOCH_DATA_KEY_FORMAT
Bit-flag indicating the epoch the data format.
#define KEY_DIRECTION_BIDIRECTIONAL
#define CO_USE_CC_EXIT_NOTIFY
Bit-flag indicating that explicit exit notifies should be sent via the control channel instead of usi...
static bool cipher_defined(const char *ciphername)
Checks if the cipher is defined and is not the null (none) cipher.
const char * md_kt_name(const char *mdname)
Retrieve a string describing the digest digest (e.g.
const char * cipher_kt_name(const char *ciphername)
Retrieve a normalised string describing the cipher (e.g.
int cipher_kt_key_size(const char *ciphername)
Returns the size of keys used by the cipher, in bytes.
#define SHA_DIGEST_LENGTH
#define SHA256_DIGEST_LENGTH
static bool dco_check_startup_option(int msglevel, const struct options *o)
static bool dco_check_option(int msglevel, const struct options *o)
static const char * dco_version_string(struct gc_arena *gc)
bool dns_options_verify(int msglevel, const struct dns_options *o)
Checks validity of DNS options.
void dns_domain_list_append(struct dns_domain **entry, char **domains, struct gc_arena *gc)
Appends DNS domain parameters to a linked list.
void dns_options_postprocess_pull(struct dns_options *o)
Merges pulled DNS servers with static ones into an ordered list.
bool dns_server_addr_parse(struct dns_server *server, const char *addr)
Parses a string IPv4 or IPv6 address and optional colon separated port, into a in_addr or in6_addr re...
struct dns_server * dns_server_get(struct dns_server **entry, long priority, struct gc_arena *gc)
Find or create DNS server with priority in a linked list.
bool dns_server_priority_parse(long *priority, const char *str, bool pulled)
Parses a string DNS server priority and validates it.
struct dns_options clone_dns_options(const struct dns_options *o, struct gc_arena *gc)
Makes a deep copy of the passed DNS options.
void show_dns_options(const struct dns_options *o)
Prints configured DNS options.
void dns_options_preprocess_pull(struct dns_options *o)
Saves and resets the server options, so that pulled ones don't mix in.
static bool dns_updown_user_set(const struct dns_options *o)
Returns whether dns-updown is user defined.
static bool dns_updown_forced(const struct dns_options *o)
Returns whether dns-updown is forced to run.
void setenv_int(struct env_set *es, const char *name, int value)
void setenv_str_i(struct env_set *es, const char *name, const char *value, const int i)
void setenv_str(struct env_set *es, const char *name, const char *value)
const char * env_set_get(const struct env_set *es, const char *name)
void setenv_str_safe(struct env_set *es, const char *name, const char *value)
bool env_set_del(struct env_set *es, const char *str)
void setenv_long_long(struct env_set *es, const char *name, long long value)
Interface functions to the internal and external multiplexers.
void helper_setdefault_topology(struct options *o)
Set –topology default depending on –mode.
void helper_tcp_nodelay(struct options *o)
void helper_client_server(struct options *o)
void helper_keepalive(struct options *o)
static int max_int(int x, int y)
static int constrain_int(int x, int min, int max)
static SERVICE_STATUS status
static int tls_verify(struct openvpn_plugin_args_func_in const *args)
void management_auth_token(struct management *man, const char *token)
void management_echo(struct management *man, const char *string, const bool pull)
#define MF_FORGET_DISCONNECT
#define MF_EXTERNAL_KEY_PKCS1PAD
#define MF_EXTERNAL_KEY_PSSPAD
#define MF_EXTERNAL_KEY_NOPADDING
#define MF_QUERY_PASSWORDS
#define MF_EXTERNAL_KEY_DIGEST
#define MF_CONNECT_AS_CLIENT
struct buffer prepend_dir(const char *dir, const char *path, struct gc_arena *gc)
Prepend a directory to a path.
const char * safe_print(const char *str, struct gc_arena *gc)
int translate_mtu_discover_type_name(const char *name)
size_t calc_options_string_link_mtu(const struct options *o, const struct frame *frame)
Calculate the link-mtu to advertise to our peer.
#define TAP_MTU_EXTRA_DEFAULT
static bool learn_address_script(const struct multi_context *m, const struct multi_instance *mi, const char *op, const struct mroute_addr *addr)
static int net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx)
void errors_to_stderr(void)
void open_syslog(const char *pgmname, bool stdio_to_null)
void redirect_stdout_stderr(const char *file, bool append)
FILE * msg_fp(const unsigned int flags)
void openvpn_exit(const int status)
static bool machine_readable_output
void set_suppress_timestamps(bool suppressed)
void set_machine_readable_output(bool parsable)
bool set_debug_level(const int level, const unsigned int flags)
static bool suppress_timestamps
#define OPENVPN_EXIT_STATUS_USAGE
#define OPENVPN_EXIT_STATUS_GOOD
bool options_cmp_equal(char *actual, const char *expected)
static void options_warning_safe_ml(const int msglevel, char *actual, const char *expected, size_t actual_n)
#define PUF_TYPE_ACCEPT
filter type to accept a matching option
static void rol6_check_alloc(struct options *options)
#define CHKACC_PRIVATE
Warn if this (private) file is group/others accessible.
static bool check_file_access_chroot_inline(bool is_inline, const char *chroot, const int type, const char *file, const int mode, const char *opt)
A wrapper for check_file_access_chroot() that returns false immediately if the file is inline (and th...
static bool check_file_access_chroot(const char *chroot, const int type, const char *file, const int mode, const char *opt)
static void options_warning_safe_scan2(const int msglevel, const int delim, const bool report_inconsistent, const char *p1, const struct buffer *b2_src, const char *b1_name, const char *b2_name)
static void options_postprocess_verify_ce(const struct options *options, const struct connection_entry *ce)
static int msglevel_forward_compatible(struct options *options, const int msglevel)
static struct local_entry * alloc_local_entry(struct connection_entry *ce, const int msglevel, struct gc_arena *gc)
static void options_postprocess_mutate_ce(struct options *o, struct connection_entry *ce)
static void usage_version(void)
static bool in_src_get(const struct in_src *is, char *line, const int size)
static struct pull_filter * alloc_pull_filter(struct options *o)
void options_server_import(struct options *o, const char *filename, int msglevel, unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
#define USAGE_VALID_SERVER_PROTOS
#define CHKACC_DIRPATH
Check for directory presence where a file should reside.
static void pre_connect_save(struct options *o)
#define CHKACC_ACPTSTDIN
If filename is stdin, it's allowed and "exists".
static void setenv_connection_entry(struct env_set *es, const struct connection_entry *e, const int i)
static int check_inline_file_via_buf(struct buffer *multiline, char *p[], struct gc_arena *gc)
static int global_auth_retry
bool options_postprocess_pull(struct options *o, struct env_set *es)
void uninit_options(struct options *o)
static void connection_entry_load_re(struct connection_entry *ce, const struct remote_entry *re)
static int check_inline_file(struct in_src *is, char *p[], struct gc_arena *gc)
static bool verify_permission(const char *name, const char *file, int line, const unsigned int type, const unsigned int allowed, unsigned int *found, const int msglevel, struct options *options, bool is_inline)
static void read_config_file(struct options *options, const char *file, int level, const char *top_file, const int top_line, const int msglevel, const unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
void show_windows_version(const unsigned int flags)
#define VERIFY_PERMISSION(mask)
static const char * options_warning_extract_parm1(const char *option_string, struct gc_arena *gc_ret)
bool key_is_external(const struct options *options)
static bool no_more_than_n_args(const int msglevel, char *p[], const int max, const unsigned int flags)
static void check_ca_required(const struct options *options)
bool auth_retry_set(const int msglevel, const char *option)
static struct http_proxy_options * parse_http_proxy_override(const char *server, const char *port, const char *flags, struct gc_arena *gc)
static void read_config_string(const char *prefix, struct options *options, const char *config, const int msglevel, const unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
static void bypass_doubledash(char **p)
#define CHKACC_FILEXSTWR
If file exists, is it writable?
static void tuntap_options_postprocess_dns(struct options *o)
Postprocess DNS related settings.
static char * get_ipv6_addr_no_netbits(const char *addr, struct gc_arena *gc)
Returns newly allocated string containing address part without "/nn".
#define PUF_TYPE_IGNORE
filter type to ignore a matching option
void show_dco_version(const unsigned int flags)
static bool apply_pull_filter(const struct options *o, char *line)
Filter an option line by all pull filters.
void rol_check_alloc(struct options *options)
static struct local_list * alloc_local_list_if_undef(struct connection_entry *ce, struct gc_arena *gc)
#define SHOW_UNSIGNED(var)
void show_settings(const struct options *o)
static void set_user_script(struct options *options, const char **script, const char *new_script, const char *type, bool in_chroot)
static in_addr_t get_ip_addr(const char *ip_string, int msglevel, bool *error)
bool apply_push_options(struct options *options, struct buffer *buf, unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
static void show_dhcp_option_list(const char *name, const char *const *array, int len)
static void show_connection_entries(const struct options *o)
static void options_postprocess_mutate_le(struct connection_entry *ce, struct local_entry *le, int mode)
static void option_iroute_ipv6(struct options *o, const char *prefix_str, int msglevel)
bool options_cmp_equal_safe(char *actual, const char *expected, size_t actual_n)
void parse_argv(struct options *options, const int argc, char *argv[], const int msglevel, const unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
#define PUF_TYPE_REJECT
filter type to reject and trigger SIGUSR1
bool string_defined_equal(const char *s1, const char *s2)
static bool check_file_access_inline(bool is_inline, const int type, const char *file, const int mode, const char *opt)
A wrapper for check_file_access() that returns false immediately if the file is inline (and therefore...
void options_postprocess(struct options *options, struct env_set *es)
int parse_topology(const char *str, const int msglevel)
static void show_dhcp_option_addrs(const char *name, const in_addr_t *array, int len)
const char * auth_retry_print(void)
static void show_http_proxy_options(const struct http_proxy_options *o)
static void options_postprocess_filechecks(struct options *options)
static void show_connection_entry(const struct connection_entry *o)
void options_warning_safe(char *actual, const char *expected, size_t actual_n)
void show_library_versions(const unsigned int flags)
void setenv_settings(struct env_set *es, const struct options *o)
#define CHKACC_ACCEPT_URI
Do not check URIs, unless they start with file:
static const char usage_message[]
static char * string_substitute(const char *src, int from, int to, struct gc_arena *gc)
static struct verify_hash_list * parse_hash_fingerprint(const char *str, int nbytes, int msglevel, struct gc_arena *gc)
Parses a hexstring and checks if the string has the correct length.
static struct connection_list * alloc_connection_list_if_undef(struct options *options)
static bool space(unsigned char c)
static bool check_cmd_access(const char *command, const char *opt, const char *chroot)
static void options_warning_safe_scan1(const int msglevel, const int delim, const bool report_inconsistent, const struct buffer *b1_src, const struct buffer *b2_src, const char *b1_name, const char *b2_name)
static struct connection_entry * alloc_connection_entry(struct options *options, const int msglevel)
static void dhcp_option_dns6_parse(const char *parm, struct in6_addr *dns6_list, int *len, int msglevel)
static bool check_file_access(const int type, const char *file, const int mode, const char *opt)
static void show_p2mp_parms(const struct options *o)
static const char * pull_filter_type_name(int type)
static void cnol_check_alloc(struct options *options)
int parse_line(const char *line, char *p[], const int n, const char *file, const int line_num, int msglevel, struct gc_arena *gc)
static int check_inline_file_via_fp(FILE *fp, char *p[], struct gc_arena *gc)
static struct remote_entry * alloc_remote_entry(struct options *options, const int msglevel)
static void options_postprocess_mutate(struct options *o, struct env_set *es)
void options_detach(struct options *o)
static unsigned int atou(const char *str)
void pre_connect_restore(struct options *o, struct gc_arena *gc)
static void dhcp_option_address_parse(const char *name, const char *parm, in_addr_t *array, int *len, int msglevel)
static struct pull_filter_list * alloc_pull_filter_list(struct options *o)
const char * print_topology(const int topology)
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)
char * options_string_extract_option(const char *options_string, const char *opt_name, struct gc_arena *gc)
Given an OpenVPN options string, extract the value of an option.
#define SHOW_STR_INLINE(var)
static void options_postprocess_cipher(struct options *o)
static void options_set_backwards_compatible_options(struct options *o)
Changes default values so that OpenVPN can be compatible with the user specified version.
static void show_tuntap_options(const struct tuntap_options *o)
void init_options(struct options *o, const bool init_gc)
#define MUST_BE_FALSE(condition, parm_name)
#define MUST_BE_UNDEF(parm, parm_name)
static const char * print_vlan_accept(enum vlan_acceptable_frames mode)
#define SHOW_PARM(name, value, format)
static void options_postprocess_http_proxy_override(struct options *o)
void options_warning(char *actual, const char *expected)
static void show_pull_filter_list(const struct pull_filter_list *l)
#define CHKACC_FILE
Check for a file/directory presence.
const char * options_string_version(const char *s, struct gc_arena *gc)
static void options_postprocess_mutate_invariant(struct options *options)
static bool ipv6_addr_safe_hexplusbits(const char *ipv6_prefix_spec)
const char title_string[]
static void setenv_local_entry(struct env_set *es, const struct local_entry *e, const int i)
static void remap_redirect_gateway_flags(struct options *opt)
static void add_option(struct options *options, char *p[], bool is_inline, const char *file, int line, const int level, const int msglevel, const unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
static struct verify_hash_list * parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel, struct gc_arena *gc)
Parses a string consisting of multiple lines of hexstrings and checks if each string has the correct ...
static struct remote_list * alloc_remote_list_if_undef(struct options *options)
void notnull(const char *arg, const char *description)
static void show_compression_warning(struct compress_options *info)
static void options_process_mutate_prf(struct options *o)
bool has_udp_in_local_list(const struct options *options)
static void option_iroute(struct options *o, const char *network_str, const char *netmask_str, int msglevel)
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)
static char * read_inline_file(struct in_src *is, const char *close_tag, int *num_lines, struct gc_arena *gc)
static void options_postprocess_verify(const struct options *o)
static void connection_entry_preload_key(const char **key_file, bool *key_inline, struct gc_arena *gc)
static bool need_compatibility_before(const struct options *o, unsigned int version)
The option –compat-mode is used to set up default settings to values used on the specified openvpn ve...
#define MODE_POINT_TO_POINT
#define SF_TCP_NODELAY_HELPER
#define OPT_P_INSTANCE
allowed in ccd, client-connect etc
#define OPT_P_NCP
Negotiable crypto parameters.
#define OPT_P_ROUTE_TABLE
#define CONNECTION_LIST_SIZE
#define OPT_P_EXPLICIT_NOTIFY
static bool dco_enabled(const struct options *o)
Returns whether the current configuration has dco enabled.
@ GENKEY_TLS_CRYPTV2_SERVER
@ GENKEY_TLS_CRYPTV2_CLIENT
#define SF_NO_PUSH_ROUTE_GATEWAY
#define PULL_DEFINED(opt)
#define PLUGIN_OPTION_LIST(opt)
#define OPT_P_ROUTE_EXTRAS
#define MAN_CLIENT_AUTH_ENABLED(opt)
@ VLAN_ONLY_UNTAGGED_OR_PRIORITY
int positive_atoi(const char *str, int msglevel)
Converts a str to a positive number if the string represents a postive integer number.
int atoi_warn(const char *str, int msglevel)
Converts a str to an integer if the string can be represented as an integer number.
bool valid_integer(const char *str, bool positive)
Checks if the string is a valid integer by checking if it can be converted to an integer.
#define MAX_SEQ_BACKTRACK
#define MIN_SEQ_BACKTRACK
#define DEFAULT_SEQ_BACKTRACK
#define MAX_TIME_BACKTRACK
#define DEFAULT_TIME_BACKTRACK
#define MIN_TIME_BACKTRACK
struct plugin_option_list * plugin_option_list_new(struct gc_arena *gc)
bool plugin_option_list_add(struct plugin_option_list *list, char **p, struct gc_arena *gc)
void plugin_option_list_print(const struct plugin_option_list *list, int msglevel)
bool ifconfig_pool_verify_range(const int msglevel, const in_addr_t start, const in_addr_t end)
#define OPENVPN_8021Q_MIN_VID
#define OPENVPN_8021Q_MAX_VID
struct http_proxy_options * init_http_proxy_options_once(struct http_proxy_options **hpo, struct gc_arena *gc)
#define MAX_CUSTOM_HTTP_HEADER
void push_reset(struct options *o)
void clone_push_list(struct options *o)
void push_remove_option(struct options *o, const char *p)
void push_options(struct options *o, char **p, int msglevel, struct gc_arena *gc)
bool is_special_addr(const char *addr_str)
struct route_option_list * clone_route_option_list(const struct route_option_list *src, struct gc_arena *a)
int netmask_to_netbits2(in_addr_t netmask)
struct route_ipv6_option_list * new_route_ipv6_option_list(struct gc_arena *a)
void get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6, const struct in6_addr *dest, openvpn_net_ctx_t *ctx)
void show_routes(int msglev)
void print_route_options(const struct route_option_list *rol, int level)
void add_route_ipv6_to_option_list(struct route_ipv6_option_list *l, const char *prefix, const char *gateway, const char *metric, int table_id)
void print_default_gateway(const int msglevel, const struct route_gateway_info *rgi, const struct route_ipv6_gateway_info *rgi6)
void copy_route_option_list(struct route_option_list *dest, const struct route_option_list *src, struct gc_arena *a)
void copy_route_ipv6_option_list(struct route_ipv6_option_list *dest, const struct route_ipv6_option_list *src, struct gc_arena *a)
void get_default_gateway(struct route_gateway_info *rgi, in_addr_t dest, openvpn_net_ctx_t *ctx)
Retrieves the best gateway for a given destination based on the routing table.
struct route_ipv6_option_list * clone_route_ipv6_option_list(const struct route_ipv6_option_list *src, struct gc_arena *a)
struct route_option_list * new_route_option_list(struct gc_arena *a)
void add_route_to_option_list(struct route_option_list *l, const char *network, const char *netmask, const char *gateway, const char *metric, int table_id)
#define ROUTE_METHOD_SERVICE
#define ROUTE_METHOD_IPAPI
#define ROUTE_METHOD_ADAPTIVE
void script_security_set(int level)
void throw_signal_soft(const int signum, const char *signal_text)
Throw a soft global signal.
const char * proto2ascii(int proto, sa_family_t af, bool display_form)
bool get_ipv6_addr(const char *hostname, struct in6_addr *network, unsigned int *netbits, int msglevel)
Translate an IPv6 addr or hostname from string form to in6_addr.
bool mac_addr_safe(const char *mac_addr)
const char * proto2ascii_all(struct gc_arena *gc)
static void bind_local(struct link_socket *sock, const sa_family_t ai_family)
sa_family_t ascii2af(const char *proto_name)
const char * proto_remote(int proto, bool remote)
bool ipv6_addr_safe(const char *ipv6_text_addr)
const char * print_in6_addr(struct in6_addr a6, unsigned int flags, struct gc_arena *gc)
bool ip_or_dns_addr_safe(const char *addr, const bool allow_fqdn)
int ascii2proto(const char *proto_name)
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)
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.
bool ip_addr_dotted_quad_safe(const char *dotted_quad)
static bool proto_is_net(int proto)
static bool proto_is_udp(int proto)
Returns if the protocol being used is UDP.
#define GETADDR_HOST_ORDER
#define RESOLV_RETRY_INFINITE
#define SF_USE_IP_PKTINFO
static bool proto_is_dgram(int proto)
Return if the protocol is datagram (UDP)
#define SF_HOST_RANDOMIZE
void ssl_set_auth_token_user(const char *username)
void ssl_set_auth_nocache(void)
int tls_version_parse(const char *vstr, const char *extra)
void ssl_set_auth_token(const char *token)
bool ssl_get_auth_nocache(void)
static bool push_peer_info(struct buffer *buf, struct tls_session *session)
Prepares the IV_ and UV_ variables that are part of the exchange to signal the peer's capabilities.
Control Channel SSL/Data channel negotiation module.
#define X509_USERNAME_FIELD_DEFAULT
const char * get_ssl_library_version(void)
return a pointer to a static memory area containing the name and version number of the SSL library in...
#define TLS_VER_BAD
Parse a TLS version specifier.
#define EXPORT_KEY_DATA_LABEL
int tls_version_max(void)
Return the maximum TLS version (as a TLS_VER_x constant) supported by current SSL implementation.
#define SSLF_TLS_VERSION_MAX_SHIFT
#define SSLF_CLIENT_CERT_OPTIONAL
#define SSLF_AUTH_USER_PASS_OPTIONAL
#define SSLF_CLIENT_CERT_NOT_REQUIRED
#define SSLF_CRL_VERIFY_DIR
#define SSLF_TLS_DEBUG_ENABLED
#define SSLF_TLS_VERSION_MAX_MASK
#define SSLF_TLS_VERSION_MIN_SHIFT
#define SSLF_TLS_VERSION_MIN_MASK
#define SSLF_USERNAME_AS_COMMON_NAME
void options_postprocess_setdefault_ncpciphers(struct options *o)
Checks for availibility of Chacha20-Poly1305 and sets the ncp_cipher to either AES-256-GCM:AES-128-GC...
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 append_cipher_to_ncp_list(struct options *o, const char *ciphername)
Appends the cipher specified by the ciphernamer parameter to to the o->ncp_ciphers list.
char * mutate_ncp_cipher_list(const char *list, struct gc_arena *gc)
Check whether the ciphers in the supplied list are supported.
Control Channel SSL/Data dynamic negotiation Module This file is split from ssl.h to be able to unit ...
Control Channel Verification Module.
#define OPENVPN_KU_REQUIRED
Require keyUsage to be present in cert (0xFFFF is an invalid KU value)
#define VERIFY_X509_SUBJECT_DN
#define VERIFY_X509_SUBJECT_RDN
#define NS_CERT_CHECK_CLIENT
Do not perform Netscape certificate type verification.
#define VERIFY_X509_SUBJECT_RDN_PREFIX
#define NS_CERT_CHECK_SERVER
Do not perform Netscape certificate type verification.
void x509_track_add(const struct x509_track **ll_head, const char *name, int msglevel, struct gc_arena *gc)
Wrapper structure for dynamically allocated memory.
int capacity
Size in bytes of memory allocated by malloc().
uint8_t * data
Pointer to the allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
struct local_list * local_list
int connect_retry_seconds
bool tls_crypt_v2_force_cookie
int connect_retry_seconds_max
const char * tls_crypt_file
const char * tls_crypt_v2_file
bool tun_mtu_extra_defined
const char * socks_proxy_port
struct http_proxy_options * http_proxy_options
bool tls_crypt_file_inline
bool tls_auth_file_inline
int explicit_exit_notification
const char * socks_proxy_authfile
const char * socks_proxy_server
const char * tls_auth_file
bool tls_crypt_v2_file_inline
struct connection_entry ** array
in_addr_t dns[N_DHCP_ADDR]
struct dns_server * servers
struct dhcp_options from_dhcp
enum dns_updown_flags updown_flags
struct dns_domain * search_domains
union dns_server_addr::@0 in
struct dns_server_addr addr[8]
struct dns_domain * domains
enum dns_server_transport transport
Structure for reassembling one incoming fragmented packet.
Packet geometry parameters.
int tun_mtu
the (user) configured tun-mtu.
Garbage collection arena used to keep track of dynamically allocated memory.
const char * http_version
const char * auth_method_string
struct http_custom_header custom_headers[MAX_CUSTOM_HTTP_HEADER]
const char * auth_file_up
struct buffer * multiline
struct iroute_ipv6 * next
const char * cipher
const name of the cipher
const char * digest
Message digest static parameters.
struct local_entry ** array
struct tuntap_options tuntap_options
int ping_rec_timeout_action
bool tuntap_options_defined
struct route_option_list * routes
struct compress_options comp
struct dns_options dns_options
const char * route_default_gateway
struct route_ipv6_option_list * routes_ipv6
struct client_nat_option_list * client_nat
const char * route_ipv6_default_gateway
int resolve_retry_seconds
const char * genkey_extra_data
struct compress_options comp
struct http_proxy_options * http_proxy_override
int push_ifconfig_ipv6_netbits
struct connection_list * connection_list
const char * management_port
bool tls_crypt_file_inline
const char * ifconfig_ipv6_remote
int max_routes_per_client
const char * ncp_ciphers_conf
The original ncp_ciphers specified by the user in the configuration.
enum vlan_acceptable_frames vlan_accept
in_addr_t push_ifconfig_constraint_network
struct options_pre_connect * pre_connect
int renegotiate_seconds_min
const char * auth_token_secret_file
unsigned int imported_protocol_flags
const char * tls_export_peer_cert_dir
const char * cryptoapi_cert
unsigned int backwards_compatible
What version we should try to be compatible with as major * 10000 + minor * 100 + patch,...
hash_algo_type verify_hash_algo
int scheduled_exit_interval
int stale_routes_ageing_time
unsigned int push_option_types_found
int management_state_buffer_size
const char * tls_auth_file
struct provider_list providers
struct in6_addr server_network_ipv6
int management_echo_buffer_size
unsigned remote_cert_ku[MAX_PARMS]
bool server_bridge_defined
const char * keying_material_exporter_label
const char * remote_cert_eku
in_addr_t ifconfig_pool_netmask
bool server_bridge_proxy_dhcp
bool allow_recursive_routing
const char * exit_event_name
const char * ifconfig_ipv6_local
bool auth_user_pass_verify_script_via_file
int ifconfig_pool_persist_refresh_freq
bool push_ifconfig_defined
bool ifconfig_pool_defined
const char * packet_id_file
const char * tls_crypt_v2_file
int management_log_history_cache
in_addr_t server_bridge_netmask
const char * ip_remote_hint
struct route_option_list * routes
in_addr_t ifconfig_pool_end
int64_t inactivity_minimum_bytes
bool ifconfig_ipv6_pool_defined
unsigned int server_flags
bool push_ifconfig_ipv6_blocked
const char * client_disconnect_script
struct remote_list * remote_list
const char * key_pass_file
bool mute_replay_warnings
const char * tls_crypt_file
const char * ifconfig_local
struct connection_entry ce
struct iroute_ipv6 * iroutes_ipv6
struct push_list push_list
struct tuntap_options tuntap_options
struct verify_hash_list * verify_hash
const char * tls_cert_profile
int64_t renegotiate_packets
unsigned int management_flags
const char * route_default_gateway
in_addr_t push_ifconfig_local_alias
struct dns_options dns_options
bool exit_event_initial_state
struct static_challenge_info sc_info
bool auth_token_call_auth
const char * learn_address_script
const char * auth_user_pass_file
int stale_routes_check_interval
struct plugin_option_list * plugin_list
const char * tls_crypt_v2_verify_script
const char * auth_user_pass_verify_script
const char * extra_certs_file
int ifconfig_ipv6_pool_netbits
in_addr_t push_ifconfig_constraint_netmask
const char * route_ipv6_default_gateway
bool priv_key_file_inline
int ping_rec_timeout_action
bool auth_user_pass_file_inline
bool enable_ncp_fallback
If defined fall back to ciphername if NCP fails.
const char * route_predown_script
in_addr_t push_ifconfig_local
const char ** ignore_unknown_option
int route_default_table_id
bool auth_token_secret_file_inline
bool extra_certs_file_inline
bool push_ifconfig_constraint_defined
int keying_material_exporter_length
bool force_key_material_export
const char * cipher_list_tls13
int status_file_update_freq
const char * management_client_user
bool allow_deprecated_insecure_static_crypto
struct pull_filter_list * pull_filter_list
const char * management_certificate
const char * genkey_filename
const struct x509_track * x509_track
bool shared_secret_file_inline
struct in6_addr push_ifconfig_ipv6_remote
const char * management_addr
const char * client_connect_script
const char * verify_x509_name
bool route_gateway_via_dhcp
bool push_ifconfig_ipv6_defined
const char * override_username
const char * client_crresponse_script
struct route_ipv6_option_list * routes_ipv6
bool machine_readable_output
const char * priv_key_file
bool tls_auth_file_inline
bool tls_crypt_v2_file_inline
in_addr_t server_bridge_pool_start
struct client_nat_option_list * client_nat
struct in6_addr push_ifconfig_ipv6_local
const char * ifconfig_remote_netmask
in_addr_t server_bridge_pool_end
enum tun_driver_type windows_driver
int64_t renegotiate_bytes
const char * route_script
in_addr_t ifconfig_pool_start
const char * management_user_pass
unsigned int server_netbits_ipv6
in_addr_t push_ifconfig_remote_netmask
in_addr_t server_bridge_ip
const char * shared_secret_file
const char * management_client_group
struct in6_addr ifconfig_ipv6_pool_base
const char * client_config_dir
enum genkey_type genkey_type
const char * ifconfig_pool_persist_filename
int ifconfig_ipv6_netbits
const char * names[MAX_PARMS]
struct pull_filter * tail
struct pull_filter * head
struct pull_filter * next
struct remote_entry ** array
const char * challenge_text
struct in6_addr dns6[N_DHCP_ADDR]
in_addr_t nbdd[N_DHCP_ADDR]
in_addr_t ntp[N_DHCP_ADDR]
in_addr_t wins[N_DHCP_ADDR]
in_addr_t dns[N_DHCP_ADDR]
const char * netbios_scope
bool dhcp_masq_custom_offset
int domain_search_list_len
const char * domain_search_list[N_SEARCH_LIST_LEN]
struct verify_hash_list * next
uint8_t hash[SHA256_DIGEST_LENGTH]
unsigned short sa_family_t
static bool pkcs11_id_management
void ipconfig_register_dns(const struct env_set *es)
int dev_type_enum(const char *dev, const char *dev_type)
bool dhcp_renew_by_adapter_index(const DWORD adapter_index)
int ascii2ipset(const char *name)
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)
void show_tap_win_adapters(int msglev, int warnlev)
void show_adapters(int msglev)
bool dhcp_release_by_adapter_index(const DWORD adapter_index)
const char * dev_type_string(const char *dev, const char *dev_type)
void tap_allow_nonadmin_access(const char *dev_node)
static bool dhcp_renew(const struct tuntap *tt)
const char * ifconfig_options_string(const struct tuntap *tt, bool remote, bool disable, struct gc_arena *gc)
const char * ipset2ascii_all(struct gc_arena *gc)
void show_valid_win32_tun_subnets(void)
const char * print_tun_backend_driver(enum tun_driver_type driver)
Return a string representation of the tun backed driver type.
#define IPW32_SET_ADAPTIVE
#define DHCP_OPTIONS_DHCP_REQUIRED
#define N_SEARCH_LIST_LEN
#define IPW32_SET_DHCP_MASQ
@ WINDOWS_DRIVER_UNSPECIFIED
@ WINDOWS_DRIVER_TAP_WINDOWS6
#define IPW32_SET_ADAPTIVE_DELAY_WINDOW
const char * win_get_tempdir(void)
void set_win_sys_path(const char *newpath, struct env_set *es)
const char * win32_version_string(struct gc_arena *gc)
Get Windows version string with architecture info.
void set_pause_exit_win32(void)