doc/openvpn.8
6fbf66fa
 .\"  OpenVPN -- An application to securely tunnel IP networks
 .\"             over a single TCP/UDP port, with support for SSL/TLS-based
 .\"             session authentication and key exchange,
 .\"             packet encryption, packet authentication, and
 .\"             packet compression.
 .\"
49979459
 .\"  Copyright (C) 2002-2018 OpenVPN Inc <sales@openvpn.net>
6fbf66fa
 .\"
 .\"  This program is free software; you can redistribute it and/or modify
 .\"  it under the terms of the GNU General Public License version 2
 .\"  as published by the Free Software Foundation.
 .\"
 .\"  This program is distributed in the hope that it will be useful,
 .\"  but WITHOUT ANY WARRANTY; without even the implied warranty of
 .\"  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 .\"  GNU General Public License for more details.
 .\"
caa54ac3
 .\"  You should have received a copy of the GNU General Public License along
 .\"  with this program; if not, write to the Free Software Foundation, Inc.,
 .\"  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
6fbf66fa
 .\"
 .\" Manual page for openvpn
c42fcbfe
 .\"
6fbf66fa
 .\" SH section heading
 .\" SS subsection heading
 .\" LP paragraph
 .\" IP indented paragraph
 .\" TP hanging label
c42fcbfe
 .\"
148329ca
 .\" .nf -- no formatting
 .\" .fi -- resume formatting
 .\" .ft 3 -- boldface
 .\" .ft -- normal face
 .\" .in +|-{n} -- indent
 .\"
5ed5ac5c
 .\" Support macros - this is not present on all platforms
 .\" Continuation line for .TP header.
 .de TQ
 .  br
 .  ns
 .  TP \\$1\" no doublequotes around argument!
 ..
 .\" End of TQ macro
 .TH openvpn 8 "28 February 2018"
6fbf66fa
 .\"*********************************************************
 .SH NAME
 openvpn \- secure IP tunnel daemon.
 .\"*********************************************************
 .SH SYNOPSIS
148329ca
 .ft 3
 openvpn [ options ... ]
 .ft
6fbf66fa
 .\"*********************************************************
 .SH INTRODUCTION
 .LP
 OpenVPN is an open source VPN daemon by James Yonan.
 Because OpenVPN tries to
 be a universal VPN tool offering a great deal of flexibility,
 there are a lot of options on this manual page.
 If you're new to OpenVPN, you might want to skip ahead to the
 examples section where you will see how to construct simple
 VPNs on the command line without even needing a configuration file.
 
 Also note that there's more documentation and examples on
 the OpenVPN web site:
 .I http://openvpn.net/
 
 And if you would like to see a shorter version of this manual,
 see the openvpn usage message which can be obtained by
 running
 .B openvpn
 without any parameters.
 .\"*********************************************************
 .SH DESCRIPTION
 .LP
 OpenVPN is a robust and highly flexible VPN daemon.
 OpenVPN supports SSL/TLS security, ethernet bridging,
 TCP or UDP tunnel transport through proxies or NAT,
 support for dynamic IP addresses and DHCP,
 scalability to hundreds or thousands of users,
 and portability to most major OS platforms.
 
 OpenVPN is tightly bound to the OpenSSL library, and derives much
 of its crypto capabilities from it.
 
 OpenVPN supports
 conventional encryption
510c8ade
 using a pre\-shared secret key
6fbf66fa
 .B (Static Key mode)
 or
 public key security
 .B (SSL/TLS mode)
 using client & server certificates.
 OpenVPN also
510c8ade
 supports non\-encrypted TCP/UDP tunnels.
6fbf66fa
 
 OpenVPN is designed to work with the
 .B TUN/TAP
 virtual networking interface that exists on most platforms.
 
 Overall, OpenVPN aims to offer many of the key features of IPSec but
 with a relatively lightweight footprint.
 .\"*********************************************************
 .SH OPTIONS
 OpenVPN allows any option to be placed either on the command line
 or in a configuration file.  Though all command line options are preceded
510c8ade
 by a double\-leading\-dash ("\-\-"), this prefix can be removed when
6fbf66fa
 an option is placed in a configuration file.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-help
6fbf66fa
 Show options.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-config file
6fbf66fa
 Load additional config options from
 .B file
 where each line corresponds to one command line option,
48fe8bb3
 but with the leading '\-\-' removed.
6fbf66fa
 
 If
48fe8bb3
 .B \-\-config file
6fbf66fa
 is the only option to the openvpn command,
 the
48fe8bb3
 .B \-\-config
6fbf66fa
 can be removed, and the command can be given as
 .B openvpn file
 
 Note that
 configuration files can be nested to a reasonable depth.
 
7256e6b4
 Double quotation or single quotation characters ("", '')
 can be used to enclose single parameters containing whitespace,
6fbf66fa
 and "#" or ";" characters in the first column
 can be used to denote comments.
 
510c8ade
 Note that OpenVPN 2.0 and higher performs backslash\-based shell
7256e6b4
 escaping for characters not in single quotations,
 so the following mappings should be observed:
6fbf66fa
 
 .nf
148329ca
 .ft 3
 .in +4
6fbf66fa
 \\\\       Maps to a single backslash character (\\).
 \\"       Pass a literal doublequote character ("), don't
          interpret it as enclosing a parameter.
 \\[SPACE] Pass a literal space or tab character, don't
          interpret it as a parameter delimiter.
148329ca
 .in -4
6fbf66fa
 .ft
 .fi
 
 For example on Windows, use double backslashes to
 represent pathnames:
 
 .nf
148329ca
 .ft 3
 .in +4
6fbf66fa
 secret "c:\\\\OpenVPN\\\\secret.key"
148329ca
 .in -4
6fbf66fa
 .ft
 .fi
 
 For examples of configuration files,
 see
 .I http://openvpn.net/examples.html
 
 Here is an example configuration file:
148329ca
 
6fbf66fa
 .nf
148329ca
 .ft 3
 .in +4
6fbf66fa
 #
 # Sample OpenVPN configuration file for
510c8ade
 # using a pre\-shared static key.
6fbf66fa
 #
 # '#' or ';' may be used to delimit comments.
 
 # Use a dynamic tun device.
 dev tun
 
 # Our remote peer
 remote mypeer.mydomain
 
 # 10.1.0.1 is our local VPN endpoint
 # 10.1.0.2 is our remote VPN endpoint
 ifconfig 10.1.0.1 10.1.0.2
 
510c8ade
 # Our pre\-shared static key
6fbf66fa
 secret static.key
148329ca
 .in -4
6fbf66fa
 .ft
 .fi
 .\"*********************************************************
 .SS Tunnel Options:
 .TP
48fe8bb3
 .B \-\-mode m
6fbf66fa
 Set OpenVPN major mode.  By default, OpenVPN runs in
510c8ade
 point\-to\-point mode ("p2p").  OpenVPN 2.0 introduces
 a new mode ("server") which implements a multi\-client
6fbf66fa
 server capability.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-local host
04f4b793
 Local host name or IP address for bind.
6fbf66fa
 If specified, OpenVPN will bind to this address only.
 If unspecified, OpenVPN will bind to all interfaces.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-remote host [port] [proto]
20006b8e
 Remote host name or IP address.  On the client, multiple
48fe8bb3
 .B \-\-remote
6fbf66fa
 options may be specified for redundancy, each referring
4e9a51d7
 to a different OpenVPN server.  Specifying multiple
48fe8bb3
 .B \-\-remote
4e9a51d7
 options for this purpose is a special case of the more
510c8ade
 general connection\-profile feature.  See the
4e9a51d7
 .B <connection>
 documentation below.
6fbf66fa
 
 The OpenVPN client will try to connect to a server at
 .B host:port
 in the order specified by the list of
48fe8bb3
 .B \-\-remote
6fbf66fa
 options.
 
4e9a51d7
 .B proto
 indicates the protocol to use when connecting with the
 remote, and may be "tcp" or "udp".
 
23d61c56
 For forcing IPv4 or IPv6 connection suffix tcp or udp
 with 4/6 like udp4/udp6/tcp4/tcp6.
 
6fbf66fa
 The client will move on to the next host in the list,
 in the event of connection failure.
 Note that at any given time, the OpenVPN client
 will at most be connected to
 one server.
 
20006b8e
 Note that since UDP is connectionless, connection failure
6fbf66fa
 is defined by the
48fe8bb3
 .B \-\-ping
6fbf66fa
 and
2d321609
 .B \-\-ping\-restart
6fbf66fa
 options.
 
20006b8e
 Note the following corner case:  If you use multiple
48fe8bb3
 .B \-\-remote
20006b8e
 options, AND you are dropping root privileges on
 the client with
48fe8bb3
 .B \-\-user
20006b8e
 and/or
48fe8bb3
 .B \-\-group,
510c8ade
 AND the client is running a non\-Windows OS, if the client needs
20006b8e
 to switch to a different server, and that server pushes
 back different TUN/TAP or route settings, the client may lack
 the necessary privileges to close and reopen the TUN/TAP interface.
 This could cause the client to exit with a fatal error.
 
6fbf66fa
 If
48fe8bb3
 .B \-\-remote
6fbf66fa
 is unspecified, OpenVPN will listen
 for packets from any IP address, but will not act on those packets unless
 they pass all authentication tests.  This requirement for authentication
 is binding on all potential peers, even those from known and supposedly
 trusted IP addresses (it is very easy to forge a source IP address on
 a UDP packet).
 
 When used in TCP mode, 
48fe8bb3
 .B \-\-remote
6fbf66fa
 will act as a filter, rejecting connections from any host which does
 not match
 .B host.
 
 If
 .B host
 is a DNS name which resolves to multiple IP addresses,
03225103
 OpenVPN will try them in the order that the system getaddrinfo()
 presents them, so priorization and DNS randomization is done
 by the system library.  Unless an IP version is forced by the
 protocol specification (4/6 suffix), OpenVPN will try both IPv4
 and IPv6 addresses, in the order getaddrinfo() returns them.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-remote\-random\-hostname
7de8f3f3
 Prepend a random string (6 bytes, 12 hex characters) to hostname to prevent
6215e11e
 DNS caching.  For example, "foo.bar.gov" would be modified to
510c8ade
 "<random\-chars>.foo.bar.gov".
6215e11e
 .\"*********************************************************
 .TP
4e9a51d7
 .B <connection>
 Define a client connection
 profile.  Client connection profiles are groups of OpenVPN options that
 describe how to connect to a given OpenVPN server.  Client connection
 profiles are specified within an OpenVPN configuration file, and
 each profile is bracketed by
 .B <connection>
 and
 .B </connection>.
 
 An OpenVPN client will try each connection profile sequentially
 until it achieves a successful connection.  
 
2d321609
 .B \-\-remote\-random
4e9a51d7
 can be used to initially "scramble" the connection
 list.
 
 Here is an example of connection profile usage:
 
 .nf
148329ca
 .ft 3
 .in +4
4e9a51d7
 client
 dev tun
 
 <connection>
 remote 198.19.34.56 1194 udp
 </connection>
 
 <connection>
 remote 198.19.34.56 443 tcp
 </connection>
 
 <connection>
 remote 198.19.34.56 443 tcp
2d321609
 http\-proxy 192.168.0.8 8080
4e9a51d7
 </connection>
 
 <connection>
 remote 198.19.36.99 443 tcp
2d321609
 http\-proxy 192.168.0.8 8080
4e9a51d7
 </connection>
 
2d321609
 persist\-key
 persist\-tun
4e9a51d7
 pkcs12 client.p12
2dc33226
 remote\-cert\-tls server
4e9a51d7
 verb 3
148329ca
 .in -4
4e9a51d7
 .ft
 .fi
 
 First we try to connect to a server at 198.19.34.56:1194 using UDP.
 If that fails, we then try to connect to 198.19.34.56:443 using TCP.
 If that also fails, then try connecting through an HTTP proxy at 
 192.168.0.8:8080 to 198.19.34.56:443 using TCP.  Finally, try to
 connect through the same proxy to a server at 198.19.36.99:443
 using TCP.
 
 The following OpenVPN options may be used inside of
 a
 .B <connection>
 block:
 
 .B bind,
2d321609
 .B connect\-retry,
 .B connect\-retry\-max,
 .B connect\-timeout,
 .B explicit\-exit\-notify,
4e9a51d7
 .B float,
d94873f6
 .B fragment,
2d321609
 .B http\-proxy,
 .B http\-proxy\-option,
57d6f103
 .B key\-direction,
2d321609
 .B link\-mtu,
4e9a51d7
 .B local,
 .B lport,
d94873f6
 .B mssfix,
2d321609
 .B mtu\-disc,
4e9a51d7
 .B nobind,
 .B port,
 .B proto,
 .B remote,
 .B rport,
2d321609
 .B socks\-proxy,
57d6f103
 .B tls\-auth,
 .B tls\-crypt,
2d321609
 .B tun\-mtu and
 .B tun\-mtu\-extra.
4e9a51d7
 
 A defaulting mechanism exists for specifying options to apply to
 all
 .B <connection>
 profiles.  If any of the above options (with the exception of
 .B remote
 ) appear outside of a
 .B <connection>
 block, but in a configuration file which has one or more
 .B <connection>
 blocks, the option setting will be used as a default for
 .B <connection>
 blocks which follow it in the configuration file.
 
 For example, suppose the
 .B nobind
 option were placed in the sample configuration file above, near
 the top of the file, before the first
 .B <connection>
 block.  The effect would be as if
 .B nobind
 were declared in all
 .B <connection>
 blocks below it.
51e6e5b0
 .\"*********************************************************
 .TP
2d321609
 .B \-\-proto\-force p
51e6e5b0
 When iterating through connection profiles,
 only consider profiles using protocol
 .B p
 ('tcp'|'udp'). 
4e9a51d7
 .\"*********************************************************
 .TP
2d321609
 .B \-\-remote\-random
6fbf66fa
 When multiple
48fe8bb3
 .B \-\-remote
4e9a51d7
 address/ports are specified, or if connection profiles are being
 used, initially randomize the order of the list
510c8ade
 as a kind of basic load\-balancing measure.
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-proto p
6fbf66fa
 Use protocol
 .B p
 for communicating with remote host.
 .B p
 can be
 .B udp,
2d321609
 .B tcp\-client,
6fbf66fa
 or
2d321609
 .B tcp\-server.
6fbf66fa
 
 The default protocol is
 .B udp
 when
48fe8bb3
 .B \-\-proto
6fbf66fa
 is not specified.
 
 For UDP operation,
48fe8bb3
 .B \-\-proto udp
6fbf66fa
 should be specified on both peers.
 
 For TCP operation, one peer must use
2d321609
 .B \-\-proto tcp\-server
6fbf66fa
 and the other must use
2d321609
 .B \-\-proto tcp\-client.
6fbf66fa
 A peer started with
2d321609
 .B tcp\-server
6fbf66fa
 will wait indefinitely for an incoming connection.  A peer
 started with
2d321609
 .B tcp\-client
6fbf66fa
 will attempt to connect, and if that fails, will sleep for 5
 seconds (adjustable via the
2d321609
 .B \-\-connect\-retry
b540a9e0
 option) and try again infinite or up to N retries (adjustable via the
2d321609
 .B \-\-connect\-retry\-max
b540a9e0
 option).  Both TCP client and server will simulate
6fbf66fa
 a SIGUSR1 restart signal if either side resets the connection.
 
 OpenVPN is designed to operate optimally over UDP, but TCP capability is provided
 for situations where UDP cannot be used.
 In comparison with UDP, TCP will usually be
 somewhat less efficient and less robust when used over unreliable or congested
 networks.
 
 This article outlines some of problems with tunneling IP over TCP:
 
510c8ade
 .I http://sites.inka.de/sites/bigred/devel/tcp\-tcp.html
6fbf66fa
 
 There are certain cases, however, where using TCP may be advantageous from
510c8ade
 a security and robustness perspective, such as tunneling non\-IP or
 application\-level UDP protocols, or tunneling protocols which don't
 possess a built\-in reliability layer.
6fbf66fa
 .\"*********************************************************
 .TP
5d429efd
 .B \-\-connect\-retry n [max]
23d61c56
 Wait
6fbf66fa
 .B n
5d429efd
 seconds  between connection attempts (default=5). Repeated reconnection
 attempts are slowed down after 5 retries per remote by doubling the wait
 time after each unsuccessful attempt. The optional argument
 .B max
 specifies the maximum value of wait time in seconds at which it gets
 capped (default=300).
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-connect\-retry\-max n
b540a9e0
 .B n
5d429efd
 specifies the number of times each
23d61c56
 .B \-\-remote
5d429efd
 or
23d61c56
 .B <connection>
5d429efd
 entry is tried. Specifying
23d61c56
 .B n
5d429efd
 as one would try each entry exactly once. A successful connection
 resets the counter. (default=unlimited).
b540a9e0
 .\"*********************************************************
f214bb21
 .TP
2d321609
 .B \-\-show\-proxy\-settings
54d40afd
 Show sensed HTTP or SOCKS proxy settings. Currently, only Windows clients
 support this option.
 .\"*********************************************************
 .TP
510c8ade
 .B \-\-http\-proxy server port [authfile|'auto'|'auto\-nct'] [auth\-method]
6fbf66fa
 Connect to remote host through an HTTP proxy at address
 .B server
 and port
 .B port.
510c8ade
 If HTTP Proxy\-Authenticate is required,
6fbf66fa
 .B authfile
 is a file containing a username and password on 2 lines, or
ec0c1dca
 "stdin" to prompt from console. Its content can also be specified
 in the config file with the
 .B \-\-http\-proxy\-user\-pass
 option. (See section on inline files)
6fbf66fa
 
2d321609
 .B auth\-method
f214bb21
 should be one of "none", "basic", or "ntlm".
 
b27dc04c
 HTTP Digest authentication is supported as well, but only via
 the
 .B auto
 or
2d321609
 .B auto\-nct
b27dc04c
 flags (below).
 
f214bb21
 The
 .B auto
 flag causes OpenVPN to automatically determine the
2d321609
 .B auth\-method
f214bb21
 and query stdin or the management interface for
 username/password credentials, if required.  This flag
 exists on OpenVPN 2.1 or higher.
b27dc04c
 
 The
2d321609
 .B auto\-nct
510c8ade
 flag (no clear\-text auth) instructs OpenVPN to automatically
b27dc04c
 determine the authentication method, but to reject weak
 authentication protocols such as HTTP Basic Authentication.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-http\-proxy\-option type [parm]
6fbf66fa
 Set extended HTTP proxy options.
 Repeat to set multiple options.
 
510c8ade
 .B VERSION version \-\-
6fbf66fa
 Set HTTP version number to
 .B version
 (default=1.0).
 
510c8ade
 .B AGENT user\-agent \-\-
 Set HTTP "User\-Agent" string to
 .B user\-agent.
d0cb816c
 
510c8ade
 .B CUSTOM\-HEADER name content \-\-
d0cb816c
 Adds the custom Header with
 .B name
 as name and
 .B content
 as the content of the custom HTTP header.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-socks\-proxy server [port] [authfile]
6fbf66fa
 Connect to remote host through a Socks5 proxy at address
 .B server
 and port
 .B port
 (default=1080).
e0a7471f
 .B authfile
 (optional) is a file containing a username and password on 2 lines, or
 "stdin" to prompt from console.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-resolv\-retry n
6fbf66fa
 If hostname resolve fails for
48fe8bb3
 .B \-\-remote,
6fbf66fa
 retry resolve for
 .B n
 seconds before failing.
 
 Set
 .B n
 to "infinite" to retry indefinitely.
 
 By default,
2d321609
 .B \-\-resolv\-retry infinite
6fbf66fa
 is enabled.  You can disable by setting n=0.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-float
6fbf66fa
 Allow remote peer to change its IP address and/or port number, such as due to
 DHCP (this is the default if
48fe8bb3
 .B \-\-remote
6fbf66fa
 is not used).
48fe8bb3
 .B \-\-float
6fbf66fa
 when specified with
48fe8bb3
 .B \-\-remote
6fbf66fa
 allows an OpenVPN session to initially connect to a peer
 at a known address, however if packets arrive from a new
 address and pass all authentication tests, the new address
 will take control of the session.  This is useful when
 you are connecting to a peer which holds a dynamic address
510c8ade
 such as a dial\-in user or DHCP client.
6fbf66fa
 
 Essentially,
48fe8bb3
 .B \-\-float
6fbf66fa
 tells OpenVPN to accept authenticated packets
 from any address, not only the address which was specified in the
48fe8bb3
 .B \-\-remote
6fbf66fa
 option.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-ipchange cmd
d6285998
 Run command
6fbf66fa
 .B cmd
510c8ade
 when our remote ip\-address is initially authenticated or
6fbf66fa
 changes.
 
d6285998
 .B cmd
 consists of a path to script (or executable program), optionally
510c8ade
 followed by arguments. The path and arguments may be single\- or double\-quoted
d6285998
 and/or escaped using a backslash, and should be separated by one or more spaces.
 
 When
 .B cmd
 is executed two arguments are appended after any arguments specified in
 .B cmd
 , as follows:
6fbf66fa
 
 .B cmd ip_address port_number
 
 Don't use
48fe8bb3
 .B \-\-ipchange
6fbf66fa
 in
48fe8bb3
 .B \-\-mode server
6fbf66fa
 mode.  Use a
2d321609
 .B \-\-client\-connect
6fbf66fa
 script instead.
 
 See the "Environmental Variables" section below for
 additional parameters passed as environmental variables.
 
 If you are running in a dynamic IP address environment where
 the IP addresses of either peer could change without notice,
 you can use this script, for example, to edit the
 .I /etc/hosts
 file with the current address of the peer.  The script will
 be run every time the remote peer changes its IP address.
 
 Similarly if
 .I our
 IP address changes due to DHCP, we should configure
 our IP address change script (see man page for
 .BR dhcpcd (8)
 ) to deliver a
 .B SIGHUP
 or
 .B SIGUSR1
 signal to OpenVPN.  OpenVPN will then
 reestablish a connection with its most recently authenticated
 peer on its new IP address.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-port port
d3eacb2d
 TCP/UDP port number or port name for both local and remote (sets both
 .B \-\-lport
 and
 .B \-\-rport
 options to given port).  The current
6fbf66fa
 default of 1194 represents the official IANA port number
510c8ade
 assignment for OpenVPN and has been used since version 2.0\-beta17.
6fbf66fa
 Previous versions used port 5000 as the default.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-lport port
d3eacb2d
 Set local TCP/UDP port number or name.  Cannot be used together with
 .B \-\-nobind
 option.
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-rport port
d3eacb2d
 Set TCP/UDP port number or name used by the
 .B \-\-remote
 option. The port can also be set directly using the
 .B \-\-remote
 option.
6fbf66fa
 .\"*********************************************************
 .TP
8832c6c4
 .B \-\-bind [ipv6only]
04f4b793
 Bind to local address and port. This is the default unless any of 
2d321609
 .B \-\-proto tcp\-client
04f4b793
 ,
2d321609
 .B \-\-http\-proxy
04f4b793
 or
2d321609
 .B \-\-socks\-proxy
04f4b793
 are used.
8832c6c4
 
 If the
 .B ipv6only
 keyword is present OpenVPN will bind only to IPv6 (as oposed
 to IPv6 and IPv4) when a IPv6 socket is opened.
 
04f4b793
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-nobind
6fbf66fa
 Do not bind to local address and port.  The IP stack will allocate
 a dynamic port for returning packets.  Since the value of the dynamic port
 could not be known in advance by a peer, this option is only suitable for
 peers which will be initiating connections by using the
48fe8bb3
 .B \-\-remote
6fbf66fa
 option.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-dev tunX | tapX | null
6fbf66fa
 TUN/TAP virtual network device (
 .B X
 can be omitted for a dynamic device.)
 
 See examples section below
 for an example on setting up a TUN device.
 
 You must use either tun devices on both ends of the connection
 or tap devices on both ends.  You cannot mix them, as they
148329ca
 represent different underlying network layers.
6fbf66fa
 
 .B tun
148329ca
 devices encapsulate IPv4 or IPv6 (OSI Layer 3) while
6fbf66fa
 .B tap
148329ca
 devices encapsulate Ethernet 802.3 (OSI Layer 2).
6fbf66fa
 .\"*********************************************************
 .TP
510c8ade
 .B \-\-dev\-type device\-type
6fbf66fa
 Which device type are we using?
510c8ade
 .B device\-type
6fbf66fa
 should be
 .B tun
148329ca
 (OSI Layer 3)
6fbf66fa
 or
148329ca
 .B tap
 (OSI Layer 2).
6fbf66fa
 Use this option only if the TUN/TAP device used with
48fe8bb3
 .B \-\-dev
6fbf66fa
 does not begin with
 .B tun
 or
 .B tap.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-topology mode
3c7f2f55
 Configure virtual addressing topology when running in
48fe8bb3
 .B \-\-dev tun
3c7f2f55
 mode.  This directive has no meaning in
48fe8bb3
 .B \-\-dev tap
3c7f2f55
 mode, which always uses a
 .B subnet
 topology.
 
 If you set this directive on the server, the
48fe8bb3
 .B \-\-server
3c7f2f55
 and
2d321609
 .B \-\-server\-bridge
3c7f2f55
 directives will automatically push your chosen topology setting to clients
 as well.  This directive can also be manually pushed to clients.  Like the
48fe8bb3
 .B \-\-dev
3c7f2f55
 directive, this directive must always be compatible between client and server.
 
 .B mode
 can be one of:
 
48fe8bb3
 .B net30 \-\-
510c8ade
 Use a point\-to\-point topology, by allocating one /30 subnet per client.
 This is designed to allow point\-to\-point semantics when some
3c7f2f55
 or all of the connecting clients might be Windows systems.  This is the
 default on OpenVPN 2.0.
 
48fe8bb3
 .B p2p \-\-
510c8ade
 Use a point\-to\-point topology where the remote endpoint of the client's
3c7f2f55
 tun interface always points to the local endpoint of the server's tun interface.
 This mode allocates a single IP address per connecting client.
 Only use
 when none of the connecting clients are Windows systems.  This mode
 is functionally equivalent to the
2d321609
 .B \-\-ifconfig\-pool\-linear
6e4a8175
 directive which is available in OpenVPN 2.0, is deprecated and will be
 removed in OpenVPN 2.5
3c7f2f55
 
48fe8bb3
 .B subnet \-\-
510c8ade
 Use a subnet rather than a point\-to\-point topology by
3c7f2f55
 configuring the tun interface with a local IP address and subnet mask,
 similar to the topology used in
48fe8bb3
 .B \-\-dev tap
3c7f2f55
 and ethernet bridging mode.
 This mode allocates a single IP address per connecting client and works on
 Windows as well.  Only available when server and clients are OpenVPN 2.1 or
 higher, or OpenVPN 2.0.x which has been manually patched with the
48fe8bb3
 .B \-\-topology
3c7f2f55
 directive code.  When used on Windows, requires version 8.2 or higher
510c8ade
 of the TAP\-Win32 driver.  When used on *nix, requires that the tun
3c7f2f55
 driver supports an
 .BR ifconfig (8)
 command which sets a subnet instead of a remote endpoint IP address.
f214bb21
 
 This option exists in OpenVPN 2.1 or higher.
3a840739
 
 Note: Using
 .B \-\-topology subnet
 changes the interpretation of the arguments of
 .B \-\-ifconfig
 to mean "address netmask", no longer "local remote".
3c7f2f55
 .\"*********************************************************
 .TP
2d321609
 .B \-\-dev\-node node
6fbf66fa
 Explicitly set the device node rather than using
 /dev/net/tun, /dev/tun, /dev/tap, etc.  If OpenVPN
 cannot figure out whether
 .B node
 is a TUN or TAP device based on the name, you should
 also specify
2d321609
 .B \-\-dev\-type tun
6fbf66fa
 or
2d321609
 .B \-\-dev\-type tap.
6fbf66fa
 
fbc04bed
 Under Mac OS X this option can be used to specify the default tun
 implementation. Using
 .B \-\-dev\-node utun
 forces usage of the native Darwin tun kernel support. Use
 .B \-\-dev\-node utunN
 to select a specific utun instance. To force using the tun.kext (/dev/tunX) use
66ff10ef
 .B \-\-dev\-node tun\fR.
 When not specifying a
fbc04bed
 .B \-\-dev\-node
 option openvpn will first try to open utun, and fall back to tun.kext.
 
510c8ade
 On Windows systems, select the TAP\-Win32 adapter which
6fbf66fa
 is named
 .B node
 in the Network Connections Control Panel or the
 raw GUID of the adapter enclosed by braces.
 The
2d321609
 .B \-\-show\-adapters
6fbf66fa
 option under Windows can also be used
510c8ade
 to enumerate all available TAP\-Win32
6fbf66fa
 adapters and will show both the network
 connections control panel name and the GUID for
510c8ade
 each TAP\-Win32 adapter.
e12fe286
 .TP
48fe8bb3
 .B \-\-lladdr address
e12fe286
 Specify the link layer address, more commonly known as the MAC address.
 Only applied to TAP devices.
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-iproute cmd
0aee9ca7
 Set alternate command to execute instead of default iproute2 command.
 May be used in order to execute OpenVPN in unprivileged environment.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-ifconfig l rn
6fbf66fa
 Set TUN/TAP adapter parameters. 
 .B l
 is the IP address of the local VPN endpoint.
510c8ade
 For TUN devices in point\-to\-point mode,
6fbf66fa
 .B rn
 is the IP address of the remote VPN endpoint.
3a840739
 For TAP devices, or TUN devices used with
 .B \-\-topology subnet,
6fbf66fa
 .B rn
3a840739
 is the subnet mask of the virtual network segment
6fbf66fa
 which is being created or connected to.
 
 For TUN devices, which facilitate virtual
510c8ade
 point\-to\-point IP connections (when used in
3a840739
 .B \-\-topology net30
 or
 .B p2p
 mode),
6fbf66fa
 the proper usage of
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 is to use two private IP addresses
 which are not a member of any
 existing subnet which is in use.
 The IP addresses may be consecutive
 and should have their order reversed
 on the remote peer.  After the VPN
 is established, by pinging
 .B rn,
 you will be pinging across the VPN.
 
 For TAP devices, which provide
 the ability to create virtual
3a840739
 ethernet segments, or TUN devices in
510c8ade
 .B \-\-topology subnet
3a840739
 mode (which create virtual "multipoint networks"),
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 is used to set an IP address and
 subnet mask just as a physical
 ethernet adapter would be
 similarly configured.  If you are
 attempting to connect to a remote
 ethernet bridge, the IP address
 and subnet should be set to values
 which would be valid on the
 the bridged ethernet segment (note
 also that DHCP can be used for the
 same purpose).
 
 This option, while primarily a proxy for the
 .BR ifconfig (8)
 command, is designed to simplify TUN/TAP
 tunnel configuration by providing a
 standard interface to the different
 ifconfig implementations on different
 platforms.
 
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 parameters which are IP addresses can
 also be specified as a DNS or /etc/hosts
 file resolvable name.
 
 For TAP devices,
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 should not be used if the TAP interface will be
 getting an IP address lease from a DHCP
 server.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-ifconfig\-noexec
6fbf66fa
 Don't actually execute ifconfig/netsh commands, instead
 pass
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 parameters to scripts using environmental variables.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-ifconfig\-nowarn
6fbf66fa
 Don't output an options consistency check warning
 if the
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 option on this side of the
 connection doesn't match the remote side.  This is useful
 when you want to retain the overall benefits of the
 options consistency check (also see
2d321609
 .B \-\-disable\-occ
6fbf66fa
 option) while only disabling the ifconfig component of
 the check.
 
 For example,
 if you have a configuration where the local host uses
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 but the remote host does not, use
2d321609
 .B \-\-ifconfig\-nowarn
6fbf66fa
 on the local host.
 
 This option will also silence warnings about potential
 address conflicts which occasionally annoy more experienced
 users by triggering "false positive" warnings.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-route network/IP [netmask] [gateway] [metric]
6fbf66fa
 Add route to routing table after connection is established.
 Multiple routes can be specified.  Routes will be
 automatically torn down in reverse order prior to
 TUN/TAP device close.
 
 This option is intended as
 a convenience proxy for the
 .BR route (8)
 shell command,
 while at the same time providing portable semantics
 across OpenVPN's platform space.
 
 .B netmask
510c8ade
 default \-\- 255.255.255.255
6fbf66fa
 
 .B gateway
510c8ade
 default \-\- taken from
2d321609
 .B \-\-route\-gateway
6fbf66fa
 or the second parameter to
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 when
48fe8bb3
 .B \-\-dev tun
6fbf66fa
 is specified.
 
40ac3d7a
 .B metric
510c8ade
 default \-\- taken from
2d321609
 .B \-\-route\-metric
40ac3d7a
 otherwise 0.
 
6fbf66fa
 The default can be specified by leaving an option blank or setting
 it to "default".
 
 The
 .B network
 and
 .B gateway
 parameters can
 also be specified as a DNS or /etc/hosts
 file resolvable name, or as one of three special keywords:
 
 .B vpn_gateway
510c8ade
 \-\- The remote VPN endpoint address
6fbf66fa
 (derived either from
2d321609
 .B \-\-route\-gateway
6fbf66fa
 or the second parameter to
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 when
48fe8bb3
 .B \-\-dev tun
6fbf66fa
 is specified).
 
 .B net_gateway
