]> git.ipfire.org Git - thirdparty/openvpn.git/blob - doc/man-sections/client-options.rst
cd3e565f2360259269110860506ab04da866cfb3
[thirdparty/openvpn.git] / doc / man-sections / client-options.rst
1 Client Options
2 --------------
3 The client options are used when connecting to an OpenVPN server configured
4 to use ``--server``, ``--server-bridge``, or ``--mode server`` in its
5 configuration.
6
7 --allow-pull-fqdn
8 Allow client to pull DNS names from server (rather than being limited to
9 IP address) for ``--ifconfig``, ``--route``, and ``--route-gateway``.
10
11 --allow-recursive-routing
12 When this option is set, OpenVPN will not drop incoming tun packets with
13 same destination as host.
14
15 --auth-token token
16 This is not an option to be used directly in any configuration files,
17 but rather push this option from a ``--client-connect`` script or a
18 ``--plugin`` which hooks into the :code:`OPENVPN_PLUGIN_CLIENT_CONNECT`
19 or :code:`OPENVPN_PLUGIN_CLIENT_CONNECT_V2` calls. This option provides a
20 possibility to replace the clients password with an authentication token
21 during the lifetime of the OpenVPN client.
22
23 Whenever the connection is renegotiated and the
24 ``--auth-user-pass-verify`` script or ``--plugin`` making use of the
25 :code:`OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY` hook is triggered, it will
26 pass over this token as the password instead of the password the user
27 provided. The authentication token can only be reset by a full reconnect
28 where the server can push new options to the client. The password the
29 user entered is never preserved once an authentication token has been
30 set. If the OpenVPN server side rejects the authentication token then
31 the client will receive an :code:`AUTH_FAILED` and disconnect.
32
33 The purpose of this is to enable two factor authentication methods, such
34 as HOTP or TOTP, to be used without needing to retrieve a new OTP code
35 each time the connection is renegotiated. Another use case is to cache
36 authentication data on the client without needing to have the users
37 password cached in memory during the life time of the session.
38
39 To make use of this feature, the ``--client-connect`` script or
40 ``--plugin`` needs to put
41 ::
42
43 push "auth-token UNIQUE_TOKEN_VALUE"
44
45 into the file/buffer for dynamic configuration data. This will then make
46 the OpenVPN server to push this value to the client, which replaces the
47 local password with the ``UNIQUE_TOKEN_VALUE``.
48
49 Newer clients (2.4.7+) will fall back to the original password method
50 after a failed auth. Older clients will keep using the token value and
51 react according to ``--auth-retry``
52
53 --auth-token-user base64username
54 Companion option to ``--auth-token``. This options allows one to override
55 the username used by the client when reauthenticating with the ``auth-token``.
56 It also allows one to use ``--auth-token`` in setups that normally do not use
57 username and password.
58
59 The username has to be base64 encoded.
60
61 --auth-user-pass
62 Authenticate with server using username/password.
63
64 Valid syntaxes:
65 ::
66
67 auth-user-pass
68 auth-user-pass up
69
70 If ``up`` is present, it must be a file containing username/password on 2
71 lines. If the password line is missing, OpenVPN will prompt for one.
72
73 If ``up`` is omitted, username/password will be prompted from the
74 console.
75
76 The server configuration must specify an ``--auth-user-pass-verify``
77 script to verify the username/password provided by the client.
78
79 --auth-retry type
80 Controls how OpenVPN responds to username/password verification errors
81 such as the client-side response to an :code:`AUTH_FAILED` message from
82 the server or verification failure of the private key password.
83
84 Normally used to prevent auth errors from being fatal on the client
85 side, and to permit username/password requeries in case of error.
86
87 An :code:`AUTH_FAILED` message is generated by the server if the client
88 fails ``--auth-user-pass`` authentication, or if the server-side
89 ``--client-connect`` script returns an error status when the client
90 tries to connect.
91
92 ``type`` can be one of:
93
94 :code:`none`
95 Client will exit with a fatal error (this is the default).
96
97 :code:`nointeract`
98 Client will retry the connection without requerying
99 for an ``--auth-user-pass`` username/password. Use this option for
100 unattended clients.
101
102 :code:`interact`
103 Client will requery for an ``--auth-user-pass``
104 username/password and/or private key password before attempting a
105 reconnection.
106
107 Note that while this option cannot be pushed, it can be controlled from
108 the management interface.
109
110 --client
111 A helper directive designed to simplify the configuration of OpenVPN's
112 client mode. This directive is equivalent to:
113 ::
114
115 pull
116 tls-client
117
118 --client-nat args
119 This pushable client option sets up a stateless one-to-one NAT rule on
120 packet addresses (not ports), and is useful in cases where routes or
121 ifconfig settings pushed to the client would create an IP numbering
122 conflict.
123
124 Examples:
125 ::
126
127 client-nat snat 192.168.0.0/255.255.0.0
128 client-nat dnat 10.64.0.0/255.255.0.0
129
130 ``network/netmask`` (for example :code:`192.168.0.0/255.255.0.0`) defines
131 the local view of a resource from the client perspective, while
132 ``alias/netmask`` (for example :code:`10.64.0.0/255.255.0.0`) defines the
133 remote view from the server perspective.
134
135 Use :code:`snat` (source NAT) for resources owned by the client and
136 :code:`dnat` (destination NAT) for remote resources.
137
138 Set ``--verb 6`` for debugging info showing the transformation of
139 src/dest addresses in packets.
140
141 --connect-retry args
142 Wait ``n`` seconds between connection attempts (default :code:`1`).
143 Repeated reconnection attempts are slowed down after 5 retries per
144 remote by doubling the wait time after each unsuccessful attempt.
145
146 Valid syntaxes:
147 ::
148
149 connect retry n
150 connect retry n max
151
152 If the optional argument ``max`` is specified, the maximum wait time in
153 seconds gets capped at that value (default :code:`300`).
154
155 --connect-retry-max n
156 ``n`` specifies the number of times each ``--remote`` or
157 ``<connection>`` entry is tried. Specifying ``n`` as :code:`1` would try
158 each entry exactly once. A successful connection resets the counter.
159 (default *unlimited*).
160
161 --connect-timeout n
162 See ``--server-poll-timeout``.
163
164 --dns args
165 Client DNS configuration to be used with the connection.
166
167 Valid syntaxes:
168 ::
169
170 dns search-domains domain [domain ...]
171 dns server n address addr[:port] [addr[:port] ...]
172 dns server n resolve-domains domain [domain ...]
173 dns server n dnssec yes|optional|no
174 dns server n transport DoH|DoT|plain
175 dns server n sni server-name
176
177 The ``--dns search-domains`` directive takes one or more domain names
178 to be added as DNS domain suffixes. If it is repeated multiple times within
179 a configuration the domains are appended, thus e.g. domain names pushed by
180 a server will amend locally defined ones.
181
182 The ``--dns server`` directive is used to configure DNS server ``n``.
183 The server id ``n`` must be a value between -128 and 127. For pushed
184 DNS server options it must be between 0 and 127. The server id is used
185 to group options and also for ordering the list of configured DNS servers;
186 lower numbers come first. DNS servers being pushed to a client replace
187 already configured DNS servers with the same server id.
188
189 The ``address`` option configures the IPv4 and / or IPv6 address(es) of
190 the DNS server. Up to eight addresses can be specified per DNS server.
191 Optionally a port can be appended after a colon. IPv6 addresses need to
192 be enclosed in brackets if a port is appended.
193
194 The ``resolve-domains`` option takes one or more DNS domains used to define
195 a split-dns or dns-routing setup, where only the given domains are resolved
196 by the server. Systems which do not support fine grained DNS domain
197 configuration will ignore this setting.
198
199 The ``dnssec`` option is used to configure validation of DNSSEC records.
200 While the exact semantics may differ for resolvers on different systems,
201 ``yes`` likely makes validation mandatory, ``no`` disables it, and ``optional``
202 uses it opportunistically.
203
204 The ``transport`` option enables DNS-over-HTTPS (``DoH``) or DNS-over-TLS (``DoT``)
205 for a DNS server. The ``sni`` option can be used with them to specify the
206 ``server-name`` for TLS server name indication.
207
208 Each server has to have at least one address configured for a configuration
209 to be valid. All the other options can be omitted.
210
211 Note that not all options may be supported on all platforms. As soon support
212 for different systems is implemented, information will be added here how
213 unsupported options are treated.
214
215 The ``--dns`` option will eventually obsolete the ``--dhcp-option`` directive.
216 Until then it will replace configuration at the places ``--dhcp-option`` puts it,
217 so that ``--dns`` overrides ``--dhcp-option``. Thus, ``--dns`` can be used today
218 to migrate from ``--dhcp-option``.
219
220 --explicit-exit-notify n
221 In UDP client mode or point-to-point mode, send server/peer an exit
222 notification if tunnel is restarted or OpenVPN process is exited. In
223 client mode, on exit/restart, this option will tell the server to
224 immediately close its client instance object rather than waiting for a
225 timeout.
226
227 If both server and client support sending this message using the control
228 channel, the message will be sent as control-channel message. Otherwise
229 the message is sent as data-channel message, which will be ignored by
230 data-channel offloaded peers.
231
232 The **n** parameter (default :code:`1` if not present) controls the
233 maximum number of attempts that the client will try to resend the exit
234 notification message if messages are sent in data-channel mode.
235
236 In UDP server mode, send :code:`RESTART` control channel command to
237 connected clients. The ``n`` parameter (default :code:`1` if not present)
238 controls client behavior. With ``n`` = :code:`1` client will attempt to
239 reconnect to the same server, with ``n`` = :code:`2` client will advance
240 to the next server.
241
242 OpenVPN will not send any exit notifications unless this option is
243 enabled.
244
245 --inactive args
246 Causes OpenVPN to exit after ``n`` seconds of inactivity on the TUN/TAP
247 device. The time length of inactivity is measured since the last
248 incoming or outgoing tunnel packet. The default value is 0 seconds,
249 which disables this feature.
250
251 Valid syntaxes:
252 ::
253
254 inactive n
255 inactive n bytes
256
257 If the optional ``bytes`` parameter is included, exit if less than
258 ``bytes`` of combined in/out traffic are produced on the tun/tap device
259 in ``n`` seconds.
260
261 In any case, OpenVPN's internal ping packets (which are just keepalives)
262 and TLS control packets are not considered "activity", nor are they
263 counted as traffic, as they are used internally by OpenVPN and are not
264 an indication of actual user activity.
265
266 --proto-force p
267 When iterating through connection profiles, only consider profiles using
268 protocol ``p`` (:code:`tcp` \| :code:`udp`).
269
270 Note that this specifically only filters by the transport layer
271 protocol, i.e. UDP or TCP. This does not affect whether IPv4 or
272 IPv6 is used as IP protocol.
273
274 For implementation reasons the option accepts the :code:`4` and :code:`6`
275 suffixes when specifying the protocol
276 (i.e. :code:`udp4` / :code:`udp6` / :code:`tcp4` / :code:`tcp6`).
277 However, these behave the same as without the suffix and should be avoided
278 to prevent confusion.
279
280 --pull
281 This option must be used on a client which is connecting to a
282 multi-client server. It indicates to OpenVPN that it should accept
283 options pushed by the server, provided they are part of the legal set of
284 pushable options (note that the ``--pull`` option is implied by
285 ``--client`` ).
286
287 In particular, ``--pull`` allows the server to push routes to the
288 client, so you should not use ``--pull`` or ``--client`` in situations
289 where you don't trust the server to have control over the client's
290 routing table.
291
292 --pull-filter args
293 Filter options on the client pushed by the server to the client.
294
295 Valid syntaxes:
296 ::
297
298 pull-filter accept text
299 pull-filter ignore text
300 pull-filter reject text
301
302 Filter options received from the server if the option starts with
303 :code:`text`. The action flag :code:`accept` allows the option,
304 :code:`ignore` removes it and :code:`reject` flags an error and triggers
305 a :code:`SIGUSR1` restart. The filters may be specified multiple times,
306 and each filter is applied in the order it is specified. The filtering of
307 each option stops as soon as a match is found. Unmatched options are accepted
308 by default.
309
310 Prefix comparison is used to match :code:`text` against the received option so
311 that
312 ::
313
314 pull-filter ignore "route"
315
316 would remove all pushed options starting with ``route`` which would
317 include, for example, ``route-gateway``. Enclose *text* in quotes to
318 embed spaces.
319
320 ::
321
322 pull-filter accept "route 192.168.1."
323 pull-filter ignore "route "
324
325 would remove all routes that do not start with ``192.168.1``.
326
327 *Note* that :code:`reject` may result in a repeated cycle of failure and
328 reconnect, unless multiple remotes are specified and connection to the
329 next remote succeeds. To silently ignore an option pushed by the server,
330 use :code:`ignore`.
331
332 --push-peer-info
333 Push additional information about the client to server. The following
334 data is always pushed to the server:
335
336 :code:`IV_VER=<version>`
337 The client OpenVPN version
338
339 :code:`IV_PLAT=[linux|solaris|openbsd|mac|netbsd|freebsd|win]`
340 The client OS platform
341
342 :code:`IV_PROTO`
343 Details about protocol extensions that the peer supports. The
344 variable is a bitfield and the bits are defined as follows:
345
346 - bit 0: Reserved, should always be zero
347 - bit 1: The peer supports peer-id floating mechanism
348 - bit 2: The client expects a push-reply and the server may
349 send this reply without waiting for a push-request first.
350 - bit 3: The client is capable of doing key derivation using
351 RFC5705 key material exporter.
352 - bit 4: The client is capable of accepting additional arguments
353 to the ``AUTH_PENDING`` message.
354 - bit 5: The client supports doing feature negotiation in P2P mode
355 - bit 6: The client is capable of parsing and receiving the ``--dns`` pushed option
356 - bit 7: The client is capable of sending exit notification via control channel using ``EXIT`` message. Also, the client is accepting the protocol-flags pushed option for the EKM capability
357 - bit 8: The client is capable of accepting ``AUTH_FAILED,TEMP`` messages
358 - bit 9: The client is capable of dynamic tls-crypt
359
360 :code:`IV_NCP=2`
361 Negotiable ciphers, client supports ``--cipher`` pushed by
362 the server, a value of 2 or greater indicates client supports
363 *AES-GCM-128* and *AES-GCM-256*. IV_NCP is *deprecated* in
364 favor of ``IV_CIPHERS``.
365
366 :code:`IV_CIPHERS=<data-ciphers>`
367 The client announces the list of supported ciphers configured with the
368 ``--data-ciphers`` option to the server.
369
370 :code:`IV_MTU=<max_mtu>`
371 The client announces the support of pushable MTU and the maximum MTU
372 it is willing to accept.
373
374 :code:`IV_GUI_VER=<gui_id> <version>`
375 The UI version of a UI if one is running, for example
376 :code:`de.blinkt.openvpn 0.5.47` for the Android app.
377
378 :code:`IV_SSO=[crtext,][openurl,][proxy_url]`
379 Additional authentication methods supported by the client.
380 This may be set by the client UI/GUI using ``--setenv``
381
382 The following flags depend on which compression formats are compiled in
383 and whether compression is allowed by options. See `Protocol options`_
384 for more details.
385
386 :code:`IV_LZO=1`
387 If client supports LZO compression.
388
389 :code:`IV_LZO_STUB=1`
390 If client was built with LZO stub capability. This is only sent if
391 ``IV_LZO=1`` is not sent.
392
393 :code:`IV_LZ4=1` and :code:`IV_LZ4v2=1`
394 If the client supports LZ4 compression.
395
396 :code:`IV_COMP_STUB=1` and :code:`IV_COMP_STUBv2=1`
397 If the client supports stub compression.
398
399 When ``--push-peer-info`` is enabled the additional information consists
400 of the following data:
401
402 :code:`IV_HWADDR=<string>`
403 This is intended to be a unique and persistent ID of the client.
404 The string value can be any readable ASCII string up to 64 bytes.
405 OpenVPN 2.x and some other implementations use the MAC address of
406 the client's interface used to reach the default gateway. If this
407 string is generated by the client, it should be consistent and
408 preserved across independent sessions and preferably
409 re-installations and upgrades.
410
411 :code:`IV_SSL=<version string>`
412 The ssl library version used by the client, e.g.
413 :code:`OpenSSL 1.0.2f 28 Jan 2016`.
414
415 :code:`IV_PLAT_VER=x.y`
416 The version of the operating system, e.g. 6.1 for Windows 7.
417 This is only sent on Windows operating systems.
418
419 :code:`UV_<name>=<value>`
420 Client environment variables whose names start with
421 :code:`UV_`
422
423 --remote args
424 Remote host name or IP address, port and protocol.
425
426 Valid syntaxes:
427 ::
428
429 remote host
430 remote host port
431 remote host port proto
432
433 The ``port`` and ``proto`` arguments are optional. The OpenVPN client
434 will try to connect to a server at ``host:port``. The ``proto`` argument
435 indicates the protocol to use when connecting with the remote, and may be
436 :code:`tcp` or :code:`udp`. To enforce IPv4 or IPv6 connections add a
437 :code:`4` or :code:`6` suffix; like :code:`udp4` / :code:`udp6`
438 / :code:`tcp4` / :code:`tcp6`.
439
440 On the client, multiple ``--remote`` options may be specified for
441 redundancy, each referring to a different OpenVPN server, in the order
442 specified by the list of ``--remote`` options. Specifying multiple
443 ``--remote`` options for this purpose is a special case of the more
444 general connection-profile feature. See the ``<connection>``
445 documentation below.
446
447 The client will move on to the next host in the list, in the event of
448 connection failure. Note that at any given time, the OpenVPN client will
449 at most be connected to one server.
450
451 Examples:
452 ::
453
454 remote server1.example.net
455 remote server1.example.net 1194
456 remote server2.example.net 1194 tcp
457
458 *Note:*
459 Since UDP is connectionless, connection failure is defined by
460 the ``--ping`` and ``--ping-restart`` options.
461
462 Also, if you use multiple ``--remote`` options, AND you are dropping
463 root privileges on the client with ``--user`` and/or ``--group`` AND
464 the client is running a non-Windows OS, if the client needs to switch
465 to a different server, and that server pushes back different TUN/TAP
466 or route settings, the client may lack the necessary privileges to
467 close and reopen the TUN/TAP interface. This could cause the client
468 to exit with a fatal error.
469
470 If ``--remote`` is unspecified, OpenVPN will listen for packets from any
471 IP address, but will not act on those packets unless they pass all
472 authentication tests. This requirement for authentication is binding on
473 all potential peers, even those from known and supposedly trusted IP
474 addresses (it is very easy to forge a source IP address on a UDP
475 packet).
476
477 When used in TCP mode, ``--remote`` will act as a filter, rejecting
478 connections from any host which does not match ``host``.
479
480 If ``host`` is a DNS name which resolves to multiple IP addresses,
481 OpenVPN will try them in the order that the system getaddrinfo()
482 presents them, so priorization and DNS randomization is done by the
483 system library. Unless an IP version is forced by the protocol
484 specification (4/6 suffix), OpenVPN will try both IPv4 and IPv6
485 addresses, in the order getaddrinfo() returns them.
486
487 --remote-random
488 When multiple ``--remote`` address/ports are specified, or if connection
489 profiles are being used, initially randomize the order of the list as a
490 kind of basic load-balancing measure.
491
492 --remote-random-hostname
493 Prepend a random string (6 bytes, 12 hex characters) to hostname to
494 prevent DNS caching. For example, "foo.bar.gov" would be modified to
495 "<random-chars>.foo.bar.gov".
496
497 --resolv-retry n
498 If hostname resolve fails for ``--remote``, retry resolve for ``n``
499 seconds before failing.
500
501 Set ``n`` to :code:`infinite` to retry indefinitely.
502
503 By default, ``--resolv-retry infinite`` is enabled. You can disable by
504 setting n=0.
505
506 --single-session
507 After initially connecting to a remote peer, disallow any new
508 connections. Using this option means that a remote peer cannot connect,
509 disconnect, and then reconnect.
510
511 If the daemon is reset by a signal or ``--ping-restart``, it will allow
512 one new connection.
513
514 ``--single-session`` can be used with ``--ping-exit`` or ``--inactive``
515 to create a single dynamic session that will exit when finished.
516
517 --server-poll-timeout n
518 When connecting to a remote server do not wait for more than ``n``
519 seconds for a response before trying the next server. The default value
520 is :code:`120`. This timeout includes proxy and TCP connect timeouts.
521
522 --static-challenge args
523 Enable static challenge/response protocol
524
525 Valid syntax:
526 ::
527
528 static-challenge text echo
529
530 The ``text`` challenge text is presented to the user which describes what
531 information is requested. The ``echo`` flag indicates if the user's
532 input should be echoed on the screen. Valid ``echo`` values are
533 :code:`0` or :code:`1`.
534
535 See management-notes.txt in the OpenVPN distribution for a description of
536 the OpenVPN challenge/response protocol.
537
538 .. include:: proxy-options.rst