Go to the documentation of this file.
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
102 #if ENABLE_IP_PKTINFO
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"
201 #ifdef ENABLE_IPROUTE
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"
216 "--route network [netmask] [gateway] [metric] :\n"
217 " Add route to routing table after connection\n"
218 " is established. Multiple routes can be specified.\n"
219 " netmask default: 255.255.255.255\n"
220 " gateway default: taken from --route-gateway or --ifconfig\n"
221 " Specify default by leaving blank or setting to \"default\".\n"
222 "--route-ipv6 network/bits [gateway] [metric] :\n"
223 " Add IPv6 route to routing table after connection\n"
224 " is established. Multiple routes can be specified.\n"
225 " gateway default: taken from --route-ipv6-gateway or 'remote'\n"
226 " in --ifconfig-ipv6\n"
227 "--route-gateway gw|'dhcp' : Specify a default gateway for use with --route.\n"
228 "--route-ipv6-gateway gw : Specify a default gateway for use with --route-ipv6.\n"
229 "--route-metric m : Specify a default metric for use with --route.\n"
230 "--route-delay n [w] : Delay n seconds after connection initiation before\n"
231 " adding routes (may be 0). If not specified, routes will\n"
232 " be added immediately after tun/tap open. On Windows, wait\n"
233 " up to w seconds for TUN/TAP adapter to come up.\n"
234 "--route-up cmd : Run command cmd after routes are added.\n"
235 "--route-pre-down cmd : Run command cmd before routes are removed.\n"
236 "--route-noexec : Don't add routes automatically. Instead pass routes to\n"
237 " --route-up script using environmental variables.\n"
238 "--route-nopull : When used with --client or --pull, accept options pushed\n"
239 " by server EXCEPT for routes, dns, and dhcp options.\n"
240 "--allow-pull-fqdn : Allow client to pull DNS names from server for\n"
241 " --ifconfig, --route, and --route-gateway.\n"
242 "--redirect-gateway [flags]: Automatically execute routing\n"
243 " commands to redirect all outgoing IP traffic through the\n"
244 " VPN. Add 'local' flag if both " PACKAGE_NAME " servers are directly\n"
245 " connected via a common subnet, such as with WiFi.\n"
246 " Add 'def1' flag to set default route using using 0.0.0.0/1\n"
247 " and 128.0.0.0/1 rather than 0.0.0.0/0. Add 'bypass-dhcp'\n"
248 " flag to add a direct route to DHCP server, bypassing tunnel.\n"
249 " Add 'bypass-dns' flag to similarly bypass tunnel for DNS.\n"
250 "--redirect-private [flags]: Like --redirect-gateway, but omit actually changing\n"
251 " the default gateway. Useful when pushing private subnets.\n"
252 "--block-ipv6 : (Client) Instead sending IPv6 to the server generate\n"
253 " ICMPv6 host unreachable messages on the client.\n"
254 " (Server) Instead of forwarding IPv6 packets send\n"
255 " ICMPv6 host unreachable packets to the client.\n"
256 "--client-nat snat|dnat network netmask alias : on client add 1-to-1 NAT rule.\n"
257 "--push-peer-info : (client only) push client info to server.\n"
258 "--setenv name value : Set a custom environmental variable to pass to script.\n"
259 "--setenv FORWARD_COMPATIBLE 1 : Relax config file syntax checking to allow\n"
260 " directives for future OpenVPN versions to be ignored.\n"
261 "--ignore-unknown-option opt1 opt2 ...: Relax config file syntax. Allow\n"
262 " these options to be ignored when unknown\n"
263 "--script-security level: Where level can be:\n"
264 " 0 -- strictly no calling of external programs\n"
265 " 1 -- (default) only call built-ins such as ifconfig\n"
266 " 2 -- allow calling of built-ins and scripts\n"
267 " 3 -- allow password to be passed to scripts via env\n"
268 "--shaper n : Restrict output to peer to n bytes per second.\n"
269 "--keepalive n m : Helper option for setting timeouts in server mode. Send\n"
270 " ping once every n seconds, restart if ping not received\n"
272 "--inactive n [bytes] : Exit after n seconds of activity on tun/tap device\n"
273 " produces a combined in/out byte count < bytes.\n"
274 "--session-timeout n: Limit connection time to n seconds.\n"
275 "--ping-exit n : Exit if n seconds pass without reception of remote ping.\n"
276 "--ping-restart n: Restart if n seconds pass without reception of remote ping.\n"
277 "--ping-timer-rem: Run the --ping-exit/--ping-restart timer only if we have a\n"
279 "--ping n : Ping remote once every n seconds over TCP/UDP port.\n"
280 #if ENABLE_IP_PKTINFO
281 "--multihome : Configure a multi-homed UDP server.\n"
283 "--fast-io : Optimize TUN/TAP/UDP writes.\n"
284 "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n"
285 "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n"
286 "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
287 "--persist-local-ip : Keep local IP address across SIGUSR1 or --ping-restart.\n"
288 #if PASSTOS_CAPABILITY
289 "--passtos : TOS passthrough (applies to IPv4 only).\n"
291 "--tun-mtu n : Take the tun/tap device MTU to be n and derive the\n"
292 " TCP/UDP MTU from it (default=%d).\n"
293 "--tun-mtu-extra n : Assume that tun/tap device might return as many\n"
294 " as n bytes more than the tun-mtu size on read\n"
295 " (default TUN=0 TAP=%d).\n"
296 "--link-mtu n : Take the TCP/UDP device MTU to be n and derive the tun MTU\n"
298 "--mtu-disc type : Should we do Path MTU discovery on TCP/UDP channel?\n"
299 " 'no' -- Never send DF (Don't Fragment) frames\n"
300 " 'maybe' -- Use per-route hints\n"
301 " 'yes' -- Always DF (Don't Fragment)\n"
302 "--mtu-test : Empirically measure and report MTU.\n"
303 #ifdef ENABLE_FRAGMENT
304 "--fragment max : Enable internal datagram fragmentation so that no UDP\n"
305 " datagrams are sent which are larger than max bytes.\n"
306 " Adds 4 bytes of overhead per datagram.\n"
308 "--mssfix [n] : Set upper bound on TCP MSS, default = tun-mtu size\n"
309 " or --fragment max value, whichever is lower.\n"
310 "--sndbuf size : Set the TCP/UDP send buffer size.\n"
311 "--rcvbuf size : Set the TCP/UDP receive buffer size.\n"
312 #if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK
313 "--mark value : Mark encrypted packets being sent with value. The mark value\n"
314 " can be matched in policy routing and packetfilter rules.\n"
315 "--bind-dev dev : Bind to the given device when making connection to a peer or\n"
316 " listening for connections. This allows sending encrypted packets\n"
317 " via a VRF present on the system.\n"
319 "--txqueuelen n : Set the tun/tap TX queue length to n (Linux only).\n"
320 #ifdef ENABLE_MEMSTATS
321 "--memstats file : Write live usage stats to memory mapped binary file.\n"
323 "--mlock : Disable Paging -- ensures key material and tunnel\n"
324 " data will never be written to disk.\n"
325 "--up cmd : Run command cmd after successful tun device open.\n"
326 " Execute as: cmd tun/tap-dev tun-mtu link-mtu \\\n"
327 " ifconfig-local-ip ifconfig-remote-ip\n"
328 " (pre --user or --group UID/GID change)\n"
329 "--up-delay : Delay tun/tap open and possible --up script execution\n"
330 " until after TCP/UDP connection establishment with peer.\n"
331 "--down cmd : Run command cmd after tun device close.\n"
332 " (post --user/--group UID/GID change and/or --chroot)\n"
333 " (command parameters are same as --up option)\n"
334 "--down-pre : Run --down command before TUN/TAP close.\n"
335 "--up-restart : Run up/down commands for all restarts including those\n"
336 " caused by --ping-restart or SIGUSR1\n"
337 "--user user : Set UID to user after initialization.\n"
338 "--group group : Set GID to group after initialization.\n"
339 "--chroot dir : Chroot to this directory after initialization.\n"
340 #ifdef ENABLE_SELINUX
341 "--setcon context: Apply this SELinux context after initialization.\n"
343 "--cd dir : Change to this directory before initialization.\n"
344 "--daemon [name] : Become a daemon after initialization.\n"
345 " The optional 'name' parameter will be passed\n"
346 " as the program name to the system logger.\n"
347 "--syslog [name] : Output to syslog, but do not become a daemon.\n"
348 " See --daemon above for a description of the 'name' parm.\n"
349 "--log file : Output log to file which is created/truncated on open.\n"
350 "--log-append file : Append log to file, or create file if nonexistent.\n"
351 "--suppress-timestamps : Don't log timestamps to stdout/stderr.\n"
352 "--machine-readable-output : Always log timestamp, message flags to stdout/stderr.\n"
353 "--writepid file : Write main process ID to file.\n"
354 "--nice n : Change process priority (>0 = lower, <0 = higher).\n"
355 "--echo [parms ...] : Echo parameters to log output.\n"
356 "--verb n : Set output verbosity to n (default=%d):\n"
357 " (Level 3 is recommended if you want a good summary\n"
358 " of what's happening without being swamped by output).\n"
359 " : 0 -- no output except fatal errors\n"
360 " : 1 -- startup info + connection initiated messages +\n"
361 " non-fatal encryption & net errors\n"
362 " : 2,3 -- show TLS negotiations & route info\n"
363 " : 4 -- show parameters\n"
364 " : 5 -- show 'RrWw' chars on console for each packet sent\n"
365 " and received from TCP/UDP (caps) or tun/tap (lc)\n"
366 " : 6 to 11 -- debug messages of increasing verbosity\n"
367 "--mute n : Log at most n consecutive messages in the same category.\n"
368 "--status file [n] : Write operational status to file every n seconds.\n"
369 "--status-version [n] : Choose the status file format version number.\n"
370 " Currently, n can be 1, 2, or 3 (default=1).\n"
371 "--disable-occ : (DEPRECATED) Disable options consistency check between peers.\n"
373 "--gremlin mask : Special stress testing mode (for debugging only).\n"
375 #if defined(USE_COMP)
376 "--compress alg : Use compression algorithm alg\n"
377 "--allow-compression: Specify whether compression should be allowed\n"
378 #if defined(ENABLE_LZO)
379 "--comp-lzo : Use LZO compression -- may add up to 1 byte per\n"
380 " packet for incompressible data.\n"
381 "--comp-noadapt : Don't use adaptive compression when --comp-lzo\n"
385 #ifdef ENABLE_MANAGEMENT
386 "--management ip port [pass] : Enable a TCP server on ip:port to handle\n"
387 " management functions. pass is a password file\n"
388 " or 'stdin' to prompt from console.\n"
389 #if UNIX_SOCK_SUPPORT
390 " To listen on a unix domain socket, specific the pathname\n"
391 " in place of ip and use 'unix' as the port number.\n"
393 "--management-client : Management interface will connect as a TCP client to\n"
394 " ip/port rather than listen as a TCP server.\n"
395 "--management-query-passwords : Query management channel for private key\n"
396 " and auth-user-pass passwords.\n"
397 "--management-query-proxy : Query management channel for proxy information.\n"
398 "--management-query-remote : Query management channel for --remote directive.\n"
399 "--management-hold : Start " PACKAGE_NAME " in a hibernating state, until a client\n"
400 " of the management interface explicitly starts it.\n"
401 "--management-signal : Issue SIGUSR1 when management disconnect event occurs.\n"
402 "--management-forget-disconnect : Forget passwords when management disconnect\n"
404 "--management-up-down : Report tunnel up/down events to management interface.\n"
405 "--management-log-cache n : Cache n lines of log file history for usage\n"
406 " by the management channel.\n"
407 #if UNIX_SOCK_SUPPORT
408 "--management-client-user u : When management interface is a unix socket, only\n"
409 " allow connections from user u.\n"
410 "--management-client-group g : When management interface is a unix socket, only\n"
411 " allow connections from group g.\n"
413 "--management-client-auth : gives management interface client the responsibility\n"
414 " to authenticate clients after their client certificate\n"
415 " has been verified.\n"
418 "--plugin m [str]: Load plug-in module m passing str as an argument\n"
419 " to its initialization function.\n"
421 "--vlan-tagging : Enable 802.1Q-based VLAN tagging.\n"
422 "--vlan-accept tagged|untagged|all : Set VLAN tagging mode. Default is 'all'.\n"
423 "--vlan-pvid v : Sets the Port VLAN Identifier. Defaults to 1.\n"
425 "Multi-Client Server options (when --mode server is used):\n"
426 "--server network netmask : Helper option to easily configure server mode.\n"
427 "--server-ipv6 network/bits : Configure IPv6 server mode.\n"
428 "--server-bridge [IP netmask pool-start-IP pool-end-IP] : Helper option to\n"
429 " easily configure ethernet bridging server mode.\n"
430 "--push \"option\" : Push a config file option back to the peer for remote\n"
431 " execution. Peer must specify --pull in its config file.\n"
432 "--push-reset : Don't inherit global push list for specific\n"
433 " client instance.\n"
434 "--push-remove opt : Remove options matching 'opt' from the push list for\n"
435 " a specific client instance.\n"
436 "--ifconfig-pool start-IP end-IP [netmask] : Set aside a pool of subnets\n"
437 " to be dynamically allocated to connecting clients.\n"
438 "--ifconfig-pool-persist file [seconds] : Persist/unpersist ifconfig-pool\n"
439 " data to file, at seconds intervals (default=600).\n"
440 " If seconds=0, file will be treated as read-only.\n"
441 "--ifconfig-ipv6-pool base-IP/bits : set aside an IPv6 network block\n"
442 " to be dynamically allocated to connecting clients.\n"
443 "--ifconfig-push local remote-netmask : Push an ifconfig option to remote,\n"
444 " overrides --ifconfig-pool dynamic allocation.\n"
445 " Only valid in a client-specific config file.\n"
446 "--ifconfig-ipv6-push local/bits remote : Push an ifconfig-ipv6 option to\n"
447 " remote, overrides --ifconfig-ipv6-pool allocation.\n"
448 " Only valid in a client-specific config file.\n"
449 "--iroute network [netmask] : Route subnet to client.\n"
450 "--iroute-ipv6 network/bits : Route IPv6 subnet to client.\n"
451 " Sets up internal routes only.\n"
452 " Only valid in a client-specific config file.\n"
453 "--disable : Client is disabled.\n"
454 " Only valid in a client-specific config file.\n"
455 "--override-username: Overrides the client-specific username to be used.\n"
456 " Only valid in a client-specific config file.\n"
457 "--verify-client-cert [none|optional|require] : perform no, optional or\n"
458 " mandatory client certificate verification.\n"
459 " Default is to require the client to supply a certificate.\n"
460 "--username-as-common-name : For auth-user-pass authentication, use\n"
461 " the authenticated username as the common name,\n"
462 " rather than the common name from the client cert.\n"
463 "--auth-user-pass-verify cmd method: Query client for username/password and\n"
464 " run command cmd to verify. If method='via-env', pass\n"
465 " user/pass via environment, if method='via-file', pass\n"
466 " user/pass via temporary file.\n"
467 "--auth-gen-token [lifetime] Generate a random authentication token which is pushed\n"
468 " to each client, replacing the password. Useful when\n"
469 " OTP based two-factor auth mechanisms are in use and\n"
470 " --reneg-* options are enabled. Optionally a lifetime in seconds\n"
471 " for generated tokens can be set.\n"
472 "--opt-verify : (DEPRECATED) Clients that connect with options that are incompatible\n"
473 " with those of the server will be disconnected.\n"
474 "--auth-user-pass-optional : Allow connections by clients that don't\n"
475 " specify a username/password.\n"
476 "--no-name-remapping : (DEPRECATED) Allow Common Name and X509 Subject to include\n"
477 " any printable character.\n"
478 "--client-to-client : Internally route client-to-client traffic.\n"
479 "--duplicate-cn : Allow multiple clients with the same common name to\n"
480 " concurrently connect.\n"
481 "--client-connect cmd : Run command cmd on client connection.\n"
482 "--client-disconnect cmd : Run command cmd on client disconnection.\n"
483 "--client-config-dir dir : Directory for custom client config files.\n"
484 "--ccd-exclusive : Refuse connection unless custom client config is found.\n"
485 "--tmp-dir dir : Temporary directory, used for --client-connect return file and plugin communication.\n"
486 "--hash-size r v : Set the size of the real address hash table to r and the\n"
487 " virtual address table to v.\n"
488 "--bcast-buffers n : Allocate n broadcast buffers.\n"
489 "--tcp-queue-limit n : Maximum number of queued TCP output packets.\n"
490 "--tcp-nodelay : Macro that sets TCP_NODELAY socket flag on the server\n"
491 " as well as pushes it to connecting clients.\n"
492 "--learn-address cmd : Run command cmd to validate client virtual addresses.\n"
493 "--connect-freq n s : Allow a maximum of n new connections per s seconds.\n"
494 "--connect-freq-initial n s : Allow a maximum of n replies for initial connections attempts per s seconds.\n"
495 "--max-clients n : Allow a maximum of n simultaneously connected clients.\n"
496 "--max-routes-per-client n : Allow a maximum of n internal routes per client.\n"
497 "--stale-routes-check n [t] : Remove routes with a last activity timestamp\n"
498 " older than n seconds. Run this check every t\n"
499 " seconds (defaults to n).\n"
500 "--explicit-exit-notify [n] : In UDP server mode send [RESTART] command on exit/restart to connected\n"
501 " clients. n = 1 - reconnect to same server,\n"
502 " 2 - advance to next server, default=1.\n"
504 "--port-share host port [dir] : When run in TCP mode, proxy incoming HTTPS\n"
505 " sessions to a web server at host:port. dir specifies an\n"
506 " optional directory to write origin IP:port data.\n"
509 "Client options (when connecting to a multi-client server):\n"
510 "--client : Helper option to easily configure client mode.\n"
511 "--auth-user-pass [up] : Authenticate with server using username/password.\n"
512 " up is a file containing the username on the first line,\n"
513 " and a password on the second. If either the password or both\n"
514 " the username and the password are omitted OpenVPN will prompt\n"
515 " for them from console.\n"
516 "--pull : Accept certain config file options from the peer as if they\n"
517 " were part of the local config file. Must be specified\n"
518 " when connecting to a '--mode server' remote host.\n"
519 "--pull-filter accept|ignore|reject t : Filter each option received from the\n"
520 " server if it starts with the text t. The action flag accept,\n"
521 " ignore or reject causes the option to be allowed, removed or\n"
522 " rejected with error. May be specified multiple times, and\n"
523 " each filter is applied in the order of appearance.\n"
524 "--dns server <n> <option> <value> [value ...] : Configure option for DNS server #n\n"
525 " Valid options are :\n"
526 " address <addr[:port]> [addr[:port] ...] : server addresses 4/6\n"
527 " resolve-domains <domain> [domain ...] : split domains\n"
528 " dnssec <yes|no|optional> : option to use DNSSEC\n"
529 " type <DoH|DoT> : query server over HTTPS / TLS\n"
530 " sni <domain> : DNS server name indication\n"
531 "--dns search-domains <domain> [domain ...]:\n"
532 " Add domains to DNS domain search list\n"
533 "--auth-retry t : How to handle auth failures. Set t to\n"
534 " none (default), interact, or nointeract.\n"
535 "--static-challenge t e [<scrv1|concat>]: Enable static challenge/response protocol using\n"
536 " challenge text t, with e indicating echo flag (0|1)\n"
537 " and optional argument scrv1 or concat to use SCRV1 protocol or"
538 " concatenate response with password. Default is scrv1.\n"
539 "--connect-timeout n : when polling possible remote servers to connect to\n"
540 " in a round-robin fashion, spend no more than n seconds\n"
541 " waiting for a response before trying the next server.\n"
542 "--allow-recursive-routing : When this option is set, OpenVPN will not drop\n"
543 " incoming tun packets with same destination as host.\n"
544 "--explicit-exit-notify [n] : On exit/restart, send exit signal to\n"
545 " server/remote. n = # of retries, default=1.\n"
547 "Data Channel Encryption Options (must be compatible between peers):\n"
548 "(These options are meaningful for both Static Key & TLS-mode)\n"
549 "--auth alg : Authenticate packets with HMAC using message\n"
550 " digest algorithm alg (default=%s).\n"
551 " (usually adds 16 or 20 bytes per packet)\n"
552 " Set alg=none to disable authentication.\n"
553 "--cipher alg : Encrypt packets with cipher algorithm alg.\n"
554 " You should usually use --data-ciphers instead.\n"
555 " Set alg=none to disable encryption.\n"
556 "--data-ciphers list : List of ciphers that are allowed to be negotiated.\n"
557 #ifndef ENABLE_CRYPTO_MBEDTLS
558 "--engine [name] : Enable OpenSSL hardware crypto engine functionality.\n"
560 "--mute-replay-warnings : Silence the output of replay warnings to log file.\n"
561 "--replay-window n [t] : Use a replay protection sliding window of size n\n"
562 " and a time window of t seconds.\n"
563 " Default n=%d t=%d\n"
564 "--replay-persist file : Persist replay-protection state across sessions\n"
566 "--test-crypto : Run a self-test of crypto features enabled.\n"
567 " For debugging only.\n"
568 #ifdef ENABLE_PREDICTION_RESISTANCE
569 "--use-prediction-resistance: Enable prediction resistance on the random\n"
570 " number generator.\n"
573 "TLS Key Negotiation Options:\n"
574 "(These options are meaningful only for TLS-mode)\n"
575 "--tls-server : Enable TLS and assume server role during TLS handshake.\n"
576 "--tls-client : Enable TLS and assume client role during TLS handshake.\n"
577 "--ca file : Certificate authority file in .pem format containing\n"
578 " root certificate.\n"
579 #ifndef ENABLE_CRYPTO_MBEDTLS
580 "--capath dir : A directory of trusted certificates (CAs"
583 "--dh file : File containing Diffie Hellman parameters\n"
584 " in .pem format (for --tls-server only).\n"
585 " Use \"openssl dhparam -out dh1024.pem 1024\" to generate.\n"
586 "--cert file : Local certificate in .pem format or a URI -- must be signed\n"
587 " by a Certificate Authority in --ca file used by the peer.\n"
588 "--extra-certs file : one or more PEM certs that complete the cert chain.\n"
589 "--key file : Local private key in .pem format or a URI.\n"
590 "--tls-version-min <version> ['or-highest'] : sets the minimum TLS version we\n"
591 " will accept from the peer. If version is unrecognized and 'or-highest'\n"
592 " is specified, require max TLS version supported by SSL implementation.\n"
593 "--tls-version-max <version> : sets the maximum TLS version we will use.\n"
594 #ifndef ENABLE_CRYPTO_MBEDTLS
595 "--pkcs12 file : PKCS#12 file containing local private key, local certificate\n"
596 " and optionally the root CA certificate.\n"
598 #ifdef ENABLE_X509ALTUSERNAME
599 "--x509-username-field : Field in x509 certificate containing the username.\n"
600 " Default is CN in the Subject field.\n"
602 "--verify-hash hash [algo] : Specify fingerprint for level-1 certificate.\n"
603 " Valid algo flags are SHA1 and SHA256. \n"
605 "--cryptoapicert select-string : Load the certificate and private key from the\n"
606 " Windows Certificate System Store.\n"
608 "--tls-cipher l : A list l of allowable TLS ciphers separated by : (optional).\n"
609 "--tls-ciphersuites l: A list of allowed TLS 1.3 cipher suites separated by : (optional)\n"
610 " : Use --show-tls to see a list of supported TLS ciphers (suites).\n"
611 "--tls-cert-profile p : Set the allowed certificate crypto algorithm profile\n"
612 " (default=legacy).\n"
613 "--providers l : A list l of OpenSSL providers to load.\n"
614 "--tls-timeout n : Packet retransmit timeout on TLS control channel\n"
615 " if no ACK from remote within n seconds (default=%d).\n"
616 "--reneg-bytes n : Renegotiate data chan. key after n bytes sent and recvd.\n"
617 "--reneg-pkts n : Renegotiate data chan. key after n packets sent and recvd.\n"
618 "--reneg-sec max [min] : Renegotiate data chan. key after at most max (default=%d)\n"
619 " and at least min (defaults to 90%% of max on servers and equal\n"
620 " to max on clients).\n"
621 "--hand-window n : Data channel key exchange must finalize within n seconds\n"
622 " of handshake initiation by any peer (default=%d).\n"
623 "--tran-window n : Transition window -- old key can live this many seconds\n"
624 " after new key renegotiation begins (default=%d).\n"
625 "--single-session: Allow only one session (reset state on restart).\n"
626 "--tls-exit : Exit on TLS negotiation failure.\n"
627 "--tls-auth f [d]: Add an additional layer of authentication on top of the TLS\n"
628 " control channel to protect against attacks on the TLS stack\n"
629 " and DoS attacks.\n"
630 " f (required) is a shared-secret key file.\n"
631 " The optional d parameter controls key directionality.\n"
632 "--tls-crypt key : Add an additional layer of authenticated encryption on top\n"
633 " of the TLS control channel to hide the TLS certificate,\n"
634 " provide basic post-quantum security and protect against\n"
635 " attacks on the TLS stack and DoS attacks.\n"
636 " key (required) provides the pre-shared key file.\n"
637 "--tls-crypt-v2 key : For clients: use key as a client-specific tls-crypt key.\n"
638 " For servers: use key to decrypt client-specific keys. For\n"
639 " key generation (--genkey tls-crypt-v2-client): use key to\n"
640 " encrypt generated client-specific key. (See --tls-crypt.)\n"
641 "--genkey tls-crypt-v2-client [keyfile] [base64 metadata]: Generate a\n"
642 " fresh tls-crypt-v2 client key, and store to\n"
643 " keyfile. If supplied, include metadata in wrapped key.\n"
644 "--genkey tls-crypt-v2-server [keyfile] [base64 metadata]: Generate a\n"
645 " fresh tls-crypt-v2 server key, and store to keyfile\n"
646 "--tls-crypt-v2-verify cmd : Run command cmd to verify the metadata of the\n"
647 " client-supplied tls-crypt-v2 client key\n"
648 "--askpass [file]: Get PEM password from controlling tty before we daemonize.\n"
649 "--auth-nocache : Don't cache --askpass or --auth-user-pass passwords.\n"
650 "--crl-verify crl ['dir']: Check peer certificate against a CRL.\n"
651 "--tls-verify cmd: Run command cmd to verify the X509 name of a\n"
652 " pending TLS connection that has otherwise passed all other\n"
653 " tests of certification. cmd should return 0 to allow\n"
654 " TLS handshake to proceed, or 1 to fail. (cmd is\n"
655 " executed as 'cmd certificate_depth subject')\n"
656 "--verify-x509-name name: Accept connections only from a host with X509 subject\n"
657 " DN name. The remote host must also pass all other tests\n"
658 " of verification.\n"
659 #ifndef ENABLE_CRYPTO_MBEDTLS
660 "--ns-cert-type t: (DEPRECATED) Require that peer certificate was signed with \n"
661 " an explicit nsCertType designation t = 'client' | 'server'.\n"
663 "--x509-track x : Save peer X509 attribute x in environment for use by\n"
664 " plugins and management interface.\n"
665 #ifdef HAVE_EXPORT_KEYING_MATERIAL
666 "--keying-material-exporter label len : Save Exported Keying Material (RFC5705)\n"
667 " of len bytes (min. 16 bytes) using label in environment for use by plugins.\n"
669 "--remote-cert-ku v ... : Require that the peer certificate was signed with\n"
670 " explicit key usage, you can specify more than one value.\n"
671 " value should be given in hex format.\n"
672 "--remote-cert-eku oid : Require that the peer certificate was signed with\n"
673 " explicit extended key usage. Extended key usage can be encoded\n"
674 " as an object identifier or OpenSSL string representation.\n"
675 "--remote-cert-tls t: Require that peer certificate was signed with explicit\n"
676 " key usage and extended key usage based on RFC3280 TLS rules.\n"
677 " t = 'client' | 'server'.\n"
681 "--pkcs11-providers provider ... : PKCS#11 provider to load.\n"
682 "--pkcs11-protected-authentication [0|1] ... : Use PKCS#11 protected authentication\n"
683 " path. Set for each provider.\n"
684 "--pkcs11-private-mode hex ... : PKCS#11 private key mode mask.\n"
685 " 0 : Try to determine automatically (default).\n"
687 " 2 : Use SignRecover.\n"
688 " 4 : Use Decrypt.\n"
690 "--pkcs11-cert-private [0|1] ... : Set if login should be performed before\n"
691 " certificate can be accessed. Set for each provider.\n"
692 "--pkcs11-pin-cache seconds : Number of seconds to cache PIN. The default is -1\n"
693 " cache until token is removed.\n"
694 "--pkcs11-id-management : Acquire identity from management interface.\n"
695 "--pkcs11-id serialized-id 'id' : Identity to use, get using standalone --show-pkcs11-ids\n"
698 "SSL Library information:\n"
699 "--show-ciphers : Show cipher algorithms to use with --cipher option.\n"
700 "--show-digests : Show message digest algorithms to use with --auth option.\n"
701 "--show-engines : Show hardware crypto accelerator engines (if available).\n"
702 "--show-tls : Show all TLS ciphers (TLS used only as a control channel).\n"
705 "Windows Specific:\n"
706 "--win-sys path : Pathname of Windows system directory. Default is the pathname\n"
707 " from SystemRoot environment variable.\n"
708 "--ip-win32 method : When using --ifconfig on Windows, set TAP-Windows adapter\n"
709 " IP address using method = manual, netsh, ipapi,\n"
710 " dynamic, or adaptive (default = adaptive).\n"
711 " Dynamic method allows two optional parameters:\n"
712 " offset: DHCP server address offset (> -256 and < 256).\n"
713 " If 0, use network address, if >0, take nth\n"
714 " address forward from network address, if <0,\n"
715 " take nth address backward from broadcast\n"
718 " lease-time: Lease time in seconds.\n"
719 " Default is one year.\n"
720 "--route-method : Which method to use for adding routes on Windows?\n"
721 " adaptive (default) -- Try ipapi then fall back to exe.\n"
722 " ipapi -- Use IP helper API.\n"
723 " exe -- Call the route.exe shell command.\n"
724 "--dhcp-option type [parm] : Set extended TAP-Windows properties, must\n"
725 " be used with --ip-win32 dynamic. For options\n"
726 " which allow multiple addresses,\n"
727 " --dhcp-option must be repeated.\n"
728 " DOMAIN name : Set DNS suffix\n"
729 " DOMAIN-SEARCH entry : Add entry to DNS domain search list\n"
730 " DNS addr : Set domain name server address(es) (IPv4 and IPv6)\n"
731 " NTP : Set NTP server address(es)\n"
732 " NBDD : Set NBDD server address(es)\n"
733 " WINS addr : Set WINS server address(es)\n"
734 " NBT type : Set NetBIOS over TCP/IP Node type\n"
735 " 1: B, 2: P, 4: M, 8: H\n"
736 " NBS id : Set NetBIOS scope ID\n"
737 " DISABLE-NBT : Disable Netbios-over-TCP/IP.\n"
738 "--dhcp-renew : Ask Windows to renew the TAP adapter lease on startup.\n"
739 "--dhcp-pre-release : Ask Windows to release the previous TAP adapter lease on\n"
741 "--register-dns : Run ipconfig /flushdns and ipconfig /registerdns\n"
742 " on connection initiation.\n"
743 "--tap-sleep n : Sleep for n seconds after TAP adapter open before\n"
744 " attempting to set adapter properties.\n"
745 "--pause-exit : When run from a console window, pause before exiting.\n"
746 "--service ex [0|1] : For use when " PACKAGE_NAME " is being instantiated by a\n"
747 " service, and should not be used directly by end-users.\n"
748 " ex is the name of an event object which, when\n"
749 " signaled, will cause " PACKAGE_NAME " to exit. A second\n"
750 " optional parameter controls the initial state of ex.\n"
751 "--show-net-up : Show " PACKAGE_NAME "'s view of routing table and net adapter list\n"
752 " after TAP adapter is up and routes have been added.\n"
753 "--windows-driver : Which tun driver to use?\n"
754 " ovpn-dco (default)\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;
841 #ifdef ENABLE_MANAGEMENT
846 #ifdef ENABLE_FEATURE_TUN_PERSIST
878 #ifdef ENABLE_PREDICTION_RESISTANCE
879 o->use_prediction_resistance =
false;
889 #ifdef ENABLE_X509ALTUSERNAME
893 o->pkcs11_pin_cache_period = -1;
908 msg(
M_USAGE,
"Could not find a suitable temporary directory."
909 " (GetTempPath() failed). Consider using --tmp-dir");
946 #define PUF_TYPE_UNDEF 0
947 #define PUF_TYPE_ACCEPT 1
948 #define PUF_TYPE_IGNORE 2
949 #define PUF_TYPE_REJECT 3
985 #define SHOW_PARM(name, value, format) msg(D_SHOW_PARMS, " " #name " = " format, (value))
986 #define SHOW_STR(var) SHOW_PARM(var, (o->var ? o->var : "[UNDEF]"), "'%s'")
987 #define SHOW_STR_INLINE(var) SHOW_PARM(var, \
988 o->var ## _inline ? "[INLINE]" : \
989 (o->var ? o->var : "[UNDEF]"), \
991 #define SHOW_INT(var) SHOW_PARM(var, o->var, "%d")
992 #define SHOW_UINT(var) SHOW_PARM(var, o->var, "%u")
993 #define SHOW_INT64(var) SHOW_PARM(var, o->var, "%" PRIi64)
994 #define SHOW_UNSIGNED(var) SHOW_PARM(var, o->var, "0x%08x")
995 #define SHOW_BOOL(var) SHOW_PARM(var, (o->var ? "ENABLED" : "DISABLED"), "%s");
1081 for (i = 0; i <
len; ++i)
1099 msg(
M_WARN,
"foreign_option: name/value overflow");
1110 bool succeeded =
false;
1118 ret =
getaddr(flags, ip_string, 0, &succeeded, NULL);
1119 if (!succeeded && error)
1134 const char *end = strchr(addr,
'/');
1142 size_t len = end - addr;
1144 memcpy(ret, addr,
len);
1152 struct in6_addr t_addr;
1153 unsigned int t_bits;
1161 char *ret = (
char *)
gc_malloc(strlen(src) + 1,
true,
gc);
1191 const char *cp = str;
1199 while (*cp && i < nbytes)
1202 if (!isxdigit(cp[0])
1204 || (cp[2] !=
':' && cp[2] !=
'\0')
1205 || sscanf(cp,
"%x", &
byte) != 1)
1207 msg(msglevel,
"format error in hash fingerprint: %s", str);
1211 ret->
hash[i++] = (uint8_t)
byte;
1222 msg(msglevel,
"hash fingerprint is wrong length - expected %d bytes, got %d: %s", nbytes, i, str);
1224 else if (term !=
'\0')
1226 msg(msglevel,
"hash fingerprint too long - expected only %d bytes: %s", nbytes, str);
1251 while ((line =
strsep(&lines,
"\n")))
1254 while (isspace(*line))
1259 if (strlen(line) == 0 || *line ==
'#' || *line ==
';')
1282 #ifndef ENABLE_SMALL
1288 for (i = 0; i < len; ++i)
1299 for (i = 0; i < len; ++i)
1335 #if defined(_WIN32) || defined(TARGET_ANDROID)
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);
1396 domain = domain->
next;
1400 msg(
M_WARN,
"WARNING: couldn't copy all --dns search-domains to --dhcp-option");
1409 bool overflow =
false;
1434 server = server->
next;
1438 msg(
M_WARN,
"WARNING: couldn't copy all --dns server addresses to --dhcp-option");
1449 if (!domain && !server)
1458 for (
int i = 1; i <= opt_max; ++i)
1461 snprintf(name,
sizeof(name),
"foreign_option_%d", i);
1464 const char *value = strchr(env_str,
'=') + 1;
1465 if ((domain && strstr(value,
"dhcp-option DOMAIN-SEARCH") == value)
1466 || (server && strstr(value,
"dhcp-option DNS") == value))
1472 setenv_foreign_option(o, &value, 1,
es);
1480 for (
size_t i = 0; i < server->
addr_count; ++i)
1484 const char *
argv[] = {
1489 setenv_foreign_option(o,
argv, 3,
es);
1493 const char *
argv[] = {
1498 setenv_foreign_option(o,
argv, 3,
es);
1501 server = server->
next;
1505 const char *
argv[] = {
"dhcp-option",
"DOMAIN-SEARCH", domain->
name };
1506 setenv_foreign_option(o,
argv, 3,
es);
1507 domain = domain->
next;
1516 snprintf(name,
sizeof(name),
"foreign_option_%d", opt_max--);
1522 #ifndef ENABLE_SMALL
1569 SHOW_STR(ifconfig_pool_persist_filename);
1570 SHOW_INT(ifconfig_pool_persist_refresh_freq);
1573 SHOW_INT(ifconfig_ipv6_pool_netbits);
1580 SHOW_STR(client_disconnect_script);
1581 SHOW_STR(client_crresponse_script);
1599 SHOW_STR(auth_user_pass_verify_script);
1600 SHOW_BOOL(auth_user_pass_verify_script_via_file);
1624 const char *network_str,
1625 const char *netmask_str,
1641 msg(msglevel,
"in --iroute %s %s : Bad network/subnet specification",
1654 const char *prefix_str,
1663 msg(msglevel,
"in --iroute-ipv6 %s: Bad IPv6 prefix specification",
1672 #ifndef ENABLE_SMALL
1740 #ifndef ENABLE_SMALL
1781 #ifdef ENABLE_FRAGMENT
1788 SHOW_INT(explicit_exit_notification);
1805 for (i = 0; i < l->
len; ++i)
1840 #ifndef ENABLE_SMALL
1847 #ifdef ENABLE_FEATURE_TUN_PERSIST
1869 #if defined(ENABLE_DCO)
1901 #if PASSTOS_CAPABILITY
1912 #ifdef ENABLE_SELINUX
1938 #if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK
1972 #ifdef ENABLE_MANAGEMENT
1976 SHOW_INT(management_log_history_cache);
1977 SHOW_INT(management_echo_buffer_size);
1982 #ifdef ENABLE_PLUGIN
1994 #ifndef ENABLE_CRYPTO_MBEDTLS
2002 #ifdef ENABLE_PREDICTION_RESISTANCE
2013 SHOW_PARM(
"cert_file",
"EXTERNAL_CERT",
"%s");
2023 SHOW_PARM(
"priv_key_file",
"EXTERNAL_PRIVATE_KEY",
"%s");
2029 #ifndef ENABLE_CRYPTO_MBEDTLS
2032 #ifdef ENABLE_CRYPTOAPI
2039 SHOW_STR(tls_export_peer_cert_dir);
2086 #ifdef ENABLE_PKCS11
2089 for (i = 0; i<
MAX_PARMS && o->pkcs11_providers[i] != NULL; i++)
2091 SHOW_PARM(pkcs11_providers, o->pkcs11_providers[i],
"%s");
2098 SHOW_PARM(pkcs11_protected_authentication, o->pkcs11_protected_authentication[i] ?
"ENABLED" :
"DISABLED",
"%s");
2105 SHOW_PARM(pkcs11_private_mode, o->pkcs11_private_mode[i],
"%08x");
2112 SHOW_PARM(pkcs11_cert_private, o->pkcs11_cert_private[i] ?
"ENABLED" :
"DISABLED",
"%s");
2136 #ifdef ENABLE_MANAGEMENT
2150 if (flags && !strcmp(flags,
"nct"))
2173 bool succeed =
false;
2174 for (i = 0; i < l->
len; ++i)
2185 for (i = 0; i < l->
len; ++i)
2196 msg(
M_WARN,
"Note: option http-proxy-override ignored because no TCP-based connection profiles are defined");
2221 msg(msglevel,
"Maximum number of 'local' options (%d) exceeded",
2256 msg(msglevel,
"Unable to process more connection options: out of memory. Number of entries = %d", l->
len);
2289 msg(msglevel,
"Unable to process more remote options: out of memory. Number of entries = %d", l->
len);
2356 if (key_file && *key_file && !(*key_inline))
2361 msg(
M_FATAL,
"Cannot pre-load keyfile (%s)", *key_file);
2364 *key_file = (
const char *) in.
data;
2372 #ifdef ENABLE_CRYPTO_MBEDTLS
2375 msg(
M_USAGE,
"Parameter --capath cannot be used with the mbed TLS version of OpenVPN.");
2382 #ifndef ENABLE_CRYPTO_MBEDTLS
2390 const char *
const str =
"You must define CA file (--ca)"
2391 #ifndef ENABLE_CRYPTO_MBEDTLS
2392 " or CA path (--capath)"
2394 " and/or peer fingerprint verification (--peer-fingerprint)";
2398 #define MUST_BE_UNDEF(parm, parm_name) \
2399 if (options->parm != defaults.parm) { msg(M_USAGE, use_err, parm_name); }
2400 #define MUST_BE_FALSE(condition, parm_name) \
2401 if (condition) { msg(M_USAGE, use_err, parm_name); }
2434 "--proto tcp is ambiguous in this context. Please specify "
2435 "--proto tcp-server or --proto tcp-client");
2444 msg(
M_USAGE,
"multiple --local statements only allowed in --server mode");
2449 msg(
M_USAGE,
"--lladdr can only be used in --dev tap mode");
2457 msg(
M_USAGE,
"only one of --tun-mtu or --link-mtu may be defined");
2462 msg(
M_USAGE,
"--mtu-test only makes sense with --proto udp");
2476 "--local and --remote addresses must be distinct from --ifconfig "
2484 "local and remote/netmask --ifconfig addresses must be different");
2489 msg(
M_USAGE,
"--bind and --nobind can't be used together");
2495 "--lport and --nobind don't make sense when used together");
2500 msg(
M_USAGE,
"--nobind doesn't make sense unless used with --remote");
2511 msg(
M_USAGE,
"--remote and one of the --local addresses are the same");
2517 msg(
M_USAGE,
"--local addresses must be distinct from --ifconfig addresses");
2522 msg(
M_USAGE,
"--local and --nobind don't make sense when used together");
2529 #ifdef ENABLE_MANAGEMENT
2534 msg(
M_USAGE,
"--management is not specified, however one or more options which modify the behavior of --management were specified");
2540 msg(
M_USAGE,
"--management-client-(user|group) can only be used on unix domain sockets");
2547 msg(
M_WARN,
"WARNING: Using --management on a TCP port WITHOUT "
2548 "passwords is STRONGLY discouraged and considered insecure");
2553 #if !defined(HAVE_XKEY_PROVIDER)
2559 msg(
M_FATAL,
"management-external-key with TLS 1.3 or later requires "
2560 "nopadding argument/support");
2570 msg(
M_USAGE,
"On Windows, --ifconfig is required when --dev tun is used");
2576 msg(
M_USAGE,
"On Windows, --ip-win32 doesn't make sense unless --ifconfig is also used");
2581 const char *prefix =
"Some --dhcp-option or --dns options require DHCP server";
2584 msg(
M_USAGE,
"%s, which is not supported by the selected %s driver",
2590 msg(
M_USAGE,
"%s, which requires --ip-win32 dynamic or adaptive",
2597 msg(
M_USAGE,
"--windows-driver wintun requires --dev tun");
2605 #ifdef ENABLE_FRAGMENT
2608 msg(
M_USAGE,
"--fragment can only be used with --proto udp");
2614 msg(
M_USAGE,
"--remote MUST be used in TCP Client mode");
2620 "--http-proxy MUST be used in TCP Client mode (i.e. --proto "
2627 "--http-proxy not specified but other http proxy options present");
2633 "--http-proxy can not be used together with --socks-proxy");
2638 msg(
M_USAGE,
"--socks-proxy can not be used in TCP Server mode");
2643 msg(
M_USAGE,
"TCP server mode allows at most one --remote address");
2651 const char use_err[] =
"--%s cannot be used with --mode server.";
2653 #define USAGE_VALID_SERVER_PROTOS "--mode server currently only supports " \
2654 "--proto values of udp, tcp-server, tcp4-server, or tcp6-server"
2655 #ifdef TARGET_ANDROID
2656 msg(
M_FATAL,
"--mode server not supported on Android");
2660 msg(
M_USAGE,
"--mode server only works with --dev tun or --dev tap");
2665 msg(
M_WARN,
"--pull-filter ignored for --mode server");
2675 msg(
M_USAGE,
"--port-share only works in TCP server mode "
2676 "(--proto values of tcp-server, tcp4-server, or tcp6-server)");
2681 msg(
M_USAGE,
"--mode server requires --tls-server");
2693 msg(
M_USAGE,
"<connection> cannot be used with --mode server");
2700 "--ipchange cannot be used with --mode server (use "
2701 "--client-connect instead)");
2709 msg(
M_USAGE,
"--connect-freq only works with --mode server --proto udp. Try --max-clients instead.");
2713 msg(
M_USAGE,
"The third parameter to --ifconfig-pool (netmask) is only valid in --dev tap mode");
2717 msg(
M_USAGE,
"--redirect-gateway cannot be used with --mode server (however --push \"redirect-gateway\" is fine)");
2726 "--ifconfig-pool-persist must be used with --ifconfig-pool or --ifconfig-ipv6-pool");
2730 msg(
M_USAGE,
"--ifconfig-ipv6-pool needs --ifconfig-ipv6");
2732 MUST_BE_UNDEF(allow_recursive_routing,
"allow-recursive-routing");
2735 msg(
M_USAGE,
"--auth-user-pass cannot be used with --mode server (it should be used on the client side only)");
2739 msg(
M_USAGE,
"--ccd-exclusive must be used with --client-config-dir");
2743 msg(
M_USAGE,
"--auth-gen-token needs a non-infinite "
2744 "--renegotiate_seconds setting");
2749 msg(
M_USAGE,
"--auth-gen-token renewal time needs to be at least "
2750 " two times --hand-window (%d).",
2758 const char *use_err =
"--%s must be used with --management-client-auth, an --auth-user-pass-verify script, or plugin";
2762 "verify-client-cert none|optional");
2764 "username-as-common-name");
2766 "auth-user-pass-optional");
2771 msg(
M_USAGE,
"--vlan-tagging must be used with --dev tap");
2775 const char use_err[] =
"--%s requires --vlan-tagging";
2782 const char use_err[] =
"--%s requires --mode server";
2788 MUST_BE_UNDEF(ifconfig_pool_persist_filename,
"ifconfig-pool-persist");
2789 MUST_BE_UNDEF(ifconfig_ipv6_pool_defined,
"ifconfig-ipv6-pool");
2794 MUST_BE_UNDEF(client_crresponse_script,
"client-crresponse");
2795 MUST_BE_UNDEF(client_disconnect_script,
"client-disconnect");
2804 "verify-client-cert");
2810 msg(
M_WARN,
"WARNING: setting tcp-nodelay on the client side will not "
2811 "affect the server. To have TCP_NODELAY in both direction use "
2812 "tcp-nodelay in the server configuration instead.");
2814 MUST_BE_UNDEF(auth_user_pass_verify_script,
"auth-user-pass-verify");
2819 msg(
M_USAGE,
"--port-share requires TCP server mode (--mode server --proto tcp-server)");
2822 MUST_BE_UNDEF(stale_routes_check_interval,
"stale-routes-check");
2826 MUST_BE_UNDEF(force_key_material_export,
"force-key-material-export");
2835 msg(
M_USAGE,
"specify only one of --tls-server, --tls-client, or --secret");
2846 msg(msglevel,
"DEPRECATION: No tls-client or tls-server option in "
2847 "configuration detected. OpenVPN 2.8 will remove the "
2848 "functionality to run a VPN without TLS. "
2849 "See the examples section in the manual page for "
2850 "examples of a similar quick setup with peer-fingerprint. "
2851 "OpenVPN 2.7 allows using this configuration when using "
2852 "--allow-deprecated-insecure-static-crypto but you should move "
2853 "to a proper configuration using TLS as soon as possible."
2859 msg(
M_WARN,
"WARNING: POTENTIALLY DANGEROUS OPTION "
2860 "--verify-client-cert none|optional "
2861 "may accept clients which do not present a certificate");
2867 const int tls_version_min =
2873 msg(
M_USAGE,
"--tls-version-min bigger than --tls-version-max");
2879 #ifdef ENABLE_PKCS11
2882 msg(
M_WARN,
"Option pkcs11-id is ignored as no pkcs11-providers are specified");
2884 else if (!
options->pkcs11_providers[0] &&
options->pkcs11_id_management)
2886 msg(
M_WARN,
"Option pkcs11-id-management is ignored as no pkcs11-providers are specified");
2889 if (
options->pkcs11_providers[0])
2893 msg(
M_USAGE,
"Parameter --pkcs11-id cannot be used when --pkcs11-id-management is also specified.");
2895 if (!
options->pkcs11_id_management &&
options->pkcs11_id == NULL)
2897 msg(
M_USAGE,
"Parameter --pkcs11-id or --pkcs11-id-management should be specified.");
2899 const char use_err[] =
"Parameter --%s cannot be used when --pkcs11-provider is also specified.";
2905 #ifdef ENABLE_CRYPTOAPI
2911 #ifdef ENABLE_CRYPTOAPI
2914 const char use_err[] =
"Parameter --%s cannot be used when --cryptoapicert is also specified.";
2925 #ifdef ENABLE_CRYPTO_MBEDTLS
2926 msg(
M_USAGE,
"Parameter --pkcs12 cannot be used with the mbed TLS version of OpenVPN.");
2928 const char use_err[] =
"Parameter --%s cannot be used when --pkcs12 is also specified.";
2940 msg(
M_USAGE,
"--key and --management-external-key are mutually exclusive");
2946 msg(
M_USAGE,
"--cert and --management-external-cert are mutually exclusive");
2950 msg(
M_USAGE,
"--management-external-cert must be used with --management-external-key");
2964 msg(
M_USAGE,
"No client-side authentication method is "
2965 "specified. You must use either "
2966 "--cert/--key, --pkcs12, or "
2967 "--auth-user-pass");
2972 msg(
M_USAGE,
"If you use one of --cert or --key, you must use them both");
2989 msg(
M_USAGE,
"--tls-auth and --tls-crypt are mutually exclusive");
2994 msg(
M_USAGE,
"--tls-crypt-v2, --tls-auth and --tls-crypt are mutually exclusive in client mode");
3004 const char use_err[] =
"Parameter %s can only be specified in TLS-mode, "
3005 "i.e. where --tls-server or --tls-client is also specified.";
3012 #ifndef ENABLE_CRYPTO_MBEDTLS
3037 #ifdef ENABLE_PKCS11
3039 MUST_BE_UNDEF(pkcs11_private_mode[0],
"pkcs11-private-mode");
3051 msg(
M_USAGE,
"--auth-user-pass requires --pull");
3057 #undef MUST_BE_UNDEF
3058 #undef MUST_BE_FALSE
3120 if (ce->
af == AF_INET6)
3122 msg(
M_INFO,
"WARNING: '--proto udp6' is not compatible with "
3123 "'--socks-proxy' today. Forcing IPv4 mode." );
3127 msg(
M_INFO,
"NOTICE: dual-stack mode for '--proto udp' does not "
3128 "work correctly with '--socks-proxy' today. Forcing IPv4." );
3155 #ifdef ENABLE_FRAGMENT
3215 msg(
M_WARN,
"NOTICE: --explicit-exit-notify ignored for --proto tcp");
3246 msg(
M_INFO,
"Flag 'def1' added to --redirect-gateway (iservice is in use)");
3420 #ifdef DEFAULT_PKCS11_MODULE
3424 if (!
options->pkcs11_providers[0]
3427 options->pkcs11_providers[0] = DEFAULT_PKCS11_MODULE;
3452 msg(
M_WARN,
"Note: --client-to-client has no effect when using data "
3453 "channel offload: packets are always sent to the VPN "
3454 "interface and then routed based on the system routing table");
3484 msg(
M_INFO,
"Note: --cipher is not set. OpenVPN versions before 2.5 "
3485 "defaulted to BF-CBC as fallback when cipher negotiation "
3486 "failed in this case. If you need this fallback please add "
3487 "'--data-ciphers-fallback BF-CBC' to your configuration "
3488 "and/or add BF-CBC to --data-ciphers. E.g. "
3494 msg(
M_WARN,
"DEPRECATED OPTION: --cipher set to '%s' but missing in "
3495 "--data-ciphers (%s). OpenVPN ignores --cipher for cipher "
3531 if (tls_ver_min == 0)
3540 else if (tls_ver_max == 0 || tls_ver_max >=
TLS_VER_1_2)
3601 "supported by the TLS library. Your system does not support this "
3602 "calculation anymore or your security policy (e.g. FIPS 140-2) "
3603 "forbids it. Connections will only work with peers running "
3604 "OpenVPN 2.6.0 or higher)");
3605 #ifndef HAVE_EXPORT_KEYING_MATERIAL
3606 msg(
M_FATAL,
"Keying Material Exporters (RFC 5705) not available either. "
3607 "No way to generate data channel keys left.");
3611 msg(
M_WARN,
"Automatically enabling option "
3612 "--force-tls-key-material-export");
3641 msg(
M_USAGE,
"--data-ciphers list contains unsupported ciphers or is too long.");
3650 for (i = 0; i < rl->
len; ++i)
3724 msg(
M_WARN,
"WARNING: Ignoring option 'dh' in tls-client mode, please only "
3725 "include this in your server configuration");
3728 #if ENABLE_MANAGEMENT
3737 msg(
M_INFO,
"Using certificate fingerprint to verify peer (no CA "
3744 msg(
M_USAGE,
"Options 'config stdin' and 'remap-usr1 SIGHUP' are "
3745 "incompatible with each other.");
3770 msg(
M_WARN,
"Option --windows-driver ovpn-dco is ignored because Data Channel Offload is disabled");
3781 msg(
M_WARN,
"Note: ignoring --dev-node as it has no effect when using "
3782 "data channel offload");
3803 #if defined(_WIN32) || defined(TARGET_ANDROID)
3806 foreign_options_copy_dns(o,
es);
3820 #ifndef ENABLE_SMALL
3822 #define CHKACC_FILE (1<<0)
3823 #define CHKACC_DIRPATH (1<<1)
3824 #define CHKACC_FILEXSTWR (1<<2)
3825 #define CHKACC_ACPTSTDIN (1<<3)
3826 #define CHKACC_PRIVATE (1<<4)
3827 #define CHKACC_ACCEPT_URI (1<<5)
3853 if (!strncmp(file,
"file:", 5))
3857 else if (!strchr(file,
'/') || strchr(file,
'/') > strchr(file,
':'))
3867 char *dirpath =
dirname(fullpath);
3902 if (st.st_mode & (S_IRWXG|S_IRWXO))
3904 msg(
M_WARN,
"WARNING: file '%s' is group or others accessible", file);
3917 return (errcode != 0 ?
true :
false);
3939 struct buffer chroot_file;
3959 const int type,
const char *file,
3960 const int mode,
const char *opt)
3976 const int mode,
const char *opt)
4083 "--crl-verify directory");
4090 R_OK,
"--crl-verify");
4097 W_OK,
"--tls-export-cert");
4130 #ifdef ENABLE_MANAGEMENT
4133 "--management user/password file");
4138 "--auth-user-pass");
4141 R_OK|X_OK,
"--chroot directory");
4143 R_OK|W_OK,
"--writepid");
4147 R_OK|W_OK,
"--status");
4151 R_OK|X_OK,
"--client-config-dir");
4153 R_OK|W_OK|X_OK,
"Temporary directory (--tmp-dir)");
4157 msg(
M_USAGE,
"Please correct these errors.");
4172 #ifndef ENABLE_SMALL
4189 #if defined(_WIN32) || defined(TARGET_ANDROID)
4192 foreign_options_copy_dns(o,
es);
4248 bool tt_local =
false;
4310 if (tt && p2p_nopull)
4313 if (ios && strlen(ios))
4331 #ifdef ENABLE_FRAGMENT
4338 #define TLS_CLIENT (o->tls_client)
4339 #define TLS_SERVER (o->tls_server)
4396 #ifdef ENABLE_PREDICTION_RESISTANCE
4397 if (o->use_prediction_resistance)
4399 buf_printf(&out,
",use-prediction-resistance");
4488 const bool report_inconsistent,
4490 const struct buffer *b2_src,
4491 const char *b1_name,
4492 const char *b2_name)
4501 ||
streq(p1,
"tls-auth")
4511 struct buffer b2 = *b2_src;
4521 if (!strcmp(p1, p2))
4525 if (!strcmp(p1_prefix, p2_prefix))
4527 if (report_inconsistent)
4529 msg(msglevel,
"WARNING: '%s' is used inconsistently, %s='%s', %s='%s'",
4541 msg(msglevel,
"WARNING: '%s' is present in %s config but missing in %s config, %s='%s'",
4556 const bool report_inconsistent,
4557 const struct buffer *b1_src,
4558 const struct buffer *b2_src,
4559 const char *b1_name,
4560 const char *b2_name)
4563 struct buffer b = *b1_src;
4583 actual[actual_n - 1] = 0;
4608 actual[actual_n - 1] = 0;
4609 if (strncmp(actual, expected, 2))
4611 msg(
D_SHOW_OCC,
"NOTE: Options consistency check may be skewed by version differences");
4616 ret = !strcmp(actual, expected);
4642 const size_t opt_name_len = strlen(opt_name);
4647 if (0 == strncmp(p, opt_name, opt_name_len)
4648 && strlen(p) > (opt_name_len+1) && p[opt_name_len] ==
' ')
4651 const char *start = &p[opt_name_len+1];
4652 const char *end = strchr(p,
',');
4653 size_t val_len = end ? end - start : strlen(start);
4655 memcpy(ret, start, val_len);
4678 if (
streq(str,
"tap-windows6"))
4682 else if (
streq(str,
"wintun"))
4687 else if (
streq(str,
"ovpn-dco"))
4693 msg(msglevel,
"--windows-driver must be tap-windows6, wintun "
4707 if (
streq(str,
"net30"))
4711 else if (
streq(str,
"p2p"))
4715 else if (
streq(str,
"subnet"))
4721 msg(msglevel,
"--topology must be net30, p2p, or subnet");
4763 if (
streq(option,
"interact"))
4767 else if (
streq(option,
"nointeract"))
4771 else if (
streq(option,
"none"))
4777 msg(msglevel,
"--auth-retry method must be 'interact', 'nointeract', or 'none'");
4792 return "nointeract";
4812 fprintf(fp,
"Usage message not available\n");
4868 #define LZO_LIB_VER_STR ", LZO ", lzo_version_string()
4870 #define LZO_LIB_VER_STR "", ""
4876 #undef LZO_LIB_VER_STR
4890 #ifndef ENABLE_SMALL
4891 #ifdef CONFIGURE_DEFINES
4894 #ifdef CONFIGURE_SPECIAL_BUILD
4906 msg(
M_USAGE,
"You must define %s", description);
4915 return !strcmp(s1, s2);
4925 ping_rec_err(
int msglevel)
4927 msg(msglevel,
"only one of --ping-exit or --ping-restart options may be specified");
4935 unsigned int val = 0;
4936 sscanf(str,
"%u", &val);
4944 return c ==
'\0' || isspace(c);
4956 const int STATE_INITIAL = 0;
4957 const int STATE_READING_QUOTED_PARM = 1;
4958 const int STATE_READING_UNQUOTED_PARM = 2;
4959 const int STATE_DONE = 3;
4960 const int STATE_READING_SQUOTED_PARM = 4;
4962 const char *error_prefix =
"";
4965 const char *c = line;
4966 int state = STATE_INITIAL;
4967 bool backslash =
false;
4971 unsigned int parm_len = 0;
4977 error_prefix =
"ERROR: ";
4985 if (!backslash && in ==
'\\' && state != STATE_READING_SQUOTED_PARM)
4991 if (state == STATE_INITIAL)
4995 if (in ==
';' || in ==
'#')
4999 if (!backslash && in ==
'\"')
5001 state = STATE_READING_QUOTED_PARM;
5003 else if (!backslash && in ==
'\'')
5005 state = STATE_READING_SQUOTED_PARM;
5010 state = STATE_READING_UNQUOTED_PARM;
5014 else if (state == STATE_READING_UNQUOTED_PARM)
5016 if (!backslash &&
space(in))
5025 else if (state == STATE_READING_QUOTED_PARM)
5027 if (!backslash && in ==
'\"')
5036 else if (state == STATE_READING_SQUOTED_PARM)
5047 if (state == STATE_DONE)
5051 memcpy(p[ret], parm, parm_len);
5052 p[ret][parm_len] =
'\0';
5053 state = STATE_INITIAL;
5058 if (backslash && out)
5060 if (!(out ==
'\\' || out ==
'\"' ||
space(out)))
5063 msg(msglevel,
"%sOptions warning: Bad backslash ('\\') usage in %s:%d", error_prefix, file, line_num);
5065 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);
5076 if (parm_len >=
SIZE(parm))
5078 parm[
SIZE(parm) - 1] = 0;
5079 msg(msglevel,
"%sOptions error: Parameter at %s:%d is too long (%d chars max): %s",
5080 error_prefix, file, line_num, (
int)
SIZE(parm), parm);
5083 parm[parm_len++] = out;
5092 }
while (*c++ !=
'\0');
5094 if (state == STATE_READING_QUOTED_PARM)
5096 msg(msglevel,
"%sOptions error: No closing quotation (\") in %s:%d", error_prefix, file, line_num);
5099 if (state == STATE_READING_SQUOTED_PARM)
5101 msg(msglevel,
"%sOptions error: No closing single quotation (\') in %s:%d", error_prefix, file, line_num);
5104 if (state != STATE_INITIAL)
5106 msg(msglevel,
"%sOptions error: Residual parse state (%d) in %s:%d", error_prefix, state, file, line_num);
5112 for (i = 0; i < ret; ++i)
5124 if (strlen(*p) >= 3 && !strncmp(*p,
"--", 2))
5131 #define IS_TYPE_FP 1
5132 #define IS_TYPE_BUF 2
5150 if ((
int) strlen(line) + 1 < size)
5170 bool endtagfound =
false;
5175 char *line_ptr = line;
5177 while (isspace(*line_ptr))
5181 if (!strncmp(line_ptr, close_tag, strlen(close_tag)))
5186 if (!
buf_safe(&buf, strlen(line)+1))
5199 msg(
M_FATAL,
"ERROR: Endtag %s missing", close_tag);
5211 int num_inline_lines = 0;
5216 if (arg[0] ==
'<' && arg[strlen(arg)-1] ==
'>')
5220 arg[strlen(arg) - 1] =
'\0';
5222 close_tag =
alloc_buf(strlen(p[0]) + 4);
5229 return num_inline_lines;
5259 const unsigned int permission_mask,
5260 unsigned int *option_types_found,
5267 const char *top_file,
5270 const unsigned int permission_mask,
5271 unsigned int *option_types_found,
5274 const int max_recursive_levels = 10;
5281 if (level <= max_recursive_levels)
5283 if (
streq(file,
"stdin"))
5294 while (fgets(line,
sizeof(line),
fp))
5301 msg(msglevel,
"In %s:%d: Maximum option line length (%d) exceeded, line starts with %s",
5306 if (line_num == 1 && strncmp(line,
"\xEF\xBB\xBF", 3) == 0)
5315 msglevel, permission_mask, option_types_found,
5317 line_num += lines_inline;
5327 msg(msglevel,
"In %s:%d: Error opening configuration file: %s", top_file, top_line, file);
5332 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);
5343 const unsigned int permission_mask,
5344 unsigned int *option_types_found,
5351 buf_set_read(&multiline, (uint8_t *)config, strlen(config));
5353 while (
buf_parse(&multiline,
'\n', line,
sizeof(line)))
5363 permission_mask, option_types_found,
es);
5364 line_num += lines_inline;
5376 const unsigned int permission_mask,
5377 unsigned int *option_types_found,
5387 if (argc == 2 && strncmp(
argv[1],
"--", 2))
5394 option_types_found,
es);
5399 for (
int i = 1; i < argc; ++i)
5404 if (strncmp(p[0],
"--", 2))
5406 msg(msglevel,
"I'm trying to parse \"%s\" as an --option parameter but I don't see a leading '--'", p[0]);
5418 char *arg =
argv[i + j];
5419 if (strncmp(arg,
"--", 2))
5430 option_types_found,
es);
5455 while (isspace(*line))
5464 msg(
D_LOW,
"Pushed option accepted by filter: '%s'", line);
5469 msg(
D_PUSH,
"Pushed option removed by filter: '%s'", line);
5475 msg(
M_WARN,
"Pushed option rejected by filter: '%s'. Restarting.", line);
5487 unsigned int permission_mask,
5488 unsigned int *option_types_found,
5493 const char *file =
"[PUSH-OPTIONS]";
5496 while (
buf_parse(buf,
',', line,
sizeof(line)))
5508 permission_mask, option_types_found,
es);
5516 const char *filename,
5518 unsigned int permission_mask,
5519 unsigned int *option_types_found,
5522 msg(
D_PUSH,
"OPTIONS IMPORT: reading client specific options from: %s", filename);
5538 const unsigned int permission_mask,
5539 unsigned int *option_types_found,
5545 #define VERIFY_PERMISSION(mask) { \
5546 if (!verify_permission(p[0], file, line, (mask), permission_mask, \
5547 option_types_found, msglevel, options, is_inline)) \
5557 const unsigned int type,
5558 const unsigned int allowed,
5559 unsigned int *found,
5564 if (!(
type & allowed))
5566 msg(msglevel,
"option '%s' cannot be used in this context (%s)", name, file);
5572 msg(msglevel,
"option '%s' is not expected to be inline (%s:%d)", name,
5582 #ifndef ENABLE_SMALL
5595 msg(
M_WARN,
"Option '%s' in %s:%d is ignored by previous <connection> blocks ", name, file, line);
5599 msg(
M_WARN,
"Option '%s' is ignored by previous <connection> blocks", name);
5611 #define NM_QUOTE_HINT (1<<0)
5617 const unsigned int flags)
5628 msg(msglevel,
"the --%s directive should have at most %d parameter%s.%s",
5631 max >= 3 ?
"s" :
"",
5632 (flags &
NM_QUOTE_HINT) ?
" To pass a list of arguments as one of the parameters, try enclosing them in double quotes (\"\")." :
"");
5649 const char **script,
5650 const char *new_script,
5656 msg(
M_WARN,
"Multiple --%s scripts defined. "
5657 "The previously configured script is overridden.",
type);
5659 *script = new_script;
5662 #ifndef ENABLE_SMALL
5664 char script_name[100];
5665 snprintf(script_name,
sizeof(script_name),
5666 "--%s script",
type);
5682 msg(
M_WARN,
"WARNING: Compression for receiving enabled. "
5683 "Compression has been used in the past to break encryption. "
5684 "Compression support is deprecated and we recommend to disable "
5694 #ifdef ENABLE_PKCS11
5695 ret = ret || (
options->pkcs11_providers[0] != NULL);
5697 #ifdef ENABLE_CRYPTOAPI
5712 const unsigned int permission_mask,
5713 unsigned int *option_types_found,
5730 p[2] =
"setenv opt";
5738 file =
"[CMD-LINE]";
5741 if (
streq(p[0],
"help"))
5747 msg(msglevel,
"--help does not accept any parameters");
5751 if (
streq(p[0],
"version") && !p[1])
5756 else if (
streq(p[0],
"config") && p[1] && !p[2])
5768 #if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL)
5769 else if (
streq(p[0],
"show-gateway") && !p[2])
5773 in_addr_t remote_ipv4 = 0;
5774 struct in6_addr remote_ipv6 = IN6ADDR_ANY_INIT;
5793 else if (
streq(p[0],
"echo") ||
streq(p[0],
"parameter"))
5817 if (p[1] && strncmp(p[1],
"msg", 3) == 0)
5820 pull_mode ?
"ECHO-PULL" :
"ECHO",
5823 #ifdef ENABLE_MANAGEMENT
5832 msg(
M_WARN,
"echo/parameter option overflow");
5835 #ifdef ENABLE_MANAGEMENT
5836 else if (
streq(p[0],
"management") && p[1] && p[2] && !p[4])
5839 if (
streq(p[2],
"unix"))
5841 #if UNIX_SOCK_SUPPORT
5844 msg(msglevel,
"MANAGEMENT: this platform does not support unix domain sockets");
5856 else if (
streq(p[0],
"management-client-user") && p[1] && !p[2])
5861 else if (
streq(p[0],
"management-client-group") && p[1] && !p[2])
5866 else if (
streq(p[0],
"management-query-passwords") && !p[1])
5871 else if (
streq(p[0],
"management-query-remote") && !p[1])
5876 else if (
streq(p[0],
"management-query-proxy") && !p[1])
5881 else if (
streq(p[0],
"management-hold") && !p[1])
5886 else if (
streq(p[0],
"management-signal") && !p[1])
5891 else if (
streq(p[0],
"management-forget-disconnect") && !p[1])
5896 else if (
streq(p[0],
"management-up-down") && !p[1])
5901 else if (
streq(p[0],
"management-client") && !p[1])
5906 else if (
streq(p[0],
"management-external-key"))
5909 for (
int j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
5911 if (
streq(p[j],
"nopadding"))
5915 else if (
streq(p[j],
"pkcs1"))
5919 else if (
streq(p[j],
"pss"))
5923 else if (
streq(p[j],
"digest"))
5929 msg(msglevel,
"Unknown management-external-key flag: %s", p[j]);
5943 else if (
streq(p[0],
"management-external-cert") && p[1] && !p[2])
5949 else if (
streq(p[0],
"management-client-auth") && !p[1])
5954 else if (
streq(p[0],
"management-log-cache") && p[1] && !p[2])
5962 msg(msglevel,
"--management-log-cache parameter is out of range");
5968 #ifdef ENABLE_PLUGIN
5969 else if (
streq(p[0],
"plugin") && p[1])
5978 msg(msglevel,
"plugin add failed: %s", p[1]);
5983 else if (
streq(p[0],
"mode") && p[1] && !p[2])
5986 if (
streq(p[1],
"p2p"))
5990 else if (
streq(p[1],
"server"))
5996 msg(msglevel,
"Bad --mode parameter: %s", p[1]);
6000 else if (
streq(p[0],
"dev") && p[1] && !p[2])
6005 else if (
streq(p[0],
"dev-type") && p[1] && !p[2])
6011 else if (
streq(p[0],
"windows-driver") && p[1] && !p[2])
6017 else if (
streq(p[0],
"disable-dco"))
6021 else if (
streq(p[0],
"dev-node") && p[1] && !p[2])
6026 else if (
streq(p[0],
"lladdr") && p[1] && !p[2])
6035 msg(msglevel,
"lladdr parm '%s' must be a MAC address", p[1]);
6039 else if (
streq(p[0],
"topology") && p[1] && !p[2])
6044 else if (
streq(p[0],
"tun-ipv6") && !p[1])
6048 msg(
M_WARN,
"Note: option tun-ipv6 is ignored because modern operating systems do not need special IPv6 tun handling anymore.");
6051 #ifdef ENABLE_IPROUTE
6052 else if (
streq(p[0],
"iproute") && p[1] && !p[2])
6055 iproute_path = p[1];
6058 else if (
streq(p[0],
"ifconfig") && p[1] && p[2] && !p[3])
6068 msg(msglevel,
"ifconfig parms '%s' and '%s' must be valid addresses", p[1], p[2]);
6072 else if (
streq(p[0],
"ifconfig-ipv6") && p[1] && p[2] && !p[3])
6074 unsigned int netbits;
6080 if (netbits < 64 || netbits > 124)
6082 msg( msglevel,
"ifconfig-ipv6: /netbits must be between 64 and 124, not '/%d'", netbits );
6092 msg(msglevel,
"ifconfig-ipv6 parms '%s' and '%s' must be valid addresses", p[1], p[2]);
6096 else if (
streq(p[0],
"ifconfig-noexec") && !p[1])
6101 else if (
streq(p[0],
"ifconfig-nowarn") && !p[1])
6106 else if (
streq(p[0],
"local") && p[1] && !p[4])
6118 if (strcmp(p[1],
"*") != 0)
6133 else if (
streq(p[0],
"remote-random") && !p[1])
6138 else if (
streq(p[0],
"connection") && p[1] && !p[3])
6152 msg(msglevel,
"Each 'connection' block must contain exactly one 'remote' directive");
6168 else if (
streq(p[0],
"ignore-unknown-option") && p[1])
6173 const char **ignore;
6177 for (i = 1; p[i]; i++)
6199 for (j = 1; p[j]; j++)
6202 if (p[j][0]==
'-' && p[j][1]==
'-')
6215 #if ENABLE_MANAGEMENT
6216 else if (
streq(p[0],
"http-proxy-override") && p[1] && p[2] && !p[4])
6226 else if (
streq(p[0],
"remote") && p[1] && !p[4])
6245 "remote: bad protocol associated with host %s: '%s'",
6267 else if (
streq(p[0],
"resolv-retry") && p[1] && !p[2])
6270 if (
streq(p[1],
"infinite"))
6279 else if ((
streq(p[0],
"preresolve") ||
streq(p[0],
"ip-remote-hint")) && !p[2])
6290 else if (
streq(p[0],
"connect-retry") && p[1] && !p[3])
6301 msg(
M_WARN,
"connect retry wait interval truncated to %d",
6311 else if ((
streq(p[0],
"connect-timeout") ||
streq(p[0],
"server-poll-timeout"))
6317 else if (
streq(p[0],
"connect-retry-max") && p[1] && !p[2])
6322 else if (
streq(p[0],
"ipchange") && p[1])
6334 else if (
streq(p[0],
"float") && !p[1])
6340 else if (
streq(p[0],
"gremlin") && p[1] && !p[2])
6346 else if (
streq(p[0],
"chroot") && p[1] && !p[2])
6351 else if (
streq(p[0],
"cd") && p[1] && !p[2])
6356 msg(
M_ERR,
"cd to '%s' failed", p[1]);
6361 #ifdef ENABLE_SELINUX
6362 else if (
streq(p[0],
"setcon") && p[1] && !p[2])
6365 options->selinux_context = p[1];
6368 else if (
streq(p[0],
"writepid") && p[1] && !p[2])
6373 else if (
streq(p[0],
"up") && p[1])
6382 else if (
streq(p[0],
"down") && p[1])
6391 else if (
streq(p[0],
"down-pre") && !p[1])
6396 else if (
streq(p[0],
"up-delay") && !p[1])
6401 else if (
streq(p[0],
"up-restart") && !p[1])
6406 else if (
streq(p[0],
"syslog") && !p[2])
6411 else if (
streq(p[0],
"daemon") && !p[2])
6424 msg(
M_WARN,
"WARNING: Multiple --daemon directives specified, ignoring --daemon %s. (Note that initscripts sometimes add their own --daemon directive.)", p[1]);
6429 else if (
streq(p[0],
"log") && p[1] && !p[2])
6435 else if (
streq(p[0],
"suppress-timestamps") && !p[1])
6441 else if (
streq(p[0],
"machine-readable-output") && !p[1])
6447 else if (
streq(p[0],
"log-append") && p[1] && !p[2])
6453 #ifdef ENABLE_MEMSTATS
6454 else if (
streq(p[0],
"memstats") && p[1] && !p[2])
6460 else if (
streq(p[0],
"mlock") && !p[1])
6465 #if ENABLE_IP_PKTINFO
6466 else if (
streq(p[0],
"multihome") && !p[1])
6472 else if (
streq(p[0],
"verb") && p[1] && !p[2])
6482 #if !defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL)
6486 msg(
M_WARN,
"NOTE: debug verbosity (--verb %d) is enabled but this build lacks debug support.",
6491 else if (
streq(p[0],
"mute") && p[1] && !p[2])
6496 else if (
streq(p[0],
"errors-to-stderr") && !p[1])
6501 else if (
streq(p[0],
"status") && p[1] && !p[3])
6510 else if (
streq(p[0],
"status-version") && p[1] && !p[2])
6516 if (version < 1 || version > 3)
6518 msg(msglevel,
"--status-version must be 1 to 3");
6523 else if (
streq(p[0],
"remap-usr1") && p[1] && !p[2])
6526 if (
streq(p[1],
"SIGHUP"))
6530 else if (
streq(p[1],
"SIGTERM"))
6536 msg(msglevel,
"--remap-usr1 parm must be 'SIGHUP' or 'SIGTERM'");
6540 else if ((
streq(p[0],
"link-mtu") ||
streq(p[0],
"udp-mtu")) && p[1] && !p[2])
6546 else if (
streq(p[0],
"tun-mtu") && p[1] && !p[3])
6560 else if (
streq(p[0],
"tun-mtu-max") && p[1] && !p[3])
6564 if (max_mtu < 68 || max_mtu > 65536)
6566 msg(msglevel,
"--tun-mtu-max value '%s' is invalid", p[1]);
6573 else if (
streq(p[0],
"tun-mtu-extra") && p[1] && !p[2])
6579 else if (
streq(p[0],
"max-packet-size") && p[1] && !p[2])
6587 msg(
M_WARN,
"Note: max-packet-size value outside of allowed "
6588 "control channel packet size (%d to %d), will use %d "
6598 #ifdef ENABLE_FRAGMENT
6599 else if (
streq(p[0],
"mtu-dynamic"))
6602 msg(msglevel,
"--mtu-dynamic has been replaced by --fragment");
6605 else if (
streq(p[0],
"fragment") && p[1] && !p[3])
6612 msg(msglevel,
"--fragment needs to be at least 68");
6616 if (p[2] &&
streq(p[2],
"mtu"))
6622 msg(msglevel,
"Unknown parameter to --fragment: %s", p[2]);
6626 else if (
streq(p[0],
"mtu-disc") && p[1] && !p[2])
6631 else if (
streq(p[0],
"mtu-test") && !p[1])
6636 else if (
streq(p[0],
"nice") && p[1] && !p[2])
6641 else if (
streq(p[0],
"rcvbuf") && p[1] && !p[2])
6646 else if (
streq(p[0],
"sndbuf") && p[1] && !p[2])
6651 else if (
streq(p[0],
"mark") && p[1] && !p[2])
6653 #if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK
6658 else if (
streq(p[0],
"socket-flags"))
6664 if (
streq(p[j],
"TCP_NODELAY"))
6670 msg(msglevel,
"unknown socket flag: %s", p[j]);
6675 else if (
streq(p[0],
"bind-dev") && p[1])
6681 else if (
streq(p[0],
"txqueuelen") && p[1] && !p[2])
6687 msg(msglevel,
"--txqueuelen not supported on this OS");
6691 else if (
streq(p[0],
"shaper") && p[1] && !p[2])
6699 msg(msglevel,
"Bad shaper value, must be between %d and %d",
6705 else if (
streq(p[0],
"port") && p[1] && !p[2])
6710 else if (
streq(p[0],
"lport") && p[1] && !p[2])
6715 if (!
streq(p[1],
"0"))
6721 else if (
streq(p[0],
"rport") && p[1] && !p[2])
6726 else if (
streq(p[0],
"bind") && !p[2])
6730 if (p[1] &&
streq(p[1],
"ipv6only"))
6736 else if (
streq(p[0],
"nobind") && !p[1])
6741 else if (
streq(p[0],
"fast-io") && !p[1])
6746 else if (
streq(p[0],
"inactive") && p[1] && !p[3])
6752 int64_t val = atoll(p[2]);
6756 msg(
M_WARN,
"WARNING: '--inactive' with a 'bytes' value"
6757 " >2 Gbyte was silently ignored in older versions. If "
6758 " your VPN exits unexpectedly with 'Inactivity timeout'"
6759 " in %d seconds, revisit this value.",
6764 else if (
streq(p[0],
"session-timeout") && p[1] && !p[2])
6769 else if (
streq(p[0],
"proto") && p[1] && !p[2])
6779 "Bad protocol: '%s'. Allowed protocols with --proto option: %s",
6787 else if (
streq(p[0],
"proto-force") && p[1] && !p[2])
6792 if (proto_force < 0)
6794 msg(msglevel,
"Bad --proto-force protocol: '%s'", p[1]);
6799 else if (
streq(p[0],
"http-proxy") && p[1] && !p[5])
6808 msg(msglevel,
"http-proxy port number not defined");
6822 if (
streq(p[3],
"auto"))
6826 else if (
streq(p[3],
"auto-nct"))
6846 else if (
streq(p[0],
"http-proxy-user-pass") && p[1])
6854 else if (
streq(p[0],
"http-proxy-retry") ||
streq(p[0],
"socks-proxy-retry"))
6857 msg(
M_WARN,
"DEPRECATED OPTION: http-proxy-retry and socks-proxy-retry: "
6858 "In OpenVPN 2.4 proxy connection retries are handled like regular connections. "
6859 "Use connect-retry-max 1 to get a similar behavior as before.");
6861 else if (
streq(p[0],
"http-proxy-timeout") && p[1] && !p[2])
6864 msg(
M_WARN,
"DEPRECATED OPTION: http-proxy-timeout: In OpenVPN 2.4 the timeout until a connection to a "
6865 "server is established is managed with a single timeout set by connect-timeout");
6867 else if (
streq(p[0],
"http-proxy-option") && p[1] && !p[4])
6874 if (
streq(p[1],
"VERSION") && p[2] && !p[3])
6878 else if (
streq(p[1],
"AGENT") && p[2] && !p[3])
6882 else if ((
streq(p[1],
"EXT1") ||
streq(p[1],
"EXT2") ||
streq(p[1],
"CUSTOM-HEADER"))
6907 custom_header->
name = p[2];
6908 custom_header->
content = p[3];
6913 msg(msglevel,
"Bad http-proxy-option or missing or extra parameter: '%s'", p[1]);
6916 else if (
streq(p[0],
"socks-proxy") && p[1] && !p[4])
6931 else if (
streq(p[0],
"keepalive") && p[1] && p[2] && !p[3])
6937 else if (
streq(p[0],
"ping") && p[1] && !p[2])
6942 else if (
streq(p[0],
"ping-exit") && p[1] && !p[2])
6948 else if (
streq(p[0],
"ping-restart") && p[1] && !p[2])
6954 else if (
streq(p[0],
"ping-timer-rem") && !p[1])
6959 else if (
streq(p[0],
"explicit-exit-notify") && !p[2])
6971 else if (
streq(p[0],
"persist-tun") && !p[1])
6976 else if (
streq(p[0],
"persist-key") && !p[1])
6979 msg(
M_WARN,
"DEPRECATED: --persist-key option ignored. "
6980 "Keys are now always persisted across restarts. ");
6982 else if (
streq(p[0],
"persist-local-ip") && !p[1])
6987 else if (
streq(p[0],
"persist-remote-ip") && !p[1])
6992 else if (
streq(p[0],
"client-nat") && p[1] && p[2] && p[3] && p[4] && !p[5])
6998 else if (
streq(p[0],
"route") && p[1] && !p[5])
7006 msg(msglevel,
"route parameter network/IP '%s' must be a valid address", p[1]);
7011 msg(msglevel,
"route parameter netmask '%s' must be an IP address", p[2]);
7016 msg(msglevel,
"route parameter gateway '%s' must be a valid address", p[3]);
7022 else if (
streq(p[0],
"route-ipv6") && p[1] && !p[4])
7030 msg(msglevel,
"route-ipv6 parameter network/IP '%s' must be a valid address", p[1]);
7035 msg(msglevel,
"route-ipv6 parameter gateway '%s' must be a valid address", p[2]);
7042 else if (
streq(p[0],
"max-routes") && !p[2])
7044 msg(
M_WARN,
"DEPRECATED OPTION: --max-routes option ignored. "
7045 "The number of routes is unlimited as of OpenVPN 2.4. "
7046 "This option will be removed in a future version, "
7047 "please remove it from your configuration.");
7049 else if (
streq(p[0],
"route-gateway") && p[1] && !p[2])
7052 if (
streq(p[1],
"dhcp"))
7064 msg(msglevel,
"route-gateway parm '%s' must be a valid address", p[1]);
7069 else if (
streq(p[0],
"route-ipv6-gateway") && p[1] && !p[2])
7077 msg(msglevel,
"route-ipv6-gateway parm '%s' must be a valid address", p[1]);
7081 else if (
streq(p[0],
"route-metric") && p[1] && !p[2])
7086 else if (
streq(p[0],
"route-delay") && !p[3])
7103 else if (
streq(p[0],
"route-up") && p[1])
7112 else if (
streq(p[0],
"route-pre-down") && p[1])
7122 "route-pre-down",
true);
7124 else if (
streq(p[0],
"route-noexec") && !p[1])
7129 else if (
streq(p[0],
"route-nopull") && !p[1])
7134 else if (
streq(p[0],
"pull-filter") && p[1] && p[2] && !p[3])
7140 if (strcmp(
"accept", p[1]) == 0)
7144 else if (strcmp(
"ignore", p[1]) == 0)
7148 else if (strcmp(
"reject", p[1]) == 0)
7154 msg(msglevel,
"Unknown --pull-filter type: %s", p[1]);
7158 f->size = strlen(p[2]);
7160 else if (
streq(p[0],
"allow-pull-fqdn") && !p[1])
7165 else if (
streq(p[0],
"redirect-gateway") ||
streq(p[0],
"redirect-private"))
7174 "WARNING: You have specified redirect-gateway and "
7175 "redirect-private at the same time (or the same option "
7176 "multiple times). This is not well supported and may lead to "
7177 "unexpected results");
7182 if (
streq(p[0],
"redirect-gateway"))
7186 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
7188 if (
streq(p[j],
"local"))
7192 else if (
streq(p[j],
"autolocal"))
7196 else if (
streq(p[j],
"def1"))
7200 else if (
streq(p[j],
"bypass-dhcp"))
7204 else if (
streq(p[j],
"bypass-dns"))
7208 else if (
streq(p[j],
"block-local"))
7212 else if (
streq(p[j],
"ipv6"))
7217 else if (
streq(p[j],
"!ipv4"))
7223 msg(msglevel,
"unknown --%s flag: %s", p[0], p[j]);
7232 else if (
streq(p[0],
"block-ipv6") && !p[1])
7237 else if (
streq(p[0],
"remote-random-hostname") && !p[1])
7242 else if (
streq(p[0],
"setenv") && p[1] && !p[3])
7245 if (
streq(p[1],
"REMOTE_RANDOM_HOSTNAME") && !p[2])
7249 else if (
streq(p[1],
"GENERIC_CONFIG"))
7251 msg(msglevel,
"this is a generic configuration and cannot directly be used");
7254 else if (
streq(p[1],
"PUSH_PEER_INFO") && !p[2])
7258 else if (
streq(p[1],
"SERVER_POLL_TIMEOUT") && p[2])
7264 if (
streq(p[1],
"FORWARD_COMPATIBLE") && p[2] &&
streq(p[2],
"1"))
7272 else if (
streq(p[0],
"compat-mode") && p[1] && !p[3])
7274 unsigned int major, minor, patch;
7275 if (!(sscanf(p[1],
"%u.%u.%u", &major, &minor, &patch) == 3))
7277 msg(msglevel,
"cannot parse version number for --compat-mode: %s",
7284 else if (
streq(p[0],
"setenv-safe") && p[1] && !p[3])
7289 else if (
streq(p[0],
"script-security") && p[1] && !p[2])
7294 else if (
streq(p[0],
"mssfix") && !p[3])
7303 && (mssfix < TLS_CHANNEL_MTU_MIN || mssfix > UINT16_MAX))
7305 msg(msglevel,
"--mssfix value '%s' is invalid", p[1]);
7323 if (p[2] &&
streq(p[2],
"mtu"))
7327 else if (p[2] &&
streq(p[2],
"fixed"))
7333 msg(msglevel,
"Unknown parameter to --mssfix: %s", p[2]);
7336 else if (
streq(p[0],
"disable-occ") && !p[1])
7341 else if (
streq(p[0],
"server") && p[1] && p[2] && !p[4])
7345 in_addr_t network, netmask;
7350 if (error || !network || !netmask)
7352 msg(msglevel,
"error parsing --server parameters");
7361 if (
streq(p[3],
"nopool"))
7367 msg(msglevel,
"error parsing --server: %s is not a recognized flag", p[3]);
7372 else if (
streq(p[0],
"server-ipv6") && p[1] && !p[2])
7375 struct in6_addr network;
7376 unsigned int netbits = 0;
7381 msg(msglevel,
"error parsing --server-ipv6 parameter");
7384 if (netbits < 64 || netbits > 124)
7387 "--server-ipv6 settings: network must be between /64 and /124 (not /%d)",
7396 else if (
streq(p[0],
"server-bridge") && p[1] && p[2] && p[3] && p[4] && !p[5])
7400 in_addr_t ip, netmask, pool_start, pool_end;
7407 if (error || !ip || !netmask || !pool_start || !pool_end)
7409 msg(msglevel,
"error parsing --server-bridge parameters");
7418 else if (
streq(p[0],
"server-bridge") && p[1] &&
streq(p[1],
"nogw") && !p[2])
7424 else if (
streq(p[0],
"server-bridge") && !p[1])
7429 else if (
streq(p[0],
"push") && p[1] && !p[2])
7434 else if (
streq(p[0],
"push-reset") && !p[1])
7439 else if (
streq(p[0],
"push-remove") && p[1] && !p[2])
7445 else if (
streq(p[0],
"ifconfig-pool") && p[1] && p[2] && !p[4])
7449 in_addr_t start, end, netmask = 0;
7460 msg(msglevel,
"error parsing --ifconfig-pool parameters");
7476 else if (
streq(p[0],
"ifconfig-pool-persist") && p[1] && !p[3])
7485 else if (
streq(p[0],
"ifconfig-ipv6-pool") && p[1] && !p[2])
7488 struct in6_addr network;
7489 unsigned int netbits = 0;
7494 msg(msglevel,
"error parsing --ifconfig-ipv6-pool parameters");
7497 if (netbits < 64 || netbits > 124)
7500 "--ifconfig-ipv6-pool settings: network must be between /64 and /124 (not /%d)",
7509 else if (
streq(p[0],
"hash-size") && p[1] && p[2] && !p[3])
7516 if (real < 1 ||
virtual < 1)
7518 msg(msglevel,
"--hash-size sizes must be >= 1 (preferably a power of 2)");
7524 else if (
streq(p[0],
"connect-freq") && p[1] && p[2] && !p[3])
7531 if (cf_max < 0 || cf_per < 0)
7533 msg(msglevel,
"--connect-freq parms must be > 0");
7539 else if (
streq(p[0],
"connect-freq-initial") && p[1] && p[2] && !p[3])
7541 long cf_max, cf_per;
7545 cf_max = strtol(p[1], &e1, 10);
7546 cf_per = strtol(p[2], &e2, 10);
7547 if (cf_max < 0 || cf_per < 0 || *e1 !=
'\0' || *e2 !=
'\0')
7549 msg(msglevel,
"--connect-freq-initial parameters must be integers and >= 0");
7555 else if (
streq(p[0],
"max-clients") && p[1] && !p[2])
7560 max_clients =
atoi_warn(p[1], msglevel);
7561 if (max_clients < 0)
7563 msg(msglevel,
"--max-clients must be at least 1");
7568 msg(msglevel,
"--max-clients must be less than %d",
MAX_PEER_ID);
7573 else if (
streq(p[0],
"max-routes-per-client") && p[1] && !p[2])
7578 else if (
streq(p[0],
"client-cert-not-required") && !p[1])
7581 msg(
M_FATAL,
"REMOVED OPTION: --client-cert-not-required, use '--verify-client-cert none' instead");
7583 else if (
streq(p[0],
"verify-client-cert") && !p[2])
7592 if (
streq(p[1],
"none"))
7596 else if (
streq(p[1],
"optional"))
7600 else if (!
streq(p[1],
"require"))
7602 msg(msglevel,
"parameter to --verify-client-cert must be 'none', 'optional' or 'require'");
7607 else if (
streq(p[0],
"username-as-common-name") && !p[1])
7612 else if (
streq(p[0],
"auth-user-pass-optional") && !p[1])
7617 else if (
streq(p[0],
"opt-verify") && !p[1])
7620 msg(
M_INFO,
"DEPRECATION: opt-verify is deprecated and will be removed "
7624 else if (
streq(p[0],
"auth-user-pass-verify") && p[1])
7633 if (
streq(p[2],
"via-env"))
7637 else if (
streq(p[2],
"via-file"))
7643 msg(msglevel,
"second parm to --auth-user-pass-verify must be 'via-env' or 'via-file'");
7649 msg(msglevel,
"--auth-user-pass-verify requires a second parameter ('via-env' or 'via-file')");
7654 p[1],
"auth-user-pass-verify",
true);
7656 else if (
streq(p[0],
"auth-gen-token"))
7662 for (
int i = 2; i <
MAX_PARMS && p[i] != NULL; i++)
7669 else if (
streq(p[i],
"external-auth"))
7675 msg(msglevel,
"Invalid argument to auth-gen-token: %s (%d)", p[i], i);
7680 else if (
streq(p[0],
"auth-gen-token-secret") && p[1] && !p[2])
7687 else if (
streq(p[0],
"client-connect") && p[1])
7695 p[1],
"client-connect",
true);
7697 else if (
streq(p[0],
"client-crresponse") && p[1])
7705 p[1],
"client-crresponse",
true);
7707 else if (
streq(p[0],
"client-disconnect") && p[1])
7715 p[1],
"client-disconnect",
true);
7717 else if (
streq(p[0],
"learn-address") && p[1])
7725 p[1],
"learn-address",
true);
7727 else if (
streq(p[0],
"tmp-dir") && p[1] && !p[2])
7732 else if (
streq(p[0],
"client-config-dir") && p[1] && !p[2])
7737 else if (
streq(p[0],
"ccd-exclusive") && !p[1])
7742 else if (
streq(p[0],
"bcast-buffers") && p[1] && !p[2])
7747 n_bcast_buf =
atoi_warn(p[1], msglevel);
7748 if (n_bcast_buf < 1)
7750 msg(msglevel,
"--bcast-buffers parameter must be > 0");
7754 else if (
streq(p[0],
"tcp-queue-limit") && p[1] && !p[2])
7756 int tcp_queue_limit;
7759 tcp_queue_limit =
atoi_warn(p[1], msglevel);
7760 if (tcp_queue_limit < 1)
7762 msg(msglevel,
"--tcp-queue-limit parameter must be > 0");
7767 else if (
streq(p[0],
"port-share") && p[1] && p[2] && !p[4])
7770 options->port_share_host = p[1];
7771 options->port_share_port = p[2];
7772 options->port_share_journal_dir = p[3];
7775 else if (
streq(p[0],
"client-to-client") && !p[1])
7780 else if (
streq(p[0],
"duplicate-cn") && !p[1])
7785 else if (
streq(p[0],
"iroute") && p[1] && !p[3])
7790 else if (
streq(p[0],
"iroute-ipv6") && p[1] && !p[2])
7795 else if (
streq(p[0],
"ifconfig-push") && p[1] && p[2] && !p[4])
7797 in_addr_t local, remote_netmask;
7802 if (local && remote_netmask)
7814 msg(msglevel,
"cannot parse --ifconfig-push addresses");
7818 else if (
streq(p[0],
"ifconfig-push-constraint") && p[1] && p[2] && !p[3])
7820 in_addr_t network, netmask;
7825 if (network && netmask)
7833 msg(msglevel,
"cannot parse --ifconfig-push-constraint addresses");
7837 else if (
streq(p[0],
"ifconfig-ipv6-push") && p[1] && !p[3])
7839 struct in6_addr local, remote;
7840 unsigned int netbits;
7846 msg(msglevel,
"cannot parse --ifconfig-ipv6-push addresses");
7854 msg( msglevel,
"cannot parse --ifconfig-ipv6-push addresses");
7864 msg( msglevel,
"second argument to --ifconfig-ipv6-push missing and no global --ifconfig-ipv6 address set");
7875 else if (
streq(p[0],
"disable") && !p[1])
7880 else if (
streq(p[0],
"override-username") && p[1] && !p[2])
7885 msg(msglevel,
"override-username exceeds the maximum length of %d "
7897 else if (
streq(p[0],
"tcp-nodelay") && !p[1])
7902 else if (
streq(p[0],
"stale-routes-check") && p[1] && !p[3])
7904 int ageing_time, check_interval;
7907 ageing_time =
atoi_warn(p[1], msglevel);
7910 check_interval =
atoi_warn(p[2], msglevel);
7914 check_interval = ageing_time;
7917 if (ageing_time < 1 || check_interval < 1)
7919 msg(msglevel,
"--stale-routes-check aging time and check interval must be >= 1");
7926 else if (
streq(p[0],
"client") && !p[1])
7931 else if (
streq(p[0],
"pull") && !p[1])
7936 else if (
streq(p[0],
"push-continuation") && p[1] && !p[2])
7941 else if (
streq(p[0],
"auth-user-pass") && !p[2])
7954 else if (
streq(p[0],
"auth-retry") && p[1] && !p[2])
7959 #ifdef ENABLE_MANAGEMENT
7960 else if (
streq(p[0],
"static-challenge") && p[1] && p[2] && !p[4])
7968 if (p[3] &&
streq(p[3],
"concat"))
7972 else if (p[3] && !
streq(p[3],
"scrv1"))
7974 msg(msglevel,
"--static-challenge: unknown format indicator '%s'", p[3]);
7979 else if (
streq(p[0],
"msg-channel") && p[1])
7983 HANDLE process = GetCurrentProcess();
7984 HANDLE handle = (HANDLE) ((intptr_t) atoll(p[1]));
7986 FALSE, DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS))
7988 msg(msglevel,
"could not duplicate service pipe handle");
7993 msg(msglevel,
"--msg-channel is only supported on Windows");
7998 else if (
streq(p[0],
"win-sys") && p[1] && !p[2])
8001 if (
streq(p[1],
"env"))
8003 msg(
M_INFO,
"NOTE: --win-sys env is default from OpenVPN 2.3. "
8004 "This entry will now be ignored. "
8005 "Please remove this entry from your configuration file.");
8012 else if (
streq(p[0],
"route-method") && p[1] && !p[2])
8015 if (
streq(p[1],
"adaptive"))
8019 else if (
streq(p[1],
"ipapi"))
8023 else if (
streq(p[1],
"exe"))
8029 msg(msglevel,
"--route method must be 'adaptive', 'ipapi', or 'exe'");
8033 else if (
streq(p[0],
"ip-win32") && p[1] && !p[4])
8043 "Bad --ip-win32 method: '%s'. Allowed methods: %s",
8058 if (!
streq(p[2],
"default"))
8062 if (!(offset > -256 && offset < 256))
8064 msg(msglevel,
"--ip-win32 dynamic [offset] [lease-time]: offset (%d) must be > -256 and < 256", offset);
8074 const int min_lease = 30;
8077 if (lease_time < min_lease)
8079 msg(msglevel,
"--ip-win32 dynamic [offset] [lease-time]: lease time parameter (%d) must be at least %d seconds", lease_time, min_lease);
8090 else if (
streq(p[0],
"dns") && p[1])
8094 if (
streq(p[1],
"search-domains") && p[2])
8098 else if (
streq(p[1],
"server") && p[2] && p[3] && p[4])
8103 msg(msglevel,
"--dns server: invalid priority value '%s'", p[2]);
8109 if (
streq(p[3],
"address") && p[4])
8111 for (
int i = 4; p[i]; ++i)
8115 msg(msglevel,
"--dns server %ld: malformed address or maximum exceeded '%s'",
priority, p[i]);
8120 else if (
streq(p[3],
"resolve-domains"))
8124 else if (
streq(p[3],
"dnssec") && !p[5])
8126 if (
streq(p[4],
"yes"))
8130 else if (
streq(p[4],
"no"))
8134 else if (
streq(p[4],
"optional"))
8140 msg(msglevel,
"--dns server %ld: malformed dnssec value '%s'",
priority, p[4]);
8144 else if (
streq(p[3],
"transport") && !p[5])
8146 if (
streq(p[4],
"plain"))
8150 else if (
streq(p[4],
"DoH"))
8154 else if (
streq(p[4],
"DoT"))
8160 msg(msglevel,
"--dns server %ld: malformed transport value '%s'",
priority, p[4]);
8164 else if (
streq(p[3],
"sni") && !p[5])
8170 msg(msglevel,
"--dns server %ld: unknown option type '%s' or missing or unknown parameter",
priority, p[3]);
8176 msg(msglevel,
"--dns: unknown option type '%s' or missing or unknown parameter", p[1]);
8180 #if defined(_WIN32) || defined(TARGET_ANDROID)
8181 else if (
streq(p[0],
"dhcp-option") && p[1])
8186 if ((
streq(p[1],
"DOMAIN") ||
streq(p[1],
"ADAPTER_DOMAIN_SUFFIX"))
8192 else if (
streq(p[1],
"NBS") && p[2] && !p[3])
8197 else if (
streq(p[1],
"NBT") && p[2] && !p[3])
8201 if (!(t == 1 || t == 2 || t == 4 || t == 8))
8203 msg(msglevel,
"--dhcp-option NBT: parameter (%d) must be 1, 2, 4, or 8", t);
8209 else if ((
streq(p[1],
"DNS") ||
streq(p[1],
"DNS6")) && p[2] && !p[3]
8212 if (strstr(p[2],
":"))
8222 else if (
streq(p[1],
"WINS") && p[2] && !p[3])
8227 else if (
streq(p[1],
"NTP") && p[2] && !p[3])
8232 else if (
streq(p[1],
"NBDD") && p[2] && !p[3])
8237 else if (
streq(p[1],
"DOMAIN-SEARCH") && p[2] && !p[3])
8245 msg(msglevel,
"--dhcp-option %s: maximum of %d search entries can be specified",
8250 else if (
streq(p[1],
"DISABLE-NBT") && !p[2])
8255 #if defined(TARGET_ANDROID)
8256 else if (
streq(p[1],
"PROXY_HTTP") && p[3] && !p[4])
8259 o->http_proxy = p[2];
8264 msg(msglevel,
"--dhcp-option: unknown option type '%s' or missing or unknown parameter", p[1]);
8270 else if (
streq(p[0],
"show-adapters") && !p[1])
8276 else if (
streq(p[0],
"show-net") && !p[1])
8283 else if (
streq(p[0],
"show-net-up") && !p[1])
8288 else if (
streq(p[0],
"tap-sleep") && p[1] && !p[2])
8293 if (s < 0 || s >= 256)
8295 msg(msglevel,
"--tap-sleep parameter must be between 0 and 255");
8300 else if (
streq(p[0],
"dhcp-renew") && !p[1])
8305 else if (
streq(p[0],
"dhcp-pre-release") && !p[1])
8311 else if (
streq(p[0],
"dhcp-release") && !p[1])
8313 msg(
M_WARN,
"Obsolete option --dhcp-release detected. This is now on by default");
8315 else if (
streq(p[0],
"dhcp-internal") && p[1] && !p[2])
8317 unsigned int adapter_index;
8320 adapter_index =
atou(p[1]);
8332 else if (
streq(p[0],
"register-dns") && !p[1])
8337 else if (
streq(p[0],
"block-outside-dns") && !p[1])
8342 else if (
streq(p[0],
"rdns-internal") && !p[1])
8358 else if (
streq(p[0],
"show-valid-subnets") && !p[1])
8364 else if (
streq(p[0],
"pause-exit") && !p[1])
8369 else if (
streq(p[0],
"service") && p[1] && !p[3])
8378 else if (
streq(p[0],
"allow-nonadmin") && !p[2])
8384 else if (
streq(p[0],
"user") && p[1] && !p[2])
8387 msg(
M_WARN,
"NOTE: --user option is not implemented on Windows");
8389 else if (
streq(p[0],
"group") && p[1] && !p[2])
8392 msg(
M_WARN,
"NOTE: --group option is not implemented on Windows");
8395 else if (
streq(p[0],
"user") && p[1] && !p[2])
8400 else if (
streq(p[0],
"group") && p[1] && !p[2])
8405 else if (
streq(p[0],
"dhcp-option") && p[1] && !p[3])
8408 setenv_foreign_option(
options, (
const char **)p, 3,
es);
8410 else if (
streq(p[0],
"route-method") && p[1] && !p[2])
8415 #if PASSTOS_CAPABILITY
8416 else if (
streq(p[0],
"passtos") && !p[1])
8422 else if (
streq(p[0],
"allow-compression") && p[1] && !p[2])
8426 if (
streq(p[1],
"no"))
8432 msg(msglevel,
"'--allow-compression no' conflicts with "
8433 " enabling compression");
8439 msg(msglevel,
"Cannot set allow-compression to '%s' "
8440 "after set to 'no'", p[1]);
8443 else if (
streq(p[1],
"asym"))
8447 else if (
streq(p[1],
"yes"))
8449 msg(
M_WARN,
"DEPRECATED OPTION: \"--allow-compression yes\" has been removed. "
8450 "We will use \"asym\" mode instead. See the manual page for more information.");
8456 msg(msglevel,
"bad allow-compression option: %s -- "
8457 "must be 'yes', 'no', or 'asym'", p[1]);
8461 else if (
streq(p[0],
"comp-lzo") && !p[2])
8471 if (
streq(p[1],
"no"))
8479 else if (!(
streq(p[1],
"yes") ||
streq(p[1],
"adaptive")))
8481 msg(msglevel,
"bad comp-lzo option: %s -- must be 'yes', 'no', or 'adaptive'", p[1]);
8487 else if (
streq(p[0],
"comp-noadapt") && !p[1])
8491 else if (
streq(p[0],
"compress") && !p[2])
8494 const char *alg =
"stub";
8500 if (
streq(alg,
"stub"))
8505 else if (
streq(alg,
"stub-v2"))
8510 else if (
streq(alg,
"migrate"))
8515 else if (
streq(alg,
"lzo"))
8520 else if (
streq(alg,
"lz4"))
8525 else if (
streq(alg,
"lz4-v2"))
8531 msg(msglevel,
"bad comp option: %s", alg);
8537 else if (
streq(p[0],
"show-ciphers") && !p[1])
8542 else if (
streq(p[0],
"show-digests") && !p[1])
8547 else if (
streq(p[0],
"show-engines") && !p[1])
8552 else if (
streq(p[0],
"key-direction") && p[1] && !p[2])
8559 if (key_direction >= 0)
8575 else if (
streq(p[0],
"secret") && p[1] && !p[3])
8577 msg(
M_WARN,
"DEPRECATED OPTION: The option --secret is deprecated.");
8581 if (!is_inline && p[2])
8586 if (key_direction >= 0)
8596 else if (
streq(p[0],
"allow-deprecated-insecure-static-crypto"))
8602 else if (
streq(p[0],
"genkey") && !p[4])
8612 if (
streq(p[1],
"secret") ||
streq(p[1],
"tls-auth")
8613 ||
streq(p[1],
"tls-crypt"))
8617 else if (
streq(p[1],
"tls-crypt-v2-server"))
8621 else if (
streq(p[1],
"tls-crypt-v2-client"))
8629 else if (
streq(p[1],
"auth-token"))
8635 msg(msglevel,
"unknown --genkey type: %s", p[1]);
8644 else if (
streq(p[0],
"auth") && p[1] && !p[2])
8649 else if (
streq(p[0],
"cipher") && p[1] && !p[2])
8654 else if (
streq(p[0],
"data-ciphers-fallback") && p[1] && !p[2])
8660 else if ((
streq(p[0],
"data-ciphers") ||
streq(p[0],
"ncp-ciphers"))
8664 if (
streq(p[0],
"ncp-ciphers"))
8666 msg(
M_INFO,
"Note: Treating option '--ncp-ciphers' as "
8667 " '--data-ciphers' (renamed in OpenVPN 2.5).");
8671 else if (
streq(p[0],
"key-derivation") && p[1])
8676 #ifdef HAVE_EXPORT_KEYING_MATERIAL
8677 if (
streq(p[1],
"tls-ekm"))
8684 msg(msglevel,
"Unknown key-derivation method %s", p[1]);
8687 else if (
streq(p[0],
"protocol-flags") && p[1])
8693 for (
size_t j = 1; j <
MAX_PARMS && p[j] != NULL; j++)
8695 if (
streq(p[j],
"cc-exit"))
8699 #ifdef HAVE_EXPORT_KEYING_MATERIAL
8700 else if (
streq(p[j],
"tls-ekm"))
8704 else if (
streq(p[j],
"dyn-tls-crypt"))
8709 else if (
streq(p[j],
"aead-epoch"))
8715 msg(msglevel,
"Unknown protocol-flags flag: %s", p[j]);
8719 else if (
streq(p[0],
"force-tls-key-material-export"))
8724 else if (
streq(p[0],
"prng") && p[1] && !p[3])
8726 msg(
M_WARN,
"NOTICE: --prng option ignored (SSL library PRNG is used)");
8728 else if (
streq(p[0],
"no-replay") && !p[1])
8732 msg(
M_FATAL,
"--no-replay was removed in OpenVPN 2.7. "
8733 "Update your configuration.");
8735 else if (
streq(p[0],
"replay-window") && !p[3])
8742 replay_window =
atoi_warn(p[1], msglevel);
8745 msg(msglevel,
"replay-window window size parameter (%d) must be between %d and %d",
8757 replay_time =
atoi_warn(p[2], msglevel);
8760 msg(msglevel,
"replay-window time window parameter (%d) must be between %d and %d",
8771 msg(msglevel,
"replay-window option is missing window size parameter");
8775 else if (
streq(p[0],
"mute-replay-warnings") && !p[1])
8780 else if (
streq(p[0],
"replay-persist") && p[1] && !p[2])
8785 else if (
streq(p[0],
"test-crypto") && !p[1])
8790 #ifndef ENABLE_CRYPTO_MBEDTLS
8791 else if (
streq(p[0],
"engine") && !p[2])
8804 else if (
streq(p[0],
"providers") && p[1])
8806 for (
size_t j = 1; j <
MAX_PARMS && p[j] != NULL; j++)
8811 #ifdef ENABLE_PREDICTION_RESISTANCE
8812 else if (
streq(p[0],
"use-prediction-resistance") && !p[1])
8815 options->use_prediction_resistance =
true;
8818 else if (
streq(p[0],
"show-tls") && !p[1])
8823 else if ((
streq(p[0],
"show-curves") ||
streq(p[0],
"show-groups")) && !p[1])
8828 else if (
streq(p[0],
"ecdh-curve") && p[1] && !p[2])
8831 msg(
M_WARN,
"Consider setting groups/curves preference with "
8832 "tls-groups instead of forcing a specific curve with "
8836 else if (
streq(p[0],
"tls-server") && !p[1])
8841 else if (
streq(p[0],
"tls-client") && !p[1])
8846 else if (
streq(p[0],
"ca") && p[1] && !p[2])
8852 #ifndef ENABLE_CRYPTO_MBEDTLS
8853 else if (
streq(p[0],
"capath") && p[1] && !p[2])
8859 else if (
streq(p[0],
"dh") && p[1] && !p[2])
8865 else if (
streq(p[0],
"cert") && p[1] && !p[2])
8871 else if (
streq(p[0],
"extra-certs") && p[1] && !p[2])
8877 else if ((
streq(p[0],
"verify-hash") && p[1] && !p[3])
8878 || (
streq(p[0],
"peer-fingerprint") && p[1] && !p[2]))
8882 int verify_hash_depth = 0;
8883 if (
streq(p[0],
"verify-hash"))
8885 msg(
M_WARN,
"DEPRECATED OPTION: The option --verify-hash is deprecated. "
8886 "You should switch to the either use the level 1 certificate as "
8887 "--ca option, use --tls-verify or use --peer-fingerprint");
8889 verify_hash_depth = 1;
8898 msg(msglevel,
"ERROR: Setting %s not allowed. --verify-hash and"
8899 " --peer-fingerprint are mutually exclusive", p[0]);
8903 if (
streq(p[0],
"verify-hash"))
8905 if ((!p[2] && !is_inline) || (p[2] &&
streq(p[2],
"SHA1")))
8910 else if (p[2] && !
streq(p[2],
"SHA256"))
8912 msg(msglevel,
"invalid or unsupported hashing algorithm: %s "
8913 "(only SHA1 and SHA256 are supported)", p[2]);
8933 while (listend->
next)
8935 listend = listend->
next;
8937 listend->
next = newlist;
8940 #if defined(ENABLE_CRYPTOAPI) && defined(HAVE_XKEY_PROVIDER)
8941 else if (
streq(p[0],
"cryptoapicert") && p[1] && !p[2])
8947 else if (
streq(p[0],
"key") && p[1] && !p[2])
8953 else if (
streq(p[0],
"tls-version-min") && p[1] && !p[3])
8960 msg(msglevel,
"unknown tls-version-min parameter: %s", p[1]);
8964 #ifdef ENABLE_CRYPTO_MBEDTLS
8967 msg(
M_WARN,
"--tls-version-min %s is not supported by mbedtls, using 1.2", p[1]);
8976 else if (
streq(p[0],
"tls-version-max") && p[1] && !p[2])
8983 msg(msglevel,
"unknown tls-version-max parameter: %s", p[1]);
8990 #ifndef ENABLE_CRYPTO_MBEDTLS
8991 else if (
streq(p[0],
"pkcs12") && p[1] && !p[2])
8998 else if (
streq(p[0],
"askpass") && !p[2])
9010 else if (
streq(p[0],
"auth-nocache") && !p[1])
9015 else if (
streq(p[0],
"auth-token") && p[1] && !p[2])
9019 #ifdef ENABLE_MANAGEMENT
9026 else if (
streq(p[0],
"auth-token-user") && p[1] && !p[2])
9031 else if (
streq(p[0],
"single-session") && !p[1])
9036 else if (
streq(p[0],
"push-peer-info") && !p[1])
9041 else if (
streq(p[0],
"tls-exit") && !p[1])
9046 else if (
streq(p[0],
"tls-cipher") && p[1] && !p[2])
9051 else if (
streq(p[0],
"tls-cert-profile") && p[1] && !p[2])
9056 else if (
streq(p[0],
"tls-ciphersuites") && p[1] && !p[2])
9061 else if (
streq(p[0],
"tls-groups") && p[1] && !p[2])
9066 else if (
streq(p[0],
"crl-verify") && p[1] && ((p[2] &&
streq(p[2],
"dir"))
9070 if (p[2] &&
streq(p[2],
"dir"))
9077 else if (
streq(p[0],
"tls-verify") && p[1])
9086 "tls-verify",
true);
9088 else if (
streq(p[0],
"tls-export-cert") && p[1] && !p[2])
9093 else if (
streq(p[0],
"compat-names"))
9096 msg(msglevel,
"--compat-names was removed in OpenVPN 2.5. "
9097 "Update your configuration.");
9100 else if (
streq(p[0],
"no-name-remapping") && !p[1])
9103 msg(msglevel,
"--no-name-remapping was removed in OpenVPN 2.5. "
9104 "Update your configuration.");
9107 else if (
streq(p[0],
"verify-x509-name") && p[1] && strlen(p[1]) && !p[3])
9113 if (
streq(p[2],
"subject"))
9117 else if (
streq(p[2],
"name"))
9121 else if (
streq(p[2],
"name-prefix"))
9127 msg(msglevel,
"unknown X.509 name type: %s", p[2]);
9134 else if (
streq(p[0],
"ns-cert-type") && p[1] && !p[2])
9136 #ifdef ENABLE_CRYPTO_MBEDTLS
9137 msg(msglevel,
"--ns-cert-type is not available with mbedtls.");
9141 if (
streq(p[1],
"server"))
9145 else if (
streq(p[1],
"client"))
9151 msg(msglevel,
"--ns-cert-type must be 'client' or 'server'");
9156 else if (
streq(p[0],
"remote-cert-ku"))
9161 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9171 else if (
streq(p[0],
"remote-cert-eku") && p[1] && !p[2])
9176 else if (
streq(p[0],
"remote-cert-tls") && p[1] && !p[2])
9180 if (
streq(p[1],
"server"))
9185 else if (
streq(p[1],
"client"))
9192 msg(msglevel,
"--remote-cert-tls must be 'client' or 'server'");
9196 else if (
streq(p[0],
"tls-timeout") && p[1] && !p[2])
9201 else if (
streq(p[0],
"reneg-bytes") && p[1] && !p[2])
9205 long long reneg_bytes = strtoll(p[1], &end, 10);
9206 if (*end !=
'\0' || reneg_bytes < 0)
9208 msg(msglevel,
"--reneg-bytes parameter must be an integer and >= 0");
9213 else if (
streq(p[0],
"reneg-pkts") && p[1] && !p[2])
9217 long long pkt_max = strtoll(p[1], &end, 10);
9218 if (*end !=
'\0' || pkt_max < 0)
9220 msg(msglevel,
"--reneg-pkts parameter must be an integer and >= 0");
9225 else if (
streq(p[0],
"reneg-sec") && p[1] && !p[3])
9234 else if (
streq(p[0],
"hand-window") && p[1] && !p[2])
9239 else if (
streq(p[0],
"tran-window") && p[1] && !p[2])
9244 else if (
streq(p[0],
"tls-auth") && p[1] && !p[3])
9246 int key_direction = -1;
9255 if (!is_inline && p[2])
9258 if (key_direction < 0)
9272 if (!is_inline && p[2])
9275 if (key_direction < 0)
9283 else if (
streq(p[0],
"tls-crypt") && p[1] && !p[3])
9297 else if (
streq(p[0],
"tls-crypt-v2") && p[1] && !p[3])
9311 if (p[2] &&
streq(p[2],
"force-cookie"))
9315 else if (p[2] &&
streq(p[2],
"allow-noncookie"))
9321 msg(msglevel,
"Unsupported tls-crypt-v2 argument: %s", p[2]);
9324 else if (
streq(p[0],
"tls-crypt-v2-verify") && p[1] && !p[2])
9329 else if (
streq(p[0],
"x509-track") && p[1] && !p[2])
9334 #ifdef ENABLE_X509ALTUSERNAME
9335 else if (
streq(p[0],
"x509-username-field") && p[1])
9338 for (
size_t j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9342 if (strncmp(
"ext:", s, 4) == 0 && !x509_username_field_ext_supported(s+4))
9344 msg(msglevel,
"Unsupported x509-username-field extension: %s", s);
9346 options->x509_username_field[j-1] = p[j];
9350 #ifdef ENABLE_PKCS11
9351 else if (
streq(p[0],
"show-pkcs11-ids") && !p[3])
9353 char *provider = p[1];
9354 bool cert_private = (p[2] == NULL ? false : (
atoi_warn(p[2], msglevel) != 0 ));
9356 #ifdef DEFAULT_PKCS11_MODULE
9359 provider = DEFAULT_PKCS11_MODULE;
9364 int i = strtol(provider, &endp, 10);
9370 provider = DEFAULT_PKCS11_MODULE;
9377 msg(msglevel,
"--show-pkcs11-ids requires a provider parameter");
9384 show_pkcs11_ids(provider, cert_private);
9387 else if (
streq(p[0],
"pkcs11-providers") && p[1])
9393 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9395 options->pkcs11_providers[j-1] = p[j];
9398 else if (
streq(p[0],
"pkcs11-protected-authentication"))
9404 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9406 options->pkcs11_protected_authentication[j-1] =
atoi_warn(p[j], msglevel) != 0 ? 1 : 0;
9409 else if (
streq(p[0],
"pkcs11-private-mode") && p[1])
9415 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9417 sscanf(p[j],
"%x", &(
options->pkcs11_private_mode[j-1]));
9420 else if (
streq(p[0],
"pkcs11-cert-private"))
9426 for (j = 1; j <
MAX_PARMS && p[j] != NULL; ++j)
9431 else if (
streq(p[0],
"pkcs11-pin-cache") && p[1] && !p[2])
9436 else if (
streq(p[0],
"pkcs11-id") && p[1] && !p[2])
9441 else if (
streq(p[0],
"pkcs11-id-management") && !p[1])
9444 options->pkcs11_id_management =
true;
9447 else if (
streq(p[0],
"rmtun") && !p[1])
9453 else if (
streq(p[0],
"mktun") && !p[1])
9459 else if (
streq(p[0],
"peer-id") && p[1] && !p[2])
9465 #ifdef HAVE_EXPORT_KEYING_MATERIAL
9466 else if (
streq(p[0],
"keying-material-exporter") && p[1] && p[2])
9472 if (strncmp(p[1],
"EXPORTER", 8))
9474 msg(msglevel,
"Keying material exporter label must begin with "
9480 msg(msglevel,
"Keying material exporter label must not be '"
9483 if (ekm_length < 16 || ekm_length > 4095)
9485 msg(msglevel,
"Invalid keying material exporter length");
9489 options->keying_material_exporter_label = p[1];
9490 options->keying_material_exporter_length = ekm_length;
9493 else if (
streq(p[0],
"allow-recursive-routing") && !p[1])
9498 else if (
streq(p[0],
"vlan-tagging") && !p[1])
9503 else if (
streq(p[0],
"vlan-accept") && p[1] && !p[2])
9506 if (
streq(p[1],
"tagged"))
9510 else if (
streq(p[1],
"untagged"))
9514 else if (
streq(p[1],
"all"))
9520 msg(msglevel,
"--vlan-accept must be 'tagged', 'untagged' or 'all'");
9524 else if (
streq(p[0],
"vlan-pvid") && p[1] && !p[2])
9532 "the parameter of --vlan-pvid parameters must be >= %u and <= %u",
9540 int msglevel_unknown = msglevel_fc;
9547 msglevel_unknown =
M_WARN;
9553 msg(msglevel_unknown,
"Unrecognized option or missing or extra parameter(s) in %s:%d: %s (%s)", file, line, p[0],
PACKAGE_VERSION);
9557 msg(msglevel_unknown,
"Unrecognized option or missing or extra parameter(s): --%s (%s)", p[0],
PACKAGE_VERSION);
const char * tls_crypt_file
#define SSLF_TLS_VERSION_MIN_SHIFT
struct in6_addr server_network_ipv6
void set_win_sys_path(const char *newpath, struct env_set *es)
struct tuntap * init_tun(const char *dev, const char *dev_type, int topology, const char *ifconfig_local_parm, const char *ifconfig_remote_netmask_parm, const char *ifconfig_ipv6_local_parm, int ifconfig_ipv6_netbits_parm, const char *ifconfig_ipv6_remote_parm, struct addrinfo *local_public, struct addrinfo *remote_public, const bool strict_warn, struct env_set *es, openvpn_net_ctx_t *ctx, struct tuntap *tt)
static struct connection_list * alloc_connection_list_if_undef(struct options *options)
static bool buf_safe(const struct buffer *buf, size_t len)
static void option_iroute(struct options *o, const char *network_str, const char *netmask_str, int msglevel)
void copy_route_option_list(struct route_option_list *dest, const struct route_option_list *src, struct gc_arena *a)
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
struct dns_options dns_options
static const char * print_vlan_accept(enum vlan_acceptable_frames mode)
enum genkey_type genkey_type
#define CHKACC_FILEXSTWR
If file exists, is it writable?
bool dhcp_renew_by_adapter_index(const DWORD adapter_index)
bool dhcp_masq_custom_offset
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.
in_addr_t dns[N_DHCP_ADDR]
#define TLS_USERNAME_LEN
Maximum length of common name.
#define MF_EXTERNAL_KEY_PSSPAD
static bool dco_check_option(int msglevel, const struct options *o)
static bool comp_non_stub_enabled(const struct compress_options *info)
bool string_defined_equal(const char *s1, const char *s2)
void helper_setdefault_topology(struct options *o)
Set –topology default depending on –mode.
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)
const char * domain_search_list[N_SEARCH_LIST_LEN]
bool options_cmp_equal(char *actual, const char *expected)
struct verify_hash_list * verify_hash
void get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6, const struct in6_addr *dest, openvpn_net_ctx_t *ctx)
void management_auth_token(struct management *man, const char *token)
void helper_client_server(struct options *o)
#define MF_EXTERNAL_KEY_PKCS1PAD
void notnull(const char *arg, const char *description)
bool is_special_addr(const char *addr_str)
struct static_challenge_info sc_info
const char * client_connect_script
#define MF_EXTERNAL_KEY_NOPADDING
static void dhcp_option_address_parse(const char *name, const char *parm, in_addr_t *array, int *len, int msglevel)
bool enable_ncp_fallback
If defined fall back to ciphername if NCP fails.
void add_route_ipv6_to_option_list(struct route_ipv6_option_list *l, const char *prefix, const char *gateway, const char *metric)
#define KEY_DIRECTION_BIDIRECTIONAL
#define SF_NO_PUSH_ROUTE_GATEWAY
static struct gc_arena gc_new(void)
struct route_ipv6_option_list * clone_route_ipv6_option_list(const struct route_ipv6_option_list *src, struct gc_arena *a)
@ VLAN_ONLY_UNTAGGED_OR_PRIORITY
int string_array_len(const char **array)
#define SF_TCP_NODELAY_HELPER
void push_remove_option(struct options *o, const char *p)
#define VERIFY_X509_SUBJECT_RDN_PREFIX
#define SSLF_TLS_VERSION_MAX_MASK
int connect_retry_seconds
int explicit_exit_notification
#define VERIFY_X509_SUBJECT_DN
#define CHKACC_ACPTSTDIN
If filename is stdin, it's allowed and "exists".
bool route_gateway_via_dhcp
bool ipv6_addr_safe(const char *ipv6_text_addr)
const char * http_version
void ssl_set_auth_token_user(const char *username)
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 options_server_import(struct options *o, const char *filename, int msglevel, unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
int len
Length in bytes of the actual content within the allocated memory.
const char * proto2ascii_all(struct gc_arena *gc)
in_addr_t nbdd[N_DHCP_ADDR]
struct push_list push_list
const char * socks_proxy_server
void dns_options_postprocess_pull(struct dns_options *o)
Merges pulled DNS servers with static ones into an ordered list.
struct buffer prepend_dir(const char *dir, const char *path, struct gc_arena *gc)
Prepend a directory to a path.
const char * route_ipv6_default_gateway
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.
#define SHA_DIGEST_LENGTH
static bool cipher_defined(const char *ciphername)
Checks if the cipher is defined and is not the null (none) cipher.
#define MAX_SEQ_BACKTRACK
unsigned int server_flags
const char * auth_token_secret_file
void setenv_str_i(struct env_set *es, const char *name, const char *value, const int i)
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 const char * pull_filter_type_name(int type)
const char * dco_version_string(struct gc_arena *gc)
int domain_search_list_len
bool options_cmp_equal_safe(char *actual, const char *expected, size_t actual_n)
bool tls_crypt_file_inline
#define DHCP_OPTIONS_DHCP_REQUIRED
const char * proto2ascii(int proto, sa_family_t af, bool display_form)
int ascii2ipset(const char *name)
int64_t inactivity_minimum_bytes
#define ROUTE_METHOD_SERVICE
static void show_pull_filter_list(const struct pull_filter_list *l)
void script_security_set(int level)
#define VERIFY_X509_SUBJECT_RDN
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 bool dhcp_renew(const struct tuntap *tt)
static void show_dhcp_option_addrs(const char *name, const in_addr_t *array, int len)
struct route_option_list * clone_route_option_list(const struct route_option_list *src, struct gc_arena *a)
in_addr_t server_bridge_ip
const char * auth_file_up
static void options_set_backwards_compatible_options(struct options *o)
Changes default values so that OpenVPN can be compatible with the user specified version.
struct verify_hash_list * next
#define SSLF_USERNAME_AS_COMMON_NAME
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.
#define MAX_TIME_BACKTRACK
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...
const char * proto_remote(int proto, bool remote)
int status_file_update_freq
void push_options(struct options *o, char **p, int msglevel, struct gc_arena *gc)
const char * auth_method_string
#define OPENVPN_EXIT_STATUS_GOOD
const char * shared_secret_file
const char * keydirection2ascii(int kd, bool remote, bool humanreadable)
void dns_domain_list_append(struct dns_domain **entry, char **domains, struct gc_arena *gc)
Appends DNS domain parameters to a linked list.
int capacity
Size in bytes of memory allocated by malloc().
bool extra_certs_file_inline
bool tls_crypt_v2_force_cookie
bool ip_addr_dotted_quad_safe(const char *dotted_quad)
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
static void setenv_local_entry(struct env_set *es, const struct local_entry *e, const int i)
void argv_free(struct argv *a)
Frees all memory allocations allocated by the struct argv related functions.
#define X509_USERNAME_FIELD_DEFAULT
bool set_debug_level(const int level, const unsigned int flags)
bool dns_options_verify(int msglevel, const struct dns_options *o)
Checks validity of DNS options.
@ GENKEY_TLS_CRYPTV2_CLIENT
static char * get_ipv6_addr_no_netbits(const char *addr, struct gc_arena *gc)
Returns newly allocated string containing address part without "/nn".
#define TLS_CHANNEL_MTU_MIN
#define CO_EPOCH_DATA_KEY_FORMAT
Bit-flag indicating the epoch the data format.
struct pull_filter * head
const char * dev_type_string(const char *dev, const char *dev_type)
#define TAP_MTU_EXTRA_DEFAULT
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)
void tap_allow_nonadmin_access(const char *dev_node)
static void options_postprocess_mutate(struct options *o, struct env_set *es)
char * mutate_ncp_cipher_list(const char *list, struct gc_arena *gc)
Check whether the ciphers in the supplied list are supported.
static void bind_local(struct link_socket *sock, const sa_family_t ai_family)
const char * safe_print(const char *str, struct gc_arena *gc)
int parse_line(const char *line, char *p[], const int n, const char *file, const int line_num, int msglevel, struct gc_arena *gc)
void buf_clear(struct buffer *buf)
Structure for reassembling one incoming fragmented packet.
static int tls_verify(struct openvpn_plugin_args_func_in const *args)
struct in6_addr push_ifconfig_ipv6_local
static bool learn_address_script(const struct multi_context *m, const struct multi_instance *mi, const char *op, const struct mroute_addr *addr)
void options_warning_safe(char *actual, const char *expected, size_t actual_n)
const char * netbios_scope
struct connection_entry ce
#define MUST_BE_FALSE(condition, parm_name)
struct route_option_list * new_route_option_list(struct gc_arena *a)
bool ip_or_dns_addr_safe(const char *addr, const bool allow_fqdn)
static char * read_inline_file(struct in_src *is, const char *close_tag, int *num_lines, struct gc_arena *gc)
static bool buf_copy(struct buffer *dest, const struct buffer *src)
char * format_hex_ex(const uint8_t *data, int size, int maxoutput, unsigned int space_break_flags, const char *separator, struct gc_arena *gc)
#define SSLF_AUTH_USER_PASS_OPTIONAL
#define ROUTE_METHOD_IPAPI
int ascii2keydirection(int msglevel, const char *str)
bool ifconfig_ipv6_pool_defined
hash_algo_type verify_hash_algo
enum dns_server_transport transport
const char * genkey_extra_data
void argv_parse_cmd(struct argv *argres, const char *cmdstr)
Parses a command string, tokenizes it and puts each element into a separate struct argv argument slot...
static bool proto_is_dgram(int proto)
Return if the protocol is datagram (UDP)
static unsigned int atou(const char *str)
int ping_rec_timeout_action
static void options_postprocess_mutate_ce(struct options *o, struct connection_entry *ce)
struct pull_filter * tail
bool has_udp_in_local_list(const struct options *options)
static void cnol_check_alloc(struct options *options)
const char * cipher_kt_name(const char *ciphername)
Retrieve a normalised string describing the cipher (e.g.
struct local_list * local_list
struct client_nat_option_list * clone_client_nat_option_list(const struct client_nat_option_list *src, struct gc_arena *gc)
const char * tls_export_peer_cert_dir
int netmask_to_netbits2(in_addr_t netmask)
void print_client_nat_list(const struct client_nat_option_list *list, int msglevel)
Packet geometry parameters.
static void options_postprocess_filechecks(struct options *options)
void plugin_option_list_print(const struct plugin_option_list *list, int msglevel)
bool allow_deprecated_insecure_static_crypto
void setenv_int(struct env_set *es, const char *name, int value)
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 ...
struct route_ipv6_option_list * routes_ipv6
const char * names[MAX_PARMS]
void throw_signal_soft(const int signum, const char *signal_text)
Throw a soft global signal.
struct dns_server * servers
#define N_SEARCH_LIST_LEN
void push_reset(struct options *o)
static const char usage_message[]
@ WINDOWS_DRIVER_UNSPECIFIED
bool allow_recursive_routing
static int net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx)
int translate_mtu_discover_type_name(const char *name)
struct route_ipv6_option_list * routes_ipv6
void add_route_to_option_list(struct route_option_list *l, const char *network, const char *netmask, const char *gateway, const char *metric)
#define SHOW_UNSIGNED(var)
const char * tls_cert_profile
void management_echo(struct management *man, const char *string, const bool pull)
#define CHKACC_ACCEPT_URI
Do not check URIs, unless they start with file:
unsigned short sa_family_t
enum tun_driver_type windows_driver
int tls_version_parse(const char *vstr, const char *extra)
static void connection_entry_load_re(struct connection_entry *ce, const struct remote_entry *re)
void test_crypto(struct crypto_options *co, struct frame *frame)
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.
const char ** ignore_unknown_option
void ipconfig_register_dns(const struct env_set *es)
struct http_proxy_options * http_proxy_override
const char * cipher_list_tls13
#define PUF_TYPE_IGNORE
filter type to ignore a matching option
bool options_postprocess_pull(struct options *o, struct env_set *es)
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 tuntap_options_defined
const char * ncp_ciphers_conf
The original ncp_ciphers specified by the user in the configuration.
static void show_connection_entries(const struct options *o)
char * string_alloc(const char *str, struct gc_arena *gc)
static void secure_memzero(void *data, size_t len)
Securely zeroise memory.
const char * socks_proxy_port
struct local_entry * array[CONNECTION_LIST_SIZE]
const char * management_port
void helper_tcp_nodelay(struct options *o)
const char * print_in6_addr(struct in6_addr a6, unsigned int flags, struct gc_arena *gc)
int connect_retry_seconds_max
const char * print_topology(const int topology)
static void show_tuntap_options(const struct tuntap_options *o)
const char * ip_remote_hint
bool mac_addr_safe(const char *mac_addr)
struct dns_options dns_options
const char * auth_user_pass_file
static void show_dhcp_option_list(const char *name, const char *const *array, int len)
#define PULL_DEFINED(opt)
struct client_nat_option_list * client_nat
bool ssl_get_auth_nocache(void)
void set_machine_readable_output(bool parsable)
struct route_option_list * routes
static void bypass_doubledash(char **p)
static struct local_entry * alloc_local_entry(struct connection_entry *ce, const int msglevel, struct gc_arena *gc)
static void option_iroute_ipv6(struct options *o, const char *prefix_str, int msglevel)
void set_suppress_timestamps(bool suppressed)
#define SSLF_TLS_VERSION_MIN_MASK
const char * md_kt_name(const char *mdname)
Retrieve a string describing the digest digest (e.g.
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...
#define MAX_CUSTOM_HTTP_HEADER
#define ROUTE_METHOD_ADAPTIVE
static bool ipv6_addr_safe_hexplusbits(const char *ipv6_prefix_spec)
const struct x509_track * x509_track
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 MF_EXTERNAL_KEY_DIGEST
bool shared_secret_file_inline
struct options_pre_connect * pre_connect
const char * management_client_group
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 int msglevel_forward_compatible(struct options *options, const int msglevel)
const char * route_default_gateway
static void remap_redirect_gateway_flags(struct options *opt)
int ifconfig_ipv6_netbits
bool push_ifconfig_ipv6_defined
const char * tls_crypt_file
#define SSLF_TLS_DEBUG_ENABLED
const char * digest
Message digest static parameters.
#define RESOLV_RETRY_INFINITE
struct compress_options comp
void clone_push_list(struct options *o)
unsigned int imported_protocol_flags
union dns_server_addr::@0 in
static void options_postprocess_cipher(struct options *o)
#define OPT_P_NCP
Negotiable crypto parameters.
int ascii2proto(const char *proto_name)
void print_route_options(const struct route_option_list *rol, int level)
static void show_compression_warning(struct compress_options *info)
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 SSLF_CRL_VERIFY_DIR
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.
static char * string_substitute(const char *src, int from, int to, struct gc_arena *gc)
#define OPENVPN_8021Q_MAX_VID
#define MF_QUERY_PASSWORDS
const char * tls_crypt_v2_file
#define COMP_F_ADVERTISE_STUBS_ONLY
bool push_ifconfig_ipv6_blocked
void ssl_set_auth_token(const char *token)
int management_state_buffer_size
int positive_atoi(const char *str, int msglevel)
Converts a str to a positive number if the string represents a postive integer number.
void dns_options_preprocess_pull(struct dns_options *o)
Saves and resets the server options, so that pulled ones don't mix in.
bool push_ifconfig_defined
const char * tls_auth_file
unsigned int backwards_compatible
What version we should try to be compatible with as major * 10000 + minor * 100 + patch,...
#define CONFIGURE_DEFINES
bool tls_crypt_v2_file_inline
#define ALLOC_OBJ_CLEAR_GC(dptr, type, gc)
static int check_inline_file_via_buf(struct buffer *multiline, char *p[], struct gc_arena *gc)
#define VERIFY_PERMISSION(mask)
FILE * msg_fp(const unsigned int flags)
const char * tls_auth_file
struct buffer * multiline
bool tls_crypt_v2_file_inline
const char * route_predown_script
int tls_version_max(void)
Return the maximum TLS version (as a TLS_VER_x constant) supported by current SSL implementation.
#define COMP_ALGV2_UNCOMPRESSED
bool push_ifconfig_constraint_defined
#define OPT_P_INSTANCE
allowed in ccd, client-connect etc
bool tls_auth_file_inline
struct plugin_option_list * plugin_option_list_new(struct gc_arena *gc)
bool auth_token_secret_file_inline
unsigned int server_netbits_ipv6
#define CHKACC_FILE
Check for a file/directory presence.
const char * tls_crypt_v2_file
static bool space(unsigned char c)
bool auth_user_pass_file_inline
struct provider_list providers
struct dns_domain * domains
static struct remote_entry * alloc_remote_entry(struct options *options, const int msglevel)
void show_valid_win32_tun_subnets(void)
@ WINDOWS_DRIVER_TAP_WINDOWS6
void options_string_import(struct options *options, const char *config, const int msglevel, const unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
const char * management_addr
#define SSLF_CLIENT_CERT_NOT_REQUIRED
#define OPENVPN_EXIT_STATUS_USAGE
static void check_ca_required(const struct options *options)
void gc_transfer(struct gc_arena *dest, struct gc_arena *src)
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 bool buf_valid(const struct buffer *buf)
void helper_keepalive(struct options *o)
static void gc_detach(struct gc_arena *a)
#define MF_FORGET_DISCONNECT
const char * ipset2ascii_all(struct gc_arena *gc)
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)
void options_postprocess(struct options *options, struct env_set *es)
in_addr_t ifconfig_pool_netmask
struct dns_domain * search_domains
void copy_client_nat_option_list(struct client_nat_option_list *dest, const struct client_nat_option_list *src)
const char * ifconfig_options_string(const struct tuntap *tt, bool remote, bool disable, struct gc_arena *gc)
void set_pause_exit_win32(void)
int parse_topology(const char *str, const int msglevel)
static bool check_file_access_chroot(const char *chroot, const int type, const char *file, const int mode, const char *opt)
int push_ifconfig_ipv6_netbits
static void tuntap_options_copy_dns(struct options *o)
bool tls_crypt_file_inline
int renegotiate_seconds_min
const char * challenge_text
struct dns_server_addr addr[8]
void open_syslog(const char *pgmname, bool stdio_to_null)
static struct remote_list * alloc_remote_list_if_undef(struct options *options)
int stale_routes_check_interval
int scheduled_exit_interval
struct client_nat_option_list * client_nat
const char * client_crresponse_script
#define IPW32_SET_ADAPTIVE
Wrapper structure for dynamically allocated memory.
@ GENKEY_TLS_CRYPTV2_SERVER
void errors_to_stderr(void)
static bool proto_is_udp(int proto)
Returns if the protocol being used is UDP.
const char * verify_x509_name
const char * route_ipv6_default_gateway
static int global_auth_retry
const char * exit_event_name
void openvpn_exit(const int status)
static void connection_entry_preload_key(const char **key_file, bool *key_inline, struct gc_arena *gc)
struct in6_addr push_ifconfig_ipv6_remote
const char * management_certificate
void show_windows_version(const unsigned int flags)
struct compress_options comp
#define CO_USE_DYNAMIC_TLS_CRYPT
Bit-flag indicating that renegotiations are using tls-crypt with a TLS-EKM derived key.
static void set_user_script(struct options *options, const char **script, const char *new_script, const char *type, bool in_chroot)
struct route_ipv6_option_list * new_route_ipv6_option_list(struct gc_arena *a)
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)
unsigned remote_cert_ku[MAX_PARMS]
static bool suppress_timestamps
static void options_postprocess_http_proxy_override(struct options *o)
#define MAN_CLIENT_AUTH_ENABLED(opt)
uint8_t hash[SHA256_DIGEST_LENGTH]
const char * override_username
void show_tap_win_adapters(int msglev, int warnlev)
struct http_proxy_options * init_http_proxy_options_once(struct http_proxy_options **hpo, struct gc_arena *gc)
void show_adapters(int msglev)
static int check_inline_file_via_fp(FILE *fp, char *p[], struct gc_arena *gc)
bool force_key_material_export
bool server_bridge_proxy_dhcp
unsigned int management_flags
static bool no_more_than_n_args(const int msglevel, char *p[], const int max, const unsigned int flags)
const char * auth_retry_print(void)
in_addr_t server_bridge_pool_start
int management_echo_buffer_size
static bool proto_is_net(int proto)
struct connection_entry ** array
void show_routes(int msglev)
#define PUF_TYPE_REJECT
filter type to reject and trigger SIGUSR1
const char * print_tun_backend_driver(enum tun_driver_type driver)
Return a string representation of the tun backed driver type.
const char * client_config_dir
static bool in_src_get(const struct in_src *is, char *line, const int size)
static bool dco_check_startup_option(int msglevel, const struct options *o)
#define SSLF_TLS_VERSION_MAX_SHIFT
Garbage collection arena used to keep track of dynamically allocated memory.
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)
const char * genkey_filename
#define COMP_F_ALLOW_NOCOMP_ONLY
struct iroute_ipv6 * next
bool key_is_external(const struct options *options)
int64_t renegotiate_packets
void setenv_str(struct env_set *es, const char *name, const char *value)
#define MODE_POINT_TO_POINT
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...
const char * cipher
const name of the cipher
int daemon(int nochdir, int noclose)
bool auth_token_call_auth
struct remote_entry ** array
#define PUF_TYPE_ACCEPT
filter type to accept a matching option
int resolve_retry_seconds
static void options_postprocess_mutate_le(struct connection_entry *ce, struct local_entry *le, int mode)
bool check_compression_settings_valid(struct compress_options *info, int msglevel)
Checks if the compression settings are valid.
struct http_proxy_options * http_proxy_options
#define EXPORT_KEY_DATA_LABEL
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...
void show_library_versions(const unsigned int flags)
static void strncpynt(char *dest, const char *src, size_t maxlen)
const char * win32_version_string(struct gc_arena *gc, bool add_name)
bool plugin_option_list_add(struct plugin_option_list *list, char **p, struct gc_arena *gc)
static void options_process_mutate_prf(struct options *o)
in_addr_t server_bridge_netmask
void copy_route_ipv6_option_list(struct route_ipv6_option_list *dest, const struct route_ipv6_option_list *src, struct gc_arena *a)
#define MIN_TIME_BACKTRACK
struct client_nat_option_list * new_client_nat_list(struct gc_arena *gc)
int cipher_kt_key_size(const char *ciphername)
Returns the size of keys used by the cipher, in bytes.
struct plugin_option_list * plugin_list
struct argv argv_new(void)
Allocates a new struct argv and ensures it is initialised.
bool priv_key_file_inline
static bool dco_enabled(const struct options *o)
Returns whether the current configuration has dco enabled.
void free_buf(struct buffer *buf)
void uninit_options(struct options *o)
int atoi_warn(const char *str, int msglevel)
Converts a str to an integer if the string can be represented as an integer number.
void ssl_set_auth_nocache(void)
bool has_tcp_in_local_list(const struct options *options)
bool tls_auth_file_inline
static bool strprefix(const char *str, const char *prefix)
Return true iff str starts with prefix.
static bool machine_readable_output
int management_log_history_cache
void show_dco_version(const unsigned int flags)
void options_detach(struct options *o)
void rol_check_alloc(struct options *options)
void redirect_stdout_stderr(const char *file, bool append)
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.
const char * socks_proxy_authfile
in_addr_t ifconfig_pool_end
#define CHKACC_DIRPATH
Check for directory presence where a file should reside.
static struct connection_entry * alloc_connection_entry(struct options *options, const int msglevel)
static bool check_cmd_access(const char *command, const char *opt, const char *chroot)
#define GETADDR_HOST_ORDER
bool exit_event_initial_state
#define PLUGIN_OPTION_LIST(opt)
static void rol6_check_alloc(struct options *options)
in_addr_t wins[N_DHCP_ADDR]
void setenv_dns_options(const struct dns_options *o, struct env_set *es)
Puts the DNS options into an environment set.
#define SHA256_DIGEST_LENGTH
bool ifconfig_pool_defined
#define MF_CONNECT_AS_CLIENT
sa_family_t ascii2af(const char *proto_name)
static in_addr_t get_ip_addr(const char *ip_string, int msglevel, bool *error)
#define IPW32_SET_DHCP_MASQ
void * gc_malloc(size_t size, bool clear, struct gc_arena *a)
static int max_int(int x, int y)
void init_options(struct options *o, const bool init_gc)
bool machine_readable_output
const char * tls_crypt_v2_verify_script
const char * key_pass_file
#define IPW32_SET_ADAPTIVE_DELAY_WINDOW
#define DHCP_OPTIONS_DHCP_OPTIONAL
static void show_http_proxy_options(const struct http_proxy_options *o)
static void usage_version(void)
static SERVICE_STATUS status
static void show_connection_entry(const struct connection_entry *o)
bool tun_mtu_extra_defined
static struct http_proxy_options * parse_http_proxy_override(const char *server, const char *port, const char *flags, struct gc_arena *gc)
const char * packet_id_file
in_addr_t push_ifconfig_remote_netmask
void show_settings(const struct options *o)
static void gc_free(struct gc_arena *a)
struct in6_addr dns6[N_DHCP_ADDR]
void show_dns_options(const struct dns_options *o)
Prints configured DNS options.
char * dirname(char *path)
static struct pull_filter_list * alloc_pull_filter_list(struct options *o)
#define CHKACC_PRIVATE
Warn if this (private) file is group/others accessible.
struct connection_list * connection_list
const char * win_get_tempdir(void)
const char * ifconfig_remote_netmask
struct buffer string_alloc_buf(const char *str, struct gc_arena *gc)
struct route_option_list * routes
int ifconfig_ipv6_pool_netbits
int max_routes_per_client
const char * cryptoapi_cert
static void show_p2mp_parms(const struct options *o)
in_addr_t server_bridge_pool_end
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 * strsep(char **stringp, const char *delim)
static const char * options_warning_extract_parm1(const char *option_string, struct gc_arena *gc_ret)
in_addr_t ifconfig_pool_start
void setenv_settings(struct env_set *es, const struct options *o)
#define USAGE_VALID_SERVER_PROTOS
#define DEFAULT_SEQ_BACKTRACK
const char * extra_certs_file
#define MUST_BE_UNDEF(parm, parm_name)
static int check_inline_file(struct in_src *is, char *p[], struct gc_arena *gc)
static void setenv_connection_entry(struct env_set *es, const struct connection_entry *e, const int i)
static bool check_file_access(const int type, const char *file, const int mode, const char *opt)
static void gc_init(struct gc_arena *a)
const char * ifconfig_pool_persist_filename
static void options_postprocess_verify_ce(const struct options *options, const struct connection_entry *ce)
#define OPENVPN_8021Q_MIN_VID
bool auth_user_pass_verify_script_via_file
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.
#define SHOW_STR_INLINE(var)
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)
const char * options_string_version(const char *s, struct gc_arena *gc)
#define SHOW_PARM(name, value, format)
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 mute_replay_warnings
struct in6_addr ifconfig_ipv6_pool_base
const char * ifconfig_ipv6_local
const char * priv_key_file
const char * client_disconnect_script
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.
unsigned int push_option_types_found
void pre_connect_restore(struct options *o, struct gc_arena *gc)
int stale_routes_ageing_time
bool apply_push_options(struct options *options, struct buffer *buf, unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
struct iroute_ipv6 * iroutes_ipv6
static int constrain_int(int x, int min, int max)
#define SF_HOST_RANDOMIZE
#define COMP_F_ALLOW_ASYM
static bool apply_pull_filter(const struct options *o, char *line)
Filter an option line by all pull filters.
bool dhcp_release_by_adapter_index(const DWORD adapter_index)
#define OPT_P_ROUTE_EXTRAS
#define SF_USE_IP_PKTINFO
static void options_postprocess_verify(const struct options *o)
struct remote_list * remote_list
#define OPENVPN_KU_REQUIRED
Require keyUsage to be present in cert (0xFFFF is an invalid KU value)
struct tuntap_options tuntap_options
struct pull_filter_list * pull_filter_list
in_addr_t push_ifconfig_local_alias
in_addr_t push_ifconfig_constraint_network
#define MIN_SEQ_BACKTRACK
const char * route_script
void x509_track_add(const struct x509_track **ll_head, const char *name, int msglevel, struct gc_arena *gc)
#define CO_USE_TLS_KEY_MATERIAL_EXPORT
Bit-flag indicating that data channel key derivation is done using TLS keying material export [RFC570...
bool ifconfig_pool_verify_range(const int msglevel, const in_addr_t start, const in_addr_t end)
struct tuntap_options tuntap_options
int64_t renegotiate_bytes
static void options_postprocess_mutate_invariant(struct options *options)
enum vlan_acceptable_frames vlan_accept
struct buffer alloc_buf(size_t size)
#define TLS_VER_BAD
Parse a TLS version specifier.
void setenv_del(struct env_set *es, const char *name)
const char * ifconfig_local
in_addr_t push_ifconfig_local
bool dns_server_priority_parse(long *priority, const char *str, bool pulled)
Parses a string DNS server priority and validates it.
const char * learn_address_script
#define DEFAULT_TIME_BACKTRACK
int ping_rec_timeout_action
bool auth_retry_set(const int msglevel, const char *option)
static struct pull_filter * alloc_pull_filter(struct options *o)
const char * management_client_user
#define OPT_P_EXPLICIT_NOTIFY
const char title_string[]
void setenv_str_safe(struct env_set *es, const char *name, const char *value)
#define CO_USE_CC_EXIT_NOTIFY
Bit-flag indicating that explicit exit notifies should be sent via the control channel instead of usi...
const char * env_set_get(const struct env_set *es, const char *name)
static bool pkcs11_id_management
struct http_custom_header custom_headers[MAX_CUSTOM_HTTP_HEADER]
const char * auth_user_pass_verify_script
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
struct pull_filter * next
static enum tun_driver_type parse_windows_driver(const char *str, const int msglevel)
Parses –windows-driver config option.
int tun_mtu
the (user) configured tun-mtu.
int ifconfig_pool_persist_refresh_freq
void setenv_long_long(struct env_set *es, const char *name, long long value)
#define SSLF_CLIENT_CERT_OPTIONAL
static struct local_list * alloc_local_list_if_undef(struct connection_entry *ce, struct gc_arena *gc)
const char * ifconfig_ipv6_remote
#define TLS_CHANNEL_BUF_SIZE
bool buf_printf(struct buffer *buf, const char *format,...)
bool server_bridge_defined
#define ALLOC_ARRAY_GC(dptr, type, n, gc)
static void pre_connect_save(struct options *o)
#define CONNECTION_LIST_SIZE
static void buf_set_read(struct buffer *buf, const uint8_t *data, size_t size)
void options_warning(char *actual, const char *expected)
#define ALLOC_OBJ_GC(dptr, type, gc)
const char * management_user_pass
#define NS_CERT_CHECK_SERVER
Do not perform Netscape certificate type verification.
in_addr_t push_ifconfig_constraint_netmask
const char * remote_cert_eku
void print_default_gateway(const int msglevel, const struct route_gateway_info *rgi, const struct route_ipv6_gateway_info *rgi6)
#define NS_CERT_CHECK_CLIENT
Do not perform Netscape certificate type verification.
in_addr_t ntp[N_DHCP_ADDR]
struct dns_options clone_dns_options(const struct dns_options *o, struct gc_arena *gc)
Makes a deep copy of the passed DNS options.
#define COMP_F_ALLOW_STUB_ONLY
static void options_warning_safe_ml(const int msglevel, char *actual, const char *expected, size_t actual_n)
int dev_type_enum(const char *dev, const char *dev_type)
static void dhcp_option_dns6_parse(const char *parm, struct in6_addr *dns6_list, int *len, int msglevel)
uint8_t * data
Pointer to the allocated memory.
bool buf_parse(struct buffer *buf, const int delim, char *line, const int size)
const char * route_default_gateway
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...