510c8ade
 \-\- The pre\-existing IP default gateway, read from the routing
6fbf66fa
 table (not supported on all OSes).
 
 .B remote_host
510c8ade
 \-\- The
48fe8bb3
 .B \-\-remote
6fbf66fa
 address if OpenVPN is being run in client mode, and is undefined in server mode.
 .\"*********************************************************
673f583f
 .TP
2d321609
 .B \-\-route\-gateway gw|'dhcp'
6fbf66fa
 Specify a default gateway
 .B gw
 for use with
48fe8bb3
 .B \-\-route.
03731db3
 
 If
 .B dhcp
 is specified as the parameter,
 the gateway address will be extracted from a DHCP
510c8ade
 negotiation with the OpenVPN server\-side LAN.
03731db3
 .\"*********************************************************
40ac3d7a
 .TP
2d321609
 .B \-\-route\-metric m
40ac3d7a
 Specify a default metric
 .B m
 for use with
48fe8bb3
 .B \-\-route.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-route\-delay [n] [w]
6fbf66fa
 Delay
 .B n
 seconds (default=0) after connection
 establishment, before adding routes. If
 .B n
 is 0, routes will be added immediately upon connection
 establishment.  If
2d321609
 .B \-\-route\-delay
6fbf66fa
 is omitted, routes will be added immediately after TUN/TAP device
 open and
48fe8bb3
 .B \-\-up
6fbf66fa
 script execution, before any
48fe8bb3
 .B \-\-user
6fbf66fa
 or 
48fe8bb3
 .B \-\-group
6fbf66fa
 privilege downgrade (or
48fe8bb3
 .B \-\-chroot
6fbf66fa
 execution.)
 
 This option is designed to be useful in scenarios where DHCP is
 used to set
 tap adapter addresses.  The delay will give the DHCP handshake
 time to complete before routes are added.
 
 On Windows,
2d321609
 .B \-\-route\-delay
6fbf66fa
 tries to be more intelligent by waiting
 .B w
 seconds (w=30 by default)
510c8ade
 for the TAP\-Win32 adapter to come up before adding routes.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-route\-up cmd
d6285998
 Run command
6fbf66fa
 .B cmd
 after routes are added, subject to
2d321609
 .B \-\-route\-delay.
6fbf66fa
 
d6285998
 .B cmd
 consists of a path to script (or executable program), optionally
510c8ade
 followed by arguments. The path and arguments may be single\- or double\-quoted
d6285998
 and/or escaped using a backslash, and should be separated by one or more spaces.
 
6fbf66fa
 See the "Environmental Variables" section below for
 additional parameters passed as environmental variables.
d6285998
 .\"*********************************************************
 .TP
2d321609
 .B \-\-route\-pre\-down cmd
d6285998
 Run command
 .B cmd
 before routes are removed upon disconnection.
6fbf66fa
 
 .B cmd
d6285998
 consists of a path to script (or executable program), optionally
510c8ade
 followed by arguments. The path and arguments may be single\- or double\-quoted
d6285998
 and/or escaped using a backslash, and should be separated by one or more spaces.
 
 See the "Environmental Variables" section below for
 additional parameters passed as environmental variables.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-route\-noexec
6fbf66fa
 Don't add or remove routes automatically.  Instead pass routes to
2d321609
 .B \-\-route\-up
6fbf66fa
 script using environmental variables.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-route\-nopull
a4d621ec
 When used with
48fe8bb3
 .B \-\-client
a4d621ec
 or
48fe8bb3
 .B \-\-pull,
510c8ade
 accept options pushed by server EXCEPT for routes, block\-outside\-dns and dhcp
38c85658
 options like DNS servers.
a4d621ec
 
 When used on the client, this option effectively bars the
 server from adding routes to the client's routing table,
 however note that this option still allows the server
 to set the TCP/IP properties of the client's TUN/TAP interface.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-allow\-pull\-fqdn
0a838de8
 Allow client to pull DNS names from server (rather than being limited
 to IP address) for
48fe8bb3
 .B \-\-ifconfig,
 .B \-\-route,
0a838de8
 and
2d321609
 .B \-\-route\-gateway.
0a838de8
 .\"*********************************************************
 .TP
2d321609
 .B \-\-client\-nat snat|dnat network netmask alias
510c8ade
 This pushable client option sets up a stateless one\-to\-one NAT
581bef87
 rule on packet addresses (not ports), and is useful in cases
 where routes or ifconfig settings pushed to the client would
 create an IP numbering conflict.
 
 .B network/netmask
 (for example 192.168.0.0/255.255.0.0)
 defines the local view of a resource from the client perspective, while
 .B alias/netmask
 (for example 10.64.0.0/255.255.0.0)
 defines the remote view from the server perspective.
 
 Use
 .B snat
 (source NAT) for resources owned by the client and
 .B dnat
 (destination NAT) for remote resources.
 
 Set
20b18fd7
 .B \-\-verb 6
581bef87
 for debugging info showing the transformation of src/dest
 addresses in packets.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-redirect\-gateway flags...
7fb0e07e
 Automatically execute routing commands to cause all outgoing IP traffic
510c8ade
 to be redirected over the VPN.  This is a client\-side option.
6fbf66fa
 
 This option performs three steps:
 
 .B (1)
 Create a static route for the
48fe8bb3
 .B \-\-remote
510c8ade
 address which forwards to the pre\-existing default gateway.
6fbf66fa
 This is done so that
 .B (3)
 will not create a routing loop.
 
 .B (2)
 Delete the default gateway route.
 
 .B (3)
 Set the new default gateway to be the VPN endpoint address (derived either from
2d321609
 .B \-\-route\-gateway
6fbf66fa
 or the second parameter to
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 when
48fe8bb3
 .B \-\-dev tun
6fbf66fa
 is specified).
 
 When the tunnel is torn down, all of the above steps are reversed so
 that the original default route is restored.
 
3c7f2f55
 Option flags:
 
48fe8bb3
 .B local \-\-
6fbf66fa
 Add the
 .B local
f6bac113
 flag if both OpenVPN peers are directly connected via a common subnet,
6fbf66fa
 such as with wireless.  The
 .B local
 flag will cause step
 .B 1
 above to be omitted.
 
576dc96c
 .B autolocal \-\-
7fb0e07e
 Try to automatically determine whether to enable
 .B local
 flag above.
 
510c8ade
 .B def1 \-\-
3c7f2f55
 Use this flag to override
6fbf66fa
 the default gateway by using 0.0.0.0/1 and 128.0.0.0/1
 rather than 0.0.0.0/0.  This has the benefit of overriding
 but not wiping out the original default gateway. 
 
510c8ade
 .B bypass\-dhcp \-\-
 Add a direct route to the DHCP server (if it is non\-local) which
3c7f2f55
 bypasses the tunnel
 (Available on Windows clients, may not be available
510c8ade
 on non\-Windows clients).
3c7f2f55
 
510c8ade
 .B bypass\-dns \-\-
 Add a direct route to the DNS server(s) (if they are non\-local) which
3c7f2f55
 bypasses the tunnel
 (Available on Windows clients, may not be available
510c8ade
 on non\-Windows clients).
3c7f2f55
 
510c8ade
 .B block\-local \-\-
7fb0e07e
 Block access to local LAN when the tunnel is active, except for
 the LAN gateway itself.  This is accomplished by routing the local
 LAN (except for the LAN gateway address) into the tunnel.
d227929b
 
510c8ade
 .B ipv6 \-\-
d227929b
 Redirect IPv6 routing into the tunnel.  This works similar to the
 .B def1
 flag, that is, more specific IPv6 routes are added (2000::/4, 3000::/4),
 covering the whole IPv6 unicast space.
 
510c8ade
 .B !ipv4 \-\-
 Do not redirect IPv4 traffic \- typically used in the flag pair
d227929b
 .B "ipv6 !ipv4"
510c8ade
 to redirect IPv6\-only.
808ba6b9
 .\"*********************************************************
 .TP
2d321609
 .B \-\-link\-mtu n
6fbf66fa
 Sets an upper bound on the size of UDP packets which are sent
 between OpenVPN peers.  It's best not to set this parameter unless
 you know what you're doing.
 .\"*********************************************************
576dc96c
 .\"*********************************************************
d02a86d3
 .TP
2d321609
 .B \-\-redirect\-private [flags]
 Like \-\-redirect\-gateway, but omit actually changing the default
576dc96c
 gateway.  Useful when pushing private subnets.
 .\"*********************************************************
6fbf66fa
 .TP
2d321609
 .B \-\-tun\-mtu n
6fbf66fa
 Take the TUN device MTU to be
 .B n
 and derive the link MTU
 from it (default=1500).  In most cases, you will probably want to
 leave this parameter set to its default value.
 
 The MTU (Maximum Transmission Units) is
 the maximum datagram size in bytes that can be sent unfragmented
 over a particular network path.  OpenVPN requires that packets
 on the control or data channels be sent unfragmented.
 
 MTU problems often manifest themselves as connections which
 hang during periods of active usage.
 
 It's best to use the
48fe8bb3
 .B \-\-fragment
6fbf66fa
 and/or
48fe8bb3
 .B \-\-mssfix
6fbf66fa
 options to deal with MTU sizing issues.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tun\-mtu\-extra n
6fbf66fa
 Assume that the TUN/TAP device might return as many as
 .B n
 bytes more than the
2d321609
 .B \-\-tun\-mtu
6fbf66fa
 size on read.  This parameter defaults to 0, which is sufficient for
 most TUN devices.  TAP devices may introduce additional overhead in excess
 of the MTU size, and a setting of 32 is the default when TAP devices are used.
 This parameter only controls internal OpenVPN buffer sizing,
 so there is no transmission overhead associated with using a larger value.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-mtu\-disc type
6fbf66fa
 Should we do Path MTU discovery on TCP/UDP channel?  Only supported on OSes such
 as Linux that supports the necessary system call to set.
 
 .B 'no'
510c8ade
 \-\- Never send DF (Don't Fragment) frames
6fbf66fa
 .br
 .B 'maybe'
510c8ade
 \-\- Use per\-route hints
6fbf66fa
 .br
 .B 'yes'
510c8ade
 \-\- Always DF (Don't Fragment)
6fbf66fa
 .br
 .\"*********************************************************
 .TP
2d321609
 .B \-\-mtu\-test
6fbf66fa
 To empirically measure MTU on connection startup,
 add the
2d321609
 .B \-\-mtu\-test
6fbf66fa
 option to your configuration.
 OpenVPN will send ping packets of various sizes
 to the remote peer and measure the largest packets
 which were successfully received.  The
2d321609
 .B \-\-mtu\-test
6fbf66fa
 process normally takes about 3 minutes to complete.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-fragment max
6fbf66fa
 Enable internal datagram fragmentation so
 that no UDP datagrams are sent which
 are larger than
 .B max
 bytes.
 
 The
 .B max
 parameter is interpreted in the same way as the
2d321609
 .B \-\-link\-mtu
6fbf66fa
 parameter, i.e. the UDP packet size after encapsulation
 overhead has been added in, but not including
 the UDP header itself.
 
 The
48fe8bb3
 .B \-\-fragment
6fbf66fa
 option only makes sense when you are using the UDP protocol (
48fe8bb3
 .B \-\-proto udp
6fbf66fa
 ).
 
48fe8bb3
 .B \-\-fragment
6fbf66fa
 adds 4 bytes of overhead per datagram.
 
 See the
48fe8bb3
 .B \-\-mssfix
6fbf66fa
 option below for an important related option to
48fe8bb3
 .B \-\-fragment.
6fbf66fa
 
 It should also be noted that this option is not meant to replace
 UDP fragmentation at the IP stack level.  It is only meant as a
 last resort when path MTU discovery is broken.  Using this option
 is less efficient than fixing path MTU discovery for your IP link and
 using native IP fragmentation instead.
 
 Having said that, there are circumstances where using OpenVPN's
 internal fragmentation capability may be your only option, such
 as tunneling a UDP multicast stream which requires fragmentation.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-mssfix max
6fbf66fa
 Announce to TCP sessions running over the tunnel that they should limit
 their send packet sizes such that after OpenVPN has encapsulated them,
 the resulting UDP packet size that OpenVPN sends to its peer will not
 exceed
 .B max
8517cba1
 bytes. The default value is
 .B 1450.
6fbf66fa
 
 The
 .B max
 parameter is interpreted in the same way as the
2d321609
 .B \-\-link\-mtu
6fbf66fa
 parameter, i.e. the UDP packet size after encapsulation
 overhead has been added in, but not including
65159152
 the UDP header itself. Resulting packet would be at most 28
 bytes larger for IPv4 and 48 bytes for IPv6 (20/40 bytes for IP
 header and 8 bytes for UDP header). Default value of 1450 allows
 IPv4 packets to be transmitted over a link with MTU 1473 or higher
 without IP level fragmentation.
6fbf66fa
 
 The
48fe8bb3
 .B \-\-mssfix
6fbf66fa
 option only makes sense when you are using the UDP protocol
510c8ade
 for OpenVPN peer\-to\-peer communication, i.e.
48fe8bb3
 .B \-\-proto udp.
6fbf66fa
 
48fe8bb3
 .B \-\-mssfix
6fbf66fa
 and
48fe8bb3
 .B \-\-fragment
6fbf66fa
 can be ideally used together, where
48fe8bb3
 .B \-\-mssfix
6fbf66fa
 will try to keep TCP from needing
 packet fragmentation in the first place,
 and if big packets come through anyhow
 (from protocols other than TCP),
48fe8bb3
 .B \-\-fragment
6fbf66fa
 will internally fragment them.
 
 Both
48fe8bb3
 .B \-\-fragment
6fbf66fa
 and
48fe8bb3
 .B \-\-mssfix
6fbf66fa
 are designed to work around cases where Path MTU discovery
 is broken on the network path between OpenVPN peers.
 
 The usual symptom of such a breakdown is an OpenVPN
 connection which successfully starts, but then stalls
 during active usage.
 
 If
48fe8bb3
 .B \-\-fragment
6fbf66fa
 and
48fe8bb3
 .B \-\-mssfix
6fbf66fa
 are used together,
48fe8bb3
 .B \-\-mssfix
6fbf66fa
 will take its default
 .B max
 parameter from the
48fe8bb3
 .B \-\-fragment max
6fbf66fa
 option.
 
 Therefore, one could lower the maximum UDP packet size
510c8ade
 to 1300 (a good first try for solving MTU\-related
6fbf66fa
 connection problems) with the following options:
 
2d321609
 .B \-\-tun\-mtu 1500 \-\-fragment 1300 \-\-mssfix
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-sndbuf size
6fbf66fa
 Set the TCP/UDP socket send buffer size.
f0b64e5d
 Defaults to operation system default.
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-rcvbuf size
6fbf66fa
 Set the TCP/UDP socket receive buffer size.
f0b64e5d
 Defaults to operation system default.
6fbf66fa
 .\"*********************************************************
 .TP
d90428d1
 .B \-\-mark value
 Mark encrypted packets being sent with value. The mark value can be
 matched in policy routing and packetfilter rules. This option is
 only supported in Linux and does nothing on other operating systems.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-socket\-flags flags...
1e2f621e
 Apply the given flags to the OpenVPN transport socket.
 Currently, only
 .B TCP_NODELAY
 is supported.
 
 The
 .B TCP_NODELAY
 socket flag is useful in TCP mode, and causes the kernel
 to send tunnel packets immediately over the TCP connection without
 trying to group several smaller packets into a larger packet.
 This can result in a considerably improvement in latency.
 
 This option is pushable from server to client, and should be used
 on both client and server for maximum effect.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-txqueuelen n
6fbf66fa
 (Linux only) Set the TX queue length on the TUN/TAP interface.
 Currently defaults to 100.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-shaper n
6fbf66fa
 Limit bandwidth of outgoing tunnel data to
 .B n
 bytes per second on the TCP/UDP port.
245831b9
 Note that this will only work if mode is set to p2p.
6fbf66fa
 If you want to limit the bandwidth
 in both directions, use this option on both peers.
 
 OpenVPN uses the following algorithm to implement
 traffic shaping: Given a shaper rate of
 .I n
 bytes per second, after a datagram write of
 .I b
 bytes is queued on the TCP/UDP port, wait a minimum of
 .I (b / n)
 seconds before queuing the next write.
 
 It should be noted that OpenVPN supports multiple
 tunnels between the same two peers, allowing you
510c8ade
 to construct full\-speed and reduced bandwidth tunnels
6fbf66fa
 at the same time,
510c8ade
 routing low\-priority data such as off\-site backups
6fbf66fa
 over the reduced bandwidth tunnel, and other data
510c8ade
 over the full\-speed tunnel.
6fbf66fa
 
 Also note that for low bandwidth tunnels
 (under 1000 bytes per second), you should probably
 use lower MTU values as well (see above), otherwise
 the packet latency will grow so large as to trigger
 timeouts in the TLS layer and TCP connections running
 over the tunnel.
 
 OpenVPN allows
 .B n
 to be between 100 bytes/sec and 100 Mbytes/sec.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-inactive n [bytes]
838911cc
 Causes OpenVPN to exit after
6fbf66fa
 .B n
63921650
 seconds of inactivity on the TUN/TAP device. The time length of
 inactivity is measured since the last incoming or outgoing tunnel
1b71eafd
 packet.  The default value is 0 seconds, which disables this feature.
838911cc
 
 If the optional
 .B bytes
 parameter is included,
63921650
 exit if less than
 .B bytes
 of combined in/out traffic are produced on the tun/tap device
 in
 .B n
 seconds.
 
 In any case, OpenVPN's internal ping packets (which are just
 keepalives) and TLS control packets are not considered
 "activity", nor are they counted as traffic, as they are used
 internally by OpenVPN and are not an indication of actual user
 activity.
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-ping n
6fbf66fa
 Ping remote over the TCP/UDP control channel
 if no packets have been sent for at least
 .B n
 seconds (specify
48fe8bb3
 .B \-\-ping
6fbf66fa
 on both peers to cause ping packets to be sent in both directions since
 OpenVPN ping packets are not echoed like IP ping packets).
 When used in one of OpenVPN's secure modes (where
2d321609
 .B \-\-secret, \-\-tls\-server,
6fbf66fa
 or
2d321609
 .B \-\-tls\-client
6fbf66fa
 is specified), the ping packet
 will be cryptographically secure.
 
 This option has two intended uses:
 
 (1) Compatibility
 with stateful firewalls.  The periodic ping will ensure that
 a stateful firewall rule which allows OpenVPN UDP packets to
 pass will not time out.
 
 (2) To provide a basis for the remote to test the existence
 of its peer using the
2d321609
 .B \-\-ping\-exit
6fbf66fa
 option.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-ping\-exit n
6fbf66fa
 Causes OpenVPN to exit after
 .B n
 seconds pass without reception of a ping
 or other packet from remote.
 This option can be combined with
48fe8bb3
 .B \-\-inactive, \-\-ping,
6fbf66fa
 and
2d321609
 .B \-\-ping\-exit
510c8ade
 to create a two\-tiered inactivity disconnect.
6fbf66fa
 
 For example,
 
2d321609
 .B openvpn [options...] \-\-inactive 3600 \-\-ping 10 \-\-ping\-exit 60
6fbf66fa
 
 when used on both peers will cause OpenVPN to exit within 60
 seconds if its peer disconnects, but will exit after one
 hour if no actual tunnel data is exchanged.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-ping\-restart n
6fbf66fa
 Similar to
2d321609
 .B \-\-ping\-exit,
6fbf66fa
 but trigger a
 .B SIGUSR1
 restart after
 .B n
 seconds pass without reception of a ping
 or other packet from remote.
 
 This option is useful in cases
 where the remote peer has a dynamic IP address and
510c8ade
 a low\-TTL DNS name is used to track the IP address using
6fbf66fa
 a service such as
 .I http://dyndns.org/
 + a dynamic DNS client such
 as
 .B ddclient.
 
 If the peer cannot be reached, a restart will be triggered, causing
 the hostname used with
48fe8bb3
 .B \-\-remote
510c8ade
 to be re\-resolved (if
2d321609
 .B \-\-resolv\-retry
6fbf66fa
 is also specified).
 
 In server mode,
2d321609
 .B \-\-ping\-restart, \-\-inactive,
6fbf66fa
 or any other type of internally generated signal will always be
 applied to
 individual client instance objects, never to whole server itself.
 Note also in server mode that any internally generated signal
 which would normally cause a restart, will cause the deletion
 of the client instance object instead.
 
 In client mode, the
2d321609
 .B \-\-ping\-restart
6fbf66fa
 parameter is set to 120 seconds by default.  This default will
 hold until the client pulls a replacement value from the server, based on
 the
48fe8bb3
 .B \-\-keepalive
6fbf66fa
 setting in the server configuration.
 To disable the 120 second default, set
2d321609
 .B \-\-ping\-restart 0
6fbf66fa
 on the client.
 
 See the signals section below for more information
 on
 .B SIGUSR1.
 
 Note that the behavior of
 .B SIGUSR1
 can be modified by the
2d321609
 .B \-\-persist\-tun, \-\-persist\-key, \-\-persist\-local\-ip,
6fbf66fa
 and
2d321609
 .B \-\-persist\-remote\-ip
6fbf66fa
 options.
 
 Also note that
2d321609
 .B \-\-ping\-exit
6fbf66fa
 and
2d321609
 .B \-\-ping\-restart
6fbf66fa
 are mutually exclusive and cannot be used together.
 .\"*********************************************************
 .TP
beaa6564
 .B \-\-keepalive interval timeout
6fbf66fa
 A helper directive designed to simplify the expression of
48fe8bb3
 .B \-\-ping
6fbf66fa
 and
beaa6564
 .B \-\-ping\-restart.
 
 This option can be used on both client and server side, but it is
7bba4007
 enough to add this on the server side as it will push appropriate
beaa6564
 .B \-\-ping
 and
2d321609
 .B \-\-ping\-restart
beaa6564
 options to the client.  If used on both server and client,
 the values pushed from server will override the client local values.
6fbf66fa
 
beaa6564
 The
 .B timeout
 argument will be twice as long on the server side.  This ensures that
 a timeout is detected on client side before the server side drops
 the connection.
341e6bb6
 
6fbf66fa
 For example,
48fe8bb3
 .B \-\-keepalive 10 60
6fbf66fa
 expands as follows:
 
 .nf
148329ca
 .ft 3
 .in +4
6fbf66fa
  if mode server:
beaa6564
    ping 10                    # Argument: interval
    ping\-restart 120           # Argument: timeout*2
    push "ping 10"             # Argument: interval
    push "ping\-restart 60"     # Argument: timeout
6fbf66fa
  else
beaa6564
    ping 10                    # Argument: interval
    ping\-restart 60            # Argument: timeout
148329ca
 .in -4
6fbf66fa
 .ft
 .fi
 .\"*********************************************************
 .TP
2d321609
 .B \-\-ping\-timer\-rem
6fbf66fa
 Run the
2d321609
 .B \-\-ping\-exit
6fbf66fa
 /
2d321609
 .B \-\-ping\-restart
6fbf66fa
 timer only if we have a remote address.  Use this option if you are
 starting the daemon in listen mode (i.e. without an explicit
48fe8bb3
 .B \-\-remote
6fbf66fa
 peer), and you don't want to start clocking timeouts until a remote
 peer connects.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-persist\-tun
6fbf66fa
 Don't close and reopen TUN/TAP device or run up/down scripts
 across
 .B SIGUSR1
 or
2d321609
 .B \-\-ping\-restart
6fbf66fa
 restarts.
 
 .B SIGUSR1
 is a restart signal similar to
 .B SIGHUP,
510c8ade
 but which offers finer\-grained control over
6fbf66fa
 reset options.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-persist\-key
510c8ade
 Don't re\-read key files across
6fbf66fa
 .B SIGUSR1
 or
2d321609
 .B \-\-ping\-restart.
6fbf66fa
 
 This option can be combined with
48fe8bb3
 .B \-\-user nobody
6fbf66fa
 to allow restarts triggered by the
 .B SIGUSR1
 signal.
 Normally if you drop root privileges in OpenVPN,
510c8ade
 the daemon cannot be restarted since it will now be unable to re\-read protected
6fbf66fa
 key files.
 
 This option solves the problem by persisting keys across
 .B SIGUSR1
510c8ade
 resets, so they don't need to be re\-read.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-persist\-local\-ip
6fbf66fa
 Preserve initially resolved local IP address and port number
 across
 .B SIGUSR1
 or
2d321609
 .B \-\-ping\-restart
6fbf66fa
 restarts.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-persist\-remote\-ip
6fbf66fa
 Preserve most recently authenticated remote IP address and port number
 across
 .B SIGUSR1
 or
2d321609
 .B \-\-ping\-restart
6fbf66fa
 restarts.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-mlock
6fbf66fa
 Disable paging by calling the POSIX mlockall function.
 Requires that OpenVPN be initially run as root (though
 OpenVPN can subsequently downgrade its UID using the
48fe8bb3
 .B \-\-user
6fbf66fa
 option).
 
 Using this option ensures that key material and tunnel
 data are never written to disk due to virtual
 memory paging operations which occur under most
 modern operating systems.  It ensures that even if an
 attacker was able to crack the box running OpenVPN, he
 would not be able to scan the system swap file to
 recover previously used
 ephemeral keys, which are used for a period of time
 governed by the
48fe8bb3
 .B \-\-reneg
6fbf66fa
 options (see below), then are discarded.
 
 The downside
 of using
48fe8bb3
 .B \-\-mlock
6fbf66fa
 is that it will reduce the amount of physical
 memory available to other applications.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-up cmd
d6285998
 Run command
 .B cmd
 after successful TUN/TAP device open
6fbf66fa
 (pre
48fe8bb3
 .B \-\-user
d6285998
 UID change).
 
 .B cmd
 consists of a path to script (or executable program), optionally
510c8ade
 followed by arguments. The path and arguments may be single\- or double\-quoted
d6285998
 and/or escaped using a backslash, and should be separated by one or more spaces.
 
 The up command is useful for specifying route
6fbf66fa
 commands which route IP traffic destined for
 private subnets which exist at the other
 end of the VPN connection into the tunnel.
 
 For
48fe8bb3
 .B \-\-dev tun
6fbf66fa
 execute as:
 
 .B cmd tun_dev tun_mtu link_mtu ifconfig_local_ip ifconfig_remote_ip [ init | restart ]
 
 For
48fe8bb3
 .B \-\-dev tap
6fbf66fa
 execute as:
 
 .B cmd tap_dev tap_mtu link_mtu ifconfig_local_ip ifconfig_netmask [ init | restart ]
 
 See the "Environmental Variables" section below for
 additional parameters passed as environmental variables.
 
d6285998
 Note that if
6fbf66fa
 .B cmd
510c8ade
 includes arguments, all OpenVPN\-generated arguments will be appended
d6285998
 to them to build an argument list with which the executable will be
 called.
6fbf66fa
 
 Typically,
 .B cmd
 will run a script to add routes to the tunnel.
 
 Normally the up script is called after the TUN/TAP device is opened.
 In this context, the last command line parameter passed to the script
 will be
 .I init.
 If the
2d321609
 .B \-\-up\-restart
6fbf66fa
 option is also used, the up script will be called for restarts as
 well.  A restart is considered to be a partial reinitialization
 of OpenVPN where the TUN/TAP instance is preserved (the
2d321609
 .B \-\-persist\-tun
6fbf66fa
 option will enable such preservation).  A restart
 can be generated by a SIGUSR1 signal, a
2d321609
 .B \-\-ping\-restart
6fbf66fa
 timeout, or a connection reset when the TCP protocol is enabled
 with the
48fe8bb3
 .B \-\-proto
6fbf66fa
 option.  If a restart occurs, and
2d321609
 .B \-\-up\-restart
6fbf66fa
 has been specified, the up script will be called with
 .I restart
 as the last parameter.
 
db950be8
 NOTE: on restart, OpenVPN will not pass the full set of environment
 variables to the script.  Namely, everything related to routing and
510c8ade
 gateways will not be passed, as nothing needs to be done anyway \- all
db950be8
 the routing setup is already in place.  Additionally, the up\-restart
 script will run with the downgraded UID/GID settings (if configured).
 
6fbf66fa
 The following standalone example shows how the
48fe8bb3
 .B \-\-up
6fbf66fa
 script can be called in both an initialization and restart context.
 (NOTE: for security reasons, don't run the following example unless UDP port
 9999 is blocked by your firewall.  Also, the example will run indefinitely,
510c8ade
 so you should abort with control\-c).
6fbf66fa
 
2d321609
 .B openvpn \-\-dev tun \-\-port 9999 \-\-verb 4 \-\-ping\-restart 10 \-\-up 'echo up' \-\-down 'echo down' \-\-persist\-tun \-\-up\-restart
6fbf66fa
 
 Note that OpenVPN also provides the
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 option to automatically ifconfig the TUN device,
 eliminating the need to define an
48fe8bb3
 .B \-\-up
6fbf66fa
 script, unless you also want to configure routes
 in the
48fe8bb3
 .B \-\-up
6fbf66fa
 script.
 
 If
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 is also specified, OpenVPN will pass the ifconfig local
 and remote endpoints on the command line to the
48fe8bb3
 .B \-\-up
6fbf66fa
 script so that they can be used to configure routes such as:
 
2d321609
 .B route add \-net 10.0.0.0 netmask 255.255.255.0 gw $5
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-up\-delay
6fbf66fa
 Delay TUN/TAP open and possible
48fe8bb3
 .B \-\-up
6fbf66fa
 script execution
 until after TCP/UDP connection establishment with peer.
 
 In
48fe8bb3
 .B \-\-proto udp
6fbf66fa
 mode, this option normally requires the use of
48fe8bb3
 .B \-\-ping
6fbf66fa
 to allow connection initiation to be sensed in the absence
 of tunnel data, since UDP is a "connectionless" protocol.
 
510c8ade
 On Windows, this option will delay the TAP\-Win32 media state
6fbf66fa
 transitioning to "connected" until connection establishment,
 i.e. the receipt of the first authenticated packet from the peer.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-down cmd
d6285998
 Run command
 .B cmd
 after TUN/TAP device close
6fbf66fa
 (post
48fe8bb3
 .B \-\-user
6fbf66fa
 UID change and/or
48fe8bb3
 .B \-\-chroot
d6285998
 ).
 .B cmd
 consists of a path to script (or executable program), optionally
510c8ade
 followed by arguments. The path and arguments may be single\- or double\-quoted
d6285998
 and/or escaped using a backslash, and should be separated by one or more spaces.
 
 Called with the same parameters and environmental
6fbf66fa
 variables as the
48fe8bb3
 .B \-\-up
6fbf66fa
 option above.
 
 Note that if you reduce privileges by using
48fe8bb3
 .B \-\-user
6fbf66fa
 and/or
48fe8bb3
 .B \-\-group,
6fbf66fa
 your
48fe8bb3
 .B \-\-down
6fbf66fa
 script will also run at reduced privilege.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-down\-pre
6fbf66fa
 Call
48fe8bb3
 .B \-\-down
6fbf66fa
 cmd/script before, rather than after, TUN/TAP close.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-up\-restart
6fbf66fa
 Enable the
48fe8bb3
 .B \-\-up
6fbf66fa
 and
48fe8bb3
 .B \-\-down
6fbf66fa
 scripts to be called for restarts as well as initial program start.
 This option is described more fully above in the
48fe8bb3
 .B \-\-up
6fbf66fa
 option documentation.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-setenv name value
6fbf66fa
 Set a custom environmental variable
 .B name=value
 to pass to script.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-setenv FORWARD_COMPATIBLE 1
373faab1
 Relax config file syntax checking so that unknown directives
 will trigger a warning but not a fatal error,
 on the assumption that a given unknown directive might be valid
 in future OpenVPN versions.
 
 This option should be used with caution, as there are good security
 reasons for having OpenVPN fail if it detects problems in a
 config file.  Having said that, there are valid reasons for wanting
 new software features to gracefully degrade when encountered by
 older software versions.
2a92fba7
 
 It is also possible to tag a single directive so as not to trigger
 a fatal error if the directive isn't recognized.  To do this,
 prepend the following before the directive:
 .B setenv opt
b685a1e6
 
39dad37d
 Versions prior to OpenVPN 2.3.3 will always ignore options set with the
 .B setenv opt
 directive.
 
b685a1e6
 See also
2d321609
 .B \-\-ignore\-unknown\-option
373faab1
 .\"*********************************************************
 .TP
2d321609
 .B \-\-setenv\-safe name value
be9150b6
 Set a custom environmental variable
 .B OPENVPN_name=value
 to pass to script.
 
 This directive is designed to be pushed by the server to clients,
 and the prepending of "OPENVPN_" to the environmental variable
 is a safety precaution to prevent a LD_PRELOAD style attack
 from a malicious or compromised server.
 .\"*********************************************************
b685a1e6
 .TP
2d321609
 .B \-\-ignore\-unknown\-option opt1 opt2 opt3 ... optN
b685a1e6
 When one of options
 .B opt1 ... optN
 is encountered in the configuration file the configuration
 file parsing does not fail if this OpenVPN version does not
 support the option. Multiple
2d321609
 .B \-\-ignore\-unknown\-option
