Advanced Configuration Commands
Viscosity provides the ability to configure additional advanced connection settings using raw configuration commands. Adding and editing configuration commands should only be attempted by advanced users: incorrect use can break your connection, make it insecure, or cause performance problems. For the vast majority of connections it is not necessary to specify or edit configuration commands.
Specifying Advanced Configuration Commands
Viscosity allows commands to be specified in the configuration commands section, located under the Advanced tab when editing your connection in Viscosity. The screenshot below shows an example of an empty configuration commands area.
Each command should be specified on a new line in the commands area. A line should start with the desired command, followed by the paramaters (if any) separated by spaces. More information about the available commands can be found in the sections below. To remove a command simply delete the entire line it is on.
Advanced Viscosity Commands
Viscosity provides a number of additional commands that provide advanced features and options beyond what is available through the editor. When specifying a Viscosity command it must start with
#viscosity, which provides backwards compatibility with older clients.
Syntax: #viscosity proxy-automatic address
Specifies an automatic proxy configuration file to set on the VPN interface. If DNS mode is set to full this setting will be used by web browsers and other applications on the system. "address" must be a full http or https address to a PAC (Proxy Auto-Configuration) file. For example
#viscosity proxy-automatic http://example.com/proxy.pac.
Syntax: #viscosity proxy-http address port
Specifies a Web Proxy (HTTP) to set on the VPN interface. If DNS mode is set to full this setting will be used by web browsers and other applications on the system. "address" must be a DNS or IP address of the proxy host, and port number must be the port. For example
#viscosity proxy-http proxy.example.com 8080.
Syntax: #viscosity proxy-https address port
Specifies a Secure Web Proxy (HTTPS) to set on the VPN interface. If DNS mode is set to full this setting will be used by web browsers and other applications on the system. "address" must be a DNS or IP address of the proxy host, and port number must be the port. For example
#viscosity proxy-https proxy.example.com 8080.
Syntax: #viscosity proxy-socks address port
Specifies a SOCKS Proxy to set on the VPN interface. If DNS mode is set to full this setting will be used by web browsers and other applications on the system. "address" must be a DNS or IP address of the proxy host, and port number must be the port. For example
#viscosity proxy-socks proxy.example.com 1080.
Advanced OpenVPN Commands
OpenVPN configuration commands that can be specified can be found below. Please be aware that this list does not contain all possible OpenVPN commands: commands that are only valid when OpenVPN is being used in server-mode, as well as ignored commands, are not listed.
Syntax: askpass [file]
Get certificate password from console or 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 askpass 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 -nodes option when you use the openssl command line tool to manage certificates and private keys.
If file is specified, read the password from the first line of file. Keep in mind that storing your password in a file to a certain extent invalidates the extra security provided by using an encrypted key.
Syntax: auth alg
Authenticate data channel packets and (if enabled) tls-auth control channel packets with HMAC using message digest algorithm alg. (The default is 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.
The OpenVPN data channel protocol uses encrypt-then-mac (i.e. first encrypt a packet, then HMAC the resulting ciphertext), which prevents padding oracle attacks.
If an AEAD cipher mode (e.g. GCM) is chosen, the specified auth algorithm is ignored for the data channel, and the authentication method of the AEAD cipher is used instead. Note that alg still specifies the digest used for tls-auth\fR. In static-key encryption mode, the HMAC key is included in the key file generated by genkey. 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 alg=none to disable authentication.
For more information on HMAC see http://www.cs.ucsd.edu/users/mihir/papers/hmac.html
Syntax: 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 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 implement any auth-token support.
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.
When using --auth-nocache in combination with a user/password file and --chroot or --daemon, make sure to use an absolute path.
This directive does not affect the http-proxy username/password. It is always cached.
Syntax: auth-retry type
Controls how OpenVPN responds to username/password verification errors such as the client-side response to an AUTH_FAILED message from the server 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 auth-user-pass authentication, or if the server-side client-connect script returns an error status when the client tries to connect.
type can be one of:
none -- Client will exit with a fatal error (this is the default).
nointeract -- Client will retry the connection without requerying for an
auth-user-pass username/password. Use this option for unattended clients.
interact -- Client will requery for an auth-user-pass 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.
Syntax: auth-token token
This is not an option to be used directly in any configuration files, but rather push this option from a client-connect script or a 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 auth-user-pass-verify script or 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.
push "auth-token UNIQUE_TOKEN_VALUE"
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.
Syntax: auth-user-pass [up]
Authenticate with server using username/password. up is a file containing username/password on 2 lines. If the password line is missing, OpenVPN will prompt for one.
If up is omitted, username/password will be prompted from the console.
The server configuration must specify an auth-user-pass-verify script to verify the username/password provided by the client.
Syntax: bcast-buffers n
Allocate n buffers for broadcast datagrams (default=256).
Syntax: bind [ipv6only]
If the ipv6only keyword is present OpenVPN will bind only to IPv6 (as oposed to IPv6 and IPv4) when a IPv6 socket is opened.
Syntax: ca file
Certificate authority (CA) file in .pem format, also referred to as the 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:
openssl req -nodes -new -x509 -keyout ca.key -out ca.crt Then edit your openssl.cnf file and edit the certificate variable to point to your new root certificate ca.crt. For testing purposes only, the OpenVPN distribution includes a sample CA certificate (ca.crt). 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.
Syntax: capath dir
Directory containing trusted certificates (CAs and CRLs). Not available with PolarSSL.
When using the 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 -CApath option of openssl verify , and the -hash option of openssl x509 and openssl crl for more information.
Require, as a condition of authentication, that a connecting client has a client-config-dir file.
Syntax: cd dir
Change directory to dir prior to reading any files such as configuration files, key files, scripts, etc. 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 daemon mode, and you want to consolidate all of your OpenVPN control files in one location.
Syntax: cert file
Local peer's signed certificate in .pem format -- must be signed by a certificate authority whose certificate is in ca file. 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 ca 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:
openssl req -nodes -new -keyout mycert.key -out mycert.csr 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:
openssl ca -out mycert.crt -in mycert.csr 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 openssl ca command reads the location of the certificate authority key from its configuration file such as /usr/share/ssl/openssl.cnf -- note also that for certificate authority functions, you must set up the files index.txt (may be empty) and serial (initialize to ' 01 ).
Syntax: chroot dir
Chroot to dir after initialization. chroot essentially redefines 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 files will operate in a pre-chroot context.
In many cases, the dir parameter can point to an empty directory, however complications can result when scripts or restarts are executed after the chroot operation.
Note: The SSL library will probably need /dev/urandom to be available inside the chroot directory dir. 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.
Syntax: cipher alg
Encrypt data channel packets with cipher algorithm alg. The default is BF-CBC, an abbreviation for Blowfish in Cipher Block Chaining mode.
Using BF-CBC is no longer recommended, because of it's 64-bit block size. This small block size allows attacks based on collisions, as demonstrated by SWEET32. See https://community.openvpn.net/openvpn/wiki/SWEET32 for details.
To see other ciphers that are available with OpenVPN, use the show-ciphers option.
Set alg=none to disable encryption.
Syntax: client-cert-not-required (DEPRECATED)
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.
Please note: This option is now deprecated and will be removed in OpenVPN v2.5. It is replaced by verify-client-cert which allows for more flexibility. The option verify-client-cert none is functionally equivalent to client-cert-not-required .
Syntax: client-connect cmd
Run command cmd on client connection.
cmd consists of a path to script (or executable program), optionally followed by arguments. The path and arguments may be single- or double-quoted and/or escaped using a backslash, and should be separated by one or more spaces.
The command is passed the common name and IP address of the just-authenticated client as environmental variables (see environmental variable section below). The command is also passed the pathname of a freshly created temporary file as the last argument (after any arguments specified in cmd ), to be used by the command 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, it should write it to the file named by the last argument.
See the client-config-dir option below for options which can be legally used in a dynamically generated config file.
Note that the return value of script is significant. If script returns a non-zero error status, it will cause the client to be disconnected.
Syntax: client-disconnect cmd
Like client-connect but called on client instance shutdown. Will not be called unless the client-connect script and plugins (if defined) were previously called on this instance with successful (0) status returns.
The exception to this rule is if the client-disconnect command or plugins are cascaded, and at least one client-connect function succeeded, then ALL of the client-disconnect functions for scripts and plugins will be called on client instance object deletion, even in cases where some of the related client-connect functions returned an error status.
Syntax: client-nat snat|dnat network netmask alias
This pushable client option sets up a stateless one-to-one NAT 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.
network/netmask (for example 192.168.0.0/255.255.0.0) defines the local view of a resource from the client perspective, while alias/netmask (for example 10.64.0.0/255.255.0.0) defines the remote view from the server perspective.
Use snat (source NAT) for resources owned by the client and dnat (destination NAT) for remote resources.
Set verb 6 for debugging info showing the transformation of src/dest addresses in packets.
Syntax: comp-lzo [mode]
Use LZO compression -- may add up to 1 byte per packet for incompressible data. mode may be "yes", "no", or "adaptive" (default).
This option is deprecated in favor of the newer compress option.
In a server mode setup, it is possible to selectively turn compression on or off for individual clients.
First, make sure the client-side config file enables selective compression by having at least one comp-lzo directive, such as comp-lzo no. 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 client-config-dir file, specify the compression setting for the client, for example:
comp-lzo yes push "comp-lzo yes"
The first line sets the comp-lzo setting for the server side of the link, the second sets the client side.
When used in conjunction with comp-lzo, this option will disable OpenVPN's adaptive compression algorithm. Normally, adaptive compression is enabled with comp-lzo. Adaptive compression tries to optimize the case where you have compression enabled, but you are sending predominantly incompressible (or pre-compressed) packets over the tunnel, such as an FTP or rsync transfer 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 compression for a period of time until the next re-sample test.
Syntax: compat-names [no-remapping] (DEPRECATED)
Until OpenVPN v2.3 the format of the X.509 Subject fields was formatted like this: .IP /C=US/L=Somewhere/CN=John Doe/[email protected] .IP In addition the old behaviour was to remap any character other than alphanumeric, underscore ('_'), dash ('-'), dot ('.'), and slash ('/') to underscore ('_'). The X.509 Subject string as returned by the tls_id environmental variable, could additionally contain colon (':') or equal ('='). .IP When using the compat-names 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. .IP In OpenVPN v2.3 the formatting of these fields changed into a more standardised format. It now looks like: .IP C=US, L=Somewhere, CN=John Doe, [email protected] .IP The new default format in OpenVPN v2.3 also does not do the character remapping 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.
The no-remapping mode flag can be used with the compat-names 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, Subject, and username strings are allowed to include any printable character including space, but excluding control characters such as tab, newline, and carriage-return. no-remapping is only available on the server side.
Please note: This option is immediately deprecated. It is only implemented to make the transition to the new formatting less intrusive. It will be removed in OpenVPN v2.5. So please update your scripts/plug-ins where necessary.
Syntax: compress [algorithm]
Enable a compression algorithm.
The algorithm 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. For backwards compatibility with OpenVPN versions before 2.4, use "lzo" (which is identical to the older option "--comp-lzo yes").
If the 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.
Syntax: connect-freq n sec
Allow a maximum of n new connections per 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.
Syntax: connect-retry n [max]
Wait n 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 max specifies the maximum value of wait time in seconds at which it gets capped (default=300).
Syntax: connect-retry-max n
n specifies the number of times each remote or <connection> entry is tried. Specifying n as one would try each entry exactly once. A successful connection resets the counter. (default=unlimited).
Syntax: crl-verify crl ['dir']
Check peer certificate against the file 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.
If the optional dir flag is specified, enable a different mode where 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.
Note: As the crl file (or directory) is read every time a peer connects, if you are dropping root privileges with user, make sure that this user has sufficient privileges to read the file.
Syntax: cryptoapicert select-string
Load the certificate and private key from the Windows Certificate System Store (Windows/OpenSSL Only).
Use this option instead of cert and key. 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:
cryptoapicert "SUBJ:Peter Runestig"
To select a certificate, based on certificate's thumbprint:
cryptoapicert "THUMB:f6 49 24 41 01 b4 ..."
The thumbprint hex string can easily be copy-and-pasted from the Windows Certificate Store GUI.
Syntax: dhcp-option type [parm]
Set extended TAP-Win32 TCP/IP properties, must be used with ip-win32 dynamic or ip-win32 adaptive. This option can be used to set additional TCP/IP properties on the TAP-Win32 adapter, and is particularly useful for configuring an OpenVPN client to access a Samba server across the VPN.
DOMAIN name -- Set Connection-specific DNS Suffix.
DNS addr -- Set primary domain name server IPv4 address. Repeat this option to set secondary DNS server addresses.
DNS6 addr -- Set primary domain name server IPv6 address. Repeat this option to set secondary DNS server IPv6 addresses.
Note: currently this is handled 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 up script could act upon it if needed.
WINS addr -- Set primary WINS server address (NetBIOS over TCP/IP Name Server). Repeat this option to set secondary WINS server addresses.
NBDD addr -- Set primary NBDD server address (NetBIOS over TCP/IP Datagram Distribution Server) Repeat this option to set secondary NBDD server addresses.
NTP addr -- Set primary NTP server address (Network Time Protocol). Repeat this option to set secondary NTP server addresses.
NBT type -- Set NetBIOS over TCP/IP Node type. Possible options: 1 = b-node (broadcasts), 2 = p-node (point-to-point name queries to a WINS server), 4 = m-node (broadcast then query name server), and 8 = h-node (query name server, then broadcast).
NBS scope-id -- 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 [email protected])
DISABLE-NBT -- Disable Netbios-over-TCP/IP.
Ask Windows to release the TAP adapter lease on shutdown. This option has no effect now, as it is enabled by default starting with version 2.4.1.
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 comes up, however if you set the TAP-Win32 adapter Media Status property to "Always Connected", you may need this flag.
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 dev tun while the other peer uses dev tap. 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.
Syntax: down cmd
Run command cmd after TUN/TAP device close (post user UID change and/or chroot ). cmd consists of a path to script (or executable program), optionally followed by arguments. The path and arguments may be single- or double-quoted and/or escaped using a backslash, and should be separated by one or more spaces.
Called with the same parameters and environmental variables as the up option above.
Call down cmd/script before, rather than after, TUN/TAP close.
Syntax: ecdh-curve name
Specify the curve to use for elliptic curve Diffie Hellman. Available curves can be listed with show-curves . The specified curve will only be used for ECDH TLS-ciphers.
This option is not supported in mbed TLS builds of OpenVPN.
Syntax: echo [parms...]
Echo parms to log output.
Designed to be used to send messages to a controlling application which is receiving the OpenVPN log output.
Syntax: engine [engine-name]
Enable OpenSSL hardware-based crypto engine functionality.
If engine-name is specified, use a specific crypto engine. Use the show-engines standalone option to list the crypto engines which are supported by OpenSSL.
Syntax: explicit-exit-notify [n]
In UDP client mode or point-to-point mode, send server/peer an exit notification 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 n parameter (default=1) controls the maximum number of attempts that the client will try to resend the exit notification message.
In UDP server mode, send RESTART control channel command to connected clients. The n parameter (default=1) controls client behavior. With n = 1 client will attempt to reconnect to the same server, with n = 2 client will advance to the next server.
OpenVPN will not send any exit notifications unless this option is enabled.
Syntax: extra-certs file
Specify a 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 certificate chain without trusting them to verify the peer-submitted certificate, as would be the case if the certs were placed in the ca file.
(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%.
Allow remote peer to change its IP address and/or port number, such as due to DHCP (this is the default if remote is not used). float when specified with remote 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 such as a dial-in user or DHCP client.
Syntax: fragment max
Enable internal datagram fragmentation so that no UDP datagrams are sent which are larger than max bytes.
The max parameter is interpreted in the same way as the link-mtu parameter, i.e. the UDP packet size after encapsulation overhead has been added in, but not including the UDP header itself.
fragment adds 4 bytes of overhead per datagram.
See the mssfix option below for an important related option to fragment. 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.
Syntax: hand-window n
Handshake Window -- the TLS-based key exchange must finalize within 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 tran-window seconds to maintain continuity of transmission of tunnel data.
Syntax: hash-size r v
Set the size of the real address hash table to r and the virtual address table to v. By default, both tables are sized at 256 buckets.
Syntax: http-proxy server port [authfile|'auto'|'auto-nct'] [auth-method]
Connect to remote host through an HTTP proxy at address server and port port. If HTTP Proxy-Authenticate is required, authfile is a file containing a username and password on 2 lines, or "stdin" to prompt from console. Its content can also be specified in the config file with the http-proxy-user-pass option. (See section on inline files)
auth-method should be one of "none", "basic", or "ntlm".
HTTP Digest authentication is supported as well, but only via the auto or auto-nct flags (below).
The auto flag causes OpenVPN to automatically determine the auth-method and query stdin or the management interface for username/password credentials, if required. This flag exists on OpenVPN 2.1 or higher.
The auto-nct flag (no clear-text auth) instructs OpenVPN to automatically determine the authentication method, but to reject weak authentication protocols such as HTTP Basic Authentication.
Syntax: http-proxy-option type [parm]
Set extended HTTP proxy options. Repeat to set multiple options.
VERSION version -- Set HTTP version number to version (default=1.0).
AGENT user-agent -- Set HTTP "User-Agent" string to user-agent. CUSTOM-HEADER name content -- Adds the custom Header with name as name and content as the content of the custom HTTP header.
Syntax: ifconfig l rn
Set TUN/TAP adapter parameters. l is the IP address of the local VPN endpoint. For TUN devices in point-to-point mode, rn is the IP address of the remote VPN endpoint. For TAP devices, or TUN devices used with topology subnet, rn is the subnet mask of the virtual network segment which is being created or connected to.
For TUN devices, which facilitate virtual point-to-point IP connections (when used in topology net30 or p2p mode), the proper usage of ifconfig 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 rn, you will be pinging across the VPN.
For TAP devices, which provide the ability to create virtual ethernet segments, or TUN devices in topology subnet mode (which create virtual "multipoint networks"), ifconfig 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 ifconfig (8) command, is designed to simplify TUN/TAP tunnel configuration by providing a standard interface to the different ifconfig implementations on different platforms.
ifconfig parameters which are IP addresses can also be specified as a DNS or /etc/hosts file resolvable name.
For TAP devices, ifconfig should not be used if the TAP interface will be getting an IP address lease from a DHCP server.
Syntax: ifconfig-ipv6 ipv6addr/bits ipv6remote
configure IPv6 address ipv6addr/bits on the ``tun device. The second parameter is used as route target for route-ipv6 if no gateway is specified.
Syntax: ifconfig-ipv6-push ipv6addr/bits ipv6remote
Don't actually execute ifconfig/netsh commands, instead pass ifconfig parameters to scripts using environmental variables.
Don't output an options consistency check warning if the ifconfig 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 disable-occ option) while only disabling the ifconfig component of the check.
This option will also silence warnings about potential address conflicts which occasionally annoy more experienced users by triggering "false positive" warnings.
Syntax: ifconfig-push local remote-netmask [alias]
Push virtual IP endpoints for client tunnel, overriding the --ifconfig-pool dynamic allocation.
The parameters local and remote-netmask are set according to the ifconfig directive which you want to execute on the client machine to configure the remote end of the tunnel. Note that the parameters local and remote-netmask 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.
The optional 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 local/remote-netmask will refer to the server view while alias/remote-netmask will refer to the client view.
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 client-config-dir or dynamically generated using a client-connect script.
Remember also to include a route directive in the main OpenVPN config file which encloses 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:
1 -- Use
client-connect script generated file for static IP (first choice).
2 -- Use
client-config-dir file for static IP (next choice).
3 -- Use
ifconfig-pool allocation for dynamic IP (last choice).
Syntax: ignore-unknown-option opt1 opt2 opt3 ... optN
When one of options 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 ignore-unknown-option 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.
ignore-unknown-option is available since OpenVPN 2.3.3.
Syntax: inactive n [bytes]
Causes OpenVPN to exit after n seconds of inactivity on the TUN/TAP device. The time length of inactivity is measured since the last incoming or outgoing tunnel packet. The default value is 0 seconds, which disables this feature.
If the optional bytes parameter is included, exit if less than bytes of combined in/out traffic are produced on the tun/tap device in 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.
Syntax: ip-win32 method
When using ifconfig on Windows, set the TAP-Win32 adapter IP address and netmask using method. Don't use this option unless you are also using ifconfig. manual -- 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.
dynamic [offset] [lease-time] -- Automatically set the IP address and netmask by replying to DHCP query messages generated by the kernel. This mode is probably the "cleanest" solution for setting the TCP/IP properties since it uses the well-known DHCP protocol. There are, however, two prerequisites for using this mode: (1) The TCP/IP properties for the TAP-Win32 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 dev tap 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 dev tun mode, OpenVPN will cause the DHCP server to masquerade as if it were coming from the remote endpoint. The optional offset parameter is an integer which is > -256 and < 256 and which defaults to -1. 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 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 lease-time parameter controls the lease time of the DHCP assignment given to the TAP-Win32 adapter, and is denoted in seconds. Normally a very long lease time is preferred because it prevents routes involving the TAP-Win32 adapter from being lost when the system goes to sleep. The default lease time is one year.
netsh -- Automatically set the IP address and netmask using the Windows command-line "netsh" command. This method appears to work correctly on Windows XP but not Windows 2000.
ipapi -- 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, it is best to leave the TCP/IP properties for the TAP-Win32 adapter in their default state, i.e. "Obtain an IP address automatically."
adaptive -- (Default) Try dynamic method initially and fail over to netsh if the DHCP negotiation with the TAP-Win32 adapter does not succeed in 20 seconds. Such failures have been known to occur when certain third-party firewall packages installed on the client machine block the DHCP negotiation used by the TAP-Win32 adapter. Note that if the netsh failover occurs, the TAP-Win32 adapter TCP/IP properties will be reset from DHCP to static, and this will cause future OpenVPN startups using the adaptive mode to use netsh immediately, rather than trying dynamic first. To "unstick" the adaptive mode from using netsh, run OpenVPN at least once using the dynamic mode to restore the TAP-Win32 adapter TCP/IP properties to a DHCP configuration.
Syntax: ipchange cmd
Run command cmd when our remote ip-address is initially authenticated or changes.
cmd consists of a path to script (or executable program), optionally followed by arguments. The path and arguments may be single- or double-quoted and/or escaped using a backslash, and should be separated by one or more spaces.
When cmd is executed two arguments are appended after any arguments specified in cmd , as follows:
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 /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 our IP address changes due to DHCP, we should configure our IP address change script (see man page for dhcpcd (8) ) to deliver a SIGHUP or SIGUSR1 signal to OpenVPN. OpenVPN will then reestablish a connection with its most recently authenticated peer on its new IP address.
Syntax: iproute cmd
Set alternate command to execute instead of default iproute2 command. May be used in order to execute OpenVPN in unprivileged environment.
Syntax: iroute network [netmask]
Generate an internal route to a specific client. The 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 route directive). The reason why two routes are needed is that the route directive routes the packet from the kernel to OpenVPN. Once in OpenVPN, the iroute directive routes to the specific client.
The iroute directive also has an important interaction with push "route ...". iroute 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 push "route ..." together with client-to-client 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.
Syntax: keepalive interval timeout
A helper directive designed to simplify the expression of ping and ping-restart. This option can be used on both client and server side, but it is in enough to add this on the server side as it will push appropriate ping and ping-restart options to the client. If used on both server and client, the values pushed from server will override the client local values.
The 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.
For example, keepalive 10 60 expands as follows:
if mode server: ping 10 # Argument: interval ping-restart 120 # Argument: timeout*2 push "ping 10" # Argument: interval push "ping-restart 60" # Argument: timeout else ping 10 # Argument: interval ping-restart 60 # Argument: timeout
Syntax: key file
Local peer's private key in .pem format. Use the private key which was generated when you built your peer's certificate (see cert file above).
Syntax: key-method m
Use data channel key negotiation method 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 random encrypt and HMAC-send keys which are forwarded to the other host over the TLS channel. Method 1 is deprecated in OpenVPN 2.4 , and will be removed in OpenVPN 2.5\fR. 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 key-method 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, key-method determines the derivation of the tunnel session keys.
Syntax: keying-material-exporter label len
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".
This option requires OpenSSL 1.0.1 or newer.
Syntax: keysize n
Size of cipher key in bits (optional). If unspecified, defaults to cipher-specific default. The show-ciphers 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 cryptanalyzed with non-standard key lengths, and a larger key may offer no real guarantee of greater security, or may even reduce security.
Syntax: learn-address cmd
Run command cmd to validate client virtual addresses or routes.
cmd consists of a path to script (or executable program), optionally followed by arguments. The path and arguments may be single- or double-quoted and/or escaped using a backslash, and should be separated by one or more spaces.
Three arguments will be appended to any arguments in cmd as follows:
 operation -- "add", "update", or "delete" based on whether or not
the address is being added to, modified, or deleted from
OpenVPN's internal routing table.
 address -- The address being learned or unlearned. This can be
an IPv4 address such as "188.8.131.52", an IPv4 subnet
such as "184.108.40.206/24", or an ethernet MAC address (when
dev tap is being used) such as "00:FF:01:02:03:04".
 common name -- 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 a failure code (non-zero), OpenVPN will reject the address and will not modify its internal routing table.
Normally, the 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, it allows a user-defined script to configure firewall access policies with regard to the client's high-level common name, rather than the low level client virtual addresses.
Syntax: link-mtu n
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.
Syntax: local host
Local host name or IP address for bind. If specified, OpenVPN will bind to this address only. If unspecified, OpenVPN will bind to all interfaces.
Syntax: lport port
Set local TCP/UDP port number or name. Cannot be used together with nobind option.
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.
Syntax: management-external-cert certificate-hint
Allows usage for external certificate instead of cert option (client-only). certificate-hint is an arbitrary string which is passed to a management interface client as an argument of NEED-CERTIFICATE notification. Requires --management-external-key.
Allows usage for external private key file instead of key option (client-only).
Syntax: 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.
Syntax: max-routes-per-client n
Allow a maximum of 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 client-config-dir file or auto-generated by a client-connect 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.
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 user 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 reneg options (see below), then are discarded.
The downside of using mlock is that it will reduce the amount of physical memory available to other applications.
Syntax: mssfix max
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 max bytes. The default value is 1450. The max parameter is interpreted in the same way as the link-mtu parameter, i.e. the UDP packet size after encapsulation overhead has been added in, but not including 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.
The mssfix option only makes sense when you are using the UDP protocol for OpenVPN peer-to-peer communication, i.e. proto udp. mssfix and fragment can be ideally used together, where mssfix 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), fragment will internally fragment them.
The usual symptom of such a breakdown is an OpenVPN connection which successfully starts, but then stalls during active usage.
Therefore, one could lower the maximum UDP packet size to 1300 (a good first try for solving MTU-related connection problems) with the following options:
Syntax: mtu-disc type
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.
'no' -- Never send DF (Don't Fragment) frames
'maybe' -- Use per-route hints
'yes' -- Always DF (Don't Fragment)
To empirically measure MTU on connection startup, add the mtu-test 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 mtu-test process normally takes about 3 minutes to complete.
Syntax: mute n
Log at most n consecutive messages in the same category. This is useful to limit repetitive logging of similar message types.
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.
Syntax: ncp-ciphers cipher_list
Restrict the allowed ciphers to be negotiated to the ciphers in cipher_list\fR. cipher_list is a colon-separated list of ciphers, and defaults to "AES-256-GCM:AES-128-GCM".
For servers, the first cipher from cipher_list will be pushed to clients that support cipher negotiation.
Cipher negotiation is enabled in client-server mode only. I.e. if mode is set to 'server' (server-side, implied by setting server ), or if pull is specified (client-side, implied by setting --client).
If both peers support and do not disable NCP, the negotiated cipher will override the cipher specified by --cipher\fR. 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 cipher setting, but the peer cipher is one of the ciphers specified in --ncp-ciphers\fR. E.g. a non-NCP client (<=2.3, or with --ncp-disabled set) connecting to a NCP server (2.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.
Disable "negotiable crypto parameters". This completely disables cipher negotiation.
Syntax: nice n
Change process priority after initialization ( n greater than 0 is lower priority, n less than zero is higher priority).
DEPRECATED This option will be removed in OpenVPN 2.5.
(Advanced) Disable OpenVPN's use of IV (cipher initialization vector). 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.
In CBC mode, OpenVPN uses a pseudo-random IV for each packet.
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 space-saving optimization that uses the unique identifier for datagram replay protection as the IV.
Syntax: no-name-remapping (DEPRECATED)
Please note: This option is now deprecated. It will be removed in OpenVPN v2.5. So please make sure you support the new X.509 name formatting described with the compat-names option as soon as possible.
(Advanced) Disable OpenVPN's protection against replay attacks. 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 sliding window algorithm used by IPSec.
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 remote option.
Syntax: ns-cert-type client|server (DEPRECATED)
This option is deprecated. Use the more modern equivalent remote-cert-tls instead. This option will be removed in OpenVPN 2.5.
Require that peer certificate was signed with an explicit 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.
See the easy-rsa/build-key-server script for an example of how to generate a certificate with the nsCertType field set to "server".
If the server certificate's nsCertType field is set to "server", then the clients can verify this with ns-cert-type server. This is an important security precaution to protect against a man-in-the-middle attack where an authorized client 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 ns-cert-type, --verify-x509-name, or tls-verify.
Clients that connect with options that are incompatible with those of the server will be disconnected.
Options that will be compared for compatibility include dev-type, link-mtu, tun-mtu, proto, ifconfig, comp-lzo, fragment, keydir, cipher, auth, keysize, secret, no-replay, no-iv, tls-auth, key-method, tls-server, and tls-client.
This option requires that disable-occ NOT be used.
Set the TOS field of the tunnel packet to what the payload's TOS is.
Don't re-read key files across SIGUSR1 or ping-restart. This option can be combined with user nobody to allow restarts triggered by the SIGUSR1 signal. Normally if you drop root privileges in OpenVPN, the daemon cannot be restarted since it will now be unable to re-read protected key files.
This option solves the problem by persisting keys across SIGUSR1 resets, so they don't need to be re-read.
Preserve initially resolved local IP address and port number across SIGUSR1 or ping-restart restarts.
Preserve most recently authenticated remote IP address and port number across SIGUSR1 or ping-restart restarts.
Don't close and reopen TUN/TAP device or run up/down scripts across SIGUSR1 or ping-restart restarts.
SIGUSR1 is a restart signal similar to SIGHUP, but which offers finer-grained control over reset options.
Syntax: ping n
Ping remote over the TCP/UDP control channel if no packets have been sent for at least n seconds (specify ping 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 secret, --tls-server, or tls-client 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 ping-exit option.
Syntax: ping-exit n
Causes OpenVPN to exit after n seconds pass without reception of a ping or other packet from remote. This option can be combined with inactive, --ping, and ping-exit to create a two-tiered inactivity disconnect.
openvpn [options...] --inactive 3600 --ping 10 --ping-exit 60 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.
Syntax: ping-restart n
Similar to ping-exit, but trigger a SIGUSR1 restart after 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 a low-TTL DNS name is used to track the IP address using a service such as http://dyndns.org/ + a dynamic DNS client such as ddclient. If the peer cannot be reached, a restart will be triggered, causing the hostname used with remote to be re-resolved (if resolv-retry is also specified).
In server mode, ping-restart, --inactive, 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 ping-restart 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 keepalive setting in the server configuration. To disable the 120 second default, set ping-restart 0 on the client.
Run the ping-exit / ping-restart 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 remote peer), and you don't want to start clocking timeouts until a remote peer connects.
Syntax: pkcs11-cert-private [0|1]...
Set if access to certificate object should be performed after login. Every provider has its own setting.
Syntax: pkcs11-id name
Specify the serialized certificate id to be used. The id can be gotten by the standalone show-pkcs11-ids option.
Syntax: pkcs11-pin-cache seconds
Specify how many seconds the PIN can be cached, the default is until the token is removed.
Syntax: pkcs11-private-mode mode...
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:
0 (default) -- Try to determine automatically.
1 -- Use sign.
2 -- Use sign recover.
4 -- Use decrypt.
8 -- Use unwrap.
Syntax: pkcs11-protected-authentication [0|1]...
Use PKCS#11 protected authentication path, useful for biometric and external keypad devices. Every provider has its own setting.
Syntax: pkcs11-providers provider...
Specify a RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki) providers to load. This option can be used instead of cert, --key, and pkcs12. If p11-kit is present on the system, its p11-kit-proxy.so module will be loaded by default if either the pkcs11-id or pkcs11-id-management options are specified without pkcs11-provider being given.
Syntax: pkcs12 file
Syntax: plugin module-pathname [init-string]
Load plug-in module from the file module-pathname, passing init-string as an argument to the module initialization function. Multiple plugin modules may be loaded into one OpenVPN process.
The module-pathname argument can be just a filename or a filename with a relative or absolute path. The format of the filename and path defines if the plug-in will be loaded from a default plug-in directory or outside this directory.
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
DEFAULT_DIR is replaced by the default plug-in directory, 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 cd option before the plugin option.
For more information and examples on how to build OpenVPN plug-in modules, see the README file in the 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 doc and the actual plugin modules are in 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 function (such as tls-verify, auth-user-pass-verify, or client-connect), then every module and script must return success (0) in order for the connection to be authenticated.
Syntax: port port
TCP/UDP port number or port name for both local and remote (sets both lport and rport options to given port). The current default of 1194 represents the official IANA port number assignment for OpenVPN and has been used since version 2.0-beta17. Previous versions used port 5000 as the default.
Syntax: prng alg [nsl]
(Advanced) For PRNG (Pseudo-random number generator), use digest algorithm alg (default=sha1), and set nsl (default=16) to the size in bytes of the nonce secret length (between 16 and 64).
Set alg=none to disable the PRNG and use the OpenSSL RAND_bytes function instead for all of OpenVPN's pseudo-random number needs.
Syntax: proto p
Use protocol p for communicating with remote host. p can be udp, tcp-client, or tcp-server. The default protocol is udp when proto is not specified.
For UDP operation, proto udp should be specified on both peers.
For TCP operation, one peer must use proto tcp-server and the other must use proto tcp-client. A peer started with tcp-server will wait indefinitely for an incoming connection. A peer started with tcp-client will attempt to connect, and if that fails, will sleep for 5 seconds (adjustable via the connect-retry option) and try again infinite or up to N retries (adjustable via the connect-retry-max option). Both TCP client and server will simulate 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:
There are certain cases, however, where using TCP may be advantageous from 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.
Syntax: proto-force p
When iterating through connection profiles, only consider profiles using protocol p ('tcp'|'udp').
This option must be used on a client which is connecting to a multi-client server. It indicates to OpenVPN that it should accept options pushed by the server, provided they are part of the legal set of pushable options (note that the pull option is implied by client ).
In particular, pull allows the server to push routes to the client, so you should not use pull or client in situations where you don't trust the server to have control over the client's routing table.
Syntax: 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 accept allows the option, ignore removes it and 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
--pull-filter ignore "route"
would remove all pushed options starting with route which would include, for example, route-gateway. Enclose \fItext\fR in quotes to embed spaces.
--pull-filter accept "route 192.168.1." --pull-filter ignore "route "
would remove all routes that do not start with 192.168.1.
This option may be used only on clients. Note that 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 ignore.
Syntax: push "option"
Push a config file option back to the client for remote execution. Note that option must be enclosed in double quotes (""). The client must specify pull 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: route, --route-gateway, --route-delay, --redirect-gateway, ip-win32, --dhcp-option, inactive, --ping, --ping-exit, --ping-restart, setenv, auth-token, persist-key, --persist-tun, --echo, comp-lzo, socket-flags, sndbuf, --rcvbuf
Push additional information about the client to server. The following data is always pushed to the server:
IV_VER=<version> -- the client OpenVPN version
IV_PLAT=[linux|solaris|openbsd|mac|netbsd|freebsd|win] -- the client OS platform
IV_LZO_STUB=1 -- if client was built with LZO stub capability
IV_LZ4=1 -- if the client supports LZ4 compressions.
IV_PROTO=2 -- if the client supports peer-id floating mechansim
IV_NCP=2 -- negotiable ciphers, client supports cipher pushed by the server, a value of 2 or greater indicates client supports AES-GCM-128 and AES-GCM-256.
IV_UI_VER=<gui_id> <version> -- the UI version of a UI if one is running, for example "de.blinkt.openvpn 0.5.47" for the Android app.
When push-peer-info is enabled the additional information consists of the following data:
IV_HWADDR=<mac address> -- the MAC address of clients default gateway
IV_SSL=<version string> -- the ssl version used by the client, e.g. "OpenSSL 1.0.2f 28 Jan 2016".
IV_PLAT_VER=x.y - the version of the operating system, e.g. 6.1 for Windows 7.
UV_<name>=<value> -- client environment variables whose names start with "UV_"
Syntax: push-remove opt
selectively remove all push options matching "opt" from the option list for a client. "opt" is matched as a substring against the whole option string to-be-pushed to the client, so push-remove route would remove all push route ... and push route-ipv6 ... statements, while ' would only remove IPv6 routes for 2001:... networks.
Don't inherit the global push list for a specific client instance. Specify this option in a client-specific context such as with a client-config-dir configuration file. This option will ignore push options at the global config file level.
Syntax: rcvbuf size
Set the TCP/UDP socket receive buffer size. Defaults to operation system default.
Syntax: redirect-gateway flags...
Automatically execute routing commands to cause all outgoing IP traffic to be redirected over the VPN. This is a client-side option.
This option performs three steps:
(1) Create a static route for the remote address which forwards to the pre-existing default gateway. This is done so that (3) will not create a routing loop.
(2) Delete the default gateway route.
When the tunnel is torn down, all of the above steps are reversed so that the original default route is restored.
local -- Add the local flag if both OpenVPN servers are directly connected via a common subnet, such as with wireless. The local flag will cause step 1 above to be omitted.
autolocal -- Try to automatically determine whether to enable local flag above.
def1 -- Use this flag to override the default gateway by using 0.0.0.0/1 and 220.127.116.11/1 rather than 0.0.0.0/0. This has the benefit of overriding but not wiping out the original default gateway.
bypass-dhcp -- Add a direct route to the DHCP server (if it is non-local) which bypasses the tunnel (Available on Windows clients, may not be available on non-Windows clients).
bypass-dns -- Add a direct route to the DNS server(s) (if they are non-local) which bypasses the tunnel (Available on Windows clients, may not be available on non-Windows clients).
block-local -- 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.
ipv6 -- Redirect IPv6 routing into the tunnel. This works similar to the def1 flag, that is, more specific IPv6 routes are added (2000::/4, 3000::/4), covering the whole IPv6 unicast space.
!ipv4 -- Do not redirect IPv4 traffic - typically used in the flag pair "ipv6 !ipv4" to redirect IPv6-only.
Syntax: redirect-private [flags]
Like --redirect-gateway, but omit actually changing the default gateway. Useful when pushing private subnets.
Run ipconfig /flushdns and ipconfig /registerdns on connection initiation. This is known to kick Windows into recognizing pushed DNS servers.
Syntax: remap-usr1 signal
Control whether internally or externally generated SIGUSR1 signals are remapped to SIGHUP (restart without persisting state) or SIGTERM (exit).
signal can be set to "SIGHUP" or "SIGTERM". By default, no remapping occurs.
Syntax: remote host [port] [proto]
Remote host name or IP address. On the client, multiple remote options may be specified for redundancy, each referring to a different OpenVPN server. Specifying multiple remote options for this purpose is a special case of the more general connection-profile feature. See the <connection> documentation below.
The OpenVPN client will try to connect to a server at host:port in the order specified by the list of remote options.
proto indicates the protocol to use when connecting with the remote, and may be "tcp" or "udp".
For forcing IPv4 or IPv6 connection suffix tcp or udp with 4/6 like udp4/udp6/tcp4/tcp6.
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.
Note the following corner case: If you use multiple remote options, AND you are dropping root privileges on the client with user and/or group, AND the client is running a non-Windows OS, if the client needs 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.
If remote 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, remote will act as a filter, rejecting connections from any host which does not match host. If host is a DNS name which resolves to multiple IP addresses, 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.
Syntax: remote-cert-eku oid
Require that peer certificate was signed with an explicit extended key usage. This is a useful security option for clients, to ensure that the host they connect to is a designated server.
The extended key usage should be encoded in oid notation, or OpenSSL symbolic representation.
Syntax: remote-cert-ku [v...]
Require that peer certificate was signed with an explicit key usage. 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).
If the list v... is also supplied, the keyUsage field must have at least the same bits set as the bits in one of the values supplied in the list v... The key usage values in the list must be encoded in hex, e.g. "--remote-cert-ku a0"
Syntax: remote-cert-tls client|server
Require that peer certificate was signed with an explicit key usage and extended key usage based on RFC3280 TLS rules.
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.
The remote-cert-tls client option is equivalent to remote-cert-ku --remote-cert-eku "TLS Web Client Authentication" The remote-cert-tls server option is equivalent to remote-cert-ku --remote-cert-eku "TLS Web Server Authentication" This is an important security precaution to protect against a man-in-the-middle attack where an authorized client 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 remote-cert-tls, --verify-x509-name, or tls-verify.
When multiple remote address/ports are specified, or if connection profiles are being used, initially randomize the order of the list as a kind of basic load-balancing measure.
Prepend a random string (6 bytes, 12 hex characters) to hostname to prevent DNS caching. For example, "foo.bar.gov" would be modified to "<random-chars>.foo.bar.gov".
Syntax: reneg-bytes n
Renegotiate data channel key after n bytes sent or received (disabled by default with an exception, see below). OpenVPN allows the lifetime of a key 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 if any of these three criteria are met by either peer.
If using ciphers with cipher block sizes less than 128-bits, --reneg-bytes is set to 64MB by default, unless it is explicitly disabled by setting the value to 0, but this is HIGHLY DISCOURAGED as this is designed to add some protection against the SWEET32 attack vector. For more information see the --cipher option.
Syntax: reneg-pkts n
Renegotiate data channel key after n packets sent and received (disabled by default).
Syntax: reneg-sec n
Renegotiate data channel key after n seconds (default=3600).
When using dual-factor authentication, note that this default value may 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 reneg-sec 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 still occur once per 3600 seconds. The solution is to increase --reneg-sec on both the 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.
Syntax: replay-persist file
Persist replay-protection state across sessions using 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 --inetd) 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.
Syntax: replay-window n [t]
Use a replay protection sliding-window of size n and a time window of t seconds.
By default n is 64 (the IPSec default) and t is 15 seconds.
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, it will accept an out-of-order packet sequence, and will deliver such packets in the same order they were received to the TCP/IP protocol stack, provided they satisfy several constraints.
(a) The packet cannot be a replay (unless no-replay is specified, which disables replay protection altogether).
(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 n. (c) If a packet arrives out of order, it will only be accepted if it arrives no later than 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 n. Satellite links in particular often require this.
If you run OpenVPN at verb 4, you will see the message "Replay-window backtrack occurred [x]" every time the maximum sequence number backtrack seen thus far increases. This can be used to calibrate 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 tunneling non-IP or UDP application protocols which might be vulnerable to a message deletion or reordering attack which falls within the normal operational parameters of IP networks.
So I would make the statement that one should never tunnel a non-IP protocol 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.
Syntax: resolv-retry n
If hostname resolve fails for remote, retry resolve for n seconds before failing.
Set n to "infinite" to retry indefinitely.
By default, resolv-retry infinite is enabled. You can disable by setting n=0.
Syntax: route network/IP [netmask] [gateway] [metric]
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 route (8) shell command, while at the same time providing portable semantics across OpenVPN's platform space.
netmask default -- 255.255.255.255
metric default -- taken from route-metric otherwise 0.
The default can be specified by leaving an option blank or setting it to "default".
The network and gateway parameters can also be specified as a DNS or /etc/hosts file resolvable name, or as one of three special keywords:
net_gateway -- The pre-existing IP default gateway, read from the routing table (not supported on all OSes).
remote_host -- The remote address if OpenVPN is being run in client mode, and is undefined in server mode.
Syntax: route-delay [n] [w]
Delay n seconds (default=0) after connection establishment, before adding routes. If n is 0, routes will be added immediately upon connection establishment. If route-delay is omitted, routes will be added immediately after TUN/TAP device open and up script execution, before any user or group privilege downgrade (or chroot 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, route-delay tries to be more intelligent by waiting w seconds (w=30 by default) for the TAP-Win32 adapter to come up before adding routes.
Syntax: route-gateway gw|'dhcp'
Specify a default gateway gw for use with route. If dhcp is specified as the parameter, the gateway address will be extracted from a DHCP negotiation with the OpenVPN server-side LAN.
Syntax: route-method m
Which method m to use for adding routes on Windows?
adaptive (default) -- Try IP helper API first. If that fails, fall
back to the route.exe shell command.
ipapi -- Use IP helper API.
exe -- Call the route.exe shell command.
Syntax: route-metric m
Specify a default metric m for use with route.
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.
Syntax: route-pre-down cmd
Run command cmd before routes are removed upon disconnection.
See the "Environmental Variables" section below for additional parameters passed as environmental variables.
Syntax: route-up cmd
Run command cmd after routes are added, subject to route-delay. cmd consists of a path to script (or executable program), optionally followed by arguments. The path and arguments may be single- or double-quoted 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.
Syntax: rport port
Syntax: script-security level
This directive offers policy-level control over OpenVPN's usage of external programs
and scripts. Lower
level values are more restrictive, higher values are more permissive. Settings for
0 -- Strictly no calling of external programs.
1 -- (Default) Only call built-in executables such as ifconfig, ip, route, or netsh.
2 -- Allow calling of built-in executables and user-defined scripts.
3 -- Allow passwords to be passed to scripts via environmental variables (potentially unsafe).
OpenVPN releases before v2.3 also supported a method flag which indicated how OpenVPN should call external commands and scripts. This could be either execve or system. As of OpenVPN v2.3, this flag is no longer accepted. In most *nix environments the execve() approach has been used without any issues.
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.
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 system flag to run these scripts. As of OpenVPN v2.3 it is now a strict requirement to have full path to the script interpreter when running non-executables files. 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:
--up 'C:\\\\Windows\\\\System32\\\\wscript.exe C:\\\\Program\\ Files\\\\OpenVPN\\\\config\\\\my-up-script.vbs'
Please note the single quote marks and the escaping of the backslashes (\\) and the space character.
The reason the support for the system flag was removed is due to the security implications with shell expansions when executing scripts via the system() call.
Syntax: secret file
Write key to file.
Syntax: secret file [direction]
Enable Static Key encryption mode (non-TLS). Use pre-shared secret file which was generated with genkey. The optional direction parameter enables the use of 4 distinct keys (HMAC-send, cipher-encrypt, HMAC-receive, cipher-decrypt), so that 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 direction parameter is omitted, 2 keys are used bidirectionally, one for HMAC and the other for encryption/decryption.
The 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 direction parameter requires that file contains a 2048 bit key. While pre-1.5 versions of OpenVPN generate 1024 bit key files, any version of OpenVPN which supports the direction parameter, will also support 2048 bit key file generation using the genkey 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. The only requirement is that you have a pre-existing secure channel with your peer (such as 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 it is a handshake-free protocol 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 but random-looking data.
Syntax: setenv FORWARD_COMPATIBLE 1
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.
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: setenv opt Versions prior to OpenVPN 2.3.3 will always ignore options set with the setenv opt directive.
See also ignore-unknown-option
Syntax: setenv name value
Set a custom environmental variable name=value to pass to script.
Syntax: setenv-safe name value
Set a custom environmental variable 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.
Syntax: shaper n
Limit bandwidth of outgoing tunnel data to n bytes per second on the TCP/UDP port. Note that this will only work if mode is set to p2p. 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 n bytes per second, after a datagram write of b bytes is queued on the TCP/UDP port, wait a minimum of (b / n) seconds before queuing the next write.
It should be noted that OpenVPN supports multiple tunnels between the same two peers, allowing you to construct full-speed and reduced bandwidth tunnels at the same time, routing low-priority data such as off-site backups over the reduced bandwidth tunnel, and other data over the full-speed tunnel.
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 n to be between 100 bytes/sec and 100 Mbytes/sec.
(Standalone) Show all available elliptic curves to use with the ecdh-curve option.
Syntax: 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.
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.
Show sensed HTTP or SOCKS proxy settings. Currently, only Windows clients support this option.
(Standalone) 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.).
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 ping-restart, it will allow one new connection.
Syntax: sndbuf size
Set the TCP/UDP socket send buffer size. Defaults to operation system default.
Syntax: socket-flags flags...
Apply the given flags to the OpenVPN transport socket. Currently, only TCP_NODELAY is supported.
The 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.
Syntax: socks-proxy server [port] [authfile]
Connect to remote host through a Socks5 proxy at address server and port port (default=1080). authfile (optional) is a file containing a username and password on 2 lines, or "stdin" to prompt from console.
Syntax: stale-routes-check n [t]
Remove routes haven't had activity for n seconds (i.e. the ageing time).
This check is ran every t seconds (i.e. check interval).
If t is not present it defaults to n This option helps to keep the dynamic routing table small. See also max-routes-per-client
Syntax: static-challenge t e
Enable static challenge/response protocol using challenge text t, with echo flag given by 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.
Syntax: status file [n]
Write operational status to file every n seconds.
Status can also be written to the syslog by sending a SIGUSR2 signal.
Syntax: status-version [n]
Choose the status file format version number. Currently n can be 1, 2, or 3 and defaults to 1.
Avoid writing timestamps to log messages, even when they otherwise would be prepended. In particular, this applies to log messages sent to stdout.
Syntax: tap-sleep n
Cause OpenVPN to sleep for n seconds immediately after the TAP-Win32 adapter state is set to "connected".
This option is intended to be used to troubleshoot problems with the ifconfig and ip-win32 options, and is used to give the TAP-Win32 adapter time to come up before Windows IP Helper API operations are applied to it.
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:
if mode server: socket-flags TCP_NODELAY push "socket-flags TCP_NODELAY"
Syntax: tcp-queue-limit n
Maximum number of output packets queued before TCP (default=64).
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 can support. When the number of output packets queued before sending to the TCP socket reaches this limit for a given client connection, OpenVPN will start to drop outgoing packets directed at this client.
Do a self-test of OpenVPN's crypto options by encrypting and 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 dev or remote. The typical usage of test-crypto would be something like this:
openvpn --test-crypto --secret key or
openvpn --test-crypto --secret key --verb 9 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 crypto library, or OpenVPN's crypto code. Since it is a self-test mode, problems with encryption and authentication can be debugged independently of network and tunnel issues.
Syntax: tls-auth file [direction]
Add an additional layer of HMAC authentication on top of the TLS control channel to mitigate DoS attacks and attacks on the TLS stack.
In a nutshell, tls-auth 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.
file (required) is a file in OpenVPN static key format which can be generated by genkey Older versions (up to 2.3) supported a freeform passphrase file. This is no longer supported in newer versions (2.4+).
See the secret option for more information on the optional direction parameter.
tls-auth is recommended when you are running OpenVPN in a mode where it is listening for packets from any IP address, such as when remote is not specified, or remote is specified with float. The rationale for this feature is as follows. TLS requires a multi-packet exchange 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, well-audited code. OpenVPN has been written with buffer overflow 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.
tls-auth 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. tls-auth can be strengthened by adding the replay-persist 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 key file used with tls-auth gives a peer nothing more than the power to initiate a TLS handshake. It is not used to encrypt or authenticate any tunnel data.
Use tls-crypt instead if you want to use the key file to not only authenticate, but also encrypt the TLS control channel.
Syntax: tls-cipher l
A list l of allowable TLS ciphers delimited by a colon (":").
This setting can be used to ensure that certain cipher suites are used (or 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) simply supplied to the crypto library. Please see the OpenSSL and/or PolarSSL documentation for details on the cipher list interpretation.
Use show-tls to see a list of TLS ciphers supported by your crypto library.
Warning! tls-cipher is an expert feature, which - if used correcly - can improve the security of your VPN connection. But it is also easy to unwittingly use it to carefully align a gun with your foot, or just break your connection. Use with care!
The default for --tls-cipher is to use PolarSSL's default cipher list when using PolarSSL or "DEFAULT:!EXP:!LOW:!MEDIUM:!kDH:!kECDH:!DSS:!PSK:!SRP:!kRSA" when using OpenSSL.
Enable TLS and assume client role during TLS handshake.
Syntax: tls-crypt keyfile
Encrypt and authenticate all control channel packets with the key from keyfile. (See 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] provides "poor-man's" post-quantum security, against attackers who will never know the pre-shared key (i.e. no forward secrecy). .RE
.IP In contrast to --tls-auth\fR, tls-crypt does *not* require the user to set --key-direction\fR. Security Considerations All peers use the same tls-crypt pre-shared group key to authenticate and encrypt control channel messages. To ensure that IV collisions remain unlikely, this key should not be used to encrypt more than 2^48 client-to-server or 2^48 server-to-client control 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 tls-crypt degrading to the same security as using --tls-auth\fR. That is, the control channel still benefits from the extra protection against 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.
Exit on TLS negotiation failure.
Syntax: tls-export-cert directory
Store the certificates the clients uses upon connection to this directory. This will be done before --tls-verify is called. The certificates will use a temporary name and will be deleted when the tls-verify script returns. The file name used for the certificate is available via the peer_cert environment variable.
Enable TLS and assume server role during TLS handshake. Note that OpenVPN is designed as a peer-to-peer application. The designation of client or server is only for the purpose of negotiating the TLS control channel.
Syntax: tls-timeout n
Packet retransmit timeout on TLS control channel if no acknowledgment from remote within n seconds (default=2). When OpenVPN sends a control packet to its peer, it will expect to receive an acknowledgement within n seconds or it will retransmit the packet, subject to a TCP-like exponential backoff algorithm. This parameter 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.
Syntax: tls-verify cmd
Run command cmd to verify the X509 name of a pending TLS connection that has otherwise passed all other tests of certification (except for revocation via crl-verify directive; the revocation test occurs after the tls-verify test).
cmd should return 0 to allow the TLS handshake to proceed, or 1 to fail.
When cmd is executed two arguments are appended after any arguments specified in cmd , as follows:
cmd certificate_depth subject These arguments are, respectively, the current certificate depth and the X509 common name (cn) of the peer.
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 verify-cn in the OpenVPN distribution.
Syntax: tls-version-max version
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".
Syntax: tls-version-min version ['or-highest']
Sets the minimum TLS version we will accept from the peer (default is "1.0"). Examples for version include "1.0", "1.1", or "1.2". If 'or-highest' is specified and version is not recognized, we will only accept the highest TLS version supported by the local SSL implementation.
Syntax: topology mode
If you set this directive on the server, the server and server-bridge directives will automatically push your chosen topology setting to clients as well. This directive can also be manually pushed to clients. Like the dev directive, this directive must always be compatible between client and server.
mode can be one of:
net30 -- Use a point-to-point topology, by allocating one /30 subnet per client. This is designed to allow point-to-point semantics when some or all of the connecting clients might be Windows systems. This is the default on OpenVPN 2.0.
p2p -- Use a point-to-point topology where the remote endpoint of the client's 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 ifconfig-pool-linear directive which is available in OpenVPN 2.0 and is now deprecated.
subnet -- Use a subnet rather than a point-to-point topology by configuring the tun interface with a local IP address and subnet mask, similar to the topology used in dev tap 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 topology directive code. When used on Windows, requires version 8.2 or higher of the TAP-Win32 driver. When used on *nix, requires that the tun driver supports an ifconfig (8) command which sets a subnet instead of a remote endpoint IP address.
This option exists in OpenVPN 2.1 or higher.
Syntax: tran-window n
Transition window -- our old key can live this many seconds 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.
Syntax: tun-mtu n
Take the TUN device MTU to be 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.
Syntax: tun-mtu-extra n
Assume that the TUN/TAP device might return as many as n bytes more than the tun-mtu 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.
Syntax: txqueuelen n
(Linux only) Set the TX queue length on the TUN/TAP interface. Currently defaults to 100.
Syntax: up cmd
Run command cmd after successful TUN/TAP device open (pre user UID change).
The up command is useful for specifying route commands which route IP traffic destined for private subnets which exist at the other end of the VPN connection into the tunnel.
For dev tun execute as:
cmd tun_dev tun_mtu link_mtu ifconfig_local_ip ifconfig_remote_ip [ init | restart ] For dev tap execute as:
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.
Note that if cmd includes arguments, all OpenVPN-generated arguments will be appended to them to build an argument list with which the executable will be called.
Typically, 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 init. If the up-restart 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 persist-tun option will enable such preservation). A restart can be generated by a SIGUSR1 signal, a ping-restart timeout, or a connection reset when the TCP protocol is enabled with the proto option. If a restart occurs, and up-restart has been specified, the up script will be called with restart as the last parameter.
NOTE: on restart, OpenVPN will not pass the full set of environment variables to the script. Namely, everything related to routing and gateways will not be passed, as nothing needs to be done anyway - all the routing setup is already in place. Additionally, the up-restart script will run with the downgraded UID/GID settings (if configured).
The following standalone example shows how the up 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, so you should abort with control-c).
openvpn --dev tun --port 9999 --verb 4 --ping-restart 10 --up 'echo up' --down 'echo down' --persist-tun --up-restart Note that OpenVPN also provides the ifconfig option to automatically ifconfig the TUN device, eliminating the need to define an up script, unless you also want to configure routes in the up script.
route add -net 10.0.0.0 netmask 255.255.255.0 gw $5
Delay TUN/TAP open and possible up script execution until after TCP/UDP connection establishment with peer.
On Windows, this option will delay the TAP-Win32 media state transitioning to "connected" until connection establishment, i.e. the receipt of the first authenticated packet from the peer.
Enable prediction resistance on PolarSSL's RNG.
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.
Note that this option only works with PolarSSL versions greater than 1.1.
For auth-user-pass-verify authentication, use the authenticated username as the common name, rather than the common name from the client cert.
Syntax: verb n
Set output verbosity to 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.
0 -- No output except fatal errors.
1 to 4 -- Normal usage range.
5 -- Output
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.
6 to 11 -- Debug info range (see errlevel.h for additional information on debug levels).
Syntax: verify-client-cert none|optional|require
Specify whether the client is required to supply a valid certificate.
Possible options are
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.
If you use this directive, the entire responsibility of authentication will rest on your auth-user-pass-verify script, so keep in mind that bugs in your script could potentially compromise the security of your VPN.
verify-client-cert none is functionally equivalent to client-cert-not-required. optional : a client may present a certificate but it is not required to do so. When using this directive, you should also use a 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 auth-user-pass-verify script, so keep in mind that bugs in your script could potentially compromise the security of your VPN.
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 verify-client-cert require ) but you also specify an auth-user-pass-verify script, then OpenVPN will perform double authentication. The client certificate verification AND the auth-user-pass-verify script will need to succeed in order for a client to be authenticated and accepted onto the VPN.
Syntax: verify-hash hash
Specify SHA1 fingerprint for level-1 cert. The level-1 cert is the CA (or intermediate cert) that signs the leaf certificate, and is one removed from the leaf certificate in the direction of the root. When accepting a connection from a peer, the level-1 cert fingerprint must match hash or certificate verification will fail. Hash is specified as XX:XX:... For example: AD:B0:95:D8:09:C8:36:45:12:A9:89:C8:90:09:CB:13:72:A6:AD:16
Syntax: verify-x509-name name type
Accept connections only if a host's X.509 name is equal to name. The remote host must also pass all other tests of verification.
Which X.509 name is compared to name depends on the setting of type. type can be "subject" to match the complete subject DN (default), "name" to match a subject RDN or "name-prefix" to match a subject RDN prefix. Which RDN is verified as name depends on the x509-username-field option. But it defaults to the common name (CN), e.g. a certificate with a subject DN "C=KG, ST=NA, L=Bishkek, CN=Server-1" would be matched by:
verify-x509-name 'C=KG, ST=NA, L=Bishkek, CN=Server-1' and verify-x509-name Server-1 name or you could use verify-x509-name Server -name-prefix if you want a client to only accept connections to "Server-1", "Server-2", etc.
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.
NOTE: Test against a name prefix only when you are using OpenVPN with a custom CA certificate that is under your control. Never use this option with type "name-prefix" when your client certificates are signed by a third party, such as a commercial web CA.
Syntax: x509-track attribute
Save peer X509 attribute value in environment for use by plugins and management interface. Prepend a '+' to attribute to save values from full cert chain. Values will be encoded as X509_<depth>_<attribute>=<value>. Multiple x509-track options can be defined to track multiple attributes.
Syntax: x509-username-field [ext:\]fieldname
Field in the X.509 certificate subject to be used as the username (default=CN). Typically, this option is specified with fieldname as either of the following:
\fRsubjectAltName The first example uses the value of the "emailAddress" attribute in the certificate's Subject field as the username. The second example uses the ext: prefix to signify that the X.509 extension fieldname "subjectAltName" be searched for an rfc822Name (email) field to be used as the username. In cases where there are multiple email addresses in ext:fieldname\fR, the last occurrence is chosen.
When this option is used, the verify-x509-name option will match against the chosen fieldname instead of the Common Name.
Please note: This option has a feature which will convert an all-lowercase fieldname to uppercase characters, e.g., ou -> OU. A mixed-case fieldname or one having the ext: prefix will be left as-is. This automatic upcasing feature is deprecated and will be removed in a future release.