b685a1e6
 options can be given to support a larger number of options to ignore.
 
 This option should be used with caution, as there are good security
 reasons for having OpenVPN fail if it detects problems in a
 config file. Having said that, there are valid reasons for wanting
 new software features to gracefully degrade when encountered by
 older software versions.
 
2d321609
 .B \-\-ignore\-unknown\-option
b685a1e6
 is available since OpenVPN 2.3.3.
 .\"*********************************************************
be9150b6
 .TP
2d321609
 .B \-\-script\-security level
510c8ade
 This directive offers policy\-level control over OpenVPN's usage of external programs
a8281352
 and scripts.  Lower
 .B level
 values are more restrictive, higher values are more permissive.  Settings for
5a2e9a25
 .B level:
 
48fe8bb3
 .B 0 \-\-
5a2e9a25
 Strictly no calling of external programs.
 .br
48fe8bb3
 .B 1 \-\-
510c8ade
 (Default) Only call built\-in executables such as ifconfig, ip, route, or netsh.
5a2e9a25
 .br
48fe8bb3
 .B 2 \-\-
510c8ade
 Allow calling of built\-in executables and user\-defined scripts.
5a2e9a25
 .br
48fe8bb3
 .B 3 \-\-
5a2e9a25
 Allow passwords to be passed to scripts via environmental variables (potentially unsafe).
a8281352
 
05634736
 OpenVPN releases before v2.3 also supported a
a8281352
 .B method
05634736
 flag which indicated how OpenVPN should call external commands and scripts.  This
 could be either
 .B execve
 or 
 .B system. 
500854c3
 As of OpenVPN 2.3, this flag is no longer accepted.  In most *nix environments the execve()
05634736
 approach has been used without any issues.
 
001384e2
 Some directives such as \-\-up allow options to be passed to the external
 script. In these cases make sure the script name does not contain any spaces or
 the configuration parser will choke because it can't determine where the script
 name ends and script options start.
 
05634736
 To run scripts in Windows in earlier OpenVPN
 versions you needed to either add a full path to the script interpreter which can parse the
 script or use the
 .B system
500854c3
 flag to run these scripts.  As of OpenVPN 2.3 it is now a strict requirement to have
510c8ade
 full path to the script interpreter when running non\-executables files.
05634736
 This is not needed for executable files, such as .exe, .com, .bat or .cmd files.  For
 example, if you have a Visual Basic script, you must use this syntax now:
a8281352
 
05634736
 .nf
 .ft 3
 .in +4
510c8ade
 \-\-up 'C:\\\\Windows\\\\System32\\\\wscript.exe C:\\\\Program\\ Files\\\\OpenVPN\\\\config\\\\my\-up\-script.vbs'
05634736
 .in -4
 .ft
 .fi
a8281352
 
05634736
 Please note the single quote marks and the escaping of the backslashes (\\) and
 the space character.
 
 The reason the support for the
 .B system
 flag was removed is due to the security implications with shell expansions
 when executing scripts via the system() call.
5a2e9a25
 .\"*********************************************************
 .TP
2d321609
 .B \-\-disable\-occ
6fbf66fa
 Don't output a warning message if option inconsistencies are detected between
 peers.  An example of an option inconsistency would be where one peer uses
48fe8bb3
 .B \-\-dev tun
6fbf66fa
 while the other peer uses
48fe8bb3
 .B \-\-dev tap.
6fbf66fa
 
 Use of this option is discouraged, but is provided as
 a temporary fix in situations where a recent version of OpenVPN must
 connect to an old version.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-user user
6fbf66fa
 Change the user ID of the OpenVPN process to
 .B user
 after initialization, dropping privileges in the process.
 This option is useful to protect the system
 in the event that some hostile party was able to gain control of
 an OpenVPN session.  Though OpenVPN's security features make
 this unlikely, it is provided as a second line of defense.
 
 By setting
 .B user
 to
 .I nobody
 or somebody similarly unprivileged, the hostile party would be
 limited in what damage they could cause.  Of course once
 you take away privileges, you cannot return them
 to an OpenVPN session.  This means, for example, that if
 you want to reset an OpenVPN daemon with a
 .B SIGUSR1
 signal
 (for example in response
 to a DHCP reset), you should make use of one or more of the
48fe8bb3
 .B \-\-persist
6fbf66fa
 options to ensure that OpenVPN doesn't need to execute any privileged
510c8ade
 operations in order to restart (such as re\-reading key files
6fbf66fa
 or running
 .BR ifconfig
 on the TUN device).
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-group group
6fbf66fa
 Similar to the
48fe8bb3
 .B \-\-user
6fbf66fa
 option,
 this option changes the group ID of the OpenVPN process to
 .B group
 after initialization.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-cd dir
6fbf66fa
 Change directory to
 .B dir
 prior to reading any files such as
 configuration files, key files, scripts, etc.
 .B dir
 should be an absolute path, with a leading "/",
 and without any references
 to the current directory such as "." or "..".
 
 This option is useful when you are running
 OpenVPN in 
48fe8bb3
 .B \-\-daemon
6fbf66fa
 mode, and you want to consolidate all of
 your OpenVPN control files in one location.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-chroot dir
6fbf66fa
 Chroot to
 .B dir
 after initialization.  
48fe8bb3
 .B \-\-chroot
6fbf66fa
 essentially redefines
 .B dir
 as being the top
 level directory tree (/).  OpenVPN will therefore
 be unable to access any files outside this tree.
 This can be desirable from a security standpoint.
 
 Since the chroot operation is delayed until after
 initialization, most OpenVPN options that reference
510c8ade
 files will operate in a pre\-chroot context.
6fbf66fa
 
 In many cases, the
 .B dir
 parameter can point to an empty directory, however
 complications can result when scripts or restarts
 are executed after the chroot operation.
b238a1f2
 
0609eb47
 Note: The SSL library will probably need /dev/urandom to be available inside
 the chroot directory
b238a1f2
 .B dir.
0609eb47
 This is because SSL libraries occasionally need to collect fresh random.  Newer
 linux kernels and some BSDs implement a getrandom() or getentropy() syscall
 that removes the need for /dev/urandom to be available.
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-setcon context
99385447
 Apply SELinux
 .B context
 after initialization. This
 essentially provides the ability to restrict OpenVPN's
 rights to only network I/O operations, thanks to
 SELinux. This goes further than
48fe8bb3
 .B \-\-user
99385447
 and
48fe8bb3
 .B \-\-chroot
99385447
 in that those two, while being great security features,
 unfortunately do not protect against privilege escalation
 by exploitation of a vulnerable system call. You can of
 course combine all three, but please note that since
 setcon requires access to /proc you will have to provide
48fe8bb3
 it inside the chroot directory (e.g. with mount \-\-bind).
99385447
 
 Since the setcon operation is delayed until after
 initialization, OpenVPN can be restricted to just
510c8ade
 network\-related system calls, whereas by applying the
99385447
 context before startup (such as the OpenVPN one provided
 in the SELinux Reference Policies) you will have to
 allow many things required only during initialization.
 
 Like with chroot, complications can result when scripts
 or restarts are executed after the setcon operation,
 which is why you should really consider using the
2d321609
 .B \-\-persist\-key
99385447
 and
2d321609
 .B \-\-persist\-tun
99385447
 options.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-daemon [progname]
6fbf66fa
 Become a daemon after all initialization functions are completed.
 This option will cause all message and error output to
 be sent to the syslog file (such as /var/log/messages),
d6285998
 except for the output of scripts and
6fbf66fa
 ifconfig commands,
 which will go to /dev/null unless otherwise redirected.
 The syslog redirection occurs immediately at the point
 that
48fe8bb3
 .B \-\-daemon
6fbf66fa
 is parsed on the command line even though
 the daemonization point occurs later.  If one of the
48fe8bb3
 .B \-\-log
6fbf66fa
 options is present, it will supercede syslog
 redirection.
 
 The optional
 .B progname
 parameter will cause OpenVPN to report its program name
 to the system logger as
 .B progname.
 This can be useful in linking OpenVPN messages
 in the syslog file with specific tunnels.
 When unspecified,
 .B progname
 defaults to "openvpn".
 
 When OpenVPN is run with the
48fe8bb3
 .B \-\-daemon
6fbf66fa
 option, it will try to delay daemonization until the majority of initialization
 functions which are capable of generating fatal errors are complete.  This means
 that initialization scripts can test the return status of the
 openvpn command for a fairly reliable indication of whether the command
 has correctly initialized and entered the packet forwarding event loop.
 
510c8ade
 In OpenVPN, the vast majority of errors which occur after initialization are non\-fatal.
b6ec7fbe
 
 Note: as soon as OpenVPN has daemonized, it can not ask for usernames,
 passwords, or key pass phrases anymore.  This has certain consequences,
510c8ade
 namely that using a password\-protected private key will fail unless the
b6ec7fbe
 .B \-\-askpass
 option is used to tell OpenVPN to ask for the pass phrase (this
500854c3
 requirement is new in v2.3.7, and is a consequence of calling daemon()
b6ec7fbe
 before initializing the crypto layer).
 
 Further, using
 .B \-\-daemon
 together with
510c8ade
 .B \-\-auth\-user\-pass
b6ec7fbe
 (entered on console) and
510c8ade
 .B \-\-auth\-nocache
b6ec7fbe
 will fail as soon as key renegotiation (and reauthentication) occurs.
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-syslog [progname]
6fbf66fa
 Direct log output to system logger, but do not become a daemon.
 See
48fe8bb3
 .B \-\-daemon
6fbf66fa
 directive above for description of
 .B progname
 parameter.
47c19c9d
 .TP
2d321609
 .B \-\-errors\-to\-stderr
47c19c9d
 Output errors to stderr instead of stdout unless log output is redirected by one of the
 .B \-\-log
 options.
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-passtos
6fbf66fa
 Set the TOS field of the tunnel packet to what the payload's TOS is.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-inetd [wait|nowait] [progname]
6fbf66fa
 Use this option when OpenVPN is being run from the inetd or
 .BR xinetd(8)
 server.
 
 The
 .B wait/nowait
 option must match what is specified in the inetd/xinetd
 config file.  The
 .B nowait
 mode can only be used with
2d321609
 .B \-\-proto tcp\-server.
6fbf66fa
 The default is
 .B wait.
 The
 .B nowait
 mode can be used to instantiate the OpenVPN daemon as a classic TCP server,
 where client connection requests are serviced on a single
 port number.  For additional information on this kind of configuration,
 see the OpenVPN FAQ:
 .I http://openvpn.net/faq.html#oneport
 
 This option precludes the use of
48fe8bb3
 .B \-\-daemon, \-\-local,
6fbf66fa
 or
48fe8bb3
 .B \-\-remote.
6fbf66fa
 Note that this option causes message and error output to be handled in the same
 way as the
48fe8bb3
 .B \-\-daemon
6fbf66fa
 option.  The optional
 .B progname
 parameter is also handled exactly as in
48fe8bb3
 .B \-\-daemon.
6fbf66fa
 
 Also note that in
 .B wait
 mode, each OpenVPN tunnel requires a separate TCP/UDP port and
 a separate inetd or xinetd entry.  See the OpenVPN 1.x HOWTO for an example
 on using OpenVPN with xinetd:
 .I http://openvpn.net/1xhowto.html
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-log file
6fbf66fa
 Output logging messages to
 .B file,
 including output to stdout/stderr which
 is generated by called scripts.
 If
 .B file
 already exists it will be truncated.
 This option takes effect
 immediately when it is parsed in the command line
 and will supercede syslog output if
48fe8bb3
 .B \-\-daemon
6fbf66fa
 or
48fe8bb3
 .B \-\-inetd
6fbf66fa
 is also specified.
 This option is persistent over the entire course of
 an OpenVPN instantiation and will not be reset by SIGHUP,
 SIGUSR1, or
2d321609
 .B \-\-ping\-restart.
6fbf66fa
 
 Note that on Windows, when OpenVPN is started as a service,
 logging occurs by default without the need to specify
 this option.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-log\-append file
6fbf66fa
 Append logging messages to
 .B file.
 If
 .B file
 does not exist, it will be created.
 This option behaves exactly like
48fe8bb3
 .B \-\-log
6fbf66fa
 except that it appends to rather
 than truncating the log file.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-suppress\-timestamps
6fbf66fa
 Avoid writing timestamps to log messages, even when they
 otherwise would be prepended. In particular, this applies to
 log messages sent to stdout.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-machine\-readable\-output
8f7d5e67
 Always write timestamps and message flags to log messages, even when they
 otherwise would not be prefixed. In particular, this applies to
 log messages sent to stdout.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-writepid file
6fbf66fa
 Write OpenVPN's main process ID to
 .B file.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-nice n
6fbf66fa
 Change process priority after initialization
 (
 .B n
 greater than 0 is lower priority,
 .B n
 less than zero is higher priority).
 .\"*********************************************************
 .\".TP
2d321609
 .\".B \-\-nice\-work n
6fbf66fa
 .\"Change priority of background TLS work thread.  The TLS thread
 .\"feature is enabled when OpenVPN is built
 .\"with pthread support, and you are running OpenVPN
 .\"in TLS mode (i.e. with
2d321609
 .\".B \-\-tls\-client
6fbf66fa
 .\"or
2d321609
 .\".B \-\-tls\-server
6fbf66fa
 .\"specified).
 .\"
510c8ade
 .\"Using a TLS thread offloads the CPU\-intensive process of SSL/TLS\-based
6fbf66fa
 .\"key exchange to a background thread so that it does not become
 .\"a latency bottleneck in the tunnel packet forwarding process.
 .\"
 .\"The parameter
 .\".B n
 .\"is interpreted exactly as with the
48fe8bb3
 .\".B \-\-nice
6fbf66fa
 .\"option above, but in relation to the work thread rather
 .\"than the main thread.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-fast\-io
6fbf66fa
 (Experimental) Optimize TUN/TAP/UDP I/O writes by avoiding
 a call to poll/epoll/select prior to the write operation.  The purpose
 of such a call would normally be to block until the device
 or socket is ready to accept the write.  Such blocking is unnecessary
 on some platforms which don't support write blocking on UDP sockets
 or TUN/TAP devices.  In such cases, one can optimize the event loop
 by avoiding the poll/epoll/select call, improving CPU efficiency
 by 5% to 10%.
 
510c8ade
 This option can only be used on non\-Windows systems, when
48fe8bb3
 .B \-\-proto udp
6fbf66fa
 is specified, and when
48fe8bb3
 .B \-\-shaper
6fbf66fa
 is NOT specified.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-multihome
510c8ade
 Configure a multi\-homed UDP server.  This option needs to be used when
abe18c69
 a server has more than one IP address (e.g. multiple interfaces, or
 secondary IP addresses), and is not using
 .B \-\-local
 to force binding to one specific address only.  This option will
 add some extra lookups to the packet path to ensure that the UDP reply
 packets are always sent from the address that the client is
 talking to. This is not supported on all platforms, and it adds more
 processing, so it's not enabled by default.
 
 Note: this option is only relevant for UDP servers.
 
510c8ade
 Note 2: if you do an IPv6+IPv4 dual\-stack bind on a Linux machine with
abe18c69
 multiple IPv4 address, connections to IPv4 addresses will not work
2a97e69e
 right on kernels before 3.15, due to missing kernel support for the
510c8ade
 IPv4\-mapped case (some distributions have ported this to earlier kernel
2a97e69e
 versions, though).
16ded86c
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-echo [parms...]
6fbf66fa
 Echo
 .B parms
 to log output.
 
 Designed to be used to send messages to a controlling application
 which is receiving the OpenVPN log output.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-remap\-usr1 signal
6fbf66fa
 Control whether internally or externally
 generated SIGUSR1 signals are remapped to
 SIGHUP (restart without persisting state) or
 SIGTERM (exit).
 
 .B signal
 can be set to "SIGHUP" or "SIGTERM".  By default, no remapping
 occurs.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-verb n
6fbf66fa
 Set output verbosity to
 .B n
 (default=1).  Each level shows all info from the previous levels.
 Level 3 is recommended if you want a good summary
 of what's happening without being swamped by output.
 
48fe8bb3
 .B 0 \-\-
6fbf66fa
 No output except fatal errors.
 .br
48fe8bb3
 .B 1 to 4 \-\-
6fbf66fa
 Normal usage range.
 .br
48fe8bb3
 .B 5 \-\-
6fbf66fa
 Output
 .B R
 and
 .B W
 characters to the console for each packet read and write, uppercase is
 used for TCP/UDP packets and lowercase is used for TUN/TAP packets.
 .br
48fe8bb3
 .B 6 to 11 \-\-
6fbf66fa
 Debug info range (see errlevel.h for additional
 information on debug levels).
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-status file [n]
6fbf66fa
 Write operational status to
 .B file
 every
 .B n
 seconds.
 
 Status can also be written to the syslog by sending a
 .B SIGUSR2
 signal.
308c9d7f
 
 With multi\-client capability enabled on a server, the status file includes a
 list of clients and a routing table. The output format can be controlled by the
 .B \-\-status\-version
 option in that case.
 
 For clients or instances running in point\-to\-point mode, it will contain the
 traffic statistics.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-status\-version [n]
308c9d7f
 Set the status file format version number to
 .B n\fR.
 
 This only affects the status file on servers with multi\-client capability
 enabled.
 
 .B 1
 \-\- traditional format (default). The client list contains the following
 fields comma\-separated: Common Name, Real Address, Bytes Received, Bytes Sent,
 Connected Since.
 .br
 .B 2
 \-\- a more reliable format for external processing. Compared to version 1, the
 client list contains some additional fields: Virtual Address, Virtual IPv6
8acc40b6
 Address, Username, Client ID, Peer ID, Data Channel Cipher.
308c9d7f
 Future versions may extend the number of fields.
 .br
 .B 3
 \-\- identical to 2, but fields are tab\-separated.
 
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-mute n
6fbf66fa
 Log at most
 .B n
 consecutive messages in the same category.  This is useful to
 limit repetitive logging of similar message types.
 .\"*********************************************************
 .TP
38d96bd7
 .B \-\-compress [algorithm]
 Enable a compression algorithm.
 
 The
 .B algorithm
9403e3f4
 parameter may be "lzo", "lz4", or empty.  LZO and LZ4
 are different compression algorithms, with LZ4 generally
 offering the best performance with least CPU usage.
500854c3
 For backwards compatibility with OpenVPN versions before v2.4, use "lzo"
2d321609
 (which is identical to the older option "\-\-comp\-lzo yes").
38d96bd7
 
 If the
 .B algorithm
 parameter is empty, compression will be turned off, but the packet
 framing for compression will still be enabled, allowing a different
 setting to be pushed later.
a59fd147
 
 .B Security Considerations
 
 Compression and encryption is a tricky combination.  If an attacker knows or is
 able to control (parts of) the plaintext of packets that contain secrets, the
 attacker might be able to extract the secret if compression is enabled.  See
 e.g. the CRIME and BREACH attacks on TLS which also leverage compression to
 break encryption.  If you are not entirely sure that the above does not apply
 to your traffic, you are advised to *not* enable compression.
 
38d96bd7
 .\"*********************************************************
 .TP
2d321609
 .B \-\-comp\-lzo [mode]
6e4a8175
 .B DEPRECATED
 This option will be removed in a future OpenVPN release.  Use the
 newer
 .B \-\-compress
 instead.
 
510c8ade
 Use LZO compression \-\- may add up to 1 byte per
6fbf66fa
 packet for incompressible data.
00d39170
 .B mode
 may be "yes", "no", or "adaptive" (default).
 
 In a server mode setup, it is possible to selectively turn
 compression on or off for individual clients.
 
510c8ade
 First, make sure the client\-side config file enables selective
00d39170
 compression by having at least one
2d321609
 .B \-\-comp\-lzo
00d39170
 directive, such as
2d321609
 .B \-\-comp\-lzo no.
00d39170
 This will turn off compression by default,
 but allow a future directive push from the server to
 dynamically change the
 on/off/adaptive setting.
 
 Next in a
2d321609
 .B \-\-client\-config\-dir
00d39170
 file, specify the compression setting for the client,
 for example:
 
 .nf
148329ca
 .ft 3
 .in +4
2d321609
 comp\-lzo yes
 push "comp\-lzo yes"
148329ca
 .in -4
00d39170
 .ft
 .fi
 
 The first line sets the
2d321609
 .B comp\-lzo
00d39170
 setting for the server
 side of the link, the second sets the client side.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-comp\-noadapt
6fbf66fa
 When used in conjunction with
2d321609
 .B \-\-comp\-lzo,
6fbf66fa
 this option will disable OpenVPN's adaptive compression algorithm.
 Normally, adaptive compression is enabled with
2d321609
 .B \-\-comp\-lzo.
6fbf66fa
 
 Adaptive compression tries to optimize the case where you have
b443772b
 compression enabled, but you are sending predominantly incompressible
510c8ade
 (or pre\-compressed) packets over the tunnel, such as an FTP or rsync transfer
6fbf66fa
 of a large, compressed file.  With adaptive compression,
 OpenVPN will periodically sample the compression process to measure its
 efficiency.  If the data being sent over the tunnel is already compressed,
 the compression efficiency will be very low, triggering openvpn to disable
510c8ade
 compression for a period of time until the next re\-sample test.
6fbf66fa
 .\"*********************************************************
 .TP
ec100d7e
 .B \-\-management socket\-name unix [pw\-file] \ \ \ \ \ (recommended)
 .TQ
510c8ade
 .B \-\-management IP port [pw\-file]
ec100d7e
 Enable a management server on a
 .B socket\-name
 Unix socket on those platforms supporting it, or on
 a designated TCP port.
 
 .B pw\-file
 , if specified, is a password file where the password must be on first line.
 Instead of a filename it can use the keyword stdin which will prompt the user
 for a password to use when OpenVPN is starting.
 
 For unix sockets, the  default  behaviour  is to create a unix domain socket
 that may be connected to by any process.  Use the
2d321609
 .B \-\-management\-client\-user
bb564a59
 and
2d321609
 .B \-\-management\-client\-group
ec100d7e
 directives to restrict access.
 
 The management interface provides a special mode where the TCP management link
 can operate over the tunnel itself.  To enable this mode, set IP to
 .B tunnel.
 Tunnel mode will cause the  management interface to listen for a
 TCP connection on the local VPN address of the TUN/TAP interface.
 
 .B BEWARE
 of enabling the management interface over TCP.  In  these cases you should
 .I ALWAYS
 make use of
 .B pw\-file
 to password protect the management interface.  Any user who can connect to this
 TCP
 .B IP:port
 will be able to manage and control (and interfere with) the OpenVPN process.
 It is also strongly recommended to set IP to 127.0.0.1 (localhost) to restrict
 accessibility of the management server to local clients.
 
 While the management port is designed for  programmatic control of OpenVPN by
 other applications, it is possible to telnet to the port, using a telnet client
 in "raw" mode.  Once  connected, type "help" for a list of commands.
 
 For detailed documentation on the management interface, see the
 .I management\-notes.txt
 file in the management folder of the OpenVPN source distribution.
 
cffcefac
 .TP
2d321609
 .B \-\-management\-client
c447b426
 Management interface will connect as a TCP/unix domain client to
cffcefac
 .B IP:port
 specified by
 .B \-\-management
c447b426
 rather than listen as a TCP server or on a unix domain socket.
 
 If the client connection fails to connect or is disconnected,
 a SIGTERM signal will be generated causing OpenVPN to quit.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-query\-passwords
6fbf66fa
 Query management channel for private key password and
2d321609
 .B \-\-auth\-user\-pass
6fbf66fa
 username/password.  Only query the management channel
 for inputs which ordinarily would have been queried from the
 console.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-query\-proxy
af1bf85a
 Query management channel for proxy server information for a specific
 .B \-\-remote
510c8ade
 (client\-only).
af1bf85a
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-query\-remote
54561af6
 Allow management interface to override
576dc96c
 .B \-\-remote
510c8ade
 directives (client\-only).
54561af6
 .\"*********************************************************
733050dc
 .TP
2d321609
 .B \-\-management\-external\-key
75b6f4bd
 Allows usage for external private key file instead of
 .B \-\-key
510c8ade
 option (client\-only).
75b6f4bd
 .\"*********************************************************
54561af6
 .TP
510c8ade
 .B \-\-management\-external\-cert certificate\-hint
39e3d336
 Allows usage for external certificate instead of
 .B \-\-cert
510c8ade
 option (client\-only).
 .B certificate\-hint
39e3d336
 is an arbitrary string which is passed to a management
510c8ade
 interface client as an argument of NEED\-CERTIFICATE notification.
d023fb66
 Requires \-\-management\-external\-key.
39e3d336
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-forget\-disconnect
a032fcb7
 Make OpenVPN forget passwords when management session
 disconnects.
 
 This directive does not affect the
2d321609
 .B \-\-http\-proxy
a032fcb7
 username/password.  It is always cached.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-hold
6fbf66fa
 Start OpenVPN in a hibernating state, until a client
 of the management interface explicitly starts it
 with the
 .B hold release
 command.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-signal
1184b824
 Send SIGUSR1 signal to OpenVPN if management session disconnects.
 This is useful when you wish to disconnect an OpenVPN session on
2d321609
 user logoff. For \-\-management\-client this option is not needed since
c447b426
 a disconnect will always generate a SIGTERM.
1184b824
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-log\-cache n
6fbf66fa
 Cache the most recent
 .B n
 lines of log file history for usage
 by the management channel.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-up\-down
15be3202
 Report tunnel up/down events to management interface.
 .B 
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-client\-auth
90efcacb
 Gives management interface client the responsibility
 to authenticate clients after their client certificate
510c8ade
 has been verified.  See management\-notes.txt in OpenVPN
90efcacb
 distribution for detailed notes.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-client\-pf
90efcacb
 Management interface clients must specify a packet
2d321609
 filter file for each connecting client.  See management\-notes.txt
90efcacb
 in OpenVPN distribution for detailed notes.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-client\-user u
bb564a59
 When the management interface is listening on a unix domain socket,
 only allow connections from user
 .B u.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-management\-client\-group g
bb564a59
 When the management interface is listening on a unix domain socket,
 only allow connections from group
 .B g.
 .\"*********************************************************
 .TP
510c8ade
 .B \-\-plugin module\-pathname [init\-string]
 Load plug\-in module from the file
 .B module\-pathname,
6fbf66fa
 passing
510c8ade
 .B init\-string
6fbf66fa
 as an argument
 to the module initialization function.  Multiple
 plugin modules may be loaded into one OpenVPN
 process.
 
f9609f1d
 The
510c8ade
 .B module\-pathname
f9609f1d
 argument can be just a filename or a filename with a relative
 or absolute path.  The format of the filename and path defines
510c8ade
 if the plug\-in will be loaded from a default plug\-in directory
f9609f1d
 or outside this directory.
 
 .nf
 .ft 3
 .in +4
 .B \-\-plugin path\ \ \ \ \ \ \ \ Effective directory used
 ====================================================
  myplug.so            DEFAULT_DIR/myplug.so
  subdir/myplug.so     DEFAULT_DIR/subdir/myplug.so
  ./subdir/myplug.so   CWD/subdir/myplug.so
  /usr/lib/my/plug.so  /usr/lib/my/plug.so
 .in -4
 .fi
 
510c8ade
 DEFAULT_DIR is replaced by the default plug\-in directory,
f9609f1d
 which is configured at the build time of OpenVPN.  CWD is the
 current directory where OpenVPN was started or the directory
 OpenVPN have swithed into via the
9636196d
 .B \-\-cd
f9609f1d
 option before the
9636196d
 .B \-\-plugin
f9609f1d
 option.
 
6fbf66fa
 For more information and examples on how to build OpenVPN
510c8ade
 plug\-in modules, see the README file in the
6fbf66fa
 .B plugin
 folder of the OpenVPN source distribution.
 
 If you are using an RPM install of OpenVPN, see
 /usr/share/openvpn/plugin.  The documentation is
 in
 .B doc
 and the actual plugin modules are in
 .B lib.
 
 Multiple plugin modules can be cascaded, and modules can be
 used in tandem with scripts.  The modules will be called by
 OpenVPN in the order that they are declared in the config
 file.  If both a plugin and script are configured for the same
 callback, the script will be called last.  If the
 return code of the module/script controls an authentication
2d321609
 function (such as tls\-verify, auth\-user\-pass\-verify, or
 client\-connect), then
6fbf66fa
 every module and script must return success (0) in order for
 the connection to be authenticated.
 .\"*********************************************************
685e486e
 .TP
510c8ade
 .B \-\-keying\-material\-exporter label len
685e486e
 Save Exported Keying Material [RFC5705] of len bytes (must be
 between 16 and 4095 bytes) using label in environment
 (exported_keying_material) for use by plugins in
 OPENVPN_PLUGIN_TLS_FINAL callback.
 
 Note that exporter labels have the potential to collide with existing PRF
 labels. In order to prevent this, labels MUST begin with "EXPORTER".
 
 .\"*********************************************************
6fbf66fa
 .SS Server Mode
510c8ade
 Starting with OpenVPN 2.0, a multi\-client TCP/UDP server mode
6fbf66fa
 is supported, and can be enabled with the
48fe8bb3
 .B \-\-mode server
6fbf66fa
 option.  In server mode, OpenVPN will listen on a single
 port for incoming client connections.  All client
 connections will be routed through a single tun or tap
 interface.  This mode is designed for scalability and should
 be able to support hundreds or even thousands of clients
 on sufficiently fast hardware.  SSL/TLS authentication must
 be used in this mode.
 .\"*********************************************************
 .TP
4cc6a259
 .B \-\-server network netmask ['nopool']
6fbf66fa
 A helper directive designed to simplify the configuration
 of OpenVPN's server mode.  This directive will set up an
 OpenVPN server which will allocate addresses to clients
 out of the given network/netmask.  The server itself
 will take the ".1" address of the given network
510c8ade
 for use as the server\-side endpoint of the local
6fbf66fa
 TUN/TAP interface.
 
 For example,
48fe8bb3
 .B \-\-server 10.8.0.0 255.255.255.0
6fbf66fa
 expands as follows:
 
 .nf
148329ca
 .ft 3
 .in +4
6fbf66fa
  mode server
2d321609
  tls\-server
3c7f2f55
  push "topology [topology]"
6fbf66fa
 
3c7f2f55
  if dev tun AND (topology == net30 OR topology == p2p):
223b2c51
    ifconfig 10.8.0.1 10.8.0.2
    if !nopool:
2d321609
      ifconfig\-pool 10.8.0.4 10.8.0.251
6fbf66fa
    route 10.8.0.0 255.255.255.0
2d321609
    if client\-to\-client:
6fbf66fa
      push "route 10.8.0.0 255.255.255.0"
3c7f2f55
    else if topology == net30:
6fbf66fa
      push "route 10.8.0.1"
 
3c7f2f55
  if dev tap OR (dev tun AND topology == subnet):
6fbf66fa
    ifconfig 10.8.0.1 255.255.255.0
223b2c51
    if !nopool:
251cc8f2
      ifconfig\-pool 10.8.0.2 10.8.0.253 255.255.255.0
2d321609
    push "route\-gateway 10.8.0.1"
    if route\-gateway unset:
      route\-gateway 10.8.0.2
4cc6a259
 
148329ca
 .in -4
6fbf66fa
 .ft
 .fi
 
 Don't use
48fe8bb3
 .B \-\-server
6fbf66fa
 if you are ethernet bridging.  Use
2d321609
 .B \-\-server\-bridge
6fbf66fa
 instead.
 .\"*********************************************************
 .TP
510c8ade
 .B \-\-server\-bridge gateway netmask pool\-start\-IP pool\-end\-IP
148329ca
 .TP
2d321609
 .B \-\-server\-bridge ['nogw']
6fbf66fa
 
 A helper directive similar to
48fe8bb3
 .B \-\-server
6fbf66fa
 which is designed to simplify the configuration
 of OpenVPN's server mode in ethernet bridging configurations.
 
03731db3
 If
2d321609
 .B \-\-server\-bridge
510c8ade
 is used without any parameters, it will enable a DHCP\-proxy
03731db3
 mode, where connecting OpenVPN clients will receive an IP
 address for their TAP adapter from the DHCP server running
510c8ade
 on the OpenVPN server\-side LAN.
03731db3
 Note that only clients that support
 the binding of a DHCP client with the TAP adapter (such as
148329ca
 Windows) can support this mode.  The optional 
 .B nogw
 flag (advanced) indicates that gateway information should not be
 pushed to the client.
03731db3
 
6fbf66fa
 To configure ethernet bridging, you 
 must first use your OS's bridging capability
 to bridge the TAP interface with the ethernet
 NIC interface.  For example, on Linux this is done
 with the
 .B brctl
 tool, and with Windows XP it is done in the Network
 Connections Panel by selecting the ethernet and
510c8ade
 TAP adapters and right\-clicking on "Bridge Connections".
6fbf66fa
 
 Next you you must manually set the
 IP/netmask on the bridge interface.  The
 .B gateway
 and
 .B netmask
 parameters to
2d321609
 .B \-\-server\-bridge
6fbf66fa
 can be set to either the IP/netmask of the
 bridge interface, or the IP/netmask of the
 default gateway/router on the bridged
 subnet.
 
 Finally, set aside a IP range in the bridged
 subnet,
 denoted by
510c8ade
 .B pool\-start\-IP
6fbf66fa
 and
510c8ade
 .B pool\-end\-IP,
6fbf66fa
 for OpenVPN to allocate to connecting
 clients.
 
 For example,
2d321609
 .B server\-bridge 10.8.0.4 255.255.255.0 10.8.0.128 10.8.0.254
6fbf66fa
 expands as follows:
 
 .nf
148329ca
 .ft 3
 .in +4
6fbf66fa
 mode server
2d321609
 tls\-server
6fbf66fa
 
2d321609
 ifconfig\-pool 10.8.0.128 10.8.0.254 255.255.255.0
 push "route\-gateway 10.8.0.4"
148329ca
 .in -4
6fbf66fa
 .ft
 .fi
03731db3
 
 In another example,
2d321609
 .B \-\-server\-bridge
03731db3
 (without parameters) expands as follows:
 
 .nf
148329ca
 .ft 3
 .in +4
03731db3
 mode server
2d321609
 tls\-server
03731db3
 
2d321609
 push "route\-gateway dhcp"
148329ca
 .in -4
 .ft
 .fi
 
 Or
2d321609
 .B \-\-server\-bridge nogw
148329ca
 expands as follows:
 
 .nf
 .ft 3
 .in +4
 mode server
2d321609
 tls\-server
148329ca
 .in -4
03731db3
 .ft
 .fi
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-push "option"
6fbf66fa
 Push a config file option back to the client for remote
 execution.  Note that
 .B
 option
 must be enclosed in double quotes ("").  The client must specify
48fe8bb3
 .B \-\-pull
6fbf66fa
 in its config file.  The set of options which can be
 pushed is limited by both feasibility and security.
 Some options such as those which would execute scripts
 are banned, since they would effectively allow a compromised
 server to execute arbitrary code on the client.
 Other options such as TLS or MTU parameters
 cannot be pushed because the client needs to know
 them before the connection to the server can be initiated.
 
 This is a partial list of options which can currently be pushed:
2d321609
 .B \-\-route, \-\-route\-gateway, \-\-route\-delay, \-\-redirect\-gateway,
 .B \-\-ip\-win32, \-\-dhcp\-option,
 .B \-\-inactive, \-\-ping, \-\-ping\-exit, \-\-ping\-restart,
48fe8bb3
 .B \-\-setenv,
f8a367f7
 .B \-\-auth\-token,
2d321609
 .B \-\-persist\-key, \-\-persist\-tun, \-\-echo,
 .B \-\-comp\-lzo,
 .B \-\-socket\-flags,
48fe8bb3
 .B \-\-sndbuf, \-\-rcvbuf
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-push\-reset
6fbf66fa
 Don't inherit the global push list for a specific client instance.
510c8ade
 Specify this option in a client\-specific context such
6fbf66fa
 as with a
2d321609
 .B \-\-client\-config\-dir
6fbf66fa
 configuration file.  This option will ignore
48fe8bb3
 .B \-\-push
6fbf66fa
 options at the global config file level.
970312f1
 .\"*********************************************************
 .TP
 .B \-\-push\-remove opt
 selectively remove all
 .B \-\-push
 options matching "opt" from the option list for a client.  "opt" is matched
510c8ade
 as a substring against the whole option string to\-be\-pushed to the client, so
970312f1
 .B \-\-push\-remove route
 would remove all
 .B \-\-push route ...
 and
510c8ade
 .B \-\-push route\-ipv6 ...
970312f1
 statements, while
510c8ade
 .B \-\-push\-remove 'route\-ipv6 2001:'
970312f1
 would only remove IPv6 routes for 2001:... networks.
 
 .B \-\-push\-remove
510c8ade
 can only be used in a client\-specific context, like in a
970312f1
 .B \-\-client\-config\-dir
 file, or
 .B \-\-client\-connect
510c8ade
 script or plugin \-\- similar to
970312f1
 .B \-\-push\-reset,
 just more selective.
 
 NOTE: to
 .I change
 an option,
 .B \-\-push\-remove
 can be used to first remove the old value, and then add a new
 .B \-\-push
 option with the new value.
6ae2f19d
 
 NOTE2: due to implementation details, 'ifconfig' and 'ifconfig-ipv6'
 can only be removed with an exact match on the option ("push-remove ifconfig"),
 no substring matching and no matching on the IPv4/IPv6 address argument
 is possible.
970312f1
 .\"*********************************************************
003e76bc
 .TP
2d321609
 .B \-\-push\-peer\-info
960524a9
 Push additional information about the client to server.
 The following data is always pushed to the server:
003e76bc
 
510c8ade
 IV_VER=<version> \-\- the client OpenVPN version
003e76bc
 
510c8ade
 IV_PLAT=[linux|solaris|openbsd|mac|netbsd|freebsd|win] \-\- the client OS platform
003e76bc
 
510c8ade
 IV_LZO_STUB=1 \-\- if client was built with LZO stub capability
960524a9
 
510c8ade
 IV_LZ4=1 \-\- if the client supports LZ4 compressions.
960524a9
 
510c8ade
 IV_PROTO=2 \-\- if the client supports peer\-id floating mechansim
960524a9
 
510c8ade
 IV_NCP=2 \-\- negotiable ciphers, client supports
960524a9
 .B \-\-cipher
 pushed by the server, a value of 2 or greater indicates client
510c8ade
 supports AES\-GCM\-128 and AES\-GCM\-256.
960524a9
 
ae950fac
 IV_GUI_VER=<gui_id> <version> \-\- the UI version of a UI if one is
960524a9
 running, for example "de.blinkt.openvpn 0.5.47" for the
 Android app.
 
 When
 .B \-\-push\-peer\-info
 is enabled the additional information consists of the following data:
 
510c8ade
 IV_HWADDR=<mac address> \-\- the MAC address of clients default gateway
003e76bc
 
510c8ade
 IV_SSL=<version string> \-\- the ssl version used by the client, e.g. "OpenSSL 1.0.2f 28 Jan 2016".
960524a9
 
510c8ade
 IV_PLAT_VER=x.y \- the version of the operating system, e.g. 6.1 for Windows 7.
003e76bc
 
510c8ade
 UV_<name>=<value> \-\- client environment variables whose names start with "UV_"
6fbf66fa
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-disable
6fbf66fa
 Disable a particular client (based on the common name)
 from connecting.  Don't use this option to disable a client
 due to key or password compromise.  Use a CRL (certificate
 revocation list) instead (see the
2d321609
 .B \-\-crl\-verify
6fbf66fa
 option).
 
 This option must be associated with a specific client instance,
 which means that it must be specified either in a client
 instance config file using
2d321609
 .B \-\-client\-config\-dir
6fbf66fa
 or dynamically generated using a
2d321609
 .B \-\-client\-connect
6fbf66fa
 script.
 .\"*********************************************************
 .TP
510c8ade
 .B \-\-ifconfig\-pool start\-IP end\-IP [netmask]
6fbf66fa
 Set aside a pool of subnets to be
 dynamically allocated to connecting clients, similar
510c8ade
 to a DHCP server.  For tun\-style
6fbf66fa
 tunnels, each client will be given a /30 subnet (for
510c8ade
 interoperability with Windows clients).  For tap\-style
6fbf66fa
 tunnels, individual addresses will be allocated, and the
 optional
 .B netmask
 parameter will also be pushed to clients.
 
 .\"*********************************************************
 .TP
2d321609
 .B \-\-ifconfig\-pool\-persist file [seconds]
 Persist/unpersist ifconfig\-pool
6fbf66fa
 data to
 .B file,
 at
 .B seconds
 intervals (default=600), as well as on program startup and
 shutdown.
 
510c8ade
 The goal of this option is to provide a long\-term association
6fbf66fa
 between clients (denoted by their common name) and the virtual
510c8ade
 IP address assigned to them from the ifconfig\-pool.
 Maintaining a long\-term
6fbf66fa
 association is good for clients because it allows them
 to effectively use the
2d321609
 .B \-\-persist\-tun
6fbf66fa
 option.
 
 .B file
510c8ade
 is a comma\-delimited ASCII file, formatted as
 <Common\-Name>,<IP\-address>.
6fbf66fa
 
 If
 .B seconds
 = 0,
 .B file
510c8ade
 will be treated as read\-only.  This is useful if
6fbf66fa
 you would like to treat
 .B file
 as a configuration file.
 
 Note that the entries in this file are treated by OpenVPN as
 suggestions only, based on past associations between
 a common name and IP address.  They do not guarantee that the given common
 name will always receive the given IP address.  If you want guaranteed
 assignment, use
2d321609
 .B \-\-ifconfig\-push
6e4a8175
 
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-ifconfig\-pool\-linear
6e4a8175
 .B DEPRECATED
 This option will be removed in OpenVPN 2.5
 
6fbf66fa
 Modifies the
2d321609
 .B \-\-ifconfig\-pool
6fbf66fa
 directive to
 allocate individual TUN interface addresses for
 clients rather than /30 subnets.  NOTE:  This option
 is incompatible with Windows clients.
3c7f2f55
 
 This option is deprecated, and should be replaced with
48fe8bb3
 .B \-\-topology p2p
3c7f2f55
 which is functionally equivalent.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-ifconfig\-push local remote\-netmask [alias]
6fbf66fa
 Push virtual IP endpoints for client tunnel,
2d321609
 overriding the \-\-ifconfig\-pool dynamic allocation.
6fbf66fa
 
 The parameters
 .B local
 and
2d321609
 .B remote\-netmask
6fbf66fa
 are set according to the
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 directive which you want to execute on the client machine to
 configure the remote end of the tunnel.  Note that the parameters
 .B local
 and
2d321609
 .B remote\-netmask
6fbf66fa
 are from the perspective of the client, not the server.  They may be
 DNS names rather than IP addresses, in which case they will be resolved
 on the server at the time of client connection.
 
581bef87
 The optional
 .B alias
 parameter may be used in cases where NAT causes the client view
 of its local endpoint to differ from the server view.  In this case
2d321609
 .B local/remote\-netmask
581bef87
 will refer to the server view while
2d321609
 .B alias/remote\-netmask
581bef87
 will refer to the client view.
 
6fbf66fa
 This option must be associated with a specific client instance,
 which means that it must be specified either in a client
 instance config file using
2d321609
 .B \-\-client\-config\-dir
6fbf66fa
 or dynamically generated using a
2d321609
 .B \-\-client\-connect
6fbf66fa
 script.
 
 Remember also to include a
48fe8bb3
 .B \-\-route
6fbf66fa
 directive in the main OpenVPN config file which encloses
 .B local,
 so that the kernel will know to route it
 to the server's TUN/TAP interface.
 
 OpenVPN's internal client IP address selection algorithm works as
 follows:
 
 .B 1
510c8ade
 \-\- Use
2d321609
 .B \-\-client\-connect script
6fbf66fa
 generated file for static IP (first choice).
 .br
 .B 2
510c8ade
 \-\- Use
2d321609
 .B \-\-client\-config\-dir
6fbf66fa
 file for static IP (next choice).
 .br
 .B 3
510c8ade
 \-\- Use
2d321609
 .B \-\-ifconfig\-pool
6fbf66fa
 allocation for dynamic IP (last choice).
 .br
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-iroute network [netmask]
6fbf66fa
 Generate an internal route to a specific
 client. The
 .B netmask
 parameter, if omitted, defaults to 255.255.255.255.
 
 This directive can be used to route a fixed subnet from
 the server to a particular client, regardless
 of where the client is connecting from.  Remember
 that you must also add the route to the system
 routing table as well (such as by using the
48fe8bb3
 .B \-\-route
6fbf66fa
 directive).  The reason why two routes are needed
 is that the
48fe8bb3
 .B \-\-route
6fbf66fa
 directive routes the packet from the kernel
 to OpenVPN.  Once in OpenVPN, the
48fe8bb3
 .B \-\-iroute
6fbf66fa
 directive routes to the specific client.
 
 This option must be specified either in a client
 instance config file using
2d321609
 .B \-\-client\-config\-dir
6fbf66fa
 or dynamically generated using a
2d321609
 .B \-\-client\-connect
6fbf66fa
 script.
 
 The
48fe8bb3
 .B \-\-iroute
6fbf66fa
 directive also has an important interaction with
48fe8bb3
 .B \-\-push
6fbf66fa
 "route ...".
48fe8bb3
 .B \-\-iroute
6fbf66fa
 essentially defines a subnet which is owned by a
 particular client (we will call this client A).
 If you would like other clients to be able to reach A's
 subnet, you can use
48fe8bb3
 .B \-\-push
6fbf66fa
 "route ..."
 together with
2d321609
 .B \-\-client\-to\-client
6fbf66fa
 to effect this.  In order for all clients to see
 A's subnet, OpenVPN must push this route to all clients
 EXCEPT for A, since the subnet is already owned by A.
 OpenVPN accomplishes this by not
 not pushing a route to a client
 if it matches one of the client's iroutes.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-client\-to\-client
6fbf66fa
 Because the OpenVPN server mode handles multiple clients
 through a single tun or tap interface, it is effectively
 a router.  The
2d321609
 .B \-\-client\-to\-client
510c8ade
 flag tells OpenVPN to internally route client\-to\-client
 traffic rather than pushing all client\-originating traffic
6fbf66fa
 to the TUN/TAP interface.
 
 When this option is used, each client will "see" the other
 clients which are currently connected.  Otherwise, each
 client will only see the server.  Don't use this option
 if you want to firewall tunnel traffic using
510c8ade
 custom, per\-client rules.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-duplicate\-cn
6fbf66fa
 Allow multiple clients with the same common name to concurrently connect.
 In the absence of this option, OpenVPN will disconnect a client instance
 upon connection of a new client having the same common name.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-client\-connect cmd
6fbf66fa
 Run
d6285998
 .B command cmd
 on client connection.
 
 .B cmd
 consists of a path to script (or executable program), optionally
510c8ade
 followed by arguments. The path and arguments may be single\- or double\-quoted
d6285998
 and/or escaped using a backslash, and should be separated by one or more spaces.
 
 The command is passed the common name
510c8ade
 and IP address of the just\-authenticated client
6fbf66fa
 as environmental variables (see environmental variable section
d6285998
 below).  The command is also passed
 the pathname of a freshly created temporary file as the last argument
 (after any arguments specified in
 .B cmd
 ), to be used by the command
6fbf66fa
 to pass dynamically generated config file directives back to OpenVPN.
 
 If the script wants to generate a dynamic config file
 to be applied on the server when the client connects,
d6285998
 it should write it to the file named by the last argument.
6fbf66fa
 
 See the
2d321609
 .B \-\-client\-config\-dir
6fbf66fa
 option below for options which
 can be legally used in a dynamically generated config file.
 
 Note that the return value of
 .B script
 is significant.  If
 .B script
510c8ade
 returns a non\-zero error status, it will cause the client
6fbf66fa
 to be disconnected.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-client\-disconnect cmd
6fbf66fa
 Like
2d321609
 .B \-\-client\-connect
6fbf66fa
 but called on client instance shutdown.  Will not be called
 unless the
2d321609
 .B \-\-client\-connect
6fbf66fa
 script and plugins (if defined)
 were previously called on this instance with
 successful (0) status returns.
 
 The exception to this rule is if the
2d321609
 .B \-\-client\-disconnect
510c8ade
 command or plugins are cascaded, and at least one client\-connect
 function succeeded, then ALL of the client\-disconnect functions for
6fbf66fa
 scripts and plugins will be called on client instance object deletion,
510c8ade
 even in cases where some of the related client\-connect functions returned
6fbf66fa
 an error status.
d6285998
 
 The
2d321609
 .B \-\-client\-disconnect
d6285998
 command is passed the same pathname as the corresponding
2d321609
 .B \-\-client\-connect
d6285998
 command as its last argument. (after any arguments specified in
 .B cmd
 ).
6fbf66fa
 .B 
 .\"*********************************************************
 .TP
2d321609
 .B \-\-client\-config\-dir dir
6fbf66fa
 Specify a directory
 .B dir
 for custom client config files.  After
 a connecting client has been authenticated, OpenVPN will
 look in this directory for a file having the same name
 as the client's X509 common name.  If a matching file
510c8ade
 exists, it will be opened and parsed for client\-specific
6fbf66fa
 configuration options.  If no matching file is found, OpenVPN
 will instead try to open and parse a default file called
ae32ea59
 "DEFAULT", which may be provided but is not required. Note that
 the configuration files must be readable by the OpenVPN process
 after it has dropped it's root privileges.
6fbf66fa
 
 This file can specify a fixed IP address for a given
 client using
2d321609
 .B \-\-ifconfig\-push,
6fbf66fa
 as well as fixed subnets owned by the client using
48fe8bb3
 .B \-\-iroute.
6fbf66fa
 
 One of the useful properties of this option is that it
 allows client configuration files to be conveniently
 created, edited, or removed while the server is live,
 without needing to restart the server.
 
 The following
510c8ade
 options are legal in a client\-specific context:
970312f1
 .B \-\-push, \-\-push\-reset, \-\-push\-remove, \-\-iroute, \-\-ifconfig\-push,
6fbf66fa
 and
48fe8bb3
 .B \-\-config.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-ccd\-exclusive
6fbf66fa
 Require, as a
 condition of authentication, that a connecting client has a
2d321609
 .B \-\-client\-config\-dir
6fbf66fa
 file.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tmp\-dir dir
6fbf66fa
 Specify a directory
 .B dir
 for temporary files.  This directory will be used by
dc2ccc82
 openvpn processes and script to communicate temporary
 data with openvpn main process. Note that
 the directory must be writable by the OpenVPN process
 after it has dropped it's root privileges.
 
 This directory will be used by in the following cases:
 
 *
2d321609
 .B \-\-client\-connect
510c8ade
 scripts to dynamically generate client\-specific
6fbf66fa
 configuration files.
dc2ccc82
 
 *
 .B OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY
 plugin hook to return success/failure via auth_control_file
 when using deferred auth method
 
 *
 .B OPENVPN_PLUGIN_ENABLE_PF
 plugin hook to pass filtering rules via pf_file
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-hash\-size r v
6fbf66fa
 Set the size of the real address hash table to
 .B r
 and the virtual address table to
 .B v.
 By default, both tables are sized at 256 buckets.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-bcast\-buffers n
6fbf66fa
 Allocate
 .B n
 buffers for broadcast datagrams (default=256).
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tcp\-queue\-limit n
b4ddf9e4
 Maximum number of output packets queued before TCP (default=64).
6fbf66fa
 
 When OpenVPN is tunneling data from a TUN/TAP device to a
 remote client over a TCP connection, it is possible that the TUN/TAP device
 might produce data at a faster rate than the TCP connection
b4ddf9e4
 can support.  When the number of output packets queued before sending to
 the TCP socket reaches this limit for a given client connection,
6fbf66fa
 OpenVPN will start to drop outgoing packets directed
 at this client.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tcp\-nodelay
ae3b3746
 This macro sets the TCP_NODELAY socket flag on the server
 as well as pushes it to connecting clients.  The TCP_NODELAY
 flag disables the Nagle algorithm on TCP sockets causing
 packets to be transmitted immediately with low latency,
 rather than waiting a short period of time in order
 to aggregate several packets into a larger containing
 packet.  In VPN applications over TCP, TCP_NODELAY
 is generally a good latency optimization.
 
 The macro expands as follows:
 
 .nf
148329ca
 .ft 3
 .in +4
ae3b3746
  if mode server:
2d321609
    socket\-flags TCP_NODELAY
    push "socket\-flags TCP_NODELAY"
148329ca
 .in -4
ae3b3746
 .ft
 .fi
 .\"*********************************************************
 .TP
2d321609
 .B \-\-max\-clients n
6fbf66fa
 Limit server to a maximum of
 .B n
 concurrent clients.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-max\-routes\-per\-client n
6fbf66fa
 Allow a maximum of
 .B n
 internal routes per client (default=256).
 This is designed to
 help contain DoS attacks where an authenticated client floods the
 server with packets appearing to come from many unique MAC addresses,
 forcing the server to deplete
 virtual memory as its internal routing table expands.
 This directive can be used in a
2d321609
 .B \-\-client\-config\-dir
510c8ade
 file or auto\-generated by a
2d321609
 .B \-\-client\-connect
6fbf66fa
 script to override the global value for a particular client.
 
 Note that this
 directive affects OpenVPN's internal routing table, not the
 kernel routing table.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-stale\-routes\-check n [t]
3a957aae
 Remove routes haven't had activity for
 .B n
 seconds (i.e. the ageing time).
 
 This check is ran every
 .B t
 seconds (i.e. check interval).
 
 If
 .B t
 is not present it defaults to
 .B n
 
 This option helps to keep the dynamic routing table small.
 See also
2d321609
 .B \-\-max\-routes\-per\-client
3a957aae
 .\"*********************************************************
 .TP
2d321609
 .B \-\-connect\-freq n sec
6fbf66fa
 Allow a maximum of
 .B n
 new connections per
 .B sec 
 seconds from clients.  This is designed to contain DoS attacks which flood
 the server with connection requests using certificates which
 will ultimately fail to authenticate.
 
 This is an imperfect solution however, because in a real
 DoS scenario, legitimate connections might also be refused.
 
 For the best protection against DoS attacks in server mode,
 use
48fe8bb3
 .B \-\-proto udp
c6e24fa3
 and either
 .B \-\-tls\-auth
 or
 .B \-\-tls\-crypt\fR.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-learn\-address cmd
d6285998
 Run command
6fbf66fa
 .B cmd
 to validate client virtual addresses or routes.
 
 .B cmd
d6285998
 consists of a path to script (or executable program), optionally
510c8ade
 followed by arguments. The path and arguments may be single\- or double\-quoted
d6285998
 and/or escaped using a backslash, and should be separated by one or more spaces.
 
 Three arguments will be appended to any arguments in
 .B cmd
 as follows:
6fbf66fa
 
48fe8bb3
 .B [1] operation \-\-
6fbf66fa
 "add", "update", or "delete" based on whether or not
 the address is being added to, modified, or deleted from
 OpenVPN's internal routing table.
 .br
48fe8bb3
 .B [2] address \-\-
6fbf66fa
 The address being learned or unlearned.  This can be
 an IPv4 address such as "198.162.10.14", an IPv4 subnet
 such as "198.162.10.0/24", or an ethernet MAC address (when
48fe8bb3
 .B \-\-dev tap
6fbf66fa
 is being used) such as "00:FF:01:02:03:04".
 .br
48fe8bb3
 .B [3] common name \-\-
6fbf66fa
 The common name on the certificate associated with the
 client linked to this address.  Only present for "add"
 or "update" operations, not "delete".
 
 On "add" or "update" methods, if the script returns
510c8ade
 a failure code (non\-zero), OpenVPN will reject the address
6fbf66fa
 and will not modify its internal routing table.
 
 Normally, the
 .B cmd
 script will use the information provided above to set
 appropriate firewall entries on the VPN TUN/TAP interface.
 Since OpenVPN provides the association between virtual IP
 or MAC address and the client's authenticated common name,
510c8ade
 it allows a user\-defined script to configure firewall access
 policies with regard to the client's high\-level common name,
6fbf66fa
 rather than the low level client virtual addresses.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-auth\-user\-pass\-verify cmd method
6fbf66fa
 Require the client to provide a username/password (possibly
 in addition to a client certificate) for authentication.
 
d6285998
 OpenVPN will run
 .B command cmd
 to validate the username/password
6fbf66fa
 provided by the client.
 
d6285998
 .B cmd
 consists of a path to script (or executable program), optionally
510c8ade
 followed by arguments. The path and arguments may be single\- or double\-quoted
d6285998
 and/or escaped using a backslash, and should be separated by one or more spaces.
 
6fbf66fa
 If
 .B method
2d321609
 is set to "via\-env", OpenVPN will call
6fbf66fa
 .B script
 with the environmental variables
 .B username
 and
 .B password
 set to the username/password strings provided by the client.
 Be aware that this method is insecure on some platforms which
 make the environment of a process publicly visible to other
 unprivileged processes.
 
 If
 .B method
2d321609
 is set to "via\-file", OpenVPN will write the username and
6fbf66fa
 password to the first two lines of a temporary file.  The filename
 will be passed as an argument to
 .B script,
 and the file will be automatically deleted by OpenVPN after
 the script returns.  The location of the temporary file is
 controlled by the
2d321609
 .B \-\-tmp\-dir
6fbf66fa
 option, and will default to the current directory if unspecified.
 For security, consider setting 
2d321609
 .B \-\-tmp\-dir
6fbf66fa
 to a volatile storage medium such as
 .B /dev/shm
 (if available) to prevent the username/password file from touching the hard drive.
 
 The script should examine the username
 and password,
 returning a success exit code (0) if the
 client's authentication request is to be accepted, or a failure
 code (1) to reject the client.
 
510c8ade
 This directive is designed to enable a plugin\-style interface
6fbf66fa
 for extending OpenVPN's authentication capabilities.
 
 To protect against a client passing a maliciously formed
 username or password string, the username string must
 consist only of these characters: alphanumeric, underbar
510c8ade
 ('_'), dash ('\-'), dot ('.'), or at ('@').  The password
6fbf66fa
 string can consist of any printable characters except for
 CR or LF.  Any illegal characters in either the username
 or password string will be converted to underbar ('_').
 
510c8ade
 Care must be taken by any user\-defined scripts to avoid
6fbf66fa
 creating a security vulnerability in the way that these
 strings are handled.  Never use these strings in such a way
 that they might be escaped or evaluated by a shell interpreter.
 
 For a sample script that performs PAM authentication, see
2d321609
 .B sample\-scripts/auth\-pam.pl
6fbf66fa
 in the OpenVPN source distribution.
 .\"*********************************************************
 .TP
58066d04
 .B \-\-auth\-gen\-token [lifetime]
 After successful user/password authentication, the OpenVPN
 server will with this option generate a temporary
 authentication token and push that to client.  On the following
 renegotiations, the OpenVPN client will pass this token instead
 of the users password.  On the server side the server will do
 the token authentication internally and it will NOT do any
 additional authentications against configured external
 user/password authentication mechanisms.
 
 The
 .B lifetime
 argument defines how long the generated token is valid.  The
 lifetime is defined in seconds.  If lifetime is not set
 or it is set to 0, the token will never expire.
 
 This feature is useful for environments which is configured
 to use One Time Passwords (OTP) as part of the user/password
 authentications and that authentication mechanism does not
510c8ade
 implement any auth\-token support.
58066d04
 .\"*********************************************************
 .TP
2d321609
 .B \-\-opt\-verify
09cc9c81
 Clients that connect with options that are incompatible
 with those of the server will be disconnected.
 
 Options that will be compared for compatibility include
86e2fa55
 dev\-type, link\-mtu, tun\-mtu, proto, ifconfig,
2d321609
 comp\-lzo, fragment, keydir, cipher, auth, keysize, secret,
 no\-replay, no\-iv, tls\-auth, key\-method, tls\-server, and tls\-client.
09cc9c81
 
 This option requires that
2d321609
 .B \-\-disable\-occ
09cc9c81
 NOT be used.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-auth\-user\-pass\-optional
24ce3b27
 Allow connections by clients that do not specify a username/password.
 Normally, when
2d321609
 .B \-\-auth\-user\-pass\-verify
24ce3b27
 or
2d321609
 .B \-\-management\-client\-auth
24ce3b27
 is specified (or an authentication plugin module), the
 OpenVPN server daemon will require connecting clients to specify a
 username and password.  This option makes the submission of a username/password
510c8ade
 by clients optional, passing the responsibility to the user\-defined authentication
24ce3b27
 module/script to accept or deny the client based on other factors
 (such as the setting of X509 certificate fields).  When this option is used,
510c8ade
 and a connecting client does not submit a username/password, the user\-defined
24ce3b27
 authentication module/script will see the username and password as being set
 to empty strings ("").  The authentication module/script MUST have logic
 to detect this condition and respond accordingly.
 .\"*********************************************************
 .TP
6e4a8175
 .B \-\-client\-cert\-not\-required
 .B DEPRECATED
 This option will be removed in OpenVPN 2.5
 
6fbf66fa
 Don't require client certificate, client will authenticate
 using username/password only.  Be aware that using this directive
 is less secure than requiring certificates from all clients.
 
b8cdb213
 .B Please note:
6e4a8175
 This is replaced by
b8cdb213
 .B \-\-verify\-client\-cert
 which allows for more flexibility. The option
 .B \-\-verify\-client\-cert none
 is functionally equivalent to
 .B \-\-client\-cert\-not\-required
 .
 
 .\"*********************************************************
 .TP
 .B \-\-verify\-client\-cert none|optional|require
 Specify whether the client is required to supply a valid certificate.
 
 Possible options are
 
 .B none
 : a client certificate is not required. the client need to authenticate
 using username/password only.  Be aware that using this directive
 is less secure than requiring certificates from all clients.
 
6fbf66fa
 If you use this directive, the
 entire responsibility of authentication will rest on your
2d321609
 .B \-\-auth\-user\-pass\-verify
6fbf66fa
 script, so keep in mind that bugs in your script
 could potentially compromise the security of your VPN.
 
b8cdb213
 .B \-\-verify\-client\-cert none
 is functionally equivalent to
 .B \-\-client\-cert\-not\-required.
 
 .B optional
 : a client may present a certificate but it is not required to do so.
 When using this directive, you should also use a
 .B \-\-auth\-user\-pass\-verify
 script to ensure that clients are authenticated using a
 certificate, a username and password, or possibly even both.
 
 Again, the entire responsibility of authentication will rest on your
 .B \-\-auth\-user\-pass\-verify
 script, so keep in mind that bugs in your script
 could potentially compromise the security of your VPN.
 
 .B require
 : this is the default option. A client is required to present a
 certificate, otherwise VPN access is refused.
 
 If you don't use this directive (or use
 .B \-\-verify\-client\-cert require
 ) but you also specify an
2d321609
 .B \-\-auth\-user\-pass\-verify
6fbf66fa
 script, then OpenVPN will perform double authentication.  The
 client certificate verification AND the
2d321609
 .B \-\-auth\-user\-pass\-verify
6fbf66fa
 script will need to succeed in order for a client to be
 authenticated and accepted onto the VPN.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-username\-as\-common\-name
6fbf66fa
 For
2d321609
 .B \-\-auth\-user\-pass\-verify
6fbf66fa
 authentication, use
 the authenticated username as the common name,
 rather than the common name from the client cert.
 .\"*********************************************************
6add6b2f
 .TP
6e4a8175
 .B \-\-compat\-names [no\-remapping]
 .B DEPRECATED
 This option will be removed in OpenVPN 2.5
 
e7412ca3
 Until OpenVPN v2.3 the format of the X.509 Subject fields was formatted
 like this:
 .IP
 .B
 /C=US/L=Somewhere/CN=John Doe/emailAddress=john@example.com
 .IP
b443772b
 In addition the old behaviour was to remap any character other than
510c8ade
 alphanumeric, underscore ('_'), dash ('\-'), dot ('.'), and slash ('/') to
e7412ca3
 underscore ('_').  The X.509 Subject string as returned by the
 .B tls_id
 environmental variable, could additionally contain colon (':') or equal ('=').
 .IP
 When using the
 .B \-\-compat\-names
510c8ade
 option, this old formatting and remapping will be re\-enabled again.  This is
 purely implemented for compatibility reasons when using older plug\-ins or
 scripts which does not handle the new formatting or UTF\-8 characters.
e7412ca3
 .IP
500854c3
 In OpenVPN 2.3 the formatting of these fields changed into a more
e7412ca3
 standardised format.  It now looks like:
 .IP
 .B
 C=US, L=Somewhere, CN=John Doe, emailAddress=john@example.com
 .IP
500854c3
 The new default format in OpenVPN 2.3 also does not do the character remapping
e7412ca3
 which happened earlier.  This new format enables proper support for UTF\-8
 characters in the usernames, X.509 Subject fields and Common Name variables and
 it complies to the RFC 2253, UTF\-8 String Representation of Distinguished
 Names.
 
26b0433c
 The
e7412ca3
 .B no\-remapping
 mode flag can be used with the
 .B
 \-\-compat\-names
9f0fc745
 option to be compatible with the now deprecated \-\-no\-name\-remapping option.
 It is only available at the server. When this mode flag is used, the Common Name,
26b0433c
 Subject, and username strings are allowed to include any printable character
 including space, but excluding control characters such as tab, newline, and
510c8ade
 carriage\-return. no\-remapping is only available on the server side.
e7412ca3
 
 .B Please note:
9f0fc745
 This option is immediately deprecated.  It is only implemented
e7412ca3
 to make the transition to the new formatting less intrusive.  It will be
510c8ade
 removed in OpenVPN 2.5.  So please update your scripts/plug\-ins where necessary.
e7412ca3
 .\"*********************************************************
 .TP
6e4a8175
 .B \-\-no\-name\-remapping
 .B DEPRECATED
 This option will be removed in OpenVPN 2.5
 
26b0433c
 The
 .B \-\-no\-name\-remapping
 option is an alias for
 .B \-\-compat\-names\ no\-remapping.
9f0fc745
 It ensures compatibility with server configurations using the
26b0433c
 .B \-\-no\-name\-remapping
 option.
 
 .B Please note:
500854c3
 This option is now deprecated.  It will be removed in OpenVPN 2.5.
10ce6370
 So please make sure you support the new X.509 name formatting
26b0433c
 described with the
 .B \-\-compat\-names
 option as soon as possible.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-port\-share host port [dir]
6add6b2f
 When run in TCP server mode, share the OpenVPN port with
 another application, such as an HTTPS server.  If OpenVPN
510c8ade
 senses a connection to its port which is using a non\-OpenVPN
6add6b2f
 protocol, it will proxy the connection to the server at
 .B host:port.
28549038
 Currently only designed to work with HTTP/HTTPS,
6add6b2f
 though it would be theoretically possible to extend to
 other protocols such as ssh.
 
1c5ff772
 .B dir
 specifies an optional directory where a temporary file with name N
 containing content C will be dynamically generated for each proxy
 connection, where N is the source IP:port of the client connection
 and C is the source IP:port of the connection to the proxy
 receiver.  This directory can be used as a dictionary by
 the proxy receiver to determine the origin of the connection.
 Each generated file will be automatically deleted when the proxied
 connection is torn down.
 
d3ad4570
 Not implemented on Windows.
6add6b2f
 .\"*********************************************************
6fbf66fa
 .SS Client Mode
 Use client mode when connecting to an OpenVPN server
 which has
2d321609
 .B \-\-server, \-\-server\-bridge,
6fbf66fa
 or
48fe8bb3
 .B \-\-mode server
6fbf66fa
 in it's configuration.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-client
6fbf66fa
 A helper directive designed to simplify the configuration
 of OpenVPN's client mode.  This directive is equivalent to:
 
 .nf
148329ca
 .ft 3
 .in +4
6fbf66fa
  pull
2d321609
  tls\-client
148329ca
 .in -4
6fbf66fa
 .ft
 .fi
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-pull
6fbf66fa
 This option must be used on a client which is connecting
510c8ade
 to a multi\-client server.  It indicates to OpenVPN that it
6fbf66fa
 should accept options pushed by the server, provided they
03653f42
 are part of the legal set of pushable options (note that the
48fe8bb3
 .B \-\-pull
03653f42
 option is implied by
48fe8bb3
 .B \-\-client
03653f42
 ).
 
 In particular,
48fe8bb3
 .B \-\-pull
03653f42
 allows the server to push routes to the client, so you should
 not use
48fe8bb3
 .B \-\-pull
03653f42
 or
48fe8bb3
 .B \-\-client
03653f42
 in situations where you don't trust the server to have control
 over the client's routing table.
6fbf66fa
 .\"*********************************************************
 .TP
7f74c27e
 .B \-\-pull\-filter accept|ignore|reject \fItext\fR
 Filter options received from the server if the option starts with
 \fItext\fR.  Runs on client. The action flag
 .B accept
 allows the option,
 .B ignore
 removes it and
 .B reject
 flags an error and triggers a SIGUSR1 restart.
 The filters may be specified multiple times, and each filter is
 applied in the order it is specified. The filtering of each
 option stops as soon as a match is found. Unmatched options are accepted
 by default.
 
 Prefix comparison is used to match \fItext\fR against the
 received option so that
 
 .nf
 .ft 3
 .in +4
 \-\-pull\-filter ignore "route"
 .in -4
 .ft
 .fi
 
 would remove all pushed options starting with
 .B route
 which would include, for example,
 .B route\-gateway.
 Enclose \fItext\fR in quotes to embed spaces.
 
 .nf
 .ft 3
 .in +4
 \-\-pull\-filter accept "route 192.168.1."
 \-\-pull\-filter ignore "route "
 .in -4
 .ft
 .fi
 
 would remove all routes that do not start with 192.168.1.
 
 This option may be used only on clients.
 Note that
 .B reject
 may result in a repeated cycle of failure and reconnect,
 unless multiple remotes are specified and connection to the next remote
 succeeds. To silently ignore an option pushed by the server, use
 .B ignore.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-auth\-user\-pass [up]
6fbf66fa
 Authenticate with server using username/password.
 .B up
6e9373c8
 is a file containing username/password on 2 lines. If the
1e9c1f09
 password line is missing, OpenVPN will prompt for one.
6fbf66fa
 
 If
 .B up
 is omitted, username/password will be prompted from the
 console.
 
 The server configuration must specify an
2d321609
 .B \-\-auth\-user\-pass\-verify
6fbf66fa
 script to verify the username/password provided by
 the client.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-auth\-retry type
6fbf66fa
 Controls how OpenVPN responds to username/password verification
510c8ade
 errors such as the client\-side response to an AUTH_FAILED message from the server
6fbf66fa
 or verification failure of the private key password.
 
 Normally used to prevent auth errors from being fatal
 on the client side, and to permit username/password requeries in case
 of error.
 
 An AUTH_FAILED message is generated by the server if the client
 fails
2d321609
 .B \-\-auth\-user\-pass
510c8ade
 authentication, or if the server\-side
2d321609
 .B \-\-client\-connect
6fbf66fa
 script returns an error status when the client
 tries to connect.
 
 .B type
 can be one of:
 
48fe8bb3
 .B none \-\-
6fbf66fa
 Client will exit with a fatal error (this is the default).
 .br
48fe8bb3
 .B nointeract \-\-
6fbf66fa
 Client will retry the connection without requerying for an
2d321609
 .B \-\-auth\-user\-pass
6fbf66fa
 username/password.  Use this option for unattended clients.
 .br
48fe8bb3
 .B interact \-\-
6fbf66fa
 Client will requery for an
2d321609
 .B \-\-auth\-user\-pass
6fbf66fa
 username/password and/or private key password before attempting a reconnection.
 
 Note that while this option cannot be pushed, it can be controlled
 from the management interface.
 .\"*********************************************************
e1e977f3
 .TP
eab3e22f
 .B \-\-static\-challenge t e
 Enable static challenge/response protocol using challenge text
 .B t,
 with
 echo flag given by
 .B e
 (0|1).
 
 The echo flag indicates whether or not the user's response
 to the challenge should be echoed.
 
 See management\-notes.txt in the OpenVPN distribution for a
 description of the OpenVPN challenge/response protocol.
 .\"*********************************************************
 .TP
d0d8a4b5
 \fB\-\-server\-poll\-timeout n\fR, \fB\-\-connect\-timeout n\fR
 When connecting to a remote server do not wait for more than
e1e977f3
 .B n
 seconds waiting for a response before trying the next server.
f2134b7b
 The default value is 120s. This timeout includes proxy and TCP
 connect timeouts.
e1e977f3
 .\"*********************************************************
6fbf66fa
 .TP
2d321609
 .B \-\-explicit\-exit\-notify [n]
510c8ade
 In UDP client mode or point\-to\-point mode, send server/peer an exit notification
6fbf66fa
 if tunnel is restarted or OpenVPN process is exited.  In client mode, on
 exit/restart, this
 option will tell the server to immediately close its client instance object
 rather than waiting for a timeout.  The
 .B n
bbea5bb3
 parameter (default=1) controls the maximum number of attempts that the client
8dd9ff8c
 will try to resend the exit notification message.
 
 In UDP server mode, send RESTART control channel command to connected clients. The
 .B n
 parameter (default=1) controls client behavior. With
 .B n
 = 1 client will attempt to reconnect
 to the same server, with
 .B n
 = 2 client will advance to the next server.
 
 OpenVPN will not send any exit
bbea5bb3
 notifications unless this option is enabled.
e8c42658
 .TP
 .B \-\-allow\-recursive\-routing
 When this option is set, OpenVPN will not drop incoming tun packets
 with same destination as host.
6fbf66fa
 .\"*********************************************************
 .SS Data Channel Encryption Options:
510c8ade
 These options are meaningful for both Static & TLS\-negotiated key modes
6fbf66fa
 (must be compatible between peers).
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-secret file [direction]
510c8ade
 Enable Static Key encryption mode (non\-TLS).
 Use pre\-shared secret
6fbf66fa
 .B file
 which was generated with
48fe8bb3
 .B \-\-genkey.
6fbf66fa
 
 The optional
 .B direction
 parameter enables the use of 4 distinct keys
510c8ade
 (HMAC\-send, cipher\-encrypt, HMAC\-receive, cipher\-decrypt), so that
6fbf66fa
 each data flow direction has a different set of HMAC and cipher keys.
 This has a number of desirable security properties including
 eliminating certain kinds of DoS and message replay attacks.
 
 When the
 .B direction
 parameter is omitted, 2 keys are used bidirectionally, one for HMAC
 and the other for encryption/decryption.
 
 The
 .B direction
 parameter should always be complementary on either side of the connection,
 i.e. one side should use "0" and the other should use "1", or both sides
 should omit it altogether.
 
 The
 .B direction
 parameter requires that
 .B file
510c8ade
 contains a 2048 bit key.  While pre\-1.5 versions of OpenVPN
6fbf66fa
 generate 1024 bit key files, any version of OpenVPN which
 supports the
 .B direction
 parameter, will also support 2048 bit key file generation
 using the
48fe8bb3
 .B \-\-genkey
6fbf66fa
 option.
 
 Static key encryption mode has certain advantages,
 the primary being ease of configuration.
 
 There are no certificates
 or certificate authorities or complicated negotiation handshakes and protocols.
510c8ade
 The only requirement is that you have a pre\-existing secure channel with
6fbf66fa
 your peer (such as
 .B ssh
 ) to initially copy the key.  This requirement, along with the
 fact that your key never changes unless you manually generate a new one,
 makes it somewhat less secure than TLS mode (see below).  If an attacker
 manages to steal your key, everything that was ever encrypted with
 it is compromised.  Contrast that to the perfect forward secrecy features of
 TLS mode (using Diffie Hellman key exchange), where even if an attacker
 was able to steal your private key, he would gain no information to help
 him decrypt past sessions.
 
 Another advantageous aspect of Static Key encryption mode is that
510c8ade
 it is a handshake\-free protocol
6fbf66fa
 without any distinguishing signature or feature
 (such as a header or protocol handshake sequence) 
 that would mark the ciphertext packets as being
 generated by OpenVPN.  Anyone eavesdropping on the wire
 would see nothing
510c8ade
 but random\-looking data.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-key\-direction
0979ec7e
 Alternative way of specifying the optional direction parameter for the
2d321609
 .B \-\-tls\-auth
0979ec7e
 and
 .B \-\-secret
 options. Useful when using inline files (See section on inline files).
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-auth alg
66407e11
 Authenticate data channel packets and (if enabled)
510c8ade
 .B tls\-auth
66407e11
 control channel packets with HMAC using message digest algorithm
6fbf66fa
 .B alg.
 (The default is
 .B SHA1
 ).
 HMAC is a commonly used message authentication algorithm (MAC) that uses
 a data string, a secure hash algorithm, and a key, to produce
 a digital signature.
 
510c8ade
 The OpenVPN data channel protocol uses encrypt\-then\-mac (i.e. first encrypt a
66407e11
 packet, then HMAC the resulting ciphertext), which prevents padding oracle
 attacks.
 
 If an AEAD cipher mode (e.g. GCM) is chosen, the specified
 .B \-\-auth
 algorithm is ignored for the data channel, and the authentication method of the
 AEAD cipher is used instead.  Note that
 .B alg
 still specifies the digest used for
510c8ade
 .B tls\-auth\fR.
6fbf66fa
 
510c8ade
 In static\-key encryption mode, the HMAC key
6fbf66fa
 is included in the key file generated by
48fe8bb3
 .B \-\-genkey.
6fbf66fa
 In TLS mode, the HMAC key is dynamically generated and shared
 between peers via the TLS control channel.  If OpenVPN receives a packet with
 a bad HMAC it will drop the packet.
 HMAC usually adds 16 or 20 bytes per packet.
 Set
 .B alg=none
 to disable authentication.
 
 For more information on HMAC see
 .I http://www.cs.ucsd.edu/users/mihir/papers/hmac.html
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-cipher alg
0fe2498e
 Encrypt data channel packets with cipher algorithm
6fbf66fa
 .B alg.
6e4a8175
 
6fbf66fa
 The default is
510c8ade
 .B BF\-CBC,
6e4a8175
 an abbreviation for Blowfish in Cipher Block Chaining mode.  When cipher
 negotiation (NCP) is allowed, OpenVPN 2.4 and newer on both client and server
 side will automatically upgrade to
510c8ade
 .B AES\-256\-GCM.
6e4a8175
 See
 .B \-\-ncp\-ciphers
 and
 .B \-\-ncp\-disable
 for more details on NCP.
6fbf66fa
 
6e4a8175
 Using
510c8ade
 .B BF\-CBC
 is no longer recommended, because of its 64\-bit block size.  This
5a1daf53
 small block size allows attacks based on collisions, as demonstrated by SWEET32.
6e4a8175
 See https://community.openvpn.net/openvpn/wiki/SWEET32 for details.  Due to
 this, support for
510c8ade
 .B BF\-CBC, DES, CAST5, IDEA
6e4a8175
 and
 .B RC2
 ciphers will be removed in OpenVPN 2.6.
6fbf66fa
 
5a1daf53
 To see other ciphers that are available with OpenVPN, use the
2d321609
 .B \-\-show\-ciphers
6fbf66fa
 option.
 
 Set
 .B alg=none
 to disable encryption.
5a1daf53
 
6fbf66fa
 .\"*********************************************************
 .TP
d728ebed
 .B \-\-ncp\-ciphers cipher_list
 Restrict the allowed ciphers to be negotiated to the ciphers in
 .B cipher_list\fR.
 .B cipher_list
510c8ade
 is a colon\-separated list of ciphers, and defaults to
 "AES\-256\-GCM:AES\-128\-GCM".
a17aa981
 
 For servers, the first cipher from
 .B cipher_list
 will be pushed to clients that support cipher negotiation.
5a1daf53
 
510c8ade
 Cipher negotiation is enabled in client\-server mode only.  I.e. if
5a1daf53
 .B \-\-mode
510c8ade
 is set to 'server' (server\-side, implied by setting
5a1daf53
 .B \-\-server
 ), or if
 .B \-\-pull
510c8ade
 is specified (client\-side, implied by setting \-\-client).
5a1daf53
 
 If both peers support and do not disable NCP, the negotiated cipher will
 override the cipher specified by
 .B \-\-cipher\fR.
 
6e5ad2fa
 Additionally, to allow for more smooth transition, if NCP is enabled, OpenVPN
 will inherit the cipher of the peer if that cipher is different from the local
 .B \-\-cipher
 setting, but the peer cipher is one of the ciphers specified in
 .B \-\-ncp\-ciphers\fR.
510c8ade
 E.g. a non\-NCP client (<=v2.3, or with \-\-ncp\-disabled set) connecting to a
 NCP server (v2.4+) with "\-\-cipher BF\-CBC" and "\-\-ncp\-ciphers
 AES\-256\-GCM:AES\-256\-CBC" set can either specify "\-\-cipher BF\-CBC" or
 "\-\-cipher AES\-256\-CBC" and both will work.
6e5ad2fa
 
d728ebed
 .\"*********************************************************
 .TP
 .B \-\-ncp\-disable
 Disable "negotiable crypto parameters".  This completely disables cipher
 negotiation.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-keysize n
ad178f01
 .B DEPRECATED
 This option will be removed in OpenVPN 2.6.
 
6fbf66fa
 Size of cipher key in bits (optional).
510c8ade
 If unspecified, defaults to cipher\-specific default.  The
2d321609
 .B \-\-show\-ciphers
6fbf66fa
 option (see below) shows all available OpenSSL ciphers,
 their default key sizes, and whether the key size can
 be changed.  Use care in changing a cipher's default
 key size.  Many ciphers have not been extensively
510c8ade
 cryptanalyzed with non\-standard key lengths, and a
6fbf66fa
 larger key may offer no real guarantee of greater
 security, or may even reduce security.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-prng alg [nsl]
510c8ade
 (Advanced) For PRNG (Pseudo\-random number generator),
03bfb228
 use digest algorithm
 .B alg
 (default=sha1), and set
 .B nsl
 (default=16)
 to the size in bytes of the nonce secret length (between 16 and 64).
 
 Set
 .B alg=none
 to disable the PRNG and use the OpenSSL RAND_bytes function
510c8ade
 instead for all of OpenVPN's pseudo\-random number needs.
03bfb228
 .\"*********************************************************
 .TP
510c8ade
 .B \-\-engine [engine\-name]
 Enable OpenSSL hardware\-based crypto engine functionality.
6fbf66fa
 
 If
510c8ade
 .B engine\-name
6fbf66fa
 is specified,
 use a specific crypto engine.  Use the
2d321609
 .B \-\-show\-engines
6fbf66fa
 standalone option to list the crypto engines which are
 supported by OpenSSL.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-no\-replay
6e4a8175
 .B DEPRECATED
 This option will be removed in OpenVPN 2.5.
 
148329ca
 (Advanced) Disable OpenVPN's protection against replay attacks.
6fbf66fa
 Don't use this option unless you are prepared to make
 a tradeoff of greater efficiency in exchange for less
 security.
 
 OpenVPN provides datagram replay protection by default.
 
 Replay protection is accomplished
 by tagging each outgoing datagram with an identifier
 that is guaranteed to be unique for the key being used.
 The peer that receives the datagram will check for
 the uniqueness of the identifier.  If the identifier
 was already received in a previous datagram, OpenVPN
 will drop the packet.  Replay protection is important
 to defeat attacks such as a SYN flood attack, where
 the attacker listens in the wire, intercepts a TCP
 SYN packet (identifying it by the context in which
 it occurs in relation to other packets), then floods
 the receiving peer with copies of this packet.
 
 OpenVPN's replay protection is implemented in slightly
 different ways, depending on the key management mode
 you have selected.
 
 In Static Key mode
 or when using an CFB or OFB mode cipher, OpenVPN uses a
 64 bit unique identifier that combines a time stamp with
 an incrementing sequence number.
 
 When using TLS mode for key exchange and a CBC cipher
 mode, OpenVPN uses only a 32 bit sequence number without
 a time stamp, since OpenVPN can guarantee the uniqueness
 of this value for each key.  As in IPSec, if the sequence number is
 close to wrapping back to zero, OpenVPN will trigger
 a new key exchange.
 
 To check for replays, OpenVPN uses
 the
 .I sliding window
 algorithm used
 by IPSec.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-replay\-window n [t]
510c8ade
 Use a replay protection sliding\-window of size
6fbf66fa
 .B n
 and a time window of
 .B t
 seconds.
 
 By default
 .B n
 is 64 (the IPSec default) and
 .B t
 is 15 seconds.
 
 This option is only relevant in UDP mode, i.e.
 when either
48fe8bb3
 .B \-\-proto udp
c42fcbfe
 is specified, or no
48fe8bb3
 .B \-\-proto
6fbf66fa
 option is specified.
 
 When OpenVPN tunnels IP packets over UDP, there is the possibility that
 packets might be dropped or delivered out of order.  Because OpenVPN, like IPSec,
 is emulating the physical network layer,
510c8ade
 it will accept an out\-of\-order packet sequence, and
6fbf66fa
 will deliver such packets in the same order they were received to
 the TCP/IP protocol stack, provided they satisfy several constraints.
 
 .B (a)
 The packet cannot be a replay (unless
2d321609
 .B \-\-no\-replay
6fbf66fa
 is specified, which disables replay protection altogether).
 
 .B (b)
 If a packet arrives out of order, it will only be accepted if the difference
 between its sequence number and the highest sequence number received
 so far is less than
 .B n.
 
 .B (c)
 If a packet arrives out of order, it will only be accepted if it arrives no later
 than
 .B t
 seconds after any packet containing a higher sequence number.
 
 If you are using a network link with a large pipeline (meaning that
 the product of bandwidth and latency is high), you may want to use
 a larger value for
 .B n.
 Satellite links in particular often require this.
 
 If you run OpenVPN at
48fe8bb3
 .B \-\-verb 4,
510c8ade
 you will see the message "Replay\-window backtrack occurred [x]"
6fbf66fa
 every time the maximum sequence number backtrack seen thus far
 increases.  This can be used to calibrate
 .B n.
 
 There is some controversy on the appropriate method of handling packet
 reordering at the security layer.
 
 Namely, to what extent should the
 security layer protect the encapsulated protocol from attacks which masquerade
 as the kinds of normal packet loss and reordering that occur over IP networks?
 
 The IPSec and OpenVPN approach is to allow packet reordering within a certain
 fixed sequence number window.
 
 OpenVPN adds to the IPSec model by limiting the window size in time as well as
 sequence space.
 
 OpenVPN also adds TCP transport as an option (not offered by IPSec) in which
 case OpenVPN can adopt a very strict attitude towards message deletion and
 reordering:  Don't allow it.  Since TCP guarantees reliability, any packet
 loss or reordering event can be assumed to be an attack.
 
 In this sense, it could be argued that TCP tunnel transport is preferred when
510c8ade
 tunneling non\-IP or UDP application protocols which might be vulnerable to a
6fbf66fa
 message deletion or reordering attack which falls within the normal
 operational parameters of IP networks.
 
510c8ade
 So I would make the statement that one should never tunnel a non\-IP protocol
6fbf66fa
 or UDP application protocol over UDP, if the protocol might be vulnerable to a
 message deletion or reordering attack that falls within the normal operating
 parameters of what is to be expected from the physical IP layer.  The problem
 is easily fixed by simply using TCP as the VPN transport layer.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-mute\-replay\-warnings
6fbf66fa
 Silence the output of replay warnings, which are a common
 false alarm on WiFi networks.  This option preserves
 the security of the replay protection code without
 the verbosity associated with warnings about duplicate
 packets.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-replay\-persist file
510c8ade
 Persist replay\-protection state across sessions using
6fbf66fa
 .B file
 to save and reload the state.
 
 This option will strengthen protection against replay attacks,
 especially when you are using OpenVPN in a dynamic context (such
 as with
48fe8bb3
 .B \-\-inetd)
6fbf66fa
 when OpenVPN sessions are frequently started and stopped. 
 
 This option will keep a disk copy of the current replay protection
 state (i.e. the most recent packet timestamp and sequence number
 received from the remote peer), so that if an OpenVPN session
 is stopped and restarted, it will reject any replays of packets
 which were already received by the prior session.
 
 This option only makes sense when replay protection is enabled
 (the default) and you are using either
48fe8bb3
 .B \-\-secret
510c8ade
 (shared\-secret key mode) or TLS mode with
2d321609
 .B \-\-tls\-auth.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-no\-iv
4969f0d6
 .B DEPRECATED
 This option will be removed in OpenVPN 2.5.
 
148329ca
 (Advanced) Disable OpenVPN's use of IV (cipher initialization vector).
6fbf66fa
 Don't use this option unless you are prepared to make
 a tradeoff of greater efficiency in exchange for less
 security.
 
 OpenVPN uses an IV by default, and requires it for CFB and
 OFB cipher modes (which are totally insecure without it).
 Using an IV is important for security when multiple
 messages are being encrypted/decrypted with the same key.
 
 IV is implemented differently depending on the cipher mode used.
 
510c8ade
 In CBC mode, OpenVPN uses a pseudo\-random IV for each packet.
6fbf66fa
 
 In CFB/OFB mode, OpenVPN uses a unique sequence number and time stamp
 as the IV.  In fact, in CFB/OFB mode, OpenVPN uses a datagram
510c8ade
 space\-saving optimization that uses the unique identifier for
6fbf66fa
 datagram replay protection as the IV.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-use\-prediction\-resistance
ed0e7993
 Enable prediction resistance on mbed TLS's RNG.
0f25d296
 
 Enabling prediction resistance causes the RNG to reseed in each
 call for random. Reseeding this often can quickly deplete the kernel
 entropy pool.
 
 If you need this option, please consider running a daemon that adds
 entropy to the kernel pool.
 
 .\"*********************************************************
 .TP
2d321609
 .B \-\-test\-crypto
510c8ade
 Do a self\-test of OpenVPN's crypto options by encrypting and
6fbf66fa
 decrypting test packets using the data channel encryption options
 specified above.  This option does not require a peer to function,
 and therefore can be specified without
48fe8bb3
 .B \-\-dev
6fbf66fa
 or
48fe8bb3
 .B \-\-remote.
6fbf66fa
 
 The typical usage of
2d321609
 .B \-\-test\-crypto
6fbf66fa
 would be something like this:
 
2d321609
 .B openvpn \-\-test\-crypto \-\-secret key
6fbf66fa
 
 or
 
2d321609
 .B openvpn \-\-test\-crypto \-\-secret key \-\-verb 9
6fbf66fa
 
 This option is very useful to test OpenVPN after it has been ported to
 a new platform, or to isolate problems in the compiler, OpenSSL
510c8ade
 crypto library, or OpenVPN's crypto code.  Since it is a self\-test mode,
6fbf66fa
 problems with encryption and authentication can be debugged independently
 of network and tunnel issues.
 .\"*********************************************************
 .SS TLS Mode Options:
 TLS mode is the most powerful crypto mode of OpenVPN in both security and flexibility.
 TLS mode works by establishing control and
 data channels which are multiplexed over a single TCP/UDP port.  OpenVPN initiates
 a TLS session over the control channel and uses it to exchange cipher
 and HMAC keys to protect the data channel.  TLS mode uses a robust reliability
 layer over the UDP connection for all control channel communication, while
 the data channel, over which encrypted tunnel data passes, is forwarded without
 any mediation.  The result is the best of both worlds: a fast data channel
 that forwards over UDP with only the overhead of encrypt,
 decrypt, and HMAC functions,
 and a control channel that provides all of the security features of TLS,
510c8ade
 including certificate\-based authentication and Diffie Hellman forward secrecy.
6fbf66fa
 
 To use TLS mode, each peer that runs OpenVPN should have its own local
 certificate/key pair (
48fe8bb3
 .B \-\-cert
6fbf66fa
 and
48fe8bb3
 .B \-\-key
6fbf66fa
 ), signed by the root certificate which is specified
 in
48fe8bb3
 .B \-\-ca.
6fbf66fa
 
 When two OpenVPN peers connect, each presents its local certificate to the
 other.  Each peer will then check that its partner peer presented a
 certificate which was signed by the master root certificate as specified in
48fe8bb3
 .B \-\-ca.
6fbf66fa
 
 If that check on both peers succeeds, then the TLS negotiation
 will succeed, both OpenVPN
 peers will exchange temporary session keys, and the tunnel will begin
 passing data.
 
d16ea8ba
 The OpenVPN project provides a set of scripts for
 managing RSA certificates & keys:
510c8ade
 .I https://github.com/OpenVPN/easy\-rsa
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tls\-server
6fbf66fa
 Enable TLS and assume server role during TLS handshake.  Note that
510c8ade
 OpenVPN is designed as a peer\-to\-peer application.  The designation
6fbf66fa
 of client or server is only for the purpose of negotiating the TLS
 control channel.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tls\-client
6fbf66fa
 Enable TLS and assume client role during TLS handshake.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-ca file
6fbf66fa
 Certificate authority (CA) file in .pem format, also referred to as the
 .I root
 certificate.  This file can have multiple
 certificates in .pem format, concatenated together.  You can construct your own
 certificate authority certificate and private key by using a command such as:
 
2d321609
 .B openssl req \-nodes \-new \-x509 \-keyout ca.key \-out ca.crt
6fbf66fa
 
 Then edit your openssl.cnf file and edit the
 .B certificate
 variable to point to your new root certificate
c70caa7f
 .B ca.crt.
6fbf66fa
 
 For testing purposes only, the OpenVPN distribution includes a sample
c70caa7f
 CA certificate (ca.crt).
6fbf66fa
 Of course you should never use
 the test certificates and test keys distributed with OpenVPN in a
 production environment, since by virtue of the fact that
 they are distributed with OpenVPN, they are totally insecure.
 .\"*********************************************************
 .TP
b63ecceb
 .B \-\-capath dir
 Directory containing trusted certificates (CAs and CRLs).
ed0e7993
 Not available with mbed TLS.
f4684ff2
 
 When using the
 .B \-\-capath
 option, you are required to supply valid CRLs for the CAs too.  CAs in the
 capath directory are expected to be named <hash>.<n>.  CRLs are expected to
 be named <hash>.r<n>.  See the
510c8ade
 .B \-CApath
f4684ff2
 option of
 .B openssl verify
 , and the
510c8ade
 .B \-hash
f4684ff2
 option of
 .B openssl x509
 and
 .B openssl crl
 for more information.
b63ecceb
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-dh file
6fbf66fa
 File containing Diffie Hellman parameters
 in .pem format (required for
2d321609
 .B \-\-tls\-server
bd9aa06f
 only).
6fbf66fa
 
bd9aa06f
 Set
 .B file=none
 to disable Diffie Hellman key exchange (and use ECDH only). Note that this
 requires peers to be using an SSL library that supports ECDH TLS cipher suites
ed0e7993
 (e.g. OpenSSL 1.0.1+, or mbed TLS 2.0+).
6fbf66fa
 
bd9aa06f
 Use
2d321609
 .B openssl dhparam \-out dh2048.pem 2048
510c8ade
 to generate 2048\-bit DH parameters. Diffie Hellman parameters may be considered
bd9aa06f
 public.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-ecdh\-curve name
609e8131
 Specify the curve to use for elliptic curve Diffie Hellman. Available
 curves can be listed with
c22428fb
 .BR \-\-show\-curves .
510c8ade
 The specified curve will only be used for ECDH TLS\-ciphers.
07d0d73a
 
 This option is not supported in mbed TLS builds of OpenVPN.
609e8131
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-cert file
510c8ade
 Local peer's signed certificate in .pem format \-\- must be signed
6fbf66fa
 by a certificate authority whose certificate is in
48fe8bb3
 .B \-\-ca file.
6fbf66fa
 Each peer in an OpenVPN link running in TLS mode should have its own
 certificate and private key file.  In addition, each certificate should
 have been signed by the key of a certificate
 authority whose public key resides in the
48fe8bb3
 .B \-\-ca
6fbf66fa
 certificate authority file.
 You can easily make your own certificate authority (see above) or pay money
 to use a commercial service such as thawte.com (in which case you will be
 helping to finance the world's second space tourist :).
 To generate a certificate,
 you can use a command such as:
 
2d321609
 .B openssl req \-nodes \-new \-keyout mycert.key \-out mycert.csr
6fbf66fa
 
 If your certificate authority private key lives on another machine, copy
 the certificate signing request (mycert.csr) to this other machine (this can
 be done over an insecure channel such as email).  Now sign the certificate
 with a command such as:
 
2d321609
 .B openssl ca \-out mycert.crt \-in mycert.csr
6fbf66fa
 
 Now copy the certificate (mycert.crt)
 back to the peer which initially generated the .csr file (this
 can be over a public medium).
 Note that the
 .B openssl ca
 command reads the location of the certificate authority key from its
 configuration file such as
 .B /usr/share/ssl/openssl.cnf
510c8ade
 \-\- note also
6fbf66fa
 that for certificate authority functions, you must set up the files
 .B index.txt
 (may be empty) and
 .B serial
 (initialize to
 .B 
 01
 ).
 .\"*********************************************************
 .TP
2d321609
 .B \-\-extra\-certs file
7966d75a
 Specify a
 .B file
 containing one or more PEM certs (concatenated together)
 that complete the
 local certificate chain.
 
 This option is useful for "split" CAs, where the CA for server
 certs is different than the CA for client certs.  Putting certs
 in this file allows them to be used to complete the local
510c8ade
 certificate chain without trusting them to verify the peer\-submitted
7966d75a
 certificate, as would be the case if the certs were placed in the
 .B ca
 file.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-key file
6fbf66fa
 Local peer's private key in .pem format.  Use the private key which was generated
 when you built your peer's certificate (see
2d321609
 .B \-\-cert file
6fbf66fa
 above).
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tls\-version\-min version ['or\-highest']
4b67f984
 Sets the minimum
 TLS version we will accept from the peer (default is "1.0").
 Examples for version
510c8ade
 include "1.0", "1.1", or "1.2".  If 'or\-highest' is specified
4b67f984
 and version is not recognized, we will only accept the highest TLS
 version supported by the local SSL implementation.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tls\-version\-max version
6cb15b90
 Set the maximum TLS version we will use (default is the highest version
 supported).  Examples for version include "1.0", "1.1", or "1.2".
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-pkcs12 file
6fbf66fa
 Specify a PKCS #12 file containing local private key,
 local certificate, and root CA certificate.
 This option can be used instead of
48fe8bb3
 .B \-\-ca, \-\-cert,
6fbf66fa
 and
48fe8bb3
 .B \-\-key.
ed0e7993
 Not available with mbed TLS.
6fbf66fa
 .\"*********************************************************
 .TP
2193d7c0
 .B \-\-verify\-hash hash [algo]
510c8ade
 Specify SHA1 or SHA256 fingerprint for level\-1 cert.  The level\-1 cert is the
7966d75a
 CA (or intermediate cert) that signs the leaf certificate, and is
 one removed from the leaf certificate in the direction of the root.
510c8ade
 When accepting a connection from a peer, the level\-1 cert
7966d75a
 fingerprint must match
 .B hash
 or certificate verification will fail.  Hash is specified
2193d7c0
 as XX:XX:... For example:
 
 .nf
 .ft 3
 .in +4
 AD:B0:95:D8:09:C8:36:45:12:A9:89:C8:90:09:CB:13:72:A6:AD:16
 .in -4
 .ft
 .fi
 
 The
 .B algo
 flag can be either SHA1 or SHA256.  If not provided, it defaults to SHA1.
7966d75a
 .\"*********************************************************
 .TP
2d321609
 .B \-\-pkcs11\-cert\-private [0|1]...
18597b93
 Set if access to certificate object should be performed after login.
 Every provider has its own setting.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-pkcs11\-id name
718526e0
 Specify the serialized certificate id to be used. The id can be gotten
 by the standalone
2d321609
 .B \-\-show\-pkcs11\-ids
718526e0
 option.
18597b93
 .\"*********************************************************
 .TP
2d321609
 .B \-\-pkcs11\-id\-management
510c8ade
 Acquire PKCS#11 id from management interface. In this case a NEED\-STR 'pkcs11\-id\-request'
 real\-time message will be triggered, application may use pkcs11\-id\-count command to
 retrieve available number of certificates, and pkcs11\-id\-get command to retrieve certificate
1bda73a7
 id and certificate body.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-pkcs11\-pin\-cache seconds
18597b93
 Specify how many seconds the PIN can be cached, the default is until the token is removed.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-pkcs11\-protected\-authentication [0|1]...
18597b93
 Use PKCS#11 protected authentication path, useful for biometric and external
 keypad devices.
 Every provider has its own setting.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-pkcs11\-providers provider...
ce98fd24
 Specify a RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki) providers
 to load.
 This option can be used instead of
48fe8bb3
 .B \-\-cert, \-\-key,
ce98fd24
 and
48fe8bb3
 .B \-\-pkcs12.
3c6d3220
 
510c8ade
 If p11\-kit is present on the system, its
2d321609
 .B p11\-kit\-proxy.so
3c6d3220
 module will be loaded by default if either the
 .B \-\-pkcs11\-id
 or
 .B \-\-pkcs11\-id\-management
 options are specified without
 .B \-\-pkcs11\-provider
 being given.
ce98fd24
 .\"*********************************************************
 .TP
2d321609
 .B \-\-pkcs11\-private\-mode mode...
718526e0
 Specify which method to use in order to perform private key operations.
 A different mode can be specified for each provider.
 Mode is encoded as hex number, and can be a mask one of the following:
ce98fd24
 
718526e0
 .B 0
510c8ade
 (default) \-\- Try to determine automatically.
ce98fd24
 .br
718526e0
 .B 1
510c8ade
 \-\- Use sign.
ce98fd24
 .br
718526e0
 .B 2
510c8ade
 \-\- Use sign recover.
ce98fd24
 .br
718526e0
 .B 4
510c8ade
 \-\- Use decrypt.
ce98fd24
 .br
718526e0
 .B 8
510c8ade
 \-\- Use unwrap.
ce98fd24
 .br
 .\"*********************************************************
 .TP
510c8ade
 .B \-\-cryptoapicert select\-string
6fbf66fa
 Load the certificate and private key from the
93c22ecc
 Windows Certificate System Store (Windows/OpenSSL Only).
6fbf66fa
 
 Use this option instead of
48fe8bb3
 .B \-\-cert
6fbf66fa
 and
48fe8bb3
 .B \-\-key.
6fbf66fa
 
 This makes
 it possible to use any smart card, supported by Windows, but also any
 kind of certificate, residing in the Cert Store, where you have access to
 the private key.  This option has been tested with a couple of different
 smart cards (GemSAFE, Cryptoflex, and Swedish Post Office eID) on the
 client side, and also an imported PKCS12 software certificate on the
 server side.
 
 To select a certificate, based on a substring search in the
 certificate's subject:
 
 .B cryptoapicert
 "SUBJ:Peter Runestig"
 
 To select a certificate, based on certificate's thumbprint:
 
 .B cryptoapicert
 "THUMB:f6 49 24 41 01 b4 ..."
 
510c8ade
 The thumbprint hex string can easily be copy\-and\-pasted from the Windows
6fbf66fa
 Certificate Store GUI.
 
 .\"*********************************************************
 .TP
2d321609
 .B \-\-key\-method m
6e4a8175
 .B DEPRECATED
 This option will be removed in OpenVPN 2.5
 
6fbf66fa
 Use data channel key negotiation method
 .B m.
 The key method must match on both sides of the connection.
 
 After OpenVPN negotiates a TLS session, a new set of keys
 for protecting the tunnel data channel is generated and
 exchanged over the TLS session.
 
 In method 1 (the default for OpenVPN 1.x), both sides generate
510c8ade
 random encrypt and HMAC\-send keys which are forwarded to
1ce06386
 the other host over the TLS channel. Method 1 is
 .B deprecated in OpenVPN 2.4
 , and
 .B will be removed in OpenVPN 2.5\fR.
6fbf66fa
 
 In method 2, (the default for OpenVPN 2.0)
 the client generates a random key.  Both client
 and server also generate some random seed material.  All key source
 material is exchanged over the TLS channel. The actual
 keys are generated using the TLS PRF function, taking source
 entropy from both client and server.  Method 2 is designed to
 closely parallel the key generation process used by TLS 1.0.
 
 Note that in TLS mode, two separate levels 
 of keying occur:
 
 (1) The TLS connection is initially negotiated, with both sides
 of the connection producing certificates and verifying the certificate
 (or other authentication info provided) of
 the other side.  The
2d321609
 .B \-\-key\-method
6fbf66fa
 parameter has no effect on this process.
 
 (2) After the TLS connection is established, the tunnel session keys are
 separately negotiated over the existing secure TLS channel.  Here,
2d321609
 .B \-\-key\-method
6fbf66fa
 determines the derivation of the tunnel session keys.
 .\"*********************************************************
 .TP
5f66f907
 .B \-\-tls\-cipher l
ea4ee313
 .TQ
 .B \-\-tls\-ciphersuites l
6fbf66fa
 A list
 .B l
 of allowable TLS ciphers delimited by a colon (":").
5f66f907
 
ea4ee313
 These setting can be used to ensure that certain cipher suites are used (or
5f66f907
 not used) for the TLS connection.  OpenVPN uses TLS to secure the control
 channel, over which the keys that are used to protect the actual VPN traffic
 are exchanged.
 
 The supplied list of ciphers is (after potential OpenSSL/IANA name translation)
ed0e7993
 simply supplied to the crypto library.  Please see the OpenSSL and/or mbed TLS
5f66f907
 documentation for details on the cipher list interpretation.
 
ea4ee313
 For OpenSSL, the
 .B \-\-tls-cipher
 is used for TLS 1.2 and below. For TLS 1.3 and up, the
 .B \-\-tls\-ciphersuites
 setting is used. mbed TLS has no TLS 1.3 support yet and only the
 .B \-\-tls-cipher
 setting is used.
 
6fbf66fa
 Use
5f66f907
 .B \-\-show\-tls
 to see a list of TLS ciphers supported by your crypto library.
 
 Warning!
 .B \-\-tls\-cipher
ea4ee313
 and
 .B \-\-tls\-ciphersuites
 are expert features, which \- if used correcly \- can improve the security of
 your VPN connection.  But it is also easy to unwittingly use them to carefully
5f66f907
 align a gun with your foot, or just break your connection.  Use with care!
77f464bd
 
ed0e7993
 The default for \-\-tls\-cipher is to use mbed TLS's default cipher list
 when using mbed TLS or
a44eac2b
 "DEFAULT:!EXP:!LOW:!MEDIUM:!kDH:!kECDH:!DSS:!PSK:!SRP:!kRSA" when using
 OpenSSL.
ea4ee313
 
 The default for \-\-tls\-ciphersuites is to use the crypto library's default.
6fbf66fa
 .\"*********************************************************
 .TP
aba75874
 .B \-\-tls\-cert\-profile profile
 Set the allowed cryptographic algorithms for certificates according to
 .B profile\fN.
 
 The following profiles are supported:
 
 .B legacy
 (default): SHA1 and newer, RSA 2048-bit+, any elliptic curve.
 
 .B preferred
 : SHA2 and newer, RSA 2048-bit+, any elliptic curve.
 
 .B suiteb
 : SHA256/SHA384, ECDSA with P-256 or P-384.
 
 This option is only fully supported for mbed TLS builds.  OpenSSL builds use
 the following approximation:
 
 .B legacy
 (default): sets "security level 1"
 
 .B preferred
 : sets "security level 2"
 
 .B suiteb
 : sets "security level 3" and \-\-tls\-cipher "SUITEB128".
 
 OpenVPN will migrate to 'preferred' as default in the future.  Please ensure
 that your keys already comply.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tls\-timeout n
6fbf66fa
 Packet retransmit timeout on TLS control channel
 if no acknowledgment from remote within
 .B n
 seconds (default=2).  When OpenVPN sends a control
 packet to its peer, it will expect to receive an
 acknowledgement within
 .B n
 seconds or it will retransmit the packet, subject
510c8ade
 to a TCP\-like exponential backoff algorithm.  This parameter
6fbf66fa
 only applies to control channel packets.  Data channel
 packets (which carry encrypted tunnel data) are never
 acknowledged, sequenced, or retransmitted by OpenVPN because
 the higher level network protocols running on top of the tunnel
 such as TCP expect this role to be left to them.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-reneg\-bytes n
6fbf66fa
 Renegotiate data channel key after
 .B n
a256aee8
 bytes sent or received (disabled by default with an exception, see below).
6fbf66fa
 OpenVPN allows the lifetime of a key
a256aee8
 to be expressed as a number of bytes encrypted/decrypted, a number of packets,
 or a number of seconds.  A key renegotiation will be forced
6fbf66fa
 if any of these three criteria are met by either peer.
a256aee8
 
510c8ade
 If using ciphers with cipher block sizes less than 128\-bits, \-\-reneg\-bytes is
a256aee8
 set to 64MB by default, unless it is explicitly disabled by setting the value to
 0, but this is
 .B HIGHLY DISCOURAGED
 as this is designed to add some protection against the SWEET32 attack vector.
 For more information see the \-\-cipher option.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-reneg\-pkts n
6fbf66fa
 Renegotiate data channel key after
 .B n
 packets sent and received (disabled by default).
 .\"*********************************************************
 .TP
dd996463
 .B \-\-reneg\-sec max [min]
 Renegotiate data channel key after at most
 .B max
 seconds (default=3600) and at least
 .B min
 seconds (default is 90% of
 .B max
 for servers, and equal to
 .B max
 for clients).
 
 The effective
 .B reneg\-sec
 value used is per session pseudo-uniform-randomized between
 .B min
 and
 .B max\fR.
 
 With the default value of 3600 this results in an effective per session value
 in the range of 3240..3600 seconds for servers, or just 3600 for clients.
9696719a
 
510c8ade
 When using dual\-factor authentication, note that this default value may
9696719a
 cause the end user to be challenged to reauthorize once per hour.
 
 Also, keep in mind that this option can be used on both the client and server,
 and whichever uses the lower value will be the one to trigger the renegotiation.
 A common mistake is to set
2d321609
 .B \-\-reneg\-sec
9696719a
 to a higher value on either the client or server, while the other side of the connection
 is still using the default value of 3600 seconds, meaning that the renegotiation will
2d321609
 still occur once per 3600 seconds.  The solution is to increase \-\-reneg\-sec on both the
9696719a
 client and server, or set it to 0 on one side of the connection (to disable), and to
 your chosen value on the other side.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-hand\-window n
510c8ade
 Handshake Window \-\- the TLS\-based key exchange must finalize within
6fbf66fa
 .B n
 seconds
 of handshake initiation by any peer (default = 60 seconds).
 If the handshake fails
 we will attempt to reset our connection with our peer and try again.
 Even in the event of handshake failure we will still use
 our expiring key for up to
2d321609
 .B \-\-tran\-window
6fbf66fa
 seconds to maintain continuity of transmission of tunnel
 data.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tran\-window n
510c8ade
 Transition window \-\- our old key can live this many seconds
6fbf66fa
 after a new a key renegotiation begins (default = 3600 seconds).
 This feature allows for a graceful transition from old to new
 key, and removes the key renegotiation sequence from the critical
 path of tunnel data forwarding.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-single\-session
6fbf66fa
 After initially connecting to a remote peer, disallow any new connections.
 Using this
 option means that a remote peer cannot connect, disconnect, and then
 reconnect.
 
 If the daemon is reset by a signal or
2d321609
 .B \-\-ping\-restart,
6fbf66fa
 it will allow one new connection.
 
2d321609
 .B \-\-single\-session
6fbf66fa
 can be used with
2d321609
 .B \-\-ping\-exit
6fbf66fa
 or
48fe8bb3
 .B \-\-inactive
6fbf66fa
 to create a single dynamic session that will exit when finished.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tls\-exit
6fbf66fa
 Exit on TLS negotiation failure.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tls\-auth file [direction]
c6e24fa3
 Add an additional layer of HMAC authentication on top of the TLS control channel
 to mitigate DoS attacks and attacks on the TLS stack.
6fbf66fa
 
 In a nutshell,
2d321609
 .B \-\-tls\-auth
6fbf66fa
 enables a kind of "HMAC firewall" on OpenVPN's TCP/UDP port,
 where TLS control channel packets
 bearing an incorrect HMAC signature can be dropped immediately without
 response.
 
 .B file
8a95f62e
 (required) is a file in OpenVPN static key format which can be generated by
48fe8bb3
 .B \-\-genkey
6fbf66fa
 
500854c3
 Older versions (up to OpenVPN 2.3) supported a freeform passphrase file.
 This is no longer supported in newer versions (v2.4+).
6fbf66fa
 
 See the
48fe8bb3
 .B \-\-secret
6fbf66fa
 option for more information on the optional
 .B direction
 parameter.
 
2d321609
 .B \-\-tls\-auth
6fbf66fa
 is recommended when you are running OpenVPN in a mode where
 it is listening for packets from any IP address, such as when
48fe8bb3
 .B \-\-remote
6fbf66fa
 is not specified, or
48fe8bb3
 .B \-\-remote
6fbf66fa
 is specified with
48fe8bb3
 .B \-\-float.
6fbf66fa
 
 The rationale for
510c8ade
 this feature is as follows.  TLS requires a multi\-packet exchange
6fbf66fa
 before it is able to authenticate a peer.  During this time
 before authentication, OpenVPN is allocating resources (memory
 and CPU) to this potential peer.  The potential peer is also
 exposing many parts of OpenVPN and the OpenSSL library to the packets
 it is sending.  Most successful network attacks today seek
 to either exploit bugs in programs (such as buffer overflow attacks) or
 force a program to consume so many resources that it becomes unusable.
 Of course the first line of defense is always to produce clean,
510c8ade
 well\-audited code.  OpenVPN has been written with buffer overflow
6fbf66fa
 attack prevention as a top priority.
 But as history has shown, many of the most widely used
 network applications have, from time to time,
 fallen to buffer overflow attacks.
 
 So as a second line of defense, OpenVPN offers
 this special layer of authentication on top of the TLS control channel so that
 every packet on the control channel is authenticated by an
 HMAC signature and a unique ID for replay protection.
 This signature will also help protect against DoS (Denial of Service) attacks.
 An important rule of thumb in reducing vulnerability to DoS attacks is to
 minimize the amount of resources a potential, but as yet unauthenticated,
 client is able to consume.
 
2d321609
 .B \-\-tls\-auth
6fbf66fa
 does this by signing every TLS control channel packet with an HMAC signature,
 including packets which are sent before the TLS level has had a chance
 to authenticate the peer.
 The result is that packets without
 the correct signature can be dropped immediately upon reception,
 before they have a chance to consume additional system resources
 such as by initiating a TLS handshake.
2d321609
 .B \-\-tls\-auth
6fbf66fa
 can be strengthened by adding the
2d321609
 .B \-\-replay\-persist
6fbf66fa
 option which will keep OpenVPN's replay protection state
 in a file so that it is not lost across restarts.
 
 It should be emphasized that this feature is optional and that the
c6e24fa3
 key file used with
2d321609
 .B \-\-tls\-auth
6fbf66fa
 gives a peer nothing more than the power to initiate a TLS
 handshake.  It is not used to encrypt or authenticate any tunnel data.
403dfe1b
 
 Use
 .B \-\-tls\-crypt
 instead if you want to use the key file to not only authenticate, but also
 encrypt the TLS control channel.
6fbf66fa
 .\"*********************************************************
 .TP
c6e24fa3
 .B \-\-tls\-crypt keyfile
 
 Encrypt and authenticate all control channel packets with the key from
 .B keyfile.
 (See
 .B \-\-tls\-auth
 for more background.)
 
 Encrypting (and authenticating) control channel packets:
 .RS
 .IP \[bu] 2
 provides more privacy by hiding the certificate used for the TLS connection,
 .IP \[bu]
 makes it harder to identify OpenVPN traffic as such,
 .IP \[bu]
510c8ade
 provides "poor\-man's" post\-quantum security, against attackers who will never
 know the pre\-shared key (i.e. no forward secrecy).
c6e24fa3
 .RE
 
 .IP
 In contrast to
 .B \-\-tls\-auth\fR,
 .B \-\-tls\-crypt
 does *not* require the user to set
 .B \-\-key\-direction\fR.
5806f66e
 
 .B Security Considerations
 
 All peers use the same
510c8ade
 .B \-\-tls\-crypt
 pre\-shared group key to authenticate and encrypt control channel messages.  To
5806f66e
 ensure that IV collisions remain unlikely, this key should not be used to
510c8ade
 encrypt more than 2^48 client\-to\-server or 2^48 server\-to\-client control
5806f66e
 channel messages.  A typical initial negotiation is about 10 packets in each
 direction.  Assuming both initial negotiation and renegotiations are at most
 2^16 (65536) packets (to be conservative), and (re)negotiations happen each
 minute for each user (24/7), this limits the tls\-crypt key lifetime to 8171
 years divided by the number of users.  So a setup with 1000 users should rotate
 the key at least once each eight years.  (And a setup with 8000 users each
 year.)
 
 If IV collisions were to occur, this could result in the security of
 .B \-\-tls\-crypt
 degrading to the same security as using
 .B \-\-tls\-auth\fR.
 That is, the control channel still benefits from the extra protection against
510c8ade
 active man\-in\-the\-middle\-attacks and DoS attacks, but may no longer offer
 extra privacy and post\-quantum security on top of what TLS itself offers.
9d59029a
 
 For large setups or setups where clients are not trusted, consider using
 .B \-\-tls\-crypt\-v2
 instead.  That uses per\-client unique keys, and thereby improves the bounds to
 \fR'rotate a client key at least once per 8000 years'.
 .\"*********************************************************
 .TP
 .B \-\-tls\-crypt\-v2 keyfile
 
 Use client\-specific tls\-crypt keys.
 
 For clients,
 .B keyfile
 is a client\-specific tls\-crypt key.  Such a key can be generated using the
 .B \-\-tls\-crypt\-v2\-genkey
 option.
 
 For servers,
 .B keyfile
 is used to unwrap client\-specific keys supplied by the client during connection
 setup.  This key must be the same as the key used to generate the
 client\-specific key (see
 .B \-\-tls\-crypt\-v2\-genkey\fR).
 
 On servers, this option can be used together with the
 .B \-\-tls\-auth
 or
 .B \-\-tls\-crypt
 option.  In that case, the server will detect whether the client is using
 client\-specific keys, and automatically select the right mode.
 .\"*********************************************************
 .TP
 .B \-\-tls\-crypt\-v2\-genkey client|server keyfile [metadata]
 
 If the first parameter equals "server", generate a \-\-tls\-crypt\-v2 server
 key and store the key in
 .B keyfile\fR.
 
 
 If the first parameter equals "client", generate a \-\-tls\-crypt\-v2 client
 key, and store the key in
 .B keyfile\fR.
 
 If supplied, include the supplied
 .B metadata
 in the wrapped client key.  This metadata must be supplied in base64\-encoded
 form.  The metadata must be at most 735 bytes long (980 bytes in base64).
 
ff931c5e
 If no metadata is supplied, OpenVPN will use a 64\-bit unix timestamp
 representing the current time in UTC, encoded in network order, as metadata for
 the generated key.
 
01039891
 A tls\-crypt\-v2 client key is wrapped using a server key.  To generate a
 client key, the user must therefore supply the server key using the
 .B \-\-tls\-crypt\-v2
 option.
 
ff931c5e
 Servers can use
 .B \-\-tls\-crypt\-v2\-verify
 to specify a metadata verification command.
 .\"*********************************************************
 .TP
 .B \-\-tls\-crypt\-v2\-verify cmd
 
 Run command
 .B cmd
 to verify the metadata of the client\-specific tls\-crypt\-v2 key of a
 connecting client.  This allows server administrators to reject client
 connections, before exposing the TLS stack (including the notoriously dangerous
 X.509 and ASN.1 stacks) to the connecting client.
 
 OpenVPN supplies the following env vars to the command:
 .RS
 .IP \[bu] 2
 script_type is set to "tls\-crypt\-v2\-verify"
 .IP \[bu]
 metadata_type is set to "0" if the metadata was user supplied, or "1" if it's a
 64\-bit unix timestamp representing the key creation time.
 .IP \[bu]
 metadata_file contains the filename of a temporary file that contains the client
 metadata.
 .RE
 
 .IP
 The command can reject the connection by exiting with a non-zero exit code.
c6e24fa3
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-askpass [file]
6fbf66fa
 Get certificate password from console or
 .B file
 before we daemonize.
 
 For the extremely
 security conscious, it is possible to protect your private key with
 a password.  Of course this means that every time the OpenVPN
 daemon is started you must be there to type the password.  The
48fe8bb3
 .B \-\-askpass
6fbf66fa
 option allows you to start OpenVPN from the command line.  It will
 query you for a password before it daemonizes.  To protect a private
 key with a password you should omit the
2d321609
 .B \-nodes
6fbf66fa
 option when you use the
 .B openssl
 command line tool to manage certificates and private keys.
 
 If
 .B file
 is specified, read the password from the first line of
 .B file.
 Keep in mind that storing your password in a file
 to a certain extent invalidates the extra security provided by
80442aee
 using an encrypted key.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-auth\-nocache
6fbf66fa
 Don't cache
48fe8bb3
 .B \-\-askpass
6fbf66fa
 or
2d321609
 .B \-\-auth\-user\-pass
6fbf66fa
 username/passwords in virtual memory.
 
 If specified, this directive will cause OpenVPN to immediately
 forget username/password inputs after they are used.  As a result,
 when OpenVPN needs a username/password, it will prompt for input
 from stdin, which may be multiple times during the duration of an
 OpenVPN session.
 
ac1cb5bf
 When using \-\-auth\-nocache in combination with a user/password file
 and \-\-chroot or \-\-daemon, make sure to use an absolute path.
 
6fbf66fa
 This directive does not affect the
2d321609
 .B \-\-http\-proxy
6fbf66fa
 username/password.  It is always cached.
 .\"*********************************************************
 .TP
f8a367f7
 .B \-\-auth\-token token
 This is not an option to be used directly in any configuration files,
 but rather push this option from a
 .B \-\-client\-connect
 script or a
 .B \-\-plugin
 which hooks into the OPENVPN_PLUGIN_CLIENT_CONNECT or
 OPENVPN_PLUGIN_CLIENT_CONNECT_V2 calls.  This option provides
 a possibility to replace the clients password with an authentication
 token during the lifetime of the OpenVPN client.
 
 Whenever the connection is renegotiated and the
 .B \-\-auth\-user\-pass\-verify
 script or
 .B \-\-plugin
 making use of the OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY hook is
 triggered, it will pass over this token as the password
 instead of the password the user provided.  The authentication
 token can only be reset by a full reconnect where the server
 can push new options to the client.  The password the user entered
 is never preserved once an authentication token have been set.  If
 the OpenVPN server side rejects the authentication token, the
 client will receive an AUTH_FAIL and disconnect.
 
 The purpose of this is to enable two factor authentication
 methods, such as HOTP or TOTP, to be used without needing to
 retrieve a new OTP code each time the connection is renegotiated.
 Another use case is to cache authentication data on the client
 without needing to have the users password cached in memory
 during the life time of the session.
 
 To make use of this feature, the
 .B \-\-client\-connect
 script or
 .B \-\-plugin
 needs to put
 
 .nf
 .ft 3
 .in +4
 push "auth\-token UNIQUE_TOKEN_VALUE"
 .in -4
 .ft
 .fi
 
 into the file/buffer for dynamic configuration data.  This
 will then make the OpenVPN server to push this value to the
 client, which replaces the local password with the
 UNIQUE_TOKEN_VALUE.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tls\-verify cmd
d6285998
 Run command
6fbf66fa
 .B cmd
 to verify the X509 name of a
 pending TLS connection that has otherwise passed all other
 tests of certification (except for revocation via
2d321609
 .B \-\-crl\-verify
6fbf66fa
 directive; the revocation test occurs after the
2d321609
 .B \-\-tls\-verify
6fbf66fa
 test).
 
 .B cmd
 should return 0 to allow the TLS handshake to proceed, or 1 to fail.
d04b8582
 
 .B cmd
d6285998
 consists of a path to script (or executable program), optionally
510c8ade
 followed by arguments. The path and arguments may be single\- or double\-quoted
d6285998
 and/or escaped using a backslash, and should be separated by one or more spaces.
 
d04b8582
 When
6fbf66fa
 .B cmd
d6285998
 is executed two arguments are appended after any arguments specified in
 .B cmd
 , as follows:
6fbf66fa
 
5e86fd93
 .B cmd certificate_depth subject
6fbf66fa
 
d04b8582
 These arguments are, respectively, the current certificate depth and
 the X509 common name (cn) of the peer.
 
6fbf66fa
 This feature is useful if the peer you want to trust has a certificate
 which was signed by a certificate authority who also signed many
 other certificates, where you don't necessarily want to trust all of them,
 but rather be selective about which
 peer certificate you will accept.  This feature allows you to write a script
 which will test the X509 name on a certificate and decide whether or
 not it should be accepted.  For a simple perl script which will test
 the common name field on the certificate, see the file
2d321609
 .B verify\-cn
6fbf66fa
 in the OpenVPN distribution.
 
 See the "Environmental Variables" section below for
 additional parameters passed as environmental variables.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tls\-export\-cert directory
39238d1b
 Store the certificates the clients uses upon connection to this
2d321609
 directory. This will be done before \-\-tls\-verify is called.  The
39238d1b
 certificates will use a temporary name and will be deleted when
2d321609
 the tls\-verify script returns.  The file name used for the certificate
39238d1b
 is available via the peer_cert environment variable.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-x509\-username\-field [ext:\]fieldname
f4e0ad82
 Field in the X.509 certificate subject to be used as the username (default=CN).
 Typically, this option is specified with
 .B fieldname
 as either of the following:
 
2d321609
 .B \-\-x509\-username\-field
f4e0ad82
 emailAddress
 .br
2d321609
 .B \-\-x509\-username\-field ext:\fRsubjectAltName
f4e0ad82
 
 The first example uses the value of the "emailAddress" attribute in the
 certificate's Subject field as the username.  The second example uses
 the
 .B ext:
 prefix to signify that the X.509 extension
 .B fieldname
 "subjectAltName" be searched for an rfc822Name (email) field to be used
 as the username.  In cases where there are multiple email addresses
 in
 .B ext:fieldname\fR,
 the last occurrence is chosen.
 
 When this option is used, the
2d321609
 .B \-\-verify\-x509\-name
f4e0ad82
 option will match against the chosen
 .B fieldname
 instead of the Common Name.
 
d2a19185
 Only the subjectAltName and issuerAltName X.509 extensions are supported.
 
f4e0ad82
 .B Please note:
510c8ade
 This option has a feature which will convert an all\-lowercase
f4e0ad82
 .B fieldname
510c8ade
 to uppercase characters, e.g., ou \-> OU.  A mixed\-case
f4e0ad82
 .B fieldname
 or one having the
 .B ext:
510c8ade
 prefix will be left as\-is.  This automatic upcasing feature
f4e0ad82
 is deprecated and will be removed in a future release.
ca8af756
 .\"*********************************************************
 .TP
2d321609
 .B \-\-verify\-x509\-name name type
9f0fc745
 Accept connections only if a host's X.509 name is equal to
 .B name.
 The remote host must also pass all other tests of verification.
 
 Which X.509 name is compared to
 .B name
 depends on the setting of type.
 .B type
 can be "subject" to match the complete subject DN (default),
510c8ade
 "name" to match a subject RDN or "name\-prefix" to match a subject RDN prefix.
9f0fc745
 Which RDN is verified as name depends on the
2d321609
 .B \-\-x509\-username\-field
9f0fc745
 option. But it defaults to the common name (CN), e.g. a certificate with a
510c8ade
 subject DN "C=KG, ST=NA, L=Bishkek, CN=Server\-1" would be matched by:
9f0fc745
 
2d321609
 .B \-\-verify\-x509\-name 'C=KG, ST=NA, L=Bishkek, CN=Server\-1'
9f0fc745
 and
2d321609
 .B \-\-verify\-x509\-name Server\-1 name
9f0fc745
 or you could use
510c8ade
 .B \-\-verify\-x509\-name Server\- name\-prefix
 if you want a client to only accept connections to "Server\-1", "Server\-2", etc.
9f0fc745
 
2d321609
 .B \-\-verify\-x509\-name
9f0fc745
 is a useful replacement for the
2d321609
 .B \-\-tls\-verify
9f0fc745
 option to verify the remote host, because
2d321609
 .B \-\-verify\-x509\-name
9f0fc745
 works in a
 .B \-\-chroot
 environment without any dependencies.
 
 Using a name prefix is a useful alternative to managing
 a CRL (Certificate Revocation List) on the client, since it allows the client
 to refuse all certificates except for those associated
 with designated servers.
 
 .B NOTE:
 Test against a name prefix only when you are using OpenVPN with
 a custom CA certificate that is under your control.
510c8ade
 Never use this option with type "name\-prefix" when your client certificates
9f0fc745
 are signed by a third party, such as a commercial web CA.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-x509\-track attribute
9356bae8
 Save peer X509
 .B attribute
 value in environment for use by plugins and management interface.
 Prepend a '+' to
 .B attribute
 to save values from full cert chain.  Values will be encoded
 as X509_<depth>_<attribute>=<value>.  Multiple
2d321609
 .B \-\-x509\-track
9356bae8
 options can be defined to track multiple attributes.
 .\"*********************************************************
 .TP
6e4a8175
 .B \-\-ns\-cert\-type client|server
 .B DEPRECATED
 This option will be removed in OpenVPN 2.5.  Use the more modern equivalent
2dc33226
 .B \-\-remote\-cert\-tls
 instead.  This option will be removed in OpenVPN 2.5.
 
6fbf66fa
 Require that peer certificate was signed with an explicit
 .B nsCertType
 designation of "client" or "server".
 
 This is a useful security option for clients, to ensure that
 the host they connect with is a designated server.
 
2d321609
 See the easy\-rsa/build\-key\-server script for an example
6fbf66fa
 of how to generate a certificate with the
 .B nsCertType
 field set to "server".
 
 If the server certificate's nsCertType field is set
 to "server", then the clients can verify this with
2d321609
 .B \-\-ns\-cert\-type server.
6fbf66fa
 
 This is an important security precaution to protect against
510c8ade
 a man\-in\-the\-middle attack where an authorized client
6fbf66fa
 attempts to connect to another client by impersonating the server.
 The attack is easily prevented by having clients verify
 the server certificate using any one of
2d321609
 .B \-\-ns\-cert\-type, \-\-verify\-x509\-name,
6fbf66fa
 or
2d321609
 .B \-\-tls\-verify.
6fbf66fa
 .\"*********************************************************
 .TP
92a5b9fb
 .B \-\-remote\-cert\-ku [v...]
411e89ae
 Require that peer certificate was signed with an explicit
 .B key usage.
 
92a5b9fb
 If present in the certificate, the keyUsage value is validated by the TLS
 library during the TLS handshake.  Specifying this option without arguments
 requires this extension to be present (so the TLS library will verify it).
411e89ae
 
92a5b9fb
 If the list
 .B v...
 is also supplied, the keyUsage field must have
 .B at least
 the same bits set as the bits in
 .B one of
 the values supplied in the list
 .B v...
 
 The key usage values in the list must be encoded in hex, e.g.
 "\-\-remote\-cert\-ku a0"
411e89ae
 .\"*********************************************************
 .TP
2d321609
 .B \-\-remote\-cert\-eku oid
411e89ae
 Require that peer certificate was signed with an explicit
 .B extended key usage.
 
f19f12c8
 This is a useful security option for clients, to ensure that
 the host they connect to is a designated server.
411e89ae
 
 The extended key usage should be encoded in oid notation, or
 OpenSSL symbolic representation.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-remote\-cert\-tls client|server
411e89ae
 Require that peer certificate was signed with an explicit
 .B key usage
 and
 .B extended key usage
6117b639
 based on RFC3280 TLS rules.
411e89ae
 
92a5b9fb
 This is a useful security option for clients, to ensure that the host they
 connect to is a designated server.  Or the other way around; for a server to
 verify that only hosts with a client certificate can connect.
411e89ae
 
 The
2d321609
 .B \-\-remote\-cert\-tls client
411e89ae
 option is equivalent to
0f4ab654
 .B
92a5b9fb
 \-\-remote\-cert\-ku \-\-remote\-cert\-eku "TLS Web Client Authentication"
6117b639
 
411e89ae
 The
2d321609
 .B \-\-remote\-cert\-tls server
411e89ae
 option is equivalent to
0f4ab654
 .B
92a5b9fb
 \-\-remote\-cert\-ku \-\-remote\-cert\-eku "TLS Web Server Authentication"
411e89ae
 
 This is an important security precaution to protect against
510c8ade
 a man\-in\-the\-middle attack where an authorized client
411e89ae
 attempts to connect to another client by impersonating the server.
 The attack is easily prevented by having clients verify
 the server certificate using any one of
2d321609
 .B \-\-remote\-cert\-tls, \-\-verify\-x509\-name,
411e89ae
 or
2d321609
 .B \-\-tls\-verify.
411e89ae
 .\"*********************************************************
 .TP
2d321609
 .B \-\-crl\-verify crl ['dir']
6fbf66fa
 Check peer certificate against the file
 .B crl
 in PEM format.
 
 A CRL (certificate revocation list) is used when a particular key is
 compromised but when the overall PKI is still intact.
 
 Suppose you had a PKI consisting of a CA, root certificate, and a number of
 client certificates.  Suppose a laptop computer containing a client key and
 certificate was stolen.  By adding the stolen certificate to the CRL file,
 you could reject any connection which attempts to use it, while preserving the
 overall integrity of the PKI.
 
 The only time when it would be necessary to rebuild the entire PKI from scratch would be
 if the root certificate key itself was compromised.
d5497262
 
 If the optional
 .B dir
 flag is specified, enable a different mode where
 .B crl
 is a directory containing files named as revoked serial numbers
 (the files may be empty, the contents are never read).  If a client
 requests a connection, where the client certificate serial number
 (decimal string) is the name of a file present in the directory,
 it will be rejected.
d55be0fb
 
 Note: As the crl file (or directory) is read every time a peer connects,
 if you are dropping root privileges with
2d321609
 .B \-\-user,
d55be0fb
 make sure that this user has sufficient privileges to read the file.
6fbf66fa
 .\"*********************************************************
 .SS SSL Library information:
 .\"*********************************************************
 .TP
2d321609
 .B \-\-show\-ciphers
6fbf66fa
 (Standalone)
 Show all cipher algorithms to use with the
48fe8bb3
 .B \-\-cipher
6fbf66fa
 option.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-show\-digests
6fbf66fa
 (Standalone)
 Show all message digest algorithms to use with the
48fe8bb3
 .B \-\-auth
6fbf66fa
 option.
 .\"*********************************************************
 .TP
5f66f907
 .B \-\-show\-tls
6fbf66fa
 (Standalone)
5f66f907
 Show all TLS ciphers supported by the crypto library.  OpenVPN uses TLS to
 secure the control channel, over which the keys that are used to protect the
 actual VPN traffic are exchanged.  The TLS ciphers will be sorted from highest
 preference (most secure) to lowest.
 
 Be aware that whether a cipher suite in this list can actually work depends on
 the specific setup of both peers (e.g. both peers must support the cipher, and
 an ECDSA cipher suite will not work if you are using an RSA certificate, etc.).
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-show\-engines
6fbf66fa
 (Standalone)
510c8ade
 Show currently available hardware\-based crypto acceleration
6fbf66fa
 engines supported by the OpenSSL library.
 .\"*********************************************************
609e8131
 .TP
2d321609
 .B \-\-show\-curves
609e8131
 (Standalone)
 Show all available elliptic curves to use with the
2d321609
 .B \-\-ecdh\-curve
609e8131
 option.
 .\"*********************************************************
6fbf66fa
 .SS Generate a random key:
510c8ade
 Used only for non\-TLS static key encryption mode.
6fbf66fa
 .\"*********************************************************
 .TP
d818bfed
 .B \-\-genkey file
6fbf66fa
 (Standalone)
d818bfed
 Generate a random key to be used as a shared secret, for use with the
48fe8bb3
 .B \-\-secret
d818bfed
 ,
 .B \-\-tls-auth
 or
 .B \-\-tls-crypt
 options.  Stores the key in
 .B file\fR.
 
 If using this for
 .B \-\-secret
 , this file must be shared with the peer over a pre\-existing secure channel
 such as
 .BR scp (1)\fR.
6fbf66fa
 .\"*********************************************************
 .SS TUN/TAP persistent tunnel config mode:
500854c3
 Available with Linux 2.4.7+.  These options comprise a standalone mode
6fbf66fa
 of OpenVPN which can be used to create and delete persistent tunnels.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-mktun
6fbf66fa
 (Standalone)
 Create a persistent tunnel on platforms which support them such
 as Linux.  Normally TUN/TAP tunnels exist only for
 the period of time that an application has them open.  This option
 takes advantage of the TUN/TAP driver's ability to build persistent
 tunnels that live through multiple instantiations of OpenVPN and die
 only when they are deleted or the machine is rebooted.
 
 One of the advantages of persistent tunnels is that they eliminate the
 need for separate
48fe8bb3
 .B \-\-up
6fbf66fa
 and
48fe8bb3
 .B \-\-down
6fbf66fa
 scripts to run the appropriate
 .BR ifconfig (8)
 and
 .BR route (8)
 commands.  These commands can be placed in the the same shell script
 which starts or terminates an OpenVPN session.
 
510c8ade
 Another advantage is that open connections through the TUN/TAP\-based tunnel
6fbf66fa
 will not be reset if the OpenVPN peer restarts.  This can be useful to
 provide uninterrupted connectivity through the tunnel in the event of a DHCP
 reset of the peer's public IP address (see the
48fe8bb3
 .B \-\-ipchange
6fbf66fa
 option above).
 
 One disadvantage of persistent tunnels is that it is harder to automatically
 configure their MTU value (see
2d321609
 .B \-\-link\-mtu
6fbf66fa
 and
2d321609
 .B \-\-tun\-mtu
6fbf66fa
 above).
 
510c8ade
 On some platforms such as Windows, TAP\-Win32 tunnels are persistent by
6fbf66fa
 default.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-rmtun
6fbf66fa
 (Standalone)
 Remove a persistent tunnel.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-dev tunX | tapX
6fbf66fa
 TUN/TAP device
 .\"*********************************************************
0aee9ca7
 .TP
48fe8bb3
 .B \-\-user user
0aee9ca7
 Optional user to be owner of this tunnel.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-group group
0aee9ca7
 Optional group to be owner of this tunnel.
 .\"*********************************************************
510c8ade
 .SS Windows\-Specific Options:
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-win\-sys path
5a2e9a25
 Set the Windows system directory pathname to use when looking for system
 executables such as
 .B route.exe
 and
 .B netsh.exe.
 By default, if this directive is
9f6ac06b
 not specified, OpenVPN will use the SystemRoot environment variable.
 
 This option have changed behaviour in OpenVPN 2.3.  Earlier you had to
 define
2d321609
 .B \-\-win\-sys env
9f6ac06b
 to use the SystemRoot environment variable, otherwise it defaulted to C:\\WINDOWS.
 It is not needed to use the
 .B env
 keyword any more, and it will just be ignored. A warning is logged when this
 is found in the configuration file.
5a2e9a25
 .\"*********************************************************
 .TP
2d321609
 .B \-\-ip\-win32 method
6fbf66fa
 When using
48fe8bb3
 .B \-\-ifconfig
510c8ade
 on Windows, set the TAP\-Win32 adapter
6fbf66fa
 IP address and netmask using
 .B method.
 Don't use this option unless you are also using
48fe8bb3
 .B \-\-ifconfig.
6fbf66fa
 
48fe8bb3
 .B manual \-\-
6fbf66fa
 Don't set the IP address or netmask automatically.
 Instead output a message
 to the console telling the user to configure the
 adapter manually and indicating the IP/netmask which
 OpenVPN expects the adapter to be set to.
 
510c8ade
 .B dynamic [offset] [lease\-time] \-\-
9bfae363
 Automatically set the IP address and netmask by replying to
6fbf66fa
 DHCP query messages generated by the kernel.  This mode is
 probably the "cleanest" solution
510c8ade
 for setting the TCP/IP properties since it uses the well\-known
6fbf66fa
 DHCP protocol.  There are, however, two prerequisites for using
510c8ade
 this mode: (1) The TCP/IP properties for the TAP\-Win32
6fbf66fa
 adapter must be set to "Obtain an IP address automatically," and
 (2) OpenVPN needs to claim an IP address in the subnet for use
 as the virtual DHCP server address.  By default in
48fe8bb3
 .B \-\-dev tap
6fbf66fa
 mode, OpenVPN will
 take the normally unused first address in the subnet.  For example,
 if your subnet is 192.168.4.0 netmask 255.255.255.0, then
 OpenVPN will take the IP address 192.168.4.0 to use as the
 virtual DHCP server address.  In
48fe8bb3
 .B \-\-dev tun
6fbf66fa
 mode, OpenVPN will cause the DHCP server to masquerade as if it were
 coming from the remote endpoint.  The optional offset parameter is
510c8ade
 an integer which is > \-256 and < 256 and which defaults to \-1.
6fbf66fa
 If offset is positive, the DHCP server will masquerade as the IP
 address at network address + offset.
 If offset is negative, the DHCP server will masquerade as the IP
 address at broadcast address + offset.  The Windows
 .B ipconfig /all
 command can be used to show what Windows thinks the DHCP server
 address is.  OpenVPN will "claim" this address, so make sure to
 use a free address.  Having said that, different OpenVPN instantiations,
 including different ends of the same connection, can share the same
 virtual DHCP server address.  The
510c8ade
 .B lease\-time
6fbf66fa
 parameter controls the lease time of the DHCP assignment given to
510c8ade
 the TAP\-Win32 adapter, and is denoted in seconds.
6fbf66fa
 Normally a very long lease time is preferred
510c8ade
 because it prevents routes involving the TAP\-Win32 adapter from
6fbf66fa
 being lost when the system goes to sleep.  The default
 lease time is one year.
 
48fe8bb3
 .B netsh \-\-
6fbf66fa
 Automatically set the IP address and netmask using
510c8ade
 the Windows command\-line "netsh"
6fbf66fa
 command.  This method appears to work correctly on
 Windows XP but not Windows 2000.
 
48fe8bb3
 .B ipapi \-\-
6fbf66fa
 Automatically set the IP address and netmask using the
 Windows IP Helper API.  This approach
 does not have ideal semantics, though testing has indicated
 that it works okay in practice.  If you use this option,
510c8ade
 it is best to leave the TCP/IP properties for the TAP\-Win32
6fbf66fa
 adapter in their default state, i.e. "Obtain an IP address
 automatically."
9bfae363
 
48fe8bb3
 .B adaptive \-\-
9bfae363
 (Default) Try
 .B dynamic
 method initially and fail over to
 .B netsh
510c8ade
 if the DHCP negotiation with the TAP\-Win32 adapter does
9bfae363
 not succeed in 20 seconds.  Such failures have been known
510c8ade
 to occur when certain third\-party firewall packages installed
9bfae363
 on the client machine block the DHCP negotiation used by
510c8ade
 the TAP\-Win32 adapter.
9bfae363
 Note that if the
 .B netsh
510c8ade
 failover occurs, the TAP\-Win32 adapter
9bfae363
 TCP/IP properties will be reset from DHCP to static, and this
 will cause future OpenVPN startups using the
 .B adaptive
 mode to use
 .B netsh
 immediately, rather than trying
 .B dynamic
 first.  To "unstick" the
 .B adaptive
 mode from using
 .B netsh,
 run OpenVPN at least once using the
 .B dynamic
510c8ade
 mode to restore the TAP\-Win32 adapter TCP/IP properties
9bfae363
 to a DHCP configuration.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-route\-method m
6fbf66fa
 Which method
 .B m
 to use for adding routes on Windows?
 
33e81c48
 .B adaptive
510c8ade
 (default) \-\- Try IP helper API first.  If that fails, fall
33e81c48
 back to the route.exe shell command.
 .br
6fbf66fa
 .B ipapi
510c8ade
 \-\- Use IP helper API.
6fbf66fa
 .br
 .B exe
510c8ade
 \-\- Call the route.exe shell command.
6fbf66fa
 .\"*********************************************************
 .TP
2d321609
 .B \-\-dhcp\-option type [parm]
510c8ade
 Set extended TAP\-Win32 TCP/IP properties, must
6fbf66fa
 be used with
2d321609
 .B \-\-ip\-win32 dynamic
33e81c48
 or
2d321609
 .B \-\-ip\-win32 adaptive.
6fbf66fa
 This option can be used to set additional TCP/IP properties
510c8ade
 on the TAP\-Win32 adapter, and is particularly useful for
6fbf66fa
 configuring an OpenVPN client to access a Samba server
 across the VPN.
 
48fe8bb3
 .B DOMAIN name \-\-
510c8ade
 Set Connection\-specific DNS Suffix.
6fbf66fa
 
48fe8bb3
 .B DNS addr \-\-
849006bf
 Set primary domain name server IPv4 or IPv6 address.  Repeat
6fbf66fa
 this option to set secondary DNS server addresses.
 
849006bf
 Note: DNS IPv6 servers are currently set using netsh (the existing
 DHCP code can only do IPv4 DHCP, and that protocol only permits IPv4
 addresses anywhere).  The option will be put into the environment, so
 an
94bfc256
 .B \-\-up
786e06ad
 script could act upon it if needed.
94bfc256
 
48fe8bb3
 .B WINS addr \-\-
6fbf66fa
 Set primary WINS server address (NetBIOS over TCP/IP Name Server).
 Repeat this option to set secondary WINS server addresses.
 
48fe8bb3
 .B NBDD addr \-\-
6fbf66fa
 Set primary NBDD server address (NetBIOS over TCP/IP Datagram Distribution Server)
 Repeat this option
 to set secondary NBDD server addresses.
 
48fe8bb3
 .B NTP addr \-\-
6fbf66fa
 Set primary NTP server address (Network Time Protocol).
 Repeat this option
 to set secondary NTP server addresses.
 
48fe8bb3
 .B NBT type \-\-
6fbf66fa
 Set NetBIOS over TCP/IP Node type.  Possible options:
 .B 1
510c8ade
 = b\-node (broadcasts),
6fbf66fa
 .B 2
510c8ade
 = p\-node (point\-to\-point
6fbf66fa
 name queries to a WINS server),
 .B 4
510c8ade
 = m\-node (broadcast
6fbf66fa
 then query name server), and
 .B 8
510c8ade
 = h\-node (query name server, then broadcast).
6fbf66fa
 
510c8ade
 .B NBS scope\-id \-\-
6fbf66fa
 Set NetBIOS over TCP/IP Scope. A NetBIOS Scope ID provides an extended
 naming service for the NetBIOS over TCP/IP (Known as NBT) module. The
 primary purpose of a NetBIOS scope ID is to isolate NetBIOS traffic on
 a single network to only those nodes with the same NetBIOS scope ID.
 The NetBIOS scope ID is a character string that is appended to the NetBIOS
 name. The NetBIOS scope ID on two hosts must match, or the two hosts
 will not be able to communicate. The NetBIOS Scope ID also allows
 computers to use the same computer name, as they have different
 scope IDs. The Scope ID becomes a part of the NetBIOS name, making the name unique.
 (This description of NetBIOS scopes courtesy of NeonSurge@abyss.com)
 
510c8ade
 .B DISABLE\-NBT \-\-
 Disable Netbios\-over\-TCP/IP.
6fbf66fa
 
 Note that if
2d321609
 .B \-\-dhcp\-option
6fbf66fa
 is pushed via
48fe8bb3
 .B \-\-push
510c8ade
 to a non\-windows client, the option will be saved in the client's
6fbf66fa
 environment before the up script is called, under
 the name "foreign_option_{n}".
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tap\-sleep n
6fbf66fa
 Cause OpenVPN to sleep for
 .B n
510c8ade
 seconds immediately after the TAP\-Win32 adapter state
6fbf66fa
 is set to "connected".
 
 This option is intended to be used to troubleshoot problems
 with the
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 and
2d321609
 .B \-\-ip\-win32
6fbf66fa
 options, and is used to give
510c8ade
 the TAP\-Win32 adapter time to come up before
6fbf66fa
 Windows IP Helper API operations are applied to it.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-show\-net\-up
6fbf66fa
 Output OpenVPN's view of the system routing table and network
 adapter list to the syslog or log file after the TUN/TAP adapter
 has been brought up and any routes have been added.
 .\"*********************************************************
 .TP
38c85658
 .B \-\-block\-outside\-dns
 Block DNS servers on other network adapters to prevent
 DNS leaks. This option prevents any application from accessing
 TCP or UDP port 53 except one inside the tunnel. It uses
 Windows Filtering Platform (WFP) and works on Windows Vista or
 later.
cc4761fc
 
510c8ade
 This option is considered unknown on non\-Windows platforms
cc4761fc
 and unsupported on Windows XP, resulting in fatal error.
 You may want to use
 .B \-\-setenv opt
 or
 .B \-\-ignore\-unknown\-option
 (not suitable for Windows XP) to ignore said error.
 Note that pushing unknown options from server does not trigger
 fatal errors.
38c85658
 .\"*********************************************************
 .TP
2d321609
 .B \-\-dhcp\-renew
6fbf66fa
 Ask Windows to renew the TAP adapter lease on startup.
 This option is normally unnecessary, as Windows automatically
 triggers a DHCP renegotiation on the TAP adapter when it
510c8ade
 comes up, however if you set the TAP\-Win32 adapter
6fbf66fa
 Media Status property to "Always Connected", you may need this
 flag.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-dhcp\-release
6fbf66fa
 Ask Windows to release the TAP adapter lease on shutdown.
500854c3
 This option has no effect now, as it is enabled by default starting with OpenVPN 2.4.1.
6fbf66fa
 .\"*********************************************************
b90c6f17
 .TP
2d321609
 .B \-\-register\-dns
fb56058a
 Run ipconfig /flushdns and ipconfig /registerdns on connection initiation.
75dfe3d7
 This is known to kick Windows into
b90c6f17
 recognizing pushed DNS servers.
 .\"*********************************************************
6fbf66fa
 .TP
2d321609
 .B \-\-pause\-exit
6fbf66fa
 Put up a "press any key to continue" message on the console prior
 to OpenVPN program exit.  This option is automatically used by the
 Windows explorer when OpenVPN is run on a configuration
510c8ade
 file using the right\-click explorer menu.
6fbf66fa
 .\"*********************************************************
 .TP
510c8ade
 .B \-\-service exit\-event [0|1]
6fbf66fa
 Should be used when OpenVPN is being automatically executed by another
 program in such
 a context that no interaction with the user via display or keyboard
510c8ade
 is possible.  In general, end\-users should never need to explicitly
6fbf66fa
 use this option, as it is automatically added by the OpenVPN service wrapper
 when a given OpenVPN configuration is being run as a service.
 
510c8ade
 .B exit\-event
6fbf66fa
 is the name of a Windows global event object, and OpenVPN will continuously
 monitor the state of this event object and exit when it becomes signaled.
 
 The second parameter indicates the initial state of
510c8ade
 .B exit\-event
6fbf66fa
 and normally defaults to 0.
 
 Multiple OpenVPN processes can be simultaneously executed with the same
510c8ade
 .B exit\-event
6fbf66fa
 parameter.  In any case, the controlling process can signal
510c8ade
 .B exit\-event,
6fbf66fa
 causing all such OpenVPN processes to exit.
 
 When executing an OpenVPN process using the
48fe8bb3
 .B \-\-service
6fbf66fa
 directive, OpenVPN will probably not have a console
 window to output status/error
 messages, therefore it is useful to use
48fe8bb3
 .B \-\-log
6fbf66fa
 or
2d321609
 .B \-\-log\-append
6fbf66fa
 to write these messages to a file.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-show\-adapters
6fbf66fa
 (Standalone)
510c8ade
 Show available TAP\-Win32 adapters which can be selected using the
2d321609
 .B \-\-dev\-node
510c8ade
 option.  On non\-Windows systems, the
6fbf66fa
 .BR ifconfig (8)
 command provides similar functionality.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-allow\-nonadmin [TAP\-adapter]
3c7f2f55
 (Standalone)
 Set
510c8ade
 .B TAP\-adapter
 to allow access from non\-administrative accounts.  If
 .B TAP\-adapter
3c7f2f55
 is omitted, all TAP adapters on the system will be configured to allow
510c8ade
 non\-admin access.
 The non\-admin access setting will only persist for the length of time that
 the TAP\-Win32 device object and driver remain loaded, and will need
 to be re\-enabled after a reboot, or if the driver is unloaded
3c7f2f55
 and reloaded.
 This directive can only be used by an administrator.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-show\-valid\-subnets
6fbf66fa
 (Standalone)
 Show valid subnets for
48fe8bb3
 .B \-\-dev tun
510c8ade
 emulation.  Since the TAP\-Win32 driver
6fbf66fa
 exports an ethernet interface to Windows, and since TUN devices are
510c8ade
 point\-to\-point in nature, it is necessary for the TAP\-Win32 driver
6fbf66fa
 to impose certain constraints on TUN endpoint address selection.
 
510c8ade
 Namely, the point\-to\-point endpoints used in TUN device emulation
6fbf66fa
 must be the middle two addresses of a /30 subnet (netmask 255.255.255.252).
 .\"*********************************************************
 .TP
2d321609
 .B \-\-show\-net
6fbf66fa
 (Standalone)
 Show OpenVPN's view of the system routing table and network
 adapter list.
 .\"*********************************************************
ce98fd24
 .SS PKCS#11 Standalone Options:
 .\"*********************************************************
 .TP
2d321609
 .B \-\-show\-pkcs11\-ids [provider] [cert_private]
ce98fd24
 (Standalone)
718526e0
 Show PKCS#11 token object list. Specify cert_private as 1
 if certificates are stored as private objects.
 
510c8ade
 If p11\-kit is present on the system, the
7c1d614c
 .B provider
 argument is optional; if omitted the default
2d321609
 .B p11\-kit\-proxy.so
7c1d614c
 module will be queried.
 
48fe8bb3
 .B \-\-verb
718526e0
 option can be used BEFORE this option to produce debugging information.
ce98fd24
 .\"*********************************************************
d8a8656f
 .SS Standalone Debug Options:
 .\"*********************************************************
 .TP
 .B \-\-show\-gateway [v6target]
 (Standalone)
 Show current IPv4 and IPv6 default gateway and interface towards the
 gateway (if the protocol in question is enabled).  If an IPv6 address
 is passed as argument, the IPv6 route for this host is reported.
 .\"*********************************************************
8259bc25
 .SS IPv6 Related Options
 .\"*********************************************************
510c8ade
 The following options exist to support IPv6 tunneling in peer\-to\-peer
 and client\-server mode.  All options are modeled after their IPv4
2a97e69e
 counterparts, so more detailed explanations given there apply here
 as well (except for
 .B \-\-topology
 , which has no effect on IPv6).
8259bc25
 .TP
2d321609
 .B \-\-ifconfig\-ipv6 ipv6addr/bits ipv6remote
8259bc25
 configure IPv6 address
 .B ipv6addr/bits
 on the ``tun'' device.  The second parameter is used as route target for
2d321609
 .B \-\-route\-ipv6
8259bc25
 if no gateway is specified.
 .TP
2d321609
 .B \-\-route\-ipv6 ipv6addr/bits [gateway] [metric]
8259bc25
 setup IPv6 routing in the system to send the specified IPv6 network
a1010a84
 into OpenVPN's ``tun''.  The gateway parameter is only used for
 IPv6 routes across ``tap'' devices, and if missing, the ``ipv6remote''
 field from
2d321609
 .B \-\-ifconfig\-ipv6
a1010a84
 is used.
8259bc25
 .TP
2d321609
 .B \-\-server\-ipv6 ipv6addr/bits
510c8ade
 convenience\-function to enable a number of IPv6 related options at
8259bc25
 once, namely
86e2fa55
 .B \-\-ifconfig\-ipv6, \-\-ifconfig\-ipv6\-pool
8259bc25
 and
2d321609
 .B \-\-push tun\-ipv6
86e2fa55
 Is only accepted if ``\-\-mode server'' or ``\-\-server'' is set. Pushing of the
 .B \-\-tun\-ipv6
 directive is done for older clients which require an explicit
 ``\-\-tun\-ipv6'' in their configuration.
8259bc25
 .TP
2d321609
 .B \-\-ifconfig\-ipv6\-pool ipv6addr/bits
8259bc25
 Specify an IPv6 address pool for dynamic assignment to clients.  The
 pool starts at
 .B ipv6addr
0d8a4ffa
 and matches the offset determined from the start of the IPv4 pool.
8259bc25
 .TP
2d321609
 .B \-\-ifconfig\-ipv6\-push ipv6addr/bits ipv6remote
510c8ade
 for ccd/ per\-client static IPv6 interface configuration, see
2d321609
 .B \-\-client\-config\-dir
8259bc25
 and
2d321609
 .B \-\-ifconfig\-push
8259bc25
 for more details.
 .TP
2d321609
 .B \-\-iroute\-ipv6 ipv6addr/bits
510c8ade
 for ccd/ per\-client static IPv6 route configuration, see
2d321609
 .B \-\-iroute
8259bc25
 for more details how to setup and use this, and how
2d321609
 .B \-\-iroute
8259bc25
 and
2d321609
 .B \-\-route
8259bc25
 interact.
 
 .\"*********************************************************
6fbf66fa
 .SH SCRIPTING AND ENVIRONMENTAL VARIABLES
 OpenVPN exports a series
510c8ade
 of environmental variables for use by user\-defined scripts.
6fbf66fa
 .\"*********************************************************
 .SS Script Order of Execution
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-up
6fbf66fa
 Executed after TCP/UDP socket bind and TUN/TAP open.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-tls\-verify
6fbf66fa
 Executed when we have a still untrusted remote peer.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-ipchange
6fbf66fa
 Executed after connection authentication, or remote IP address change.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-client\-connect
6fbf66fa
 Executed in
48fe8bb3
 .B \-\-mode server
6fbf66fa
 mode immediately after client authentication.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-route\-up
6fbf66fa
 Executed after connection authentication, either
 immediately after, or some number of seconds after
 as defined by the
2d321609
 .B \-\-route\-delay
6fbf66fa
 option.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-route\-pre\-down
415421c2
 Executed right before the routes are removed.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-client\-disconnect
6fbf66fa
 Executed in
48fe8bb3
 .B \-\-mode server
6fbf66fa
 mode on client instance shutdown.
 .\"*********************************************************
 .TP
48fe8bb3
 .B \-\-down
6fbf66fa
 Executed after TCP/UDP and TUN/TAP close.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-learn\-address
6fbf66fa
 Executed in
48fe8bb3
 .B \-\-mode server
6fbf66fa
 mode whenever an IPv4 address/route or MAC address is added to OpenVPN's
 internal routing table.
 .\"*********************************************************
 .TP
2d321609
 .B \-\-auth\-user\-pass\-verify
6fbf66fa
 Executed in
48fe8bb3
 .B \-\-mode server
6fbf66fa
 mode on new client connections, when the client is
 still untrusted.
 .\"*********************************************************
 .SS String Types and Remapping
 In certain cases, OpenVPN will perform remapping of characters
 in strings.  Essentially, any characters outside the set of
 permitted characters for each string type will be converted
 to underbar ('_').
 
 .B Q:
 Why is string remapping necessary?
 
 .B A:
 It's an important security feature to prevent the malicious coding of
 strings from untrusted sources to be passed as parameters to scripts,
 saved in the environment, used as a common name, translated to a filename,
 etc.
 
148329ca
 .B Q:
 Can string remapping be disabled?
 
 .B A:
 Yes, by using the
2d321609
 .B \-\-no\-name\-remapping
148329ca
 option, however this should be considered an advanced option.
 
6fbf66fa
 Here is a brief rundown of OpenVPN's current string types and the 
 permitted character class for each string:
 
 .B X509 Names:
510c8ade
 Alphanumeric, underbar ('_'), dash ('\-'), dot ('.'), at
6fbf66fa
 ('@'), colon (':'), slash ('/'), and equal ('=').  Alphanumeric is defined 
 as a character which will cause the C library isalnum() function to return 
 true.
 
 .B Common Names:
510c8ade
 Alphanumeric, underbar ('_'), dash ('\-'), dot ('.'), and at
6fbf66fa
 ('@').
 
2d321609
 .B \-\-auth\-user\-pass username:
6fbf66fa
 Same as Common Name, with one exception: starting with OpenVPN 2.0.1,
 the username is passed to the OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY plugin in its raw form,
 without string remapping.
 
2d321609
 .B \-\-auth\-user\-pass password:
6fbf66fa
 Any "printable" character except CR or LF.  
 Printable is defined to be a character which will cause the C library 
 isprint() function to return true.
 
2d321609
 .B \-\-client\-config\-dir filename as derived from common name or username:
510c8ade
 Alphanumeric, underbar ('_'), dash ('\-'), and dot ('.') except for "." or
 ".." as standalone strings.  As of v2.0.1\-rc6, the at ('@') character has
6fbf66fa
 been added as well for compatibility with the common name character class.
 
 .B Environmental variable names:
 Alphanumeric or underbar ('_').
 
 .B Environmental variable values:
 Any printable character.
 
 For all cases, characters in a string which are not members of the legal 
 character class for that string type will be remapped to underbar ('_').
 .\"*********************************************************
 .SS Environmental Variables
 Once set, a variable is persisted
 indefinitely until it is reset by a new value or a restart,
 
510c8ade
 As of OpenVPN 2.0\-beta12, in server mode, environmental
6fbf66fa
 variables set by OpenVPN
 are scoped according to the client objects
 they are
 associated with, so there should not be any issues with
 scripts having access to stale, previously set variables
 which refer to different client instances.
 .\"*********************************************************
 .TP
 .B bytes_received
 Total number of bytes received from client during VPN session.
 Set prior to execution of the
2d321609
 .B \-\-client\-disconnect
6fbf66fa
 script.
 .\"*********************************************************
 .TP
 .B bytes_sent
 Total number of bytes sent to client during VPN session.
 Set prior to execution of the
2d321609
 .B \-\-client\-disconnect
6fbf66fa
 script.
 .\"*********************************************************
 .TP
 .B common_name
 The X509 common name of an authenticated client.
 Set prior to execution of
2d321609
 .B \-\-client\-connect, \-\-client\-disconnect,
6fbf66fa
 and
2d321609
 .B \-\-auth\-user\-pass\-verify
6fbf66fa
 scripts.
 .\"*********************************************************
 .TP
 .B config
 Name of first
48fe8bb3
 .B \-\-config
6fbf66fa
 file.
 Set on program initiation and reset on SIGHUP.
 .\"*********************************************************
 .TP
 .B daemon
 Set to "1" if the
48fe8bb3
 .B \-\-daemon
6fbf66fa
 directive is specified, or "0" otherwise.
 Set on program initiation and reset on SIGHUP.
 .\"*********************************************************
 .TP
 .B daemon_log_redirect
 Set to "1" if the
48fe8bb3
 .B \-\-log
6fbf66fa
 or
2d321609
 .B \-\-log\-append
6fbf66fa
 directives are specified, or "0" otherwise.
 Set on program initiation and reset on SIGHUP.
 .\"*********************************************************
 .TP
 .B dev
 The actual name of the TUN/TAP device, including
 a unit number if it exists.
 Set prior to
48fe8bb3
 .B \-\-up
6fbf66fa
 or
48fe8bb3
 .B \-\-down
6fbf66fa
 script execution.
 .\"*********************************************************
 .TP
9dff2c1f
 .B dev_idx
 On Windows, the device index of the TUN/TAP adapter (to
 be used in netsh.exe calls which sometimes just do not work
 right with interface names).
 Set prior to
 .B \-\-up
 or
 .B \-\-down
 script execution.
 .\"*********************************************************
 .TP
6fbf66fa
 .B foreign_option_{n}
 An option pushed via
48fe8bb3
 .B \-\-push
6fbf66fa
 to a client which does not natively support it,
 such as
2d321609
 .B \-\-dhcp\-option
510c8ade
 on a non\-Windows system, will be recorded to this
6fbf66fa
 environmental variable sequence prior to
48fe8bb3
 .B \-\-up
6fbf66fa
 script execution.
 .\"*********************************************************
 .TP
 .B ifconfig_broadcast
 The broadcast address for the virtual
 ethernet segment which is derived from the
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 option when
48fe8bb3
 .B \-\-dev tap
6fbf66fa
 is used.
 Set prior to OpenVPN calling the
 .I ifconfig
 or
 .I netsh
 (windows version of ifconfig) commands which
 normally occurs prior to
48fe8bb3
 .B \-\-up
6fbf66fa
 script execution.
 .\"*********************************************************
 .TP
04d66ef0
 .B ifconfig_ipv6_local
 The local VPN endpoint IPv6 address specified in the
2d321609
 .B \-\-ifconfig\-ipv6
04d66ef0
 option (first parameter).
 Set prior to OpenVPN calling the
 .I ifconfig
 or
 .I netsh
 (windows version of ifconfig) commands which
 normally occurs prior to
 .B \-\-up
 script execution.
 .\"*********************************************************
 .TP
 .B ifconfig_ipv6_netbits
 The prefix length of the IPv6 network on the VPN interface.  Derived from
 the /nnn parameter of the IPv6 address in the
2d321609
 .B \-\-ifconfig\-ipv6
04d66ef0
 option (first parameter).
 Set prior to OpenVPN calling the
 .I ifconfig
 or
 .I netsh
 (windows version of ifconfig) commands which
 normally occurs prior to
 .B \-\-up
 script execution.
 .\"*********************************************************
 .TP
 .B ifconfig_ipv6_remote
 The remote VPN endpoint IPv6 address specified in the
2d321609
 .B \-\-ifconfig\-ipv6
04d66ef0
 option (second parameter).
 Set prior to OpenVPN calling the
 .I ifconfig
 or
 .I netsh
 (windows version of ifconfig) commands which
 normally occurs prior to
 .B \-\-up
 script execution.
 .\"*********************************************************
 .TP
6fbf66fa
 .B ifconfig_local
 The local VPN endpoint IP address specified in the
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 option (first parameter).
 Set prior to OpenVPN calling the
 .I ifconfig
 or
 .I netsh
 (windows version of ifconfig) commands which
 normally occurs prior to
48fe8bb3
 .B \-\-up
6fbf66fa
 script execution.
 .\"*********************************************************
 .TP
 .B ifconfig_remote
 The remote VPN endpoint IP address specified in the
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 option (second parameter) when
48fe8bb3
 .B \-\-dev tun
6fbf66fa
 is used.
 Set prior to OpenVPN calling the
 .I ifconfig
 or
 .I netsh
 (windows version of ifconfig) commands which
 normally occurs prior to
48fe8bb3
 .B \-\-up
6fbf66fa
 script execution.
 .\"*********************************************************
 .TP
 .B ifconfig_netmask
 The subnet mask of the virtual ethernet segment
 that is specified as the second parameter to
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 when
48fe8bb3
 .B \-\-dev tap
6fbf66fa
 is being used.
 Set prior to OpenVPN calling the
 .I ifconfig
 or
 .I netsh
 (windows version of ifconfig) commands which
 normally occurs prior to
48fe8bb3
 .B \-\-up
6fbf66fa
 script execution.
 .\"*********************************************************
 .TP
 .B ifconfig_pool_local_ip
 The local
 virtual IP address for the TUN/TAP tunnel taken from an
2d321609
 .B \-\-ifconfig\-push
6fbf66fa
 directive if specified, or otherwise from
 the ifconfig pool (controlled by the
2d321609
 .B \-\-ifconfig\-pool
6fbf66fa
 config file directive).
 Only set for
48fe8bb3
 .B \-\-dev tun
6fbf66fa
 tunnels.
 This option is set on the server prior to execution
 of the
2d321609
 .B \-\-client\-connect
6fbf66fa
 and
2d321609
 .B \-\-client\-disconnect
6fbf66fa
 scripts.
 .\"*********************************************************
 .TP
 .B ifconfig_pool_netmask
 The
 virtual IP netmask for the TUN/TAP tunnel taken from an
2d321609
 .B \-\-ifconfig\-push
6fbf66fa
 directive if specified, or otherwise from
 the ifconfig pool (controlled by the
2d321609
 .B \-\-ifconfig\-pool
6fbf66fa
 config file directive).
 Only set for
48fe8bb3
 .B \-\-dev tap
6fbf66fa
 tunnels.
 This option is set on the server prior to execution
 of the
2d321609
 .B \-\-client\-connect
6fbf66fa
 and
2d321609
 .B \-\-client\-disconnect
6fbf66fa
 scripts.
 .\"*********************************************************
 .TP
 .B ifconfig_pool_remote_ip
 The remote
 virtual IP address for the TUN/TAP tunnel taken from an
2d321609
 .B \-\-ifconfig\-push
6fbf66fa
 directive if specified, or otherwise from
 the ifconfig pool (controlled by the
2d321609
 .B \-\-ifconfig\-pool
6fbf66fa
 config file directive).
 This option is set on the server prior to execution
 of the
2d321609
 .B \-\-client\-connect
6fbf66fa
 and
2d321609
 .B \-\-client\-disconnect
6fbf66fa
 scripts.
 .\"*********************************************************
 .TP
 .B link_mtu
 The maximum packet size (not including the IP header)
 of tunnel data in UDP tunnel transport mode.
 Set prior to
48fe8bb3
 .B \-\-up
6fbf66fa
 or
48fe8bb3
 .B \-\-down
6fbf66fa
 script execution.
 .\"*********************************************************
 .TP
 .B local
 The
48fe8bb3
 .B \-\-local
6fbf66fa
 parameter.
 Set on program initiation and reset on SIGHUP.
 .\"*********************************************************
 .TP
 .B local_port
076fd3e4
 The local port number or name, specified by
48fe8bb3
 .B \-\-port
6fbf66fa
 or
48fe8bb3
 .B \-\-lport.
6fbf66fa
 Set on program initiation and reset on SIGHUP.
 .\"*********************************************************
 .TP
 .B password
 The password provided by a connecting client.
 Set prior to
2d321609
 .B \-\-auth\-user\-pass\-verify
6fbf66fa
 script execution only when the
2d321609
 .B via\-env
6fbf66fa
 modifier is specified, and deleted from the environment
 after the script returns.
 .\"*********************************************************
 .TP
 .B proto
 The
48fe8bb3
 .B \-\-proto
6fbf66fa
 parameter.
 Set on program initiation and reset on SIGHUP.
 .\"*********************************************************
 .TP
 .B remote_{n}
 The
48fe8bb3
 .B \-\-remote
6fbf66fa
 parameter.
 Set on program initiation and reset on SIGHUP.
 .\"*********************************************************
 .TP
 .B remote_port_{n}
 The remote port number, specified by
48fe8bb3
 .B \-\-port
6fbf66fa
 or
48fe8bb3
 .B \-\-rport.
6fbf66fa
 Set on program initiation and reset on SIGHUP.
 .\"*********************************************************
 .TP
 .B route_net_gateway
510c8ade
 The pre\-existing default IP gateway in the system routing
6fbf66fa
 table.
 Set prior to
48fe8bb3
 .B \-\-up
6fbf66fa
 script execution.
 .\"*********************************************************
 .TP
 .B route_vpn_gateway
 The default gateway used by
48fe8bb3
 .B \-\-route
6fbf66fa
 options, as specified in either the
2d321609
 .B \-\-route\-gateway
6fbf66fa
 option or the second parameter to
48fe8bb3
 .B \-\-ifconfig
6fbf66fa
 when
48fe8bb3
 .B \-\-dev tun
6fbf66fa
 is specified.
 Set prior to
48fe8bb3
 .B \-\-up
6fbf66fa
 script execution.
 .\"*********************************************************
 .TP
 .B route_{parm}_{n}
 A set of variables which define each route to be added, and
 are set prior to
48fe8bb3
 .B \-\-up
6fbf66fa
 script execution.
 
 .B parm
 will be one of "network", "netmask", "gateway", or "metric".
 
 .B n
 is the OpenVPN route number, starting from 1.
 
 If the network or gateway are resolvable DNS names,
 their IP address translations will be recorded rather
 than their names as denoted on the command line
 or configuration file.
 .\"*********************************************************
 .TP
04d66ef0
 .B route_ipv6_{parm}_{n}
 A set of variables which define each IPv6 route to be added, and
 are set prior to
 .B \-\-up
 script execution.
 
 .B parm
 will be one of "network" or "gateway" ("netmask" is contained as "/nnn"
 in the route_ipv6_network_{n}, unlike IPv4 where it is passed in a separate
 environment variable).
 
 .B n
 is the OpenVPN route number, starting from 1.
 
 If the network or gateway are resolvable DNS names,
 their IP address translations will be recorded rather
 than their names as denoted on the command line
 or configuration file.
 .\"*********************************************************
 .TP
39238d1b
 .B peer_cert
 Temporary file name containing the client certificate upon
2d321609
 connection.  Useful in conjunction with \-\-tls\-verify
39238d1b
 .\"*********************************************************
 .TP
6fbf66fa
 .B script_context
 Set to "init" or "restart" prior to up/down script execution.
 For more information, see
 documentation for
48fe8bb3
 .B \-\-up.
6fbf66fa
 .\"*********************************************************
 .TP
 .B script_type
a4bd825b
 Prior to execution of any script, this variable is set to the type of
 script being run.  It can be one of the following:
2d321609
 .B up, down, ipchange, route\-up, tls\-verify, auth\-user\-pass\-verify,
 .B client\-connect, client\-disconnect,
6fbf66fa
 or
2d321609
 .B learn\-address.
d02a86d3
 Set prior to execution of any script.
6fbf66fa
 .\"*********************************************************
 .TP
 .B signal
 The reason for exit or restart.  Can be one of
 .B sigusr1, sighup, sigterm, sigint, inactive
 (controlled by
48fe8bb3
 .B \-\-inactive
6fbf66fa
 option),
2d321609
 .B ping\-exit
6fbf66fa
 (controlled by
2d321609
 .B \-\-ping\-exit
6fbf66fa
 option),
2d321609
 .B ping\-restart
6fbf66fa
 (controlled by
2d321609
 .B \-\-ping\-restart
6fbf66fa
 option),
2d321609
 .B connection\-reset
6fbf66fa
 (triggered on TCP connection reset),
 .B error,
 or
 .B unknown
 (unknown signal).  This variable is set just prior to down script execution.
 .\"*********************************************************
 .TP
a783c400
 .B time_ascii
510c8ade
 Client connection timestamp, formatted as a human\-readable
a783c400
 time string.
 Set prior to execution of the
2d321609
 .B \-\-client\-connect
a783c400
 script.
 .\"*********************************************************
 .TP
 .B time_duration
 The duration (in seconds) of the client session which is now
 disconnecting.
 Set prior to execution of the
2d321609
 .B \-\-client\-disconnect
a783c400
 script.
 .\"*********************************************************
 .TP
 .B time_unix
 Client connection timestamp, formatted as a unix integer
 date/time value.
 Set prior to execution of the
2d321609
 .B \-\-client\-connect
a783c400
 script.
 .\"*********************************************************
 .TP
af1e4d26
 .B tls_digest_{n} / tls_digest_sha256_{n}
 Contains the certificate SHA1 / SHA256 fingerprint, where
ace54e9b
 .B n
 is the verification level.  Only set for TLS connections.  Set prior
 to execution of
2d321609
 .B \-\-tls\-verify
ace54e9b
 script.
 .\"*********************************************************
 .TP
6fbf66fa
 .B tls_id_{n}
 A series of certificate fields from the remote peer,
 where
 .B n
 is the verification level.  Only set for TLS connections.  Set prior
 to execution of
2d321609
 .B \-\-tls\-verify
6fbf66fa
 script.
 .\"*********************************************************
 .TP
 .B tls_serial_{n}
 The serial number of the certificate from the remote peer,
 where
 .B n
 is the verification level.  Only set for TLS connections.  Set prior
 to execution of
2d321609
 .B \-\-tls\-verify
959d6078
 script. This is in the form of a decimal string like "933971680", which is
510c8ade
 suitable for doing serial\-based OCSP queries (with OpenSSL, do not
959d6078
 prepend "0x" to the string) If something goes wrong while reading
7d5e26cb
 the value from the certificate it will be an empty string, so your
 code should check that.
 See the contrib/OCSP_check/OCSP_check.sh script for an example.
6fbf66fa
 .\"*********************************************************
 .TP
f80a52b0
 .B tls_serial_hex_{n}
 Like
 .B tls_serial_{n}\fR,
 but in hex form (e.g. "12:34:56:78:9A").
 .\"*********************************************************
 .TP
6fbf66fa
 .B tun_mtu
 The MTU of the TUN/TAP device.
 Set prior to
48fe8bb3
 .B \-\-up
6fbf66fa
 or
48fe8bb3
 .B \-\-down
6fbf66fa
 script execution.
 .\"*********************************************************
 .TP
3ac2ac72
 .B trusted_ip (or trusted_ip6)
6fbf66fa
 Actual IP address of connecting client or peer which has been authenticated.
 Set prior to execution of
2d321609
 .B \-\-ipchange, \-\-client\-connect,
6fbf66fa
 and
2d321609
 .B \-\-client\-disconnect
6fbf66fa
 scripts.
3ac2ac72
 If using ipv6 endpoints (udp6, tcp6),
 .B trusted_ip6
 will be set instead.
6fbf66fa
 .\"*********************************************************
 .TP
 .B trusted_port
 Actual port number of connecting client or peer which has been authenticated.
 Set prior to execution of
2d321609
 .B \-\-ipchange, \-\-client\-connect,
6fbf66fa
 and
2d321609
 .B \-\-client\-disconnect
6fbf66fa
 scripts.
 .\"*********************************************************
 .TP
3ac2ac72
 .B untrusted_ip (or untrusted_ip6)
6fbf66fa
 Actual IP address of connecting client or peer which has not been authenticated
 yet.  Sometimes used to
 .B nmap
 the connecting host in a
2d321609
 .B \-\-tls\-verify
6fbf66fa
 script to ensure it is firewalled properly.
 Set prior to execution of
2d321609
 .B \-\-tls\-verify
6fbf66fa
 and
2d321609
 .B \-\-auth\-user\-pass\-verify
6fbf66fa
 scripts.
3ac2ac72
 If using ipv6 endpoints (udp6, tcp6),
 .B untrusted_ip6
 will be set instead.
6fbf66fa
 .\"*********************************************************
 .TP
 .B untrusted_port
 Actual port number of connecting client or peer which has not been authenticated
 yet.
 Set prior to execution of
2d321609
 .B \-\-tls\-verify
6fbf66fa
 and
2d321609
 .B \-\-auth\-user\-pass\-verify
6fbf66fa
 scripts.
 .\"*********************************************************
 .TP
 .B username
 The username provided by a connecting client.
 Set prior to
2d321609
 .B \-\-auth\-user\-pass\-verify
6fbf66fa
 script execution only when the
2d321609
 .B via\-env
6fbf66fa
 modifier is specified.
 .\"*********************************************************
fd81c006
 .TP
 .B X509_{n}_{subject_field}
 An X509 subject field from the remote peer certificate,
 where
 .B n
 is the verification level.  Only set for TLS connections.  Set prior
 to execution of
2d321609
 .B \-\-tls\-verify
fd81c006
 script.  This variable is similar to
 .B tls_id_{n}
 except the component X509 subject fields are broken out, and
 no string remapping occurs on these field values (except for remapping
 of control characters to "_").
 For example, the following variables would be set on the
 OpenVPN server using the sample client certificate
2d321609
 in sample\-keys (client.crt).
fd81c006
 Note that the verification level is 0 for the client certificate
 and 1 for the CA certificate.
148329ca
 
fd81c006
 .nf
148329ca
 .ft 3
 .in +4
fd81c006
 X509_0_emailAddress=me@myhost.mydomain
510c8ade
 X509_0_CN=Test\-Client
 X509_0_O=OpenVPN\-TEST
fd81c006
 X509_0_ST=NA
 X509_0_C=KG
 X509_1_emailAddress=me@myhost.mydomain
510c8ade
 X509_1_O=OpenVPN\-TEST
fd81c006
 X509_1_L=BISHKEK
 X509_1_ST=NA
 X509_1_C=KG
148329ca
 .in -4
fd81c006
 .ft
 .fi
 .\"*********************************************************
0979ec7e
 .SH INLINE FILE SUPPORT
 OpenVPN allows including files in the main configuration for the
7a7a79f6
 .B \-\-ca, \-\-cert, \-\-dh, \-\-extra\-certs, \-\-key, \-\-pkcs12, \-\-secret,
510c8ade
 .B \-\-crl\-verify, \-\-http\-proxy\-user\-pass, \-\-tls\-auth
0979ec7e
 and
8025a62c
 .B \-\-tls\-crypt
0979ec7e
 options.
 
 Each inline file started by the line
 .B <option>
 and ended by the line
 .B </option>
 
 Here is an example of an inline file usage
 
 .nf
 .ft 3
 .in +4
 <cert>
510c8ade
 \-\-\-\-\-BEGIN CERTIFICATE\-\-\-\-\-
0979ec7e
 [...]
510c8ade
 \-\-\-\-\-END CERTIFICATE\-\-\-\-\-
0979ec7e
 </cert>
 .in -4
 .ft
 .fi
 
 When using the inline file feature with
 .B \-\-pkcs12
 the inline file has to be base64 encoded. Encoding of a .p12 file into base64 can be done for example with OpenSSL by running
2d321609
 .B openssl base64 \-in input.p12
0979ec7e
 
6fbf66fa
 .SH SIGNALS
 .TP
 .B SIGHUP
 Cause OpenVPN to close all TUN/TAP and
 network connections,
510c8ade
 restart, re\-read the configuration file (if any),
6fbf66fa
 and reopen TUN/TAP and network connections.
 .\"*********************************************************
 .TP
 .B SIGUSR1
 Like 
 .B SIGHUP,
510c8ade
 except don't re\-read configuration file, and possibly don't close and reopen TUN/TAP
 device, re\-read key files, preserve local IP address/port, or preserve most recently authenticated
6fbf66fa
 remote IP address/port based on
2d321609
 .B \-\-persist\-tun, \-\-persist\-key, \-\-persist\-local\-ip,
6fbf66fa
 and
2d321609
 .B \-\-persist\-remote\-ip
6fbf66fa
 options respectively (see above).
 
 This signal may also be internally generated by a timeout condition, governed
 by the
2d321609
 .B \-\-ping\-restart
6fbf66fa
 option.
 
 This signal, when combined with
2d321609
 .B \-\-persist\-remote\-ip,
6fbf66fa
 may be
 sent when the underlying parameters of the host's network interface change
 such as when the host is a DHCP client and is assigned a new IP address.
 See
48fe8bb3
 .B \-\-ipchange
6fbf66fa
 above for more information.
 .\"*********************************************************
 .TP
 .B SIGUSR2
 Causes OpenVPN to display its current statistics (to the syslog
 file if
48fe8bb3
 .B \-\-daemon
6fbf66fa
 is used, or stdout otherwise).
 .\"*********************************************************
 .TP
 .B SIGINT, SIGTERM
 Causes OpenVPN to exit gracefully.
 .\"*********************************************************
 .SH TUN/TAP DRIVER SETUP
 If you are running Linux 2.4.7 or higher, you probably have the TUN/TAP driver
 already installed.  If so, there are still a few things you need to do:
 
 Make device:
 .B mknod /dev/net/tun c 10 200
 
 Load driver:
 .B modprobe tun
 .\"*********************************************************
 .SH EXAMPLES
 Prior to running these examples, you should have OpenVPN installed on two
 machines with network connectivity between them.  If you have not
 yet installed OpenVPN, consult the INSTALL file included in the OpenVPN
 distribution.
 .\"*********************************************************
 .SS TUN/TAP Setup:
 If you are using Linux 2.4 or higher,
 make the tun device node and load the tun module:
 .IP
 .B mknod /dev/net/tun c 10 200
 .LP
 .IP
 .B modprobe tun
 .LP
 If you installed from RPM, the
 .B mknod
 step may be omitted, because the RPM install does that for you.
 
ce637abd
 Only Linux 2.4 and newer are supported.
6fbf66fa
 
 For other platforms, consult the INSTALL file at
 .I http://openvpn.net/install.html
 for more information.
 .\"*********************************************************
 .SS Firewall Setup:
 If firewalls exist between
 the two machines, they should be set to forward UDP port 1194
 in both directions.  If you do not have control over the firewalls
 between the two machines, you may still be able to use OpenVPN by adding
48fe8bb3
 .B \-\-ping 15
6fbf66fa
 to each of the
 .B openvpn
 commands used below in the examples (this will cause each peer to send out
 a UDP ping to its remote peer once every 15 seconds which will cause many
 stateful firewalls to forward packets in both directions
 without an explicit firewall rule).
 
510c8ade
 If you are using a Linux iptables\-based firewall, you may need to enter
6fbf66fa
 the following command to allow incoming packets on the TUN device:
 .IP
2d321609
 .B iptables \-A INPUT \-i tun+ \-j ACCEPT
6fbf66fa
 .LP
 See the firewalls section below for more information on configuring firewalls
 for use with OpenVPN.
 .\"*********************************************************
 .SS VPN Address Setup:
 For purposes
 of our example, our two machines will be called
0f731990
 .B bob.example.com
6fbf66fa
 and
0f731990
 .B alice.example.com.
6fbf66fa
 If you are constructing a VPN over the internet, then replace
0f731990
 .B bob.example.com
6fbf66fa
 and
0f731990
 .B alice.example.com
6fbf66fa
 with the internet hostname or IP address that each machine will use
 to contact the other over the internet.
 
 Now we will choose the tunnel endpoints.  Tunnel endpoints are
 private IP addresses that only have meaning in the context of
 the VPN.  Each machine will use the tunnel endpoint of the other
 machine to access it over the VPN.  In our example,
0f731990
 the tunnel endpoint for bob.example.com
 will be 10.4.0.1 and for alice.example.com, 10.4.0.2.
6fbf66fa
 
 Once the VPN is established, you have essentially
 created a secure alternate path between the two hosts
 which is addressed by using the tunnel endpoints.  You can
 control which network
 traffic passes between the hosts 
 (a) over the VPN or (b) independently of the VPN, by choosing whether to use
 (a) the VPN endpoint address or (b) the public internet address,
0f731990
 to access the remote host. For example if you are on bob.example.com and you wish to connect to alice.example.com
6fbf66fa
 via
 .B ssh
 without using the VPN (since
 .B ssh
510c8ade
 has its own built\-in security) you would use the command
0f731990
 .B ssh alice.example.com.
6fbf66fa
 However in the same scenario, you could also use the command
 .B telnet 10.4.0.2
0f731990
 to create a telnet session with alice.example.com over the VPN, that would
6fbf66fa
 use the VPN to secure the session rather than
 .B ssh.
 
 You can use any address you wish for the
 tunnel endpoints
 but make sure that they are private addresses
 (such as those that begin with 10 or 192.168) and that they are
 not part of any existing subnet on the networks of
 either peer, unless you are bridging.  If you use an address that is part of
 your local subnet for either of the tunnel endpoints,
 you will get a weird feedback loop.
 .\"*********************************************************
 .SS Example 1: A simple tunnel without security
 .LP
0f731990
 On bob:
6fbf66fa
 .IP
0f731990
 .B openvpn \-\-remote alice.example.com \-\-dev tun1 \-\-ifconfig 10.4.0.1 10.4.0.2 \-\-verb 9
6fbf66fa
 .LP
0f731990
 On alice:
6fbf66fa
 .IP
0f731990
 .B openvpn \-\-remote bob.example.com \-\-dev tun1 \-\-ifconfig 10.4.0.2 10.4.0.1 \-\-verb 9
6fbf66fa
 .LP
 Now verify the tunnel is working by pinging across the tunnel.
 .LP
0f731990
 On bob:
6fbf66fa
 .IP
 .B ping 10.4.0.2
 .LP
0f731990
 On alice:
6fbf66fa
 .IP
 .B ping 10.4.0.1
 .LP
 The
48fe8bb3
 .B \-\-verb 9
6fbf66fa
 option will produce verbose output, similar to the
 .BR tcpdump (8)
 program.  Omit the
48fe8bb3
 .B \-\-verb 9
6fbf66fa
 option to have OpenVPN run quietly.
 .\"*********************************************************
510c8ade
 .SS Example 2: A tunnel with static\-key security (i.e. using a pre\-shared secret)
0f731990
 First build a static key on bob.
6fbf66fa
 .IP
48fe8bb3
 .B openvpn \-\-genkey \-\-secret key
6fbf66fa
 .LP
 This command will build a random key file called
 .B key
 (in ascii format).
 Now copy
 .B key
0f731990
 to alice over a secure medium such as by
6fbf66fa
 using the
 .BR scp (1)
 program.
 .LP
0f731990
 On bob:
6fbf66fa
 .IP
0f731990
 .B openvpn \-\-remote alice.example.com \-\-dev tun1 \-\-ifconfig 10.4.0.1 10.4.0.2 \-\-verb 5 \-\-secret key
6fbf66fa
 .LP
0f731990
 On alice:
6fbf66fa
 .IP
0f731990
 .B openvpn \-\-remote bob.example.com \-\-dev tun1 \-\-ifconfig 10.4.0.2 10.4.0.1 \-\-verb 5 \-\-secret key
6fbf66fa
 .LP
 Now verify the tunnel is working by pinging across the tunnel.
 .LP
0f731990
 On bob:
6fbf66fa
 .IP
 .B ping 10.4.0.2
 .LP
0f731990
 On alice:
6fbf66fa
 .IP
 .B ping 10.4.0.1
 .\"*********************************************************
510c8ade
 .SS Example 3: A tunnel with full TLS\-based security
6fbf66fa
 For this test, we will designate
0f731990
 .B bob
6fbf66fa
 as the TLS client and
0f731990
 .B alice
6fbf66fa
 as the TLS server.
510c8ade
 .I Note that client or server designation only has meaning for the TLS subsystem.  It has no bearing on OpenVPN's peer\-to\-peer, UDP\-based communication model.
6fbf66fa
 
 First, build a separate certificate/key pair
0f731990
 for both bob and alice (see above where
48fe8bb3
 .B \-\-cert
6fbf66fa
 is discussed for more info).  Then construct
 Diffie Hellman parameters (see above where
48fe8bb3
 .B \-\-dh
6fbf66fa
 is discussed for more info).  You can also use the
 included test files client.crt, client.key,
c70caa7f
 server.crt, server.key and ca.crt.
510c8ade
 The .crt files are certificates/public\-keys, the .key
c70caa7f
 files are private keys, and ca.crt is a certification
6fbf66fa
 authority who has signed both
 client.crt and server.crt.  For Diffie Hellman
 parameters you can use the included file dh1024.pem.
 .I Note that all client, server, and certificate authority certificates and keys included in the OpenVPN distribution are totally insecure and should be used for testing only.
 .LP
0f731990
 On bob:
6fbf66fa
 .IP
0f731990
 .B openvpn \-\-remote alice.example.com \-\-dev tun1 \-\-ifconfig 10.4.0.1 10.4.0.2 \-\-tls\-client \-\-ca ca.crt \-\-cert client.crt \-\-key client.key \-\-reneg\-sec 60 \-\-verb 5
6fbf66fa
 .LP
0f731990
 On alice:
6fbf66fa
 .IP
0f731990
 .B openvpn \-\-remote bob.example.com \-\-dev tun1 \-\-ifconfig 10.4.0.2 10.4.0.1 \-\-tls\-server \-\-dh dh1024.pem \-\-ca ca.crt \-\-cert server.crt \-\-key server.key \-\-reneg\-sec 60 \-\-verb 5
6fbf66fa
 .LP
 Now verify the tunnel is working by pinging across the tunnel.
 .LP
0f731990
 On bob:
6fbf66fa
 .IP
 .B ping 10.4.0.2
 .LP
0f731990
 On alice:
6fbf66fa
 .IP
 .B ping 10.4.0.1
 .LP
 Notice the
2d321609
 .B \-\-reneg\-sec 60
6fbf66fa
 option we used above.  That tells OpenVPN to renegotiate
 the data channel keys every minute.
 Since we used
48fe8bb3
 .B \-\-verb 5
6fbf66fa
 above, you will see status information on each new key negotiation.
 
 For production operations, a key renegotiation interval of 60 seconds
 is probably too frequent.  Omit the
2d321609
 .B \-\-reneg\-sec 60
6fbf66fa
 option to use OpenVPN's default key renegotiation interval of one hour.
 .\"*********************************************************
 .SS Routing:
 Assuming you can ping across the tunnel,
 the next step is to route a real subnet over
0f731990
 the secure tunnel.  Suppose that bob and alice have two network
6fbf66fa
 interfaces each, one connected
 to the internet, and the other to a private
 network.  Our goal is to securely connect
0f731990
 both private networks.  We will assume that bob's private subnet
 is 10.0.0.0/24 and alice's is 10.0.1.0/24.
6fbf66fa
 .LP
 First, ensure that IP forwarding is enabled on both peers.
 On Linux, enable routing:
 .IP
 .B echo 1 > /proc/sys/net/ipv4/ip_forward
 .LP
 and enable TUN packet forwarding through the firewall:
 .IP
2d321609
 .B iptables \-A FORWARD \-i tun+ \-j ACCEPT
6fbf66fa
 .LP
0f731990
 On bob:
6fbf66fa
 .IP
2d321609
 .B route add \-net 10.0.1.0 netmask 255.255.255.0 gw 10.4.0.2
6fbf66fa
 .LP
0f731990
 On alice:
6fbf66fa
 .IP
2d321609
 .B route add \-net 10.0.0.0 netmask 255.255.255.0 gw 10.4.0.1
6fbf66fa
 .LP
 Now any machine on the 10.0.0.0/24 subnet can
 access any machine on the 10.0.1.0/24 subnet
 over the secure tunnel (or vice versa).
 
 In a production environment, you could put the route command(s)
d6285998
 in a script and execute with the
48fe8bb3
 .B \-\-up
6fbf66fa
 option.
 .\"*********************************************************
 .SH FIREWALLS
510c8ade
 OpenVPN's usage of a single UDP port makes it fairly firewall\-friendly.
6fbf66fa
 You should add an entry to your firewall rules to allow incoming OpenVPN
 packets.  On Linux 2.4+:
 .IP
2d321609
 .B iptables \-A INPUT \-p udp \-s 1.2.3.4 \-\-dport 1194 \-j ACCEPT
6fbf66fa
 .LP
 This will allow incoming packets on UDP port 1194 (OpenVPN's default UDP port)
 from an OpenVPN peer at 1.2.3.4.
 
510c8ade
 If you are using HMAC\-based packet authentication (the default in any of
6fbf66fa
 OpenVPN's secure modes), having the firewall filter on source
 address can be considered optional, since HMAC packet authentication
 is a much more secure method of verifying the authenticity of
 a packet source.  In that case:
 .IP
2d321609
 .B iptables \-A INPUT \-p udp \-\-dport 1194 \-j ACCEPT
6fbf66fa
 .LP
 would be adequate and would not render the host inflexible with
 respect to its peer having a dynamic IP address.
 
 OpenVPN also works well on stateful firewalls.  In some cases, you may
 not need to add any static rules to the firewall list if you are
 using a stateful firewall that knows how to track UDP connections.
 If you specify
48fe8bb3
 .B \-\-ping n,
6fbf66fa
 OpenVPN will be guaranteed
 to send a packet to its peer at least once every
 .B n
 seconds.  If
 .B n
 is less than the stateful firewall connection timeout, you can
 maintain an OpenVPN connection indefinitely without explicit
 firewall rules.
 
 You should also add firewall rules to allow incoming IP traffic on
 TUN or TAP devices such as:
 .IP
2d321609
 .B iptables \-A INPUT \-i tun+ \-j ACCEPT
6fbf66fa
 .LP
 to allow input packets from tun devices,
 .IP
2d321609
 .B iptables \-A FORWARD \-i tun+ \-j ACCEPT
6fbf66fa
 .LP
 to allow input packets from tun devices to be forwarded to
 other hosts on the local network,
 .IP
2d321609
 .B iptables \-A INPUT \-i tap+ \-j ACCEPT
6fbf66fa
 .LP
 to allow input packets from tap devices, and
 .IP
2d321609
 .B iptables \-A FORWARD \-i tap+ \-j ACCEPT
6fbf66fa
 .LP
 to allow input packets from tap devices to be forwarded to
 other hosts on the local network.
 
 These rules are secure if you use packet authentication,
 since no incoming packets will arrive on a TUN or TAP
 virtual device
 unless they first pass an HMAC authentication test.
 .\"*********************************************************
 .SH FAQ
 .I http://openvpn.net/faq.html
 .\"*********************************************************
 .SH HOWTO
 For a more comprehensive guide to setting up OpenVPN
 in a production setting, see the OpenVPN HOWTO at
 .I http://openvpn.net/howto.html
 .\"*********************************************************
 .SH PROTOCOL
 For a description of OpenVPN's underlying protocol,
 see 
 .I http://openvpn.net/security.html
 .\"*********************************************************
 .SH WEB
 OpenVPN's web site is at
 .I http://openvpn.net/
 
 Go here to download the latest version of OpenVPN, subscribe
 to the mailing lists, read the mailing list
148329ca
 archives, or browse the SVN repository.
6fbf66fa
 .\"*********************************************************
 .SH BUGS
148329ca
 Report all bugs to the OpenVPN team <info@openvpn.net>.
6fbf66fa
 .\"*********************************************************
 .SH "SEE ALSO"
 .BR dhcpcd (8),
 .BR ifconfig (8),
 .BR openssl (1),
 .BR route (8),
 .BR scp (1)
 .BR ssh (1)
 .\"*********************************************************
 .SH NOTES 
 .LP
 This product includes software developed by the
 OpenSSL Project (
 .I http://www.openssl.org/
 )
 
 For more information on the TLS protocol, see
 .I http://www.ietf.org/rfc/rfc2246.txt
 
510c8ade
 For more information on the LZO real\-time compression library see
6fbf66fa
 .I http://www.oberhumer.com/opensource/lzo/
 .\"*********************************************************
 .SH COPYRIGHT
49979459
 Copyright (C) 2002\-2018 OpenVPN Inc This program is free software;
6fbf66fa
 you can redistribute it and/or modify
 it under the terms of the GNU General Public License version 2
 as published by the Free Software Foundation.
 .\"*********************************************************
 .SH AUTHORS
 James Yonan <jim@yonan.net>