OPENVPN(8)
๐ OPENVPN ๐ โ from the OPENVPN(8) System Manager's Manual
okay bestie, welcome to the manual page for openvpn, and yes it's under System Manager's Manual because it's that kind of icon. grab a snack, this one is LONG, but we're getting through it together ๐ซถ
โจ NAME โจ
openvpn โ Secure IP tunnel daemon
โจ SYNOPSIS โจ
openvpn [ options ... ]
openvpn --help
โจ INTRODUCTION โจ
OpenVPN is an open source VPN daemon by James Yonan. The whole reason this manual page is so unserious-long is that OpenVPN is trying to be a universal VPN tool with a ridiculous amount of flexibility, so like, there are a LOT of options here. If you're new to OpenVPN, lowkey skip ahead to the examples section โ that's where you'll see how to build simple VPNs right on the command line without even needing a configuration file. no cap ๐
Also there's more documentation and examples on the OpenVPN web site: https://openvpn.net/
And if you want the short version of this manual, there's the openvpn usage message, which you get by running openvpn with no parameters at all. baby steps ๐ธ
โจ DESCRIPTION โจ
OpenVPN is a robust and highly flexible VPN daemon. She supports:
- SSL/TLS security
- ethernet bridging
- TCP or UDP tunnel transport through proxies or NAT
- support for dynamic IP addresses and DHCP
- scalability to hundreds or thousands of users
- portability to most major OS platforms
OpenVPN is tightly bound to the OpenSSL library, and derives much of its crypto capabilities from it. ๐ค
OpenVPN supports conventional encryption using a pre-shared secret key (Static Key mode) or public key security (SSL/TLS mode) using client & server certificates. She also supports non-encrypted TCP/UDP tunnels. (yes, unencrypted, we'll talk about it, don't @ me)
OpenVPN is designed to work with the TUN/TAP virtual networking interface that exists on most platforms.
Overall, OpenVPN aims to offer many of the key features of IPSec but with a relatively lightweight footprint. slay ๐ โจ
โจ OPTIONS โจ
OpenVPN lets you put any option either on the command line or in a configuration file. All command line options are preceded by a double-leading-dash (--), but that prefix can be removed when an option lives in a configuration file. iykyk
๐ Generic Options ๐
This section covers generic options which are accessible regardless of which mode OpenVPN is configured as. universal queen behavior ๐
--helpโ Show options.
--auth-nocacheโ Don't cache--askpassor--auth-user-passusername/passwords in virtual memory. ๐ง ๐จ
If specified, this directive will cause OpenVPN to immediately forget username/password inputs after they are used. As a result, when OpenVPN needs a username/password, it will prompt for input from stdin, which may be multiple times during the duration of an OpenVPN session.
When using --auth-nocache in combination with a user/password file and --chroot or --daemon, make sure to use an absolute path. โ ๏ธ
--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. ๐๏ธ
--chroot dirโ Chroot to dir after initialization.--chrootessentially 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/urandomto be available inside the chroot directory dir. This is because SSL libraries occasionally need to collect fresh randomness. Newer linux kernels and some BSDs implement agetrandom()orgetentropy()syscall that removes the need for/dev/urandomto be available.
--compat-mode versionโ This option provides a convenient way to alter the defaults of OpenVPN to be more compatible with the version version specified. All of the changes this option applies can also be achieved using individual configuration options.
The version specified with this option is the version of OpenVPN peer OpenVPN should try to be compatible with. In general OpenVPN should be compatible with the last two previous version without this option. E.g. OpenVPN 2.6.0 should be compatible with 2.5.x and 2.4.x without this option. However, there might be some edge cases that still require this option even in these cases.
Note: Using this option reverts defaults to no longer recommended values and should be avoided if possible. ๐จ
The following table details what defaults are changed depending on the version specified.
- 2.5.x or lower:
--allow-compression asymis automatically added to the configuration if no other compression options are present. - 2.4.x or lower: The cipher in
--cipheris appended to--data-ciphers. - 2.3.x or lower:
--data-ciphers-fallbackis automatically added with the same cipher as--cipher. - 2.3.6 or lower:
--tls-version-min 1.0is added to the configuration when--tls-version-minis not explicitly set.
If not required, this is option should be avoided. Setting this option can lower security or disable features like data-channel offloading. ๐ฌ don't do it for funsies
--config fileโ Load additional config options from file where each line corresponds to one command line option, but with the leading--removed.
If --config file is the only option to the openvpn command, the --config can be removed, and the command can be given as openvpn file
Note that configuration files can be nested to a reasonable depth. ๐ช
Double quotation or single quotation characters ("", '') can be used to enclose single parameters containing whitespace, and "#" or ";" characters in the first column can be used to denote comments.
Note that OpenVPN 2.0 and higher performs backslash-based shell escaping for characters not in single quotations, so the following mappings should be observed:
\\ Maps to a single backslash character (\).
\" Pass a literal doublequote character ("), don't
interpret it as enclosing a parameter.
\[SPACE] Pass a literal space or tab character, don't
interpret it as a parameter delimiter.
For example on Windows, use double backslashes to represent pathnames:
secret "c:\\OpenVPN\\secret.key"
For examples of configuration files, see https://openvpn.net/community-resources/how-to/
Here is an example configuration file:
#
# Sample OpenVPN configuration file for
# using a pre-shared static key.
#
# '#' or ';' may be used to delimit comments.
# Use a dynamic tun device.
dev tun
# Our remote peer
remote mypeer.mydomain
# 10.1.0.1 is our local VPN endpoint
# 10.1.0.2 is our remote VPN endpoint
ifconfig 10.1.0.1 10.1.0.2
# Our pre-shared static key
secret static.key
--daemon prognameโ Become a daemon after all initialization functions are completed. ๐งโโ๏ธ
Valid syntaxes:
daemon
daemon progname
This option will cause all message and error output to be sent to the syslog file (such as /var/log/messages), except for the output of scripts and ifconfig commands, which will go to /dev/null unless otherwise redirected. The syslog redirection occurs immediately at the point that --daemon is parsed on the command line even though the daemonization point occurs later. If one of the --log options is present, it will supersede syslog redirection.
The optional progname parameter will cause OpenVPN to report its program name to the system logger as progname. This can be useful in linking OpenVPN messages in the syslog file with specific tunnels. When unspecified, progname defaults to openvpn.
When OpenVPN is run with the --daemon option, it will try to delay daemonization until the majority of initialization functions which are capable of generating fatal errors are complete. This means that initialization scripts can test the return status of the openvpn command for a fairly reliable indication of whether the command has correctly initialized and entered the packet forwarding event loop.
In OpenVPN, the vast majority of errors which occur after initialization are non-fatal.
Note: as soon as OpenVPN has daemonized, it can not ask for usernames, passwords, or key pass phrases anymore. This has certain consequences, namely that using a password-protected private key will fail unless the --askpass option is used to tell OpenVPN to ask for the pass phrase. ๐ญ
Further, using--daemontogether with--auth-user-pass(entered on console) and--auth-nocachewill fail as soon as key renegotiation (and reauthentication) occurs. ๐
--disable-occโ DEPRECATED Disable "options consistency check" (OCC) in configurations that do not use TLS.
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. ๐ซ
--engine engine-nameโ Enable OpenSSL hardware-based crypto engine functionality. โ๏ธโจ
Valid syntaxes:
engine
engine engine-name
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.
--group groupโ Similar to the--useroption, this option changes the group ID of the OpenVPN process to group after initialization. ๐
--ignore-unknown-option argsโ okay so this one is the "bestie, chill, I got this" option for config files. Valid syntax is:
ignore-unknown-option opt1 opt2 opt3 ... optN
When one of opt1 ... optN shows up in the configuration file, parsing does not fail just because your OpenVPN version doesn't know that option. And you can stack multiple --ignore-unknown-option lines if you've got a whole squad of options to ignore. ๐
Use this one with caution, fr. There are genuinely good security reasons why OpenVPN wants to fail when it spots problems in a config file. That said, there are also valid reasons for wanting newer software features to just gracefully degrade when an older version runs into them.
--ignore-unknown-option has been around since OpenVPN 2.3.3. โจ
--iproute cmdโ swap in a different command to run instead of the default iproute2 command. Basically: use this when you wanna run OpenVPN in an unprivileged environment. ๐ซถ--keying-material-exporter argsโ save Exported Keying Material [RFC5705] oflenbytes (andlenmust be between 16 and 4095 bytes, no negotiating bestie) usinglabel, and stick it in the environment asexported_keying_materialso plugins can grab it in theOPENVPN_PLUGIN_TLS_FINALcallback. Valid syntax:
keying-material-exporter label len
Heads up: exporter labels can potentially collide with existing PRF labels. To prevent that, labels MUST begin with EXPORTER. Not optional. Periodt. ๐
--mlockโ disables paging by calling the POSIXmlockallfunction. Requires OpenVPN to be started as root initially (tho it can downgrade its UID afterwards with--user).
Why do you care? Because this ensures key material and tunnel data never get written to disk via virtual memory paging, which happens on basically every modern OS. It means that even if an attacker somehow cracked the box running OpenVPN, they couldn't scan the system swap file to recover previously used ephemeral keys โ and those keys live for a period governed by the --reneg options (see below), then get discarded. ๐
The downside: --mlock reduces the amount of physical memory available to other applications. Trade-offs, bestie.
How much memory can be locked and how that limit is enforced is OS-dependent. On Linux the default limit an unprivileged process may lock (RLIMIT_MEMLOCK) is low, and if privileges get dropped later, future memory allocations will very likely fail. You can bump the limit with ulimit or systemd directives, depending on how OpenVPN is started.
If the platform has the getrlimit(2) system call, OpenVPN checks how much mlock-able memory is available before calling mlockall(2), and tries to raise the limit to 100 MB if less than that is configured. 100 Mb is kinda arbitrary ngl โ it's enough for a moderately-sized OpenVPN deployment, but memory usage might go beyond that if the number of concurrent clients is high. ๐
--nice nโ change process priority after initialization (ngreater than 0 = lower priority,nless than zero = higher priority).--providers providersโ load the list of (OpenSSL) providers. Mainly useful for using an external provider for key management liketpm2-openssl, or for loading the legacy provider with:
--providers legacy default
Changing this option between SIGHUP might not behave well. If you need to change/add/remove this option, fully restart OpenVPN. No half-measures. ๐ฆ
--remap-usr1 signalโ controls whether internally or externally generatedSIGUSR1signals get remapped toSIGHUP(restart without persisting state) orSIGTERM(exit).
signal can be set to SIGHUP or SIGTERM. By default, no remapping occurs.
--script-security levelโ this directive gives you policy-level control over how OpenVPN uses external programs and scripts. Lowerlevelvalues = more restrictive, higher values = more permissive. The settings forlevel:
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. That could be either execve or system. As of OpenVPN 2.3, this flag is no longer accepted. Gone. Bye. ๐
Some directives, like --up, allow options to be passed to the external script. In those cases make sure the script name does not contain any spaces, or the configuration parser will choke because it can't figure out where the script name ends and the script options start.
On Windoes it is a strict requirement to have the full path to the script interpreter when running non-executables files. This isn't 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:
--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. Don't skip them, the parser will notice. ๐ธ
--setcon contextโ apply SELinuxcontextafter initialization. This essentially gives you the ability to restrict OpenVPN's rights to only network I/O operations, thanks to SELinux. It goes further than--userand--chrootin that those two, while being great security features, unfortunately don't protect against privilege escalation by exploitation of a vulnerable system call. You can absolutely combine all three, but please note that sincesetconrequires access to/proc, you'll have to provide it inside the chroot directory (e.g. withmount --bind).
Since the setcon operation is delayed until after initialization, OpenVPN can be restricted to just network-related system calls โ whereas if you apply the context before startup (like the OpenVPN one provided in the SELinux Reference Policies), you'll have to allow many things that are only needed during initialization.
Like with chroot, complications can result when scripts or restarts are executed after the setcon operation, which is why you should really consider using the --persist-tun option. ๐ง
--status argsโ write operational status tofileeverynseconds.ndefaults to60if you don't specify it. Valid syntaxes:
status file
status file n
Status can also be written to the syslog by sending a SIGUSR2 signal. ๐ฌ
With multi-client capability enabled on a server, the status file includes a list of clients and a routing table. In that case the output format can be controlled by the --status-version option.
For clients or instances running in point-to-point mode, it'll contain the traffic statistics.
--status-version nโ set the status file format version number ton.
This only affects the status file on servers with multi-client capability enabled. Valid status version values:
1 โ traditional format (default). The client list contains the following fields, comma-separated: Common Name, Real Address, Bytes Received, Bytes Sent, Connected Since.
2 โ a more reliable format for external processing. Compared to version 1, the client list contains some additional fields: Virtual Address, Virtual IPv6 Address, Username, Client ID, Peer ID, Data Channel Cipher. Future versions may extend the number of fields.
3 โ identical to 2, but fields are tab-separated.
--test-cryptoโ 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 doesn't require a peer to function, and therefore can be specified without--devor--remote. Self-care crypto test, honestly. ๐ฅ
The typical usage of --test-crypto would be something like this:
openvpn --test-crypto
or
openvpn --test-crypto --verb 9
This option is super useful for testing OpenVPN after it's been ported to a new platform, or for isolating problems in the compiler, the OpenSSL crypto library, or OpenVPN's crypto code. Since it's a self-test mode, problems with encryption and authentication can be debugged independently of network and tunnel issues. Iconic debugging setup, ngl.
Older versions of OpenVPN used the --secret argument to specify a static key for this test. Newer versions generate a random key for the test. โจ
--tmp-dir dirโ specify a directorydirfor temporary files instead of the defaultTMPDIR(or"/tmp"if unset). Note that it must be writable by the main process after it has dropped root privileges.
This directory gets used to communicate with scripts and plugins:
--client-connectscripts and theOPENVPN_PLUGIN_CLIENT_CONNECTplug-in hook, to dynamically generate the client-specific configurationclient_connect_config_fileand return success/failure viaclient_connect_deferred_filewhen using the deferred client connect methodOPENVPN_PLUGIN_AUTH_USER_PASS_VERIFYplug-in hooks return success/failure viaauth_control_filewhen using the deferred auth method, and pending authentication viaauth_pending_file.
--use-prediction-resistanceโ enable prediction resistance on mbed TLS's RNG.
Enabling prediction resistance causes the RNG to reseed on 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.
--user userโ after initialization, OpenVPN drops privileges and switches its user ID to user. The whole point? If some hostile party ever manages to hijack an OpenVPN session, this keeps them boxed in. OpenVPN's security features already make that scenario super unlikely, but bestie, this is the second line of defense โ the girl who's got your back when the first one's busy. Setting user to a dedicated unprivileged account that exists purely to run openvpn means the attacker can only cause limited damage. ๐
But here's the catch โ once you give those privileges away, you can never take them back. So if you wanna reset an OpenVPN daemon with a SIGUSR1 signal (say, in response to a DHCP reset), you need to use one or more of the --persist options so OpenVPN doesn't have to do any privileged operations to restart โ stuff like re-reading key files or running ifconfig on the TUN device. Plan ahead, queen. ๐
NOTE: Previous versions of openvpn used nobody as the example unpriviledged user. It is not recommended to actually use that user since it is usually used by other system services already. Always create a dedicated user for openvpn. ๐ซ
--writepid fileโ Write OpenVPN's main process ID to file. So you can find it later, iykyk. ๐
๐ Log options ๐
--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. Like a lil note passed in class, but for software. ๐--errors-to-stderrโ Output errors tostderrinstead ofstdout, unless log output is redirected by one of the--logoptions. Keep your error stream separate, it's giving organized. โจ--log fileโ Output logging messages to file, including output tostdout/stderrwhich is generated by called scripts. If file already exists it will be truncated (rip to whatever was in there ๐ญ). This option takes effect immediately when it is parsed in the command line and will supersede syslog output if--daemonis also specified. It's persistent over the entire course of an OpenVPN instantiation and will not be reset bySIGHUP,SIGUSR1, or--ping-restart. Loyal to the end, no cap. ๐ซถ
Note that on Windows, when OpenVPN is started as a service, logging occurs by default without the need to specify this option. Windows stays doing the most. ๐
--log-append fileโ Append logging messages to file. If file does not exist, it will be created. This option behaves exactly like--logexcept that it appends to rather than truncating the log file. The non-destructive sibling, we stan. ๐--machine-readable-outputโ 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 tostdout. For the girlies who parse logs with scripts. ๐ค--mute nโ Log at most n consecutive messages in the same category. This is useful to limit repetitive logging of similar message types. Because sometimes the log is that friend who texts the same thing eleven times. ๐--mute-replay-warningsโ 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. All the safety, none of the yapping. ๐คซ--suppress-timestampsโ Avoid writing timestamps to log messages, even when they otherwise would be prepended. In particular, this applies to log messages sent tostdout. Minimalist era. ๐ฐ๏ธ--syslog prognameโ Direct log output to system logger, but do not become a daemon. See--daemondirective above for description of the progname parameter. Syslog takes the wheel, but OpenVPN stays in the foreground. ๐--verb nโ Set output verbosity to n (default1). Each level shows all info from the previous levels. Level3is recommended if you want a good summary of what's happening without being swamped by output. The vibe-check dial for your logs:0โ No output except fatal errors.1to4โ Normal usage range.5โ OutputsRandWcharacters to the console for each packet read and write, uppercase is used for TCP/UDP packets and lowercase is used for TUN/TAP packets.6to11โ Debug info range (seeerrlevel.hin the source code for additional information on debug levels).
๐ Protocol options ๐
Options in this section affect features available in the OpenVPN wire protocol. Many of these options also define the encryption options of the data channel in the OpenVPN wire protocol. These options must be configured in a compatible way between both the local and remote side. It's a two-way street, bestie โ mismatch and it's not gonna work. ๐ค
--allow-compression modeโ As described in the--compressoption, compression is a potentially dangerous option. This option allows controlling the behaviour of OpenVPN when compression is used and allowed. The mode argument can be one of the following values:asymโ OpenVPN will only decompress incoming packets but not compress outgoing packets. This also allows migrating to disable compression when changing both server and client configurations to remove compression at the same time is not a feasible option.no(default) โ OpenVPN will refuse any compression. If data-channel offloading is enabled, OpenVPN will additionally also refuse compression framing (stub). Hard pass, blocked, no thank you. โyesโ DEPRECATED This option is an alias forasym. Previously it did enable compression for outgoing packets, but OpenVPN never compresses packets on send now. It's giving nostalgia, not function. ๐
--auth algโ Authenticate data channel packets and (if enabled)tls-authcontrol channel packets with HMAC using message digest algorithm alg. (The default isSHA1). 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. Order matters, bestie. โจ
If an AEAD cipher mode (e.g. GCM) is chosen then 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.
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 https://tools.ietf.org/html/rfc2104
--cipher algโ This option should not be used any longer in TLS mode and still exists for two reasons:- compatibility with old configurations still carrying it around;
- allow users connecting to OpenVPN peers older than
2.6.0to have--cipherconfigured the same way as the remote counterpart. This can avoid MTU/frame size warnings.
Before 2.4.0, this option was used to select the cipher to be configured on the data channel, however, later versions usually ignored this directive in favour of a negotiated cipher. Starting with 2.6.0, this option is always ignored in TLS mode when it comes to configuring the cipher.
If you wish to specify the cipher to use on the data channel, please see --data-ciphers (for regular negotiation) and --data-ciphers-fallback (for a fallback option when the negotiation cannot take place because the other peer is old or has negotiation disabled). Those are the main characters now. ๐
To see ciphers that are available with OpenVPN, use the --show-ciphers option.
Set alg to none to disable encryption.
--compress algorithmโ DEPRECATED Enable a compression algorithm. Compression is generally not recommended. VPN tunnels which use compression are susceptible to the VORALCE attack vector. See also themigrateparameter below. โ ๏ธ
The algorithm parameter may be lzo, lz4, lz4-v2, stub, stub-v2, migrate or empty. LZO and LZ4 are different compression algorithms, with LZ4 generally offering the best performance with least CPU usage. Efficiency queen. ๐
The lz4-v2 and stub-v2 variants implement a better framing that does not add overhead when packets cannot be compressed. All other variants always add one extra framing byte compared to no compression framing.
Especially stub-v2 is essentially identical to no compression and no compression framing as its header indicates IP version 5 in a tun setup and can (ab)used to complete disable compression to clients. (See the migrate option below)
If the algorithm parameter is stub, stub-v2 or empty, compression will be turned off, but the packet framing for compression will still be enabled, allowing a different setting to be pushed later. Additionally, stub and stub-v2 wil disable announcing lzo and lz4 compression support via IV_ variables to the server.
Note: the stub (or empty) option is NOT compatible with the older option --comp-lzo no.
Using migrate as compression algorithm enables a special migration mode. It allows migration away from the --compress/--comp-lzo options to no compression. This option sets the server to no compression mode and the server behaves identical to a server without a compression option for all clients without a compression in their config. However, if a client is detected that indicates that compression is used (via OCC), the server will automatically add --push compress stub-v2 to the client specific configuration if supported by the client and otherwise switch to comp-lzo no and add --push comp-lzo to the client specific configuration. Glow-up arc for your config. ๐ฆ
Security Considerations
Compression and encryption is a tricky combination. If an attacker knows or is able to control (parts of) the plain-text of packets that contain secrets, the attacker might be able to extract the secret if compression is enabled. See e.g. the CRIME and BREACH attacks on TLS and VORACLE on VPNs which also leverage to break encryption. If you are not entirely sure that the above does not apply to your traffic, you are advised to not enable compression. Fr fr, just leave it off. ๐ซ๐
For this reason compression support was removed from current versions of OpenVPN. It will still decompress compressed packets received via a VPN connection but it will never compress any outgoing packets. Like, she'll unzip your lil gift but she is NOT packing one for you. ๐
--comp-lzomode โ DEPRECATED turns on the LZO compression algorithm. Compression is generally not recommended, bestie. VPN tunnels which uses compression are suspectible to the VORALCE attack vector. ๐ญ
This lets the other side of the connection use LZO compression. Due to difference in packet format this may add 1 additional byte per packet. With current versions of OpenVPN no actual compression will happen.
mode may be yes, no, or adaptive but there is no actual change in behavior anymore. So cute that you get a choice. It's a fake choice. But it's yours. โจ
--comp-noadaptโ DEPRECATED This option does not have any effect anymore since current versions of OpenVPN never compress outgoing packets. She's just standing there. Menacingly. Doing nothing. ๐ซถ--key-directionโ alternative way of specifying the optional direction parameter for the--tls-authoption. Useful when using inline files (See section on inline files).--data-cipherscipher-list โ restrict the allowed ciphers to be negotiated to the ciphers in cipher-list. cipher-list is a colon-separated list of ciphers, and defaults toAES-256-GCM:AES-128-GCM:CHACHA20-POLY1305when Chacha20-Poly1305 is available and otherwiseAES-256-GCM:AES-128-GCM.
For servers, the first cipher from cipher-list that is also supported by the client will be pushed to clients that support cipher negotiation. First come, first served, and the server is doing the choosing. ๐
For more details see the chapter on Data channel cipher negotiation. Especially if you need to support clients with OpenVPN versions older than 2.4! iykyk, the old ones are out here wildin'.
Starting with OpenVPN 2.6 a cipher can be prefixed with a ? to mark it as optional. This allows including ciphers in the list that may not be available on all platforms. E.g. AES-256-GCM:AES-128-GCM:?CHACHA20-POLY1305 would only enable Chacha20-Poly1305 if the underlying SSL library (and its configuration) supports it.
Starting with OpenVPN 2.7 the special keyword DEFAULT can be used in the string and is replaced by the default ciphers. This can be used to add an additional allowed cipher to the allowed ciphers, e.g. DEFAULT:AES-192-CBC to use the default ciphers but also allow AES-192-CBC.
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 no common cipher is found during cipher negotiation, the connection is terminated. Not a vibe check fail, a whole tunnel fail. ๐ To support old clients/old servers that do not provide any cipher negotiation support see --data-ciphers-fallback.
If --compat-mode is set to a version older than 2.5.0 the cipher specified by --cipher will be appended to --data-ciphers if not already present.
This list is restricted to be 127 chars long after conversion to OpenVPN ciphers.
This option was called --ncp-ciphers in OpenVPN 2.4 but has been renamed to --data-ciphers in OpenVPN 2.5 to more accurately reflect its meaning. glow-up era. rebranded. iconic. โจ
--data-ciphers-fallbackalg โ configure a cipher that is used to fall back to if we could not determine which cipher the peer is willing to use.
This option should only be needed to connect to peers that are running OpenVPN 2.3 or older versions, and have been configured with --enable-small (typically used on routers or other embedded devices). Grandma router needs her legacy lane. ๐
--allow-deprecated-insecure-static-cryptoโ DEPRECATED This allow using OpenVPN without TLS. This is deprecated and will be removed in OpenVPN 2.8. Bestie. Do not. She's on the way out the door in 2.8. ๐ช--tran-windown โ Transition window -- our old key can live this many seconds after a new a key renegotiation begins (default3600seconds). 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. She's not ghosting the old key, she's giving it a slow soft launch out the door. ๐ฆ--force-tls-key-material-exportโ This option is only available in--mode serverand forces to use Keying Material Exporters (RFC 5705) for clients. This can be used to simulate an environment where the cryptographic library does not support the older method to generate data channel keys anymore. This option is intended to be a test option and might be removed in a future OpenVPN version without notice. Test option energy: could vanish mid-conversation, no text back. ๐
๐ Client Options ๐
The client options are used when connecting to an OpenVPN server configured to use --server, --server-bridge, or --mode server in its configuration.
--allow-pull-fqdnโ Allow client to pull DNS names from server (rather than being limited to IP address) for--ifconfig,--route, and--route-gateway. Names, not just numbers. Main character treatment. ๐--allow-recursive-routingโ When this option is set, OpenVPN will not drop incoming tun packets with same destination as host.--auth-tokentoken โ This is not an option to be used directly in any configuration files, but rather push this option from a--client-connectscript or a--pluginwhich hooks into theOPENVPN_PLUGIN_CLIENT_CONNECTorOPENVPN_PLUGIN_CLIENT_CONNECT_V2calls. 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 has been set. If the OpenVPN server side rejects the authentication token then the client will receive an AUTH_FAILED and disconnect. She said NO and hung up. ๐
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. Security girlies, this one's for you. ๐ซถ
To make use of this feature, the --client-connect script or --plugin needs to put
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.
Newer clients (2.4.7+) will fall back to the original password method after a failed auth. Older clients will keep using the token value and react according to --auth-retry.
--auth-token-userbase64username โ Companion option to--auth-token. This options allows one to override the username used by the client when reauthenticating with the auth-token. It also allows one to use--auth-tokenin setups that normally do not use username and password.
The username has to be base64 encoded. Encode it or it doesn't count, bestie. โจ
--auth-user-passโ Authenticate with server using username/password.
Valid syntaxes:
auth-user-pass
auth-user-pass up
If up is present, it must be a file containing username/password on 2 lines or a flag named username-only to indicate no password should be prompted for. In the former case, if the password line is missing in the file, OpenVPN will prompt for one.
If up is omitted, username/password will be prompted from the console.
This option can also be inlined
<auth-user-pass>
username
[password]
</auth-user-pass>
where password is optional, and will be prompted from the console if missing.
The username-only flag is meant to be used with SSO authentication. In this case the user will be asked for a username but not password. Instead, a dummy password [[BLANK]] is generated internally and submitted to the server. See management-notes.txt for how this option affects username/password prompt via the management interface. For the console, it simply eliminates the password prompt.
The username-only flag cannot be used along with embedding username and/or password in the config file, or while reading them from an external file. In such cases, if only username is relevant and no password prompt is desired, a dummy password like 'no_passsword' should be embedded as well. This flag is also incompatible with the --static-challenge option and legacy dynamic challenge protocol. She does NOT play well with others. Pick a lane. ๐ซ
The server configuration must specify an --auth-user-pass-verify script to verify the username/password provided by the client.
--auth-retrytype โ Controls how OpenVPN responds to username/password verification errors such as the client-side response to anAUTH_FAILEDmessage 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). Default behavior is "I'm leaving and I'm not telling you why." ๐nointeractโ Client will retry the connection without requerying for an--auth-user-passusername/password. Use this option for unattended clients. No talking, just trying again. Silent retry queen. ๐interactโ Client will requery for an--auth-user-passusername/password and/or private key password before attempting a reconnection. She WILL ask again. Politely. Repeatedly. ๐
Note that while this option cannot be pushed, it can be controlled from the management interface.
--clientโ bestie this is the โจlazy girlโจ directive that sets up client mode for you, no cap. It's literally the same as doing:
pull
tls-client
--client-nat argsโ okay so this one is a pushable client option and it sets up a stateless one-to-one NAT rule on packet addresses (not ports, we're not doing ports here ๐ ). When is it useful? When routes or ifconfig settings pushed to the client would create an IP numbering conflict. Iconic little fixer-upper.
Valid syntax:
client-nat snat|dnat network netmask alias
Examples, bestie:
client-nat snat 192.168.0.0 255.255.0.0 10.64.0.0
client-nat dnat 10.64.0.0 255.255.0.0 192.168.0.0
So network and netmask (like 192.168.0.0 255.255.0.0) define the local view of a resource from the client perspective, while alias (like 10.64.0.0) defines the remote view from the server perspective using that same netmask.
Use snat (source NAT) for resources owned by the client, and dnat (destination NAT) for remote resources. ๐ซถ
Oh and set --verb 6 for debugging info showing the transformation of src/dest addresses in packets. Chef's kiss for troubleshooting.
--connect-retry argsโ waitnseconds between connection attempts (default1). Repeated reconnection attempts get slowed down after 5 retries per remote by doubling the wait time after each unsuccessful attempt. It's giving exponential backoff but make it cute.
Valid syntaxes:
connect retry n
connect retry n max
If the optional argument max is specified, the maximum wait time in seconds gets capped at that value (default 300). So it can't just spiral forever, periodt.
--connect-retry-max nโnis how many times each--remoteor<connection>entry gets tried. If you setnto1it would try each entry exactly once. A successful connection resets the counter โจ (default unlimited).
--connect-timeout nโ not me redirecting you, but go see--server-poll-timeout. ๐
--dns argsโ client DNS configuration to be used with the connection. Big one, buckle up ๐ธ
Valid syntaxes:
dns search-domains domain [domain ...]
dns server n address addr[:port] [addr[:port] ...]
dns server n resolve-domains domain [domain ...]
dns server n dnssec yes|optional|no
dns server n transport DoH|DoT|plain
dns server n sni server-name
The --dns search-domains directive takes one or more domain names to be added as DNS domain suffixes. If it's repeated multiple times within a configuration, the domains are appended โ so for example domain names pushed by a server will amend the locally defined ones. Bestie they just stack. ๐ฅ
The --dns server directive is how you configure DNS server n. That server id n has to be a value between -128 and 127. For pushed DNS server options it must be between 0 and 127. The server id is used to group options and also for ordering the list of configured DNS servers โ lower numbers come first. DNS servers being pushed to a client replace already configured DNS servers with the same server id. Only the group of options corresponding to the lowest server id is applied. Main character server only ๐
The address option configures the IPv4 and / or IPv6 address(es) of the DNS server. Up to eight addresses can be specified per DNS server. Optionally a port can be appended after a colon. IPv6 addresses need to be enclosed in brackets if a port is appended. Don't forget the brackets, I'm begging ๐ญ
The resolve-domains option takes one or more DNS domains used to define a split-dns or dns-routing setup, where only the given domains are resolved by the server. Systems which do not support fine grained DNS domain configuration will ignore this setting. Rude of them but okay.
The dnssec option configures validation of DNSSEC records. While the exact semantics may differ for resolvers on different systems, yes likely makes validation mandatory, no disables it, and optional uses it opportunistically. She's flexible โจ
The transport option enables DNS-over-HTTPS (DoH) or DNS-over-TLS (DoT) for a DNS server. The sni option can be used with them to specify the server-name for TLS server name indication.
Each server has to have at least one address configured for a configuration to be valid. All the other options can be omitted. That's the one non-negotiable.
Note that not all options may be supported on all platforms. As soon support for different systems is implemented, information will be added here how unsupported options are treated. (Yes, that's the vibe for now.)
The --dns option will eventually obsolete the --dhcp-option directive. Until then it will replace configuration at the places --dhcp-option puts it, so that --dns overrides --dhcp-option. Thus, --dns can be used today to migrate from --dhcp-option. Glow-up arc ๐
Windows only:
- If
tap-windows6is in use, dns servers are set by DHCP by default. In this case only--dns search-domainsand--dns server n address ..with the lowest value ofnare interpreted. All other--dnsoptions are ignored. Use of thedcodriver is the recommended way to make use of these new features. - If
--dns server n resolve-domainsis in use, the DNS server addresses corresponding tonare set on the interface only ifsearch-domainsis also specified. Otherwise these DNS addresses are used only for NRPT rules for split-DNS.
--explicit-exit-notify nโ in UDP client mode or point-to-point mode, send server/peer an exit notification if the tunnel is restarted or the OpenVPN process is exited. In client mode, on exit/restart, this option tells the server to immediately close its client instance object rather than waiting for a timeout. No ghosting your server, bestie ๐ซถ
If both server and client support sending this message using the control channel, the message will be sent as a control-channel message. Otherwise the message is sent as a data-channel message, which will be ignored by data-channel offloaded peers.
The n parameter (default 1 if not present) controls the maximum number of attempts that the client will try to resend the exit notification message if messages are sent in data-channel mode.
In UDP server mode, send RESTART control channel command to connected clients. The n parameter (default 1 if not present) controls client behavior. With n = 1 the client will attempt to reconnect to the same server, with n = 2 the client will advance to the next server. Choose your fighter ๐
OpenVPN will not send any exit notifications unless this option is enabled. Fr fr, nothing happens without it.
--inactive argsโ causes OpenVPN to exit afternseconds 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 is0seconds, which disables this feature. So by default she stays ๐๏ธ
Valid syntaxes:
inactive n
inactive n bytes
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. The โจvibe checkโจ is on real user traffic only.
NOTE: on FreeBSD with DCO, due to platform limits, the previous paragraph is not correct. In that case, encapsulation overhead and keepalives are counted, so using this feature needs a sufficiently-high bytes value to take these extra numbers into account. Bestie, set that number high or she'll dip on you. ๐ญ
--proto-force pโ when iterating through connection profiles, only consider profiles using protocolp(tcp|udp).
Note that this specifically only filters by the transport layer protocol, i.e. UDP or TCP. This does not affect whether IPv4 or IPv6 is used as IP protocol. Different thing entirely, don't get it twisted.
For implementation reasons the option accepts the 4 and 6 suffixes when specifying the protocol (i.e. udp4 / udp6 / tcp4 / tcp6). However, these behave the same as without the suffix and should be avoided to prevent confusion. It's giving legacy, ngl ๐
--pullโ 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--pulloption 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.
Read that again, bestie. Trust the server or don't hand it the keys to your routing table. Periodt. ๐
--pull-filter argsโ filter options on the client pushed by the server to the client. Very much a bouncer at the door ๐
Valid syntaxes:
pull-filter accept text
pull-filter ignore text
pull-filter reject text
Filter options received from the server if the option starts with text. 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 text 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 text 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.
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. She's dramatic, use ignore if you want peace โจ
Warning: pull-filter cannot be relied upon as a security measure to protect against offending options pushed by a server. For example, the filter could be defeated by pushing options with extra spaces between tokens or other formatting variations. It's a filter, not a fortress, okay? ๐
--push-peer-infoโ push additional information about the client to server. The following data is always pushed to the server:IV_VER=<version>โ the OpenVPN version the client is running ๐IV_PLAT=[linux|solaris|openbsd|mac|netbsd|freebsd|win]โ the client's OS platform, no capIV_PROTOโ deets about which protocol extensions the peer supports. It's a bitfield, bestie, and the bits go like this:- bit 0: Reserved, should always be zero ๐
- bit 1: the peer supports peer-id floating mechanism
- bit 2: the client expects a push-reply and the server may send this reply without waiting for a push-request first.
- bit 3: the client is capable of doing key derivation using RFC5705 key material exporter.
- bit 4: the client is capable of accepting additional arguments to the AUTH_PENDING message.
- bit 5: the client supports doing feature negotiation in P2P mode
- bit 6: the client is capable of parsing and receiving the
--dnspushed option - bit 7: the client is capable of sending exit notification via control channel using EXIT message. Also, the client is accepting the protocol-flags pushed option for the EKM capability
- bit 8: the client is capable of accepting
AUTH_FAILED,TEMPmessages - bit 9: the client is capable of dynamic tls-crypt
- bit 10: the client is capable of data epoch keys
IV_NCP=2โ negotiable ciphers, the client supports--cipherpushed by the server, and a value of 2 or greater means the client supports AES-GCM-128 and AES-GCM-256. โ ๏ธ Heads up:IV_NCPis deprecated in favor ofIV_CIPHERS.IV_CIPHERS=<data-ciphers>โ the client announces the list of supported ciphers configured with the--data-ciphersoption to the server.IV_MTU=<max_mtu>โ the client announces the support of pushable MTU and the maximum MTU it is willing to accept.IV_GUI_VER=<gui_id> <version>โ the UI version of a UI if one is running, for examplede.blinkt.openvpn 0.5.47for the Android app. This may be set by the client UI/GUI using--setenv.IV_SSO=[crtext,][openurl,][proxy_url]โ additional authentication methods supported by the client. This may be set by the client UI/GUI using--setenv.
The following flags depend on which compression formats are compiled in and whether compression is allowed by options. See Protocol options for more details.
IV_LZO=1โ if the client supports LZO compression.IV_LZO_STUB=1โ if the client was built with LZO stub capability. This is only sent ifIV_LZO=1is not sent. It means the client can talk to a server configured with--comp-lzo no.IV_LZ4=1andIV_LZ4v2=1โ if the client supports LZ4 compression.IV_COMP_STUB=1andIV_COMP_STUBv2=1โ if the client supports stub compression. It means the client can talk to a server configured with--compress.
When --push-peer-info is enabled the additional information consists of the following data:
IV_HWADDR=<string>โ this is intended to be a unique and persistent ID of the client. The string value can be any readable ASCII string up to 64 bytes. OpenVPN 2.x and some other implementations use the MAC address of the client's interface used to reach the default gateway. If this string is generated by the client, it should be consistent and preserved across independent sessions and preferably re-installations and upgrades. ๐IV_SSL=<version string>โ the ssl library 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.1for Windows 7. This may be set by the client UI/GUI using--setenv. On Windows systems it is automatically determined by openvpn itself. On other platforms OpenVPN will default to sending the information returned by theuname()system call in the release field, which is usually the currently running kernel version. This is highly system specific, though.UV_<name>=<value>โ client environment variables whose names start withUV_
โจ --remote args โจ
Remote host name or IP address, port and protocol. The whole "where am I even connecting to" moment, bestie ๐
Valid syntaxes:
remote host
remote host port
remote host port proto
The port and proto arguments are optional. The OpenVPN client will try to connect to a server at host:port. The proto argument indicates the protocol to use when connecting with the remote, and may be tcp or udp. To enforce IPv4 or IPv6 connections add a 4 or 6 suffix; like udp4 / udp6 / tcp4 / tcp6.
On the client, multiple --remote options may be specified for redundancy, each referring to a different OpenVPN server, in the order specified by the list of --remote options. Specifying multiple --remote options for this purpose is a special case of the more general connection-profile feature. See the <connection> documentation below.
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. One at a time, main character energy ๐
Examples:
remote server1.example.net
remote server1.example.net 1194
remote server2.example.net 1194 tcp
Note: Since UDP is connectionless, connection failure is defined by the--pingand--ping-restartoptions.
Also, if you use multiple--remoteoptions, AND you are dropping root privileges on the client with--userand/or--groupAND 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). No skipping the vibe check, sorry ๐ซถ
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.
--remote-randomโ when multiple--remoteaddress/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. Shuffle and slay ๐--remote-random-hostnameโ 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".--resolv-retry nโ if hostname resolve fails for--remote, retry resolve fornseconds before failing.
Set n to infinite to retry indefinitely.
By default, --resolv-retry infinite is enabled. You can disable by setting n=0.
--preresolveโ resolve configured--remote,--local,--http-proxy, and--socks-proxyhostnames at startup before opening the connection.
The resolved addresses are cached and reused for reconnects, so OpenVPN will not re-resolve these hostnames after the initial connection attempt. This can help configurations where DNS is unavailable while the VPN is down, but can be counter-productive for dynamic DNS names or when roaming between networks where address family availability changes, such as DNS64/NAT64. ๐ฆ
--single-sessionโ 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.
--single-session can be used with --ping-exit or --inactive to create a single dynamic session that will exit when finished. One connection and then we're done, periodt ๐
--server-poll-timeout nโ when connecting to a remote server do not wait for more thannseconds for a response before trying the next server. The default value is120. This timeout includes proxy and TCP connect timeouts.--static-challenge argsโ enable static challenge/response protocol
Valid syntax:
static-challenge text echo [format]
The text challenge text is presented to the user which describes what information is requested. The echo flag indicates if the user's input should be echoed on the screen. Valid echo values are 0 or 1. The optional format indicates whether the password and response should be combined using the SCRV1 protocol (format = scrv1) or simply concatenated (format = concat). scrv1 is the default.
See management-notes.txt in the OpenVPN distribution for a description of the OpenVPN challenge/response protocol. ๐โจ
--http-proxyargs โ bestie, this is how you make OpenVPN slide out through an HTTP proxy to reach the remote host ๐ You need at least an address server and a port argument, no skipping.
If the proxy is like "who dis, give me HTTP Proxy-Authenticate", you can hand over either a file name pointing at an authfile that has a username and password sitting on 2 lines, or the word stdin to make it prompt you from the console. That content can also be dropped straight into the config file with the --http-proxy-user-pass option (go peek at INLINE FILE SUPPORT, iykyk).
The last optional argument is the auth-method, and it's gotta be one of none, basic, or ntlm2.
HTTP Digest authentication is supported too, but only via the auto or auto-nct flags (scroll down). And heads up: this has to replace the authfile argument. Not both. One or the other. Periodt.
The auto flag makes OpenVPN figure out the auth-method all by itself and query stdin or the management interface for username/password credentials, if it needs them. This flag exists on OpenVPN 2.1 or higher ๐
The auto-nct flag (that's "no clear-text auth") tells OpenVPN to automatically determine the authentication method, but to reject weak authentication protocols such as HTTP Basic Authentication. Iconic, honestly ๐
Examples:
# no authentication
http-proxy proxy.example.net 3128
# basic authentication, load credentials from file
http-proxy proxy.example.net 3128 authfile.txt
# basic authentication, ask user for credentials
http-proxy proxy.example.net 3128 stdin
# NTLM authentication, load credentials from file
http-proxy proxy.example.net 3128 authfile.txt ntlm2
# determine which authentication is required, ask user for credentials
http-proxy proxy.example.net 3128 auto
# determine which authentication is required, but reject basic
http-proxy proxy.example.net 3128 auto-nct
# determine which authentication is required, but set credentials
http-proxy proxy.example.net 3128 auto
http-proxy-user-pass authfile.txt
# basic authentication, specify credentials inline
http-proxy proxy.example.net 3128 "" basic
<http-proxy-user-pass>
username
password
</http-proxy-user-pass>
Note that support for NTLMv1 proxies was removed with OpenVPN 2.7. Sontlmis now just an alias forntlm2; i.e. OpenVPN will always attempt to use NTLMv2 authentication. Rip NTLMv1, you will not be missed ๐
--http-proxy-user-passuserpass โ overwrites the username/password info for--http-proxy. If you specify it as an inline option (again, see INLINE FILE SUPPORT), it gets read as username/password separated by a newline. When you specify it on the command line instead, it's interpreted as a filename โ same deal as the third argument to--http-proxy. ๐ธ
Example:
<http-proxy-user-pass>
username
password
</http-proxy-user-pass>
--http-proxy-optionargs โ sets extended HTTP proxy options, because sometimes you need โจextraโจ. It requires an option type as the argument, plus an optional parameter to that type. Repeat it to set multiple options, stack 'em up ๐ง- VERSION version โ set the HTTP version number to version (default
1.0). - AGENT user-agent โ set the HTTP
"User-Agent"string to user-agent. - CUSTOM-HEADER name content โ adds the custom Header, with name as the name and content as the content of the custom HTTP header.
- VERSION version โ set the HTTP version number to version (default
Examples:
http-proxy-option VERSION 1.1
http-proxy-option AGENT OpenVPN/2.4
http-proxy-option X-Proxy-Flag some-flags
--socks-proxyargs โ connects to the remote host through a Socks5 proxy, no cap ๐งฆ A required server argument is needed. Optionally you can give a port (default1080) and an authfile. The authfile is a file containing a username and password on 2 lines, or you can usestdinto prompt from the console. Easy.
๐ฅ๏ธ Server Options โจ
Okay so starting with OpenVPN 2.0, a multi-client TCP/UDP server mode is a whole thing, and you turn it on with the --mode server option ๐
In server mode, OpenVPN will listen on a single port for incoming client connections. All those client connections get routed through a single tun or tap interface. This mode is literally designed for scalability and should be able to support hundreds or even thousands of clients on sufficiently fast hardware. Main character energy fr fr.
SSL/TLS authentication must be used in this mode. Non-negotiable bestie.
--auth-gen-tokenargs โ returns an authentication token to successfully authenticated clients ๐
Valid syntax:
auth-gen-token [lifetime] [renewal-time] [external-auth]
After a successful user/password authentication, the OpenVPN server will, with this option, generate a temporary authentication token and push that to the client. On the following renegotiations, the OpenVPN client will pass this token instead of the user's 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 tokens implemented by this mechanism include an initial timestamp and a renew timestamp, and they're secured by HMAC ๐ฅ
The lifetime argument defines how long the generated token is valid. lifetime is defined in seconds. If lifetime is not set, or it is set to 0, the token will never expire.
If renewal-time is not set it defaults to reneg-sec.
The token will expire either after the configured lifetime of the token is reached, or after not being renewed for more than 2 * renewal-time seconds. Clients will be sent renewed tokens on every TLS renegotiation. If renewal-time is lower than reneg-sec, the server will push an updated temporary authentication token every reneweal-time seconds. This is done to invalidate a token if a client is disconnected for a sufficiently long time, while at the same time permitting much longer token lifetimes for active clients.
This feature is useful for environments which are configured to use One Time Passwords (OTP) as part of the user/password authentications, and where that authentication mechanism does not implement any auth-token support.
When the external-auth keyword is present, the normal authentication method will always be called even if auth-token succeeds. Normally other authentications method are skipped if auth-token verification succeeds or fails.
This option postpones this decision to the external authentication methods and checks the validity of the account and does other checks.
In this mode the environment will have a session_id variable that holds the session id from auth-gen-token. Also an environment variable session_state is present. This variable indicates whether the auth-token has succeeded or not. It can have the following values:
- Initial โ no token from client.
- Authenticated โ token is valid and not expired.
- Expired โ token is valid but has expired.
- Invalid โ token is invalid (failed HMAC or wrong length)
- AuthenticatedEmptyUser / ExpiredEmptyUser โ the token is not valid with the username sent from the client, but would be valid (or expired) if we assume an empty username was used instead. These two cases are a workaround for behaviour in OpenVPN 3. If this workaround is not needed, these two cases should be handled in the same way as
Invalid.
Warning: use this feature only if you want your authentication method called on every verification. Since the external authentication is called, it needs to also indicate a success or failure of the authentication. It is strongly recommended to return an authentication failure in the case of theInvalid/Expiredauth-token with theexternal-authoption, unless the client could authenticate in another acceptable way (e.g. client certificate) โ otherwise returning success will lead to authentication bypass (as does returning success on a wrong password from a script). ๐ญ In the case thatExpiredtoken is accepted, the token will keep the session id and start time from the original (expired) token.
Note: the username for--auth-gen-tokencan be overridden by--override-username. In this case the client will be pushed also the--auth-token-useroption, and an auth token that is valid for that username instead of the original username that the client authenticated with. ๐ฆ
--auth-gen-token-secretfile โ specifies a file that holds a secret for the HMAC used in--auth-gen-token. If file is not present, OpenVPN will generate a random secret on startup. You should use this file if auth-token should validate after restarting a server, or if a client should be able to roam between multiple OpenVPN servers with their auth-token ๐--auth-user-pass-optionalโ allow connections by clients that do not specify a username/password. Normally, when--auth-user-pass-verifyor--management-client-authare specified (or an authentication plugin module), the OpenVPN server daemon will require connecting clients to specify a username and password. This option makes the submission of a username/password by clients optional, passing the responsibility to the user-defined authentication module/script to accept or deny the client based on other factors (such as the setting of X509 certificate fields) ๐
When this option is used, and a connecting client does not submit a username/password, the user-defined authentication module/script will see the username and password as being set to empty strings ("").
The authentication module/script MUST have logic to detect this condition and respond accordingly. Like, actually must. Don't skip that part ๐
--ccd-exclusiveโ require, as a condition of authentication, that a connecting client has a--client-config-dirfile. No file, no entry ๐ช--client-config-dir dirโ okay so bestie, this one is a whole moment. You point it at a directory dir, and the second a connecting client finishes authenticating, OpenVPN goes rummaging in that directory looking for a file named exactly like the client's X509 common name. Found one? It gets opened and parsed for client-specific config options. No match? Then OpenVPN tries to open a default file calledDEFAULTโ you can provide that one but honestly you don't have to, it's not required. And heads up: those config files gotta be readable by the OpenVPN process after it's dropped its root privileges. ๐ญ
This file can specify a fixed IP address for a given client using --ifconfig-push, as well as fixed subnets owned by the client using --iroute.
One of the genuinely iconic properties of this option: it lets you create, edit, or delete client config files while the server is live, no restart needed. main character energy fr.
The following options are legal in a client-specific context: --push, --push-reset, --push-remove, --iroute, --ifconfig-push, --vlan-pvid and --config.
Note: OpenVPN uses the CN exactly as written in the certificate. But since this is a file access the filesystem might interfere. Importantly OpenVPN will consider two CNs that only differ in case as different names but a case-insensitive filesystem (like you might encounter on Windows or macOS) will treat them as the same. When you generate your certificates make sure that the CNs are sufficiently different to not cause issues. When trusting an external CA note that this is a potential attack vector via maliciously generated certificates that exploit this issue. ๐
--client-to-clientโ so the OpenVPN server mode handles multiple clients through a singletunortapinterface, which lowkey makes it a router. This flag tells OpenVPN to route client-to-client traffic internally instead of pushing all client-originating traffic out to the TUN/TAP interface.
When this option is used, each client will "see" the other clients which are currently connected. Otherwise, each client will only see the server. Don't use this option if you want to firewall tunnel traffic using custom, per-client rules.
Please note that when using data channel offload this option has no effect. Packets are always sent to the tunnel interface and then routed based on the system routing table.
--disableโ disables a particular client (based on the common name) from connecting. Don't use this option to disable a client due to key or password compromise โ use a CRL (certificate revocation list) instead (see the--crl-verifyoption). ๐จ
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.
--connect-freq argsโ allows a maximum of n new connections per sec seconds from clients.
Valid syntax:
connect-freq n sec
This is designed to contain DoS attacks which flood the server with connection requests using certificates which will ultimately fail to authenticate.
This limit applies after --connect-freq-initial and only applies to client that have completed the three-way handshake or client that use --tls-crypt-v2 without cookie support (allow-noncookie argument to --tls-crypt-v2).
This is an imperfect solution however, because in a real DoS scenario, legitimate connections might also be refused. ๐
For the best protection against DoS attacks in server mode, use --proto udp and either --tls-auth or --tls-crypt. slay.
--connect-freq-initial argsโ (UDP only) allows a maximum of n initial connection packet responses per sec seconds from the OpenVPN server to clients.
Valid syntax:
connect-freq-initial n sec
OpenVPN starting at 2.6 is very efficient in responding to initial connection packets. When not limiting the initial responses an OpenVPN daemon can be abused in reflection attacks. This option is designed to limit the rate OpenVPN will respond to initial attacks.
Connection attempts that complete the initial three-way handshake will not be counted against the limit. The default is to allow 100 initial connection per 10s.
--duplicate-cnโ allows multiple clients with the same common name to concurrently connect. In the absence of this option, OpenVPN will disconnect a client instance upon connection of a new client having the same common name. โจ--ifconfig-pool argsโ sets aside a pool of subnets to be dynamically allocated to connecting clients, similar to a DHCP server.
Valid syntax:
ifconfig-pool start-IP end-IP [netmask]
For tun-style tunnels, each client will be given a /30 subnet (for interoperability with Windows clients). For tap-style tunnels, individual addresses will be allocated, and the optional netmask parameter will also be pushed to clients.
--ifconfig-ipv6-pool argsโ specifies an IPv6 address pool for dynamic assignment to clients.
Valid args:
ifconfig-ipv6-pool ipv6addr/bits
The pool starts at ipv6addr and matches the offset determined from the start of the IPv4 pool. If the host part of the given IPv6 address is 0, the pool starts at ipv6addr +1.
--ifconfig-pool-persist argsโ persist/unpersist ifconfig-pool data to file, at seconds intervals (default600), as well as on program startup and shutdown.
Valid syntax:
ifconfig-pool-persist file [seconds]
The goal of this option is to provide a long-term association between clients (denoted by their common name) and the virtual IP address assigned to them from the ifconfig-pool. Maintaining a long-term association is good for clients because it allows them to effectively use the --persist-tun option.
file is a comma-delimited ASCII file, formatted as <Common-Name>,<IP-address>. ๐
If seconds = 0, file will be treated as read-only. This is useful if you would like to treat file as a configuration file.
Note that the entries in this file are treated by OpenVPN as suggestions only, based on past associations between a common name and IP address. They do not guarantee that the given common name will always receive the given IP address. If you want guaranteed assignment, use --ifconfig-push.
--ifconfig-push argsโ pushes virtual IP endpoints for client tunnel, overriding the--ifconfig-pooldynamic allocation.
Valid syntax:
ifconfig-push local remote-netmask [alias]
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:
- Use
--client-connectscript generated file for static IP (first choice). - Use
--client-config-dirfile for static IP (next choice). - Use
--ifconfig-poolallocation for dynamic IP (last choice).
When DCO is enabled and the IP is not in contained in the network specified by --ifconfig, OpenVPN will install a /32 host route for the local IP address.
--ifconfig-ipv6-push argsโ for--client-config-dirper-client static IPv6 interface configuration, see--client-config-dirand--ifconfig-pushfor more details.
Valid syntax:
ifconfig-ipv6-push ipv6addr/bits ipv6remote
When DCO is enabled and the IP is not in contained in the network specified by --ifconfig-ipv6, OpenVPN will install a /128 host route for the ipv6addr IP address.
--multihome [same-interface]โ configures a multi-homed UDP server. This option needs to be used when a server has more than one IP address (e.g. multiple interfaces, or secondary IP addresses), and is not using--localto force binding to one specific address only. This option will add some extra lookups to the packet path to ensure that the UDP reply packets are always sent from the address that the client is talking to. This is not supported on all platforms, and it adds more processing, so it's not enabled by default. ๐
Notes:
- This option is only relevant for UDP servers.
- Starting with 2.7.0, OpenVPN will ignore the incoming interface of the packet, and leave selection of the outgoing interface to the normal routing/policy mechanisms of the OS ("set
ipi_ifindex=0"). - if the
same-interfaceflag is added, OpenVPN will copy the incoming interface index to the outgoing interface index, trying to send the packet out over the same interface where it came in on (= restoring earlier OpenVPN behaviour). This might not work if there are no usable routes on that interface. ๐ญ
- the *BSD systems use a totally different API for IPv4 that doesn't even hand over the interface index (
IP_RECVDSTADDR), so over there this whole difference only kicks in for IPv6. ok noted ๐
โจ --iroute args โจ
Spawn an internal route that points at one specific client. If you leave the netmask out, it defaults to 255.255.255.255 โ no cap.
Valid syntax:
iroute network [netmask]
So here's the vibe: this directive lets you route a fixed subnet from the server straight to a particular client, no matter where that client happens to be connecting from. ๐ฆ But bestie, listen โ you still have to add the route to the system routing table too (like, with --route). Why two routes?? Because they do two different jobs: --route sends the packet from the kernel over to OpenVPN. Then once it's inside OpenVPN, --iroute takes over and points it at the specific client. Two hops of routing, one glowing packet. โจ
When you're using DCO though, --iroute is usually enough on its own โ DCO can fully configure the routing table itself. The extra --route only matters if you specifically want traffic for that network pointed at the VPN interface even when the responsible client isn't connected (in which case the traffic just gets dropped, fyi).
This option has to live either in a client instance config file via --client-config-dir, or be dynamically generated by a --client-connect script. Those are your only two doors. ๐ช
Also, --iroute has a whole situationship with --push "route ...". Basically --iroute declares "this subnet belongs to this client" (let's call her client A ๐). If you want other clients to be able to reach A's subnet, you use --push "route ..." together with --client-to-client. And for all clients to see A's subnet, OpenVPN has to push that route to everyone EXCEPT A โ because A already owns it, obviously, she doesn't need to be told about her own subnet. OpenVPN pulls this off by simply not pushing a route to a client if it matches one of that client's iroutes. smart, no notes. ๐
โจ --iroute-ipv6 args โจ
This is the --client-config-dir per-client static IPv6 route config situation โ go read --iroute for the full tea on how to set this up and use it, and how --iroute and --route interact. ๐
Valid syntax:
iroute-ipv6 ipv6addr/bits
โจ --max-clients n โจ
Caps the server at a maximum of n concurrent clients. Defaults to 1024. It's giving bouncer at the club ๐
โจ --max-routes-per-client n โจ
Allows a maximum of n internal routes per client (default 256). This one exists to help contain DoS attacks โ the scenario being an authenticated client flooding the server with packets that look like they're coming from a zillion unique MAC addresses, which would force the server to burn through virtual memory as its internal routing table balloons. ๐ญ This directive can go in a --client-config-dir file, or be auto-generated by a --client-connect script, to override the global value for one particular client.
Heads up: this directive affects OpenVPN's internal routing table, not the kernel routing table. Different table, bestie. ๐ซถ
โจ --override-username username โจ
Sets the username of a connection to the username you specify. That username also gets used by --auth-gen-token. But โ plot twist โ the overridden username only takes effect after --client-config-dir has been read and the --auth-user-pass-verify and --client-connect scripts have already run.
Also --username-as-common-name will use the client-provided username as the common-name. It's recommended to avoid --override-username if you're using --username-as-common-name. pick a lane bestie ๐
The changed username gets picked up by the status output and by --auth-gen-token. It also gets pushed to the client using --auth-token-user if --auth-gen-token is enabled.
Internally, on all subsequent renegotiations, the client-provided username gets replaced by the username from --override-username. And if the client switches to a username that's different from both the initial one and the overridden one? Rejected. blocked. ๐
Special care should be taken that both the initial username of the client and the overridden username are handled correctly when using --override-username and the related options โ to avoid authentication/authorisation bypasses. This is the serious part, don't skip it. ๐ฅ
This option is mainly for use cases that use certificates and multi factor authentication, and therefore don't provide a username that --auth-gen-token could use โ it's how you give those scenarios a username.
If the --auth-token directive is pushed by another script/plugin or the management interface, consider also generating and pushing --auth-token-user.
โจ --port-share args โจ
Share OpenVPN TCP with another service. generous queen ๐
Valid syntax:
port-share host port [dir]
When it's running in TCP server mode, this shares the OpenVPN port with another application โ like, say, an HTTPS server. If OpenVPN senses a connection to its port that's using a non-OpenVPN protocol, it proxies that connection over to the server at host:port. Currently it's only designed to work with HTTP/HTTPS, though theoretically it could be extended to other protocols like ssh.
dir specifies an optional directory where a temporary file gets dynamically generated for each proxy connection โ name N, content C, where C is the source IP:port of the client connection and N is the source IP:port of the connection to the proxy receiver. The proxy receiver can use that directory as a dictionary to figure out where a connection came from. Each generated file gets automatically deleted when the proxied connection is torn down. โจ
Not implemented on Windows. ๐ช๐ซ
โจ --push option โจ
Pushes a config file option back to the client for remote execution. Note that option must be wrapped in double quotes (""). The client has to specify --pull in its config file. The set of options you can push is limited by both feasibility and security โ some options, like anything that would execute scripts, are banned, because otherwise a compromised server could just execute arbitrary code on the client. and we are NOT doing that ๐ค Other options, like TLS or MTU parameters, can't be pushed because the client needs to already know them before the connection to the server can even be initiated.
Here's a partial list of options that can currently be pushed: --route, --route-gateway, --route-delay, --redirect-gateway, --ip-win32, --dhcp-option, --dns, --inactive, --ping, --ping-exit, --ping-restart, --setenv, --auth-token, --persist-tun, --echo, --comp-lzo, --socket-flags, --sndbuf, --rcvbuf, --session-timeout
Note: using--pushrequires OpenVPN to run in--mode server(or to be using one of the--server,--server-bridgehelper directives).
โจ --push-remove opt โจ
Selectively removes all --push options matching opt from the option list for a client. opt is matched as a substring against the whole option string that's about to be pushed to the client โ so --push-remove route would remove all --push route ... and --push route-ipv6 ... statements, while --push-remove "route-ipv6 2001:" would only remove IPv6 routes for 2001:... networks. precision ๐
--push-remove can only be used in a client-specific context โ like in a --client-config-dir file, or a --client-connect script or plugin. Similar to --push-reset, just more selective.
NOTE: to change an option, you can use--push-removeto first remove the old value, and then add a new--pushoption with the new value.
NOTE 2: due to implementation details,ifconfigandifconfig-ipv6can only be removed with an exact match on the option (push-remove ifconfig) โ no substring matching, and no matching on the IPv4/IPv6 address argument is possible. ๐
โจ --push-reset โจ
Don't inherit the global push list for a specific client instance. Specify this option in a client-specific context, like with a --client-config-dir configuration file. This option will ignore --push options at the global config file level.
NOTE:--push-resetis very thorough โ it removes almost all options from the list of to-be-pushed options. And in many cases some of those options will need to be re-configured afterwards. Specifically,--topology subnetand--route-gatewaywill get lost, and this will break client configs in many cases. So for most purposes,--push-removeis better suited to selectively remove push options for individual clients. it's giving sledgehammer vs. scalpel ๐
โจ --server args โจ
A helper directive designed to simplify configuring OpenVPN's server mode. It sets up an OpenVPN server that allocates addresses to clients out of the given network/netmask. The server itself takes the .1 address of the given network as the server-side endpoint of the local TUN/TAP interface. And if you pass the optional nopool flag, no dynamic IP address pool gets prepared for VPN clients. ๐
Valid syntax:
server network netmask [nopool]
For example, --server 10.8.0.0 255.255.255.0 expands as follows:
mode server
tls-server
push "topology [topology]"
if dev tun AND (topology == net30 OR topology == p2p):
ifconfig 10.8.0.1 10.8.0.2
if !nopool:
ifconfig-pool 10.8.0.4 10.8.0.251
route 10.8.0.0 255.255.255.0
if client-to-client:
push "route 10.8.0.0 255.255.255.0"
else if topology == net30:
push "route 10.8.0.1"
if dev tap OR (dev tun AND topology == subnet):
ifconfig 10.8.0.1 255.255.255.0
if !nopool:
ifconfig-pool 10.8.0.2 10.8.0.253 255.255.255.0
push "route-gateway 10.8.0.1"
if route-gateway unset:
route-gateway 10.8.0.2
Don't use--serverif you're ethernet bridging โ use--server-bridgeinstead. wrong tool for the vibe fr fr ๐ธ
--server-bridgeargs โ bestie, this is the glow-up helper for ethernet bridging setups. It's a sibling of--server, made to make your life easier when you're running OpenVPN's server mode in ethernet bridging configurations. ๐
Here are the valid syntaxes, exactly as they live:
server-bridge gateway netmask pool-start-IP pool-end-IP
server-bridge [nogw]
Use --server-bridge with zero parameters and it flips on DHCP-proxy mode โ meaning your connecting OpenVPN clients get their TAP adapter's IP address handed to them by the DHCP server chillin' on the OpenVPN server-side LAN. Lowkey important caveat though: only clients that support binding a DHCP client with the TAP adapter (Windows girlies, I'm looking at you) can do this mode. The optional nogw flag (advanced, iykyk) means gateway info does not get pushed to the client. ๐
Okay so to actually set up ethernet bridging, the order of operations matters:
- First, use your OS's bridging capability to bridge the TAP interface with the ethernet NIC interface. On Linux that's the
brctltool; on Windows XP it's the Network Connections Panel โ select the ethernet and TAP adapters, right-click, and hit "Bridge Connections". ๐ - Next, manually set the IP/netmask on the bridge interface. The
gatewayandnetmaskparameters you hand to--server-bridgecan be either the IP/netmask of the bridge interface itself, or the IP/netmask of the default gateway/router on the bridged subnet. Either is fine, fr fr. - Finally, carve out an IP range in the bridged subnet โ that's your
pool-start-IPandpool-end-IPโ and that's the range OpenVPN allocates to connecting clients. โจ
For example, server-bridge 10.8.0.4 255.255.255.0 10.8.0.128 10.8.0.254 expands as follows:
mode server
tls-server
ifconfig-pool 10.8.0.128 10.8.0.254 255.255.255.0
push "route-gateway 10.8.0.4"
In another example, --server-bridge (no parameters, just vibes) expands as follows:
mode server
tls-server
push "route-gateway dhcp"
Or --server-bridge nogw expands as follows:
mode server
tls-server
--server-ipv6args โ the convenience-function that turns on a whole bundle of IPv6-related options at once, namely--ifconfig-ipv6,--ifconfig-ipv6-pooland--push tun-ipv6. Slay, one line for three things. ๐ฆ
Valid syntax:
server-ipv6 ipv6addr/bits
Pushing the --tun-ipv6 directive is done for older clients that require an explicit --tun-ipv6 in their configuration. (We love a backwards-compatible era moment. ๐)
--stale-routes-checkargs โ say goodbye to routes that haven't had any activity for n seconds (that's the ageing time). This check runs every t seconds (that's the check interval). ๐งน
Valid syntax:
stale-routes-check n [t]
If t isn't present, it defaults to n. Simple as.
Now the fine print, and it matters: only dynamically learned routes are subject to this check. Routes added from configuration โ like --iroute entries and a client's pushed ifconfig address โ are never removed by it; they only get dropped when the client disconnects. Periodt.
This option helps keep the dynamic routing table small. See also --max-routes-per-client. ๐
--username-as-common-nameโ use the authenticated username as the common-name, instead of the common-name from the client certificate. Requires that some form of--auth-user-passverification is in effect. And because the swap happens after--auth-user-passverification, your verification script or plugin still receives the common-name from the certificate. Sneaky but intentional. ๐
The common_name environment variable passed to scripts and plugins invoked after authentication (e.g. client-connect script) and file names parsed in client-config directory will match the username. ๐ฏ
--verify-client-certmode โ tells you whether the client is required to supply a valid certificate.
Possible mode options are:
noneโ a client certificate is not required. The client needs 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 rests on your --auth-user-pass-verify script, so keep in mind that bugs in your script could potentially compromise the security of your VPN. Like, genuinely, no pressure or anything. ๐
--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 you use this directive, you should also use a--auth-user-pass-verifyscript to make sure clients are authenticated using a certificate, a username and password, or possibly even both. ๐
Again, the entire responsibility of authentication rests 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. No cert, no entry, bestie. ๐ซ
If you don't use this directive (or you use --verify-client-cert require) but you also specify an --auth-user-pass-verify script, then OpenVPN performs double authentication. The client certificate verification AND the --auth-user-pass-verify script both need to succeed for a client to be authenticated and accepted onto the VPN. Two locks, one door. ๐
--vlan-taggingโ server-only option, and it's giving switch energy. It turns the OpenVPN server instance into a switch that understands VLAN-tagging, based on IEEE 802.1Q. ๐
The server TAP device and each of the connecting clients is seen as a port of the switch. All client ports are in untagged mode and the server TAP device is VLAN-tagged, untagged or accepts both, depending on the --vlan-accept setting.
Vocabulary moment, because this terminology is everywhere:
- Ethernet frames with a prepended 802.1Q tag are called "tagged".
- If the VLAN Identifier (VID) field in such a tag is non-zero, the frame is called "VLAN-tagged".
- If the VID is zero, but the Priority Control Point (PCP) field is non-zero, the frame is called "prio-tagged".
- If there's no 802.1Q tag at all, the frame is "untagged".
Using the --vlan-pvid v option once per client (see --client-config-dir), each port can be associated with a certain VID. Packets can only be forwarded between ports having the same VID. So clients with differing VIDs are completely separated from one another, even if --client-to-client is activated. Mutual blocking, but make it networking. ๐ง
The packet filtering takes place in the OpenVPN server. Clients should not have any VLAN tagging configuration applied.
The --vlan-tagging option is off by default. While it's turned off, OpenVPN accepts any Ethernet frame and does not perform any special processing for VLAN-tagged packets.
This option can only be activated in --dev tap mode. Don't try it anywhere else. โญ
--vlan-acceptargs โ configures the VLAN tagging policy for the server TAP device.
Valid syntax:
vlan-accept all|tagged|untagged
The following modes are available:
taggedโ admit only VLAN-tagged frames. Only VLAN-tagged packets are accepted, while untagged or priority-tagged packets are dropped when entering the server TAP device.untaggedโ admit only untagged and prio-tagged frames. VLAN-tagged packets are not accepted, while untagged or priority-tagged packets entering the server TAP device are tagged with the value configured for the global--vlan-pvidsetting.all(default) โ admit all frames. All packets are admitted and then treated like untagged or tagged mode respectively.
Note: some vendors refer to switch ports running in tagged mode as "trunk ports" and switch ports running in untagged mode as "access ports". Just so you're not confused when a Cisco girlie starts talking. ๐
Packets forwarded from clients to the server are VLAN-tagged with the originating client's PVID, unless the VID matches the global --vlan-pvid, in which case the tag is removed. Poof. โจ
If no PVID is configured for a given client (see --vlan-pvid), packets are tagged with 1 by default.
--vlan-pvidv โ specifies which VLAN identifier a "port" is associated with. Only valid when--vlan-taggingis specified. ๐
In the client context, the setting specifies which VLAN ID a client is associated with. In the global context, the VLAN ID of the server TAP device is set. The latter only makes sense for --vlan-accept untagged and --vlan-accept all modes.
Valid values for v go from 1 through to 4094. The global value defaults to 1. If no --vlan-pvid is specified in the client context, the global value is inherited.
In some switch implementations, the PVID is also referred to as "Native VLAN". Different name, same icon behaviour. ๐
๐ Encryption Options ๐
๐ SSL Library information ๐
--show-ciphersโ (Standalone) show all cipher algorithms to use with the--cipheroption. Window shopping, but for crypto. ๐--show-digestsโ (Standalone) show all message digest algorithms to use with the--authoption.--show-tlsโ (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. Ranking, but make it cryptographic. ๐ฅ
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.). It's a two-party vibe check, bestie. ๐ซถ
--show-enginesโ (Standalone) show currently available hardware-based crypto acceleration engines supported by the OpenSSL library. Zoom zoom. ๐๏ธ--show-groupsโ (Standalone) show all available elliptic curves/groups to use with the--ecdh-curveandtls-groupsoptions. ๐ธ
โจ Generating key material โจ
Okay bestie, it's giving locksmith era ๐. Here's how you make the keys.
--genkeyargs โ (Standalone) Generate a key to be used of the type keytype. if keyfile is left out or empty the key will be output onstdout. See the following sections for the different keytypes.
Valid syntax:
--genkey keytype keyfile
Valid keytype arguments are:
secretโ Standard OpenVPN shared secret keystls-cryptโ Alias forsecrettls-authโ Alias forsecretauth-tokenโ Key used for--auth-gen-token-keytls-crypt-v2-serverโ TLS Crypt v2 server keytls-crypt-v2-clientโ TLS Crypt v2 client key
Examples:
$ openvpn --genkey secret shared.key
$ openvpn --genkey tls-crypt shared.key
$ openvpn --genkey tls-auth shared.key
$ openvpn --genkey tls-crypt-v2-server v2crypt-server.key
$ openvpn --tls-crypt-v2 v2crypt-server.key --genkey tls-crypt-v2-client v2crypt-client-1.key
- Generating Shared Secret Keys โ Generate a shared secret, for use with the
--tls-author--tls-cryptoptions.
Syntax:
$ openvpn --genkey tls-crypt|tls-auth keyfile
The key is saved in keyfile. Both variants (tls-crypt and tls-auth) generate the same type of key. The aliases are added for convenience.
This file must be shared with the peer over a pre-existing secure channel such as scp(1).
- Generating TLS Crypt v2 Server key โ Generate a
--tls-crypt-v2key to be used by an OpenVPN server. The key is stored in keyfile.
Syntax:
--genkey tls-crypt-v2-server keyfile
- Generating TLS Crypt v2 Client key โ Generate a
--tls-crypt-v2key to be used by OpenVPN clients. The key is stored in keyfile.
Syntax
--genkey tls-crypt-v2-client keyfile [metadata]
If supplied, include the supplied metadata in the wrapped client key. This metadata must be supplied in base64-encoded form. The metadata must be at most 733 bytes long (980 characters in base64, though note that 980 base64 characters can encode more than 733 bytes).
If no metadata is supplied, OpenVPN will use a 64-bit unix timestamp representing the current time in UTC, encoded in network order, as metadata for the generated key.
A tls-crypt-v2 client key is wrapped using a server key. To generate a client key, the user must therefore supply the server key using the --tls-crypt-v2 option.
Servers can use --tls-crypt-v2-verify to specify a metadata verification command.
- Generate Authentication Token key โ Generate a new secret that can be used with
--auth-gen-token-secret
Syntax:
--genkey auth-token [keyfile]
Note: This file should be kept secret to the server as anyone that has access to this file will be able to generate auth tokens that the OpenVPN server will accept as valid. ๐คซ
๐ Data Channel Renegotiation ๐
When running OpenVPN in client/server mode, the data channel will use a separate ephemeral encryption key which is rotated at regular intervals. Spicy rotation, love that. ๐
--reneg-bytesn โ 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.
When data channel offload (DCO) is enabled, this option is ignored. DCO does not support configurable renegotiation thresholds; automatic key renegotiation mechanisms are sufficient for modern ciphers.
--reneg-pktsn โ Renegotiate data channel key after n packets sent and received (disabled by default).
When data channel offload (DCO) is enabled, this option is ignored. DCO does not support configurable renegotiation thresholds; automatic key renegotiation mechanisms are sufficient for modern ciphers.
--reneg-secargs โ Renegotiate data channel key after at most max seconds (default3600) and at least min seconds (default is 90% of max for servers, and equal to max for clients).
reneg-sec max [min]
The effective --reneg-sec value used is per session pseudo-uniform-randomized between min and max.
With the default value of 3600 this results in an effective per session value in the range of 3240 .. 3600 seconds for servers, or just 3600 for clients.
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.
๐ TLS Mode Options ๐
TLS mode is the most powerful crypto mode of OpenVPN in both security and flexibility. TLS mode works by establishing control and data channels which are multiplexed over a single TCP/UDP port. OpenVPN initiates a TLS session over the control channel and uses it to exchange cipher and HMAC keys to protect the data channel. TLS mode uses a robust reliability layer over the UDP connection for all control channel communication, while the data channel, over which encrypted tunnel data passes, is forwarded without any mediation. The result is the best of both worlds: a fast data channel that forwards over UDP with only the overhead of encrypt, decrypt, and HMAC functions, and a control channel that provides all of the security features of TLS, including certificate-based authentication and Diffie Hellman forward secrecy.
To use TLS mode, each peer that runs OpenVPN should have its own local certificate/key pair (--cert and --key), signed by the root certificate which is specified in --ca.
When two OpenVPN peers connect, each presents its local certificate to the other. Each peer will then check that its partner peer presented a certificate which was signed by the master root certificate as specified in --ca.
If that check on both peers succeeds, then the TLS negotiation will succeed, both OpenVPN peers will exchange temporary session keys, and the tunnel will begin passing data.
The OpenVPN project provides a set of scripts for managing RSA certificates and keys: https://github.com/OpenVPN/easy-rsa
--askpassfile โ Get certificate password from console or file before we daemonize.
Valid syntaxes:
askpass
askpass file
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.
--cafile โ Certificate authority (CA) file in.pemformat, also referred to as the root certificate. This file can have multiple certificates in.pemformat, 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.
--capathdir โ Directory containing trusted certificates (CAs and CRLs). Not available with mbed TLS.
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, openssl crl and X509_LOOKUP_hash_dir()(3) for more information.
Similar to the --crl-verify option, CRLs are not mandatory - OpenVPN will log the usual warning in the logs if the relevant CRL is missing, but the connection will be allowed.
--certfile|uri โ Local peer's signed certificate in.pemformat or as a URI -- must be signed by a certificate authority whose certificate is in--cafile in the peer configuration. URI is supported only when built with OpenSSL 3.0 or later and any required providers are loaded. Types of URIs supported and their syntax depends on providers. OpenSSL has internal support for"file:/absolute/path"URI in which case the scheme"file:"is optional, and any file format recognized by OpenSSL (e.g., PEM, PKCS12) is supported. PKCS#11 URI (RFC 7512) is supported by pkcs11-provider.
Every peer in an OpenVPN link running in TLS mode needs its own certificate and private key file, no sharing bestie ๐
And on top of that, each certificate should have been signed by the key of a certificate authority whose public key lives 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).
--crl-verify args : Check peer certificate against a Certificate Revocation List. No cap, this is your "you're uninvited now" list ๐
Valid syntax:
crl-verify file/directory flag
Examples:
crl-verify crl-file.pem
crl-verify /etc/openvpn/crls dir
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. slay, the rest of the squad stays safe โจ
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. that's the full reset moment fr fr
The option is not mandatory โ if the relevant CRL is missing, OpenVPN will log a warning in the logs โ e.g.
VERIFY WARNING: depth=0, unable to get certificate CRL
but the connection will be allowed. If the optional dir flag is specified, enable a different mode where the crl-verify is pointed at 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. it's giving "your name's on the list, bestie" ๐
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. don't set yourself up to fail bestie ๐
--dh file : File containing finite field Diffie Hellman parameters in .pem format (used by --tls-server only).
Set file to none to disable fine field Diffie Hellman key exchange (and to only use ECDH or newer hybrid key agreement algorithms like X25519MLKEM768 instead). Note that this requires peers to be using an SSL library that supports ECDH TLS cipher suites (e.g. OpenSSL 1.0.1+, or mbed TLS 2.0+). Starting with 2.7.0, this is the same as not specifying --dh at all.
Diffie Hellman parameters can be generated using openssl dhparam -out dh2048.pem 2048 but it is recommended to use none as finite field Diffie Hellman have been replaced by more modern variants like ECDH.
Diffie Hellman parameters may be considered public. it's public info, not a secret, so no gatekeeping ๐ซถ
--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. sorry mbed TLS girlies, this one's not for you ๐ญ
--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. chain complete, trust NOT extended โ very specific, very iconic ๐
--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.
The --hand-window parameter also controls the amount of time that the OpenVPN client repeats the pull request until it times out. yes queen, keep retrying โจ
--key file|uri : Local peer's private key in .pem format or a URI. Use the private key which was generated when you built your peer's certificate (see --cert file above). URI is supported only when built with OpenSSL 3.0 or later and any required providers are loaded. (See --cert for more details).
--ns-cert-type type : DEPRECATED The --remote-cert-tls option should be used instead. The option is still available since it can't be silently ignored and needs updates to certificates and configs on both sides of the connection. However it should not be used for new clients or servers. It depends on the deprecated nsCertType certificate field.
Might not work depending on the TLS library used.
Will be removed in a future release. it's on the way out, don't build your whole life around it ๐
--pkcs12 file : Specify a PKCS #12 file containing local private key, local certificate, and root CA certificate. This option can be used instead of --ca, --cert, and --key. Not available with mbed TLS. three-in-one, it's giving bundle deal ๐
--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.
--remote-cert-ku key-usage : 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 key-usage is a list of usage bits, the keyUsage field must have at least the same bits set as the bits in one of the values supplied in the key-usage list.
The key-usage values in the list must be encoded in hex, e.g.
remote-cert-ku a0
--remote-cert-tls type : Require that peer certificate was signed with an explicit key usage and extended key usage based on RFC3280 TLS rules.
Valid syntaxes:
remote-cert-tls server
remote-cert-tls client
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. mutual vibes check, both sides verified ๐ฆ
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, --peer-fingerprint or --tls-verify. impostor behavior gets shut DOWN, periodt ๐
--tls-auth args : Add an additional layer of HMAC authentication on top of the TLS control channel to mitigate DoS attacks and attacks on the TLS stack.
Valid syntaxes:
tls-auth file
tls-auth file 0
tls-auth file 1
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. blocked, no reply, no drama ๐
file (required) is a file in OpenVPN static key format which can be generated by --genkey.
Older versions (up to OpenVPN 2.3) supported a freeform passphrase file. This is no longer supported in newer versions (v2.4+). freeform passphrase era is OVER, bestie ๐ญ
The optional direction parameter enables the use of 2 distinct keys (HMAC-send, HMAC-receive), so that each data flow direction has a different HMAC key. This has a number of desirable security properties including eliminating certain kinds of DoS and message replay attacks. two keys, two directions, obsessed ๐ฅ
When the direction parameter is omitted, the same key is used bidirectionally.
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. don't do 0 and 0, that's not complementary, that's a mess ๐
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.
--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. wide-open listener? yeah, add the HMAC layer fr fr ๐ซถ
okay so bestie, the rationale for this feature is literally this: TLS needs a multi-packet exchange before it can authenticate a peer. ๐ During that pre-auth window, OpenVPN is out here allocating resources (memory and CPU) to this potential peer. And the potential peer is also exposing so many parts of OpenVPN and the OpenSSL library to the packets it's sending. ๐ญ Most successful network attacks today are trying to either exploit bugs in programs (like 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 is giving you this special layer of authentication on top of the TLS control channel โ meaning every packet on the control channel gets 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. ๐
--tls-groupslist โ A list of allowable groups/curves in order of preference.
Set the allowed elliptic curves/groups for the TLS session. These groups are allowed to be used in signatures and key exchange. ๐
mbedTLS currently allows all known curves per default. โจ
OpenSSL 1.1+ restricts the list per default to
"X25519:secp256r1:X448:secp521r1:secp384r1"
If you use certificates that use non-standard curves, you might need to add them here. If you do not force the ecdh curve by using --ecdh-curve, the groups for ecdh will also be picked from this list. ๐
OpenVPN maps the curve name secp256r1 to prime256v1 to allow specifying the same tls-groups option for mbedTLS and OpenSSL. ๐ง
Warning: this option not only affects elliptic curve certificates but also the key exchange in TLS 1.3 and using this option improperly will disable TLS 1.3. ๐ญ
--tls-cert-profileprofile โ Set the allowed cryptographic algorithms for certificates according to profile.
The following profiles are supported:
insecureโ Identical for mbed TLS tolegacylegacy(default) โ SHA1 and newer, RSA 2048-bit+, any elliptic curve.preferredโ SHA2 and newer, RSA 2048-bit+, any elliptic curve.suitebโ SHA256/SHA384, ECDSA with P-256 or P-384.
This option is only fully supported for mbed TLS builds. OpenSSL builds use the following approximation:
insecureโ sets "security level 0"legacy(default) โ sets "security level 1"preferredโ sets "security level 2"suitebโ sets "security level 3" and--tls-cipher "SUITEB128".
OpenVPN will migrate to 'preferred' as default in the future. Please ensure that your keys already comply. ๐
โ ๏ธ WARNING: --tls-cipher, --tls-ciphersuites and tls-groups
These options are expert features, which - if used correctly - can improve the security of your VPN connection. But it is also easy to unwittingly use them to carefully align a gun with your foot, or just break your connection. Use with care! ๐
--tls-cipherl โ 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 mbed TLS documentation for details on the cipher list interpretation. ๐
For OpenSSL, the --tls-cipher option is used for TLS 1.2 and below.
Use --show-tls to see a list of TLS ciphers supported by your crypto library. โจ
The default for --tls-cipher is to use mbed TLS's default cipher list when using mbed TLS or DEFAULT:!EXP:!LOW:!MEDIUM:!kDH:!kECDH:!DSS:!PSK:!SRP:!kRSA when using OpenSSL. ๐
--tls-ciphersuitesl โ Same as--tls-cipherbut for TLS 1.3 and up. mbed TLS has no TLS 1.3 support yet and only the--tls-ciphersetting is used. ๐ญ
The default for --tls-ciphersuites is to use the crypto library's default. ๐ธ
--tls-clientโ Enable TLS and assume client role during TLS handshake. ๐ซถ--tls-cryptkeyfile โ Encrypt and authenticate all control channel packets with the key from keyfile. (See--tls-authfor more background.) ๐
Encrypting (and authenticating) control channel packets:
- provides more privacy by hiding the certificate used for the TLS connection, ๐ต๏ธโโ๏ธ
- makes it harder to identify OpenVPN traffic as such, ๐ฅท
- provides "poor-man's" post-quantum security, against attackers who will never know the pre-shared key (i.e. no forward secrecy). ๐ฎ
In contrast to --tls-auth, --tls-crypt does not require the user to set --key-direction. โจ
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. 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. ๐
For large setups or setups where clients are not trusted, consider using --tls-crypt-v2 instead. That uses per-client unique keys, and thereby improves the bounds to 'rotate a client key at least once per 8000 years'. ๐
--tls-crypt-v2keyfile โ Valid syntax:
tls-crypt-v2 keyfile
tls-crypt-v2 keyfile force-cookie
tls-crypt-v2 keyfile allow-noncookie
Use client-specific tls-crypt keys. ๐
For clients, keyfile is a client-specific tls-crypt key. Such a key can be generated using the --genkey tls-crypt-v2-client option. โจ
For servers, keyfile is used to unwrap client-specific keys supplied by the client during connection setup. This key must be the same as the key used to generate the client-specific key (see --genkey tls-crypt-v2-client). ๐ซถ
On servers, this option can be used together with the --tls-auth or --tls-crypt option. In that case, the server will detect whether the client is using client-specific keys, and automatically select the right mode. ๐ค
The optional parameters force-cookie allows only tls-crypt-v2 clients that support a cookie based stateless three way handshake that avoids replay attacks and state exhaustion on the server side (OpenVPN 2.6 and later). The option allow-noncookie explicitly allows older tls-crypt-v2 clients. The default is (currently) allow-noncookie. ๐ช
--tls-crypt-v2-verifycmd โ Run command cmd to verify the metadata of the client-specific tls-crypt-v2 key of a connecting client. This allows server administrators to reject client connections, before exposing the TLS stack (including the notoriously dangerous X.509 and ASN.1 stacks) to the connecting client. ๐ก๏ธ
OpenVPN supplies the following environment variables to the command (and only these variables. The normal environment variables available for other scripts are NOT present):
script_typeis set totls-crypt-v2-verifymetadata_typeis set to0if the metadata was user supplied, or1if it's a 64-bit unix timestamp representing the key creation time.metadata_filecontains the filename of a temporary file that contains the client metadata.
The command can reject the connection by exiting with a non-zero exit code. ๐ซ
--tls-crypt-v2-max-agen โ Reject tls-crypt-v2 client keys that are older than n days or have no timestamp. โณ--tls-exitโ the moment TLS negotiation fails, we're out. bye bestie ๐ Super handy when you literally only want ONE attempt at connecting โ think test scripts, monitoring scripts, that kind of thing. (OpenVPN's own test suite uses it exactly like this, iykyk.)--tls-serverโ turns TLS on and makes us play the server role during the TLS handshake. And okay, quick vibe check: OpenVPN is designed as a peer-to-peer app. The whole "client" vs "server" thing is only about who does what while negotiating the TLS control channel. That's it. No cap.--tls-timeout nโ packet retransmit timeout on the TLS control channel. If we don't get an ack from the remote withinnseconds, that's a problem (default2). So here's the tea: when OpenVPN fires a control packet at its peer, it expects an acknowledgement back withinnseconds, otherwise it retransmits โ subject to a TCP-like exponential backoff algorithm. This parameter only applies to control channel packets. Data channel packets (the ones carrying your actual encrypted tunnel data) are never acknowledged, sequenced, or retransmitted by OpenVPN, because the higher level network protocols riding on top of the tunnel โ TCP, hi โ expect that job to be left to them. Respect the hierarchy, periodt.--tls-version-min argsโ sets the minimum TLS version we'll accept from the peer (default in 2.6.0 and later is"1.2").
Valid syntax:
tls-version-min version ['or-highest']
Examples for version include 1.0, 1.1, or 1.2. And if or-highest is specified and version isn't recognized? Then we only accept the highest TLS version supported by the local SSL implementation. slay โจ
--tls-version-max versionโ sets the maximum TLS version we'll use (default is the highest version supported). Examples for version include1.0,1.1, or1.2.--verify-hash argsโ DEPRECATED ๐ specify SHA1 or SHA256 fingerprint for the level-1 cert.
Valid syntax:
verify-hash hash [algo]
So what's a level-1 cert, bestie? It's the CA (or intermediate cert) that signs the leaf certificate, and it sits one removed from the leaf certificate in the direction of the root. When we accept a connection from a peer, the level-1 cert fingerprint must match hash, or certificate verification fails. Hash is written as XX:XX:.... Like, for example:
AD:B0:95:D8:09:C8:36:45:12:A9:89:C8:90:09:CB:13:72:A6:AD:16
The algo flag can be either SHA1 or SHA256. Not provided? Defaults to SHA1.
This option can also be inlined:
<verify-hash>
00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff
11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00
</verify-hash>
If the option is inlined, algo is always SHA256. ๐ซถ
--peer-fingerprint argsโ specify a SHA256 fingerprint or a whole list of SHA256 fingerprints to verify the peer certificate against. The peer certificate has to match one of the fingerprints, otherwise certificate verification fails. This option can also be inlined.
Valid syntax:
peer-fingerprint AD:B0:95:D8:09:...
or inline:
<peer-fingerprint>
00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff
11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00
</peer-fingerprint>
When the --peer-fingerprint option is used, specifying a CA with --ca or --capath is optional. That's what lets --peer-fingerprint work as an alternative to a PKI with self-signed certificates for small setups. See the examples section for such a setup. small setup girlies, this one's for you ๐ธ
--verify-x509-name argsโ accept connections only if a host's X.509 name is equal to name. The remote host still has to pass all the other tests of verification, bestie. No skipping.
Valid syntax:
verify-x509 name type
Which X.509 name gets compared to name depends on the setting of type. type can be:
subjectโ match the complete subject DN (this is the default)nameโ match a subject RDNname-prefixโ 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). So, for example, a certificate with a subject DN of:
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'
verify-x509-name Server-1 name
verify-x509-name Server- name-prefix
That last one is chef's kiss if you want a client to only accept connections to Server-1, Server-2, etc. ๐
--verify-x509-name is a useful replacement for the --tls-verify option when verifying the remote host, because --verify-x509-name works inside a --chroot environment without any dependencies. portable queen โจ
Using a name prefix is a useful alternative to managing a CRL (Certificate Revocation List) on the client, since it lets the client refuse every certificate except the ones associated with designated servers.
NOTE: Test against a name prefix only when you're using OpenVPN with a custom CA certificate that's 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. Fr fr, don't do it. ๐
--x509-track attributeโ saves the peer X509 attribute value into the environment so plugins and the management interface can use it. Prepend a+to attribute to save values from the full cert chain. Otherwise the attribute is only exported for the leaf cert (i.e. depth0of the cert chain). Values get encoded asX509_<depth>_<attribute>=<value>. You can define multiple--x509-trackoptions to track multiple attributes. collect them all ๐
attribute can be any part of the X509 Subject field or any X509v3 extension (RFC 3280). Heads up though: X509v3 extensions might not be supported when you're not using the default TLS backend library (OpenSSL). You can also request the SHA1 and SHA256 fingerprints of the cert, but that's always exported as tls_digest_{n} and tls_digest_sha256_{n} anyway.
Note that by default all parts of the X509 Subject field are exported in the environment for the whole cert chain. But if you use --x509-track at least once, then only the attributes specified by these options get exported.
Examples:
x509-track CN # exports only X509_0_CN
x509-track +CN # exports X509_{n}_CN for chain
x509-track basicConstraints # exports value of "X509v3 Basic Constraints"
x509-track SHA256 # exports SHA256 fingerprint
--x509-username-field argsโ fields in the X.509 certificate subject to be used as the username (defaultCN). If you specify multiple fields, their values get concatenated into one username using the_symbol as a separator.
Valid syntax:
x509-username-field [ext:]fieldname [[ext:]fieldname...]
Typically, this option is specified with fieldname arguments as either of the following:
x509-username-field emailAddress
x509-username-field 1.2.840.113549.1.9.1
x509-username-field ext:subjectAltName
x509-username-field CN serialNumber
Let's break it down, because this is giving โจdetailsโจ:
- The first two examples use the value of the
emailAddressattribute in the certificate's Subject field as the username โ where the first example uses the name while the second example uses the oid. - The third example uses the
ext:prefix to signify that the X.509 extension fieldnamesubjectAltNameshould be searched for anrfc822Name(email) field to be used as the username. In cases where there are multiple email addresses inext:fieldname, the last occurrence is chosen. - The last example uses the value of the
CNattribute in the Subject field, combined with the_separator and the hexadecimal representation of the certificate'sserialNumber.
When this option is used, the --verify-x509-name option will match against the chosen fieldname instead of the Common Name.
Only the subjectAltName and issuerAltName X.509 extensions and the serialNumber X.509 attribute are supported.
Non-compliant symbols are being replaced with the _ symbol โ same as the field separator โ so concatenating multiple fields with such symbols or _ symbols can potentially lead to username collisions. yikes, watch out for that ๐
๐ณ PKCS#11 / SmartCard options ๐
--pkcs11-cert-private argsโ set if access to the certificate object should be performed after login. Every provider has its own setting.
Valid syntaxes:
pkcs11-cert-private 0
pkcs11-cert-private 1
--pkcs11-id nameโ specify the serialized certificate id to be used. You can get the id from the standalone--show-pkcs11-idsoption. See also the description of the--pkcs11-providersoption. ๐ซถ--pkcs11-id-managementโ acquire the PKCS#11 id from the management interface. In this case aNEED-STR'pkcs11-id-request'real-time message will be triggered, and the application may use thepkcs11-id-countcommand to retrieve the available number of certificates, and thepkcs11-id-getcommand to retrieve the certificate id and certificate body. See also the description of the--pkcs11-providersoption.--pkcs11-pin-cache secondsโ specify how many seconds the PIN can be cached. The default is until the token is removed. set it and forget it โจ--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 a 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.
--pkcs11-protected-authentication argsโ use the PKCS#11 protected authentication path, useful for biometric and external keypad devices. Every provider has its own setting.
Valid syntaxes:
pkcs11-protected-authentication 0
pkcs11-protected-authentication 1
--pkcs11-providers providersโ okay so you wanna load some RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki) providers? ๐ณ This is your girl. You can hand it a space-separated list of one or more provider library names. And bestie, this option โ paired with--pkcs11-idorpkcs11-id-managementโ can fully stand in for--certand--keyor--pkcs12. no cert files required, we're doing tokens now ๐
So here's the tea: if p11-kit is chillin' on your system and it was enabled during build, its p11-kit-proxy.so module gets loaded by default whenever either --pkcs11-id or --pkcs11-id-management shows up without --pkcs11-providers. Cute, right? BUT โจ if default loading wasn't enabled in the build and you didn't specify any providers, those former options get ignored. just straight-up ghosted ๐ญ
--show-pkcs11-ids argsโ (Standalone) Show PKCS#11 token object list. Let's see what's on that token ๐
Valid syntax:
show-pkcs11 [provider] [cert_private]
Set cert_private to 1 if certificates are stored as private objects.
If p11-kit is present on the system, the provider argument is optional โ skip it and the default p11-kit-proxy.so module gets queried instead. ๐ฆ
And pro tip: the --verb option can be used BEFORE this option to produce debugging information. before, bestie. order matters, iykyk ๐
๐ซ Data channel cipher negotiation ๐ซ
OpenVPN 2.4 and up have the power to negotiate which data cipher gets used to encrypt data packets. literally main character energy for the crypto stack ๐ฅ This section spills all the details on how that mechanism works, plus the different backwards-compatibility situations with older servers and clients.
โจ OpenVPN 2.5 and later behaviour โจ
When both client and server are running at least OpenVPN 2.5, the order of the ciphers in the server's --data-ciphers is what picks the data cipher. Which means: the first cipher in that list that's also in the client's --data-ciphers list is the winner ๐
If there's no common cipher, the client gets rejected with an AUTH_FAILED message (as seen in client log):
AUTH: Received control message: AUTH_FAILED,Data channel cipher
negotiation failed (no shared cipher)
OpenVPN 2.5 and later will only allow the ciphers specified in --data-ciphers. If --data-ciphers isn't set, the default is AES-256-GCM:AES-128-GCM. And in 2.6 and later the default changes to AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305 when Chacha20-Poly1305 is available. glow up โจ
For backwards compatibility, OpenVPN 2.6 and later with --compat-mode 2.4.x (or lower), and OpenVPN 2.5, will automatically add a cipher specified using the --cipher option to this list. so it's not left out, bestie ๐ซถ
๐ธ OpenVPN 2.4 clients ๐ธ
The negotiation support in OpenVPN 2.4 was the first iteration of the implementation and still had some quirks. Its main goal was "upgrade to AES-256-GCM when possible". An OpenVPN 2.4 client that's built against a crypto library supporting AES in GCM mode and does not have --ncp-disable will always announce support for AES-256-GCM and AES-128-GCM to a server by sending IV_NCP=2. always. no chill.
This only causes a problem if the --ncp-ciphers option has been changed from the default of AES-256-GCM:AES-128-GCM to a value that doesn't include those two ciphers. When an OpenVPN server tries to use AES-256-GCM or AES-128-GCM, the connection will then fail. ๐ So it's recommended to always keep the AES-256-GCM and AES-128-GCM ciphers in your --ncp-ciphers options to avoid this behaviour.
๐ฆ OpenVPN 3 clients ๐ฆ
Clients based on the OpenVPN 3.x library (https://github.com/openvpn/openvpn3/) do not have a configurable --ncp-ciphers or --data-ciphers option. Newer versions by default disable legacy AES-CBC, BF-CBC, and DES-CBC ciphers. These clients will always announce support for all their supported AEAD ciphers (AES-256-GCM, AES-128-GCM and in newer versions also Chacha20-Poly1305).
To support OpenVPN 3.x based clients, at least one of these ciphers needs to be included in the server's --data-ciphers option. that's the vibe check โ
๐ OpenVPN 2.3 and older clients (and clients with --ncp-disable) ๐
When a client without cipher negotiation support connects to a server, the cipher specified with the --cipher option in the client configuration must be included in the --data-ciphers option of the server to allow the client to connect. Otherwise the client gets sent the AUTH_FAILED message that indicates no shared cipher. ๐
If the client is 2.3 or older and was configured with the --enable-small ./configure argument, using data-ciphers-fallback cipher in the server config file with the explicit cipher used by the client is necessary.
โญ OpenVPN 2.4 server โญ
When a client indicates support for AES-128-GCM and AES-256-GCM (with IV_NCP=2), an OpenVPN 2.4 server will send the first cipher of the --ncp-ciphers to the OpenVPN client regardless of what the cipher is. wild, right? ๐
To emulate the behaviour of an OpenVPN 2.4 client as close as possible, and have compatibility with a setup that depends on this quirk, adding AES-128-GCM and AES-256-GCM to the client's --data-ciphers option is required. OpenVPN 2.5+ will only announce the IV_NCP=2 flag if those ciphers are present.
๐ OpenVPN 2.3 and older servers (and servers with --ncp-disable) ๐
The cipher used by the server must be included in --data-ciphers to allow the client to connect to a server without cipher negotiation support. (For compatibility OpenVPN 2.5 will also accept the cipher set with --cipher.)
If the server is 2.3 or older and has been configured with the --enable-small ./configure argument, adding --data-ciphers-fallback cipher to the client config with the explicit cipher used by the server is necessary.
๐ Blowfish in CBC mode (BF-CBC) deprecation ๐
The --cipher option defaulted to BF-CBC in OpenVPN 2.4 and older versions. That default was never changed, so as to keep backwards compatibility. In OpenVPN 2.5 this behaviour has now been changed, so that if --cipher is not explicitly set, it does not allow the weak BF-CBC cipher any more โ and it needs to be explicitly added as --cipher BFC-CBC or added to --data-ciphers.
We strongly recommend switching away from BF-CBC to a more secure cipher as soon as possible instead. fr fr, don't be the last one on the old cipher ๐ญ
๐ NETWORK CONFIGURATION ๐
OpenVPN consists of two sides of network configuration. One side is the link between the local and remote side, the other side is the virtual network adapter (tun/tap device). two sides, both iconic ๐
๐ Link Options ๐
This link options section covers options related to the connection between the local and the remote host. the glow-up of the pipe itself โจ
--bind keywordsโ Bind to local address and port. This is the default unless any of--proto tcp-client,--http-proxyor--socks-proxyare used. So normally you're already doing this without even trying, bestie ๐ซถ
If the optional ipv6only keyword is present, OpenVPN will bind only to IPv6 (as opposed to IPv6 and IPv4) when an IPv6 socket is opened. just IPv6. exclusive. ๐
--floatโ Allow the remote peer to change its IP address and/or port number, like when DHCP or NAT mappings change. Heads up:--floatonly works when using UDP transport. no TCP, nope.
--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're connecting to a peer that holds a dynamic address, like a dial-in user or DHCP client.
Essentially, --float tells OpenVPN to accept authenticated packets from any address, not only the address which was specified in the --remote option. she's flexible like that ๐ธ
--fragment argsโ Valid syntax:
fragment max
fragment max mtu
Enable internal datagram fragmentation so that no UDP datagrams are sent which are larger than max bytes. โ๏ธ
If the mtu parameter is present, the max parameter is interpreted to include IP and UDP encapsulation overhead. The mtu parameter is introduced in OpenVPN version 2.6.0. โญ
If the mtu parameter is absent, 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.
The --fragment option only makes sense when you're using the UDP protocol (--proto udp).
--fragment adds 4 bytes of overhead per datagram. yes, four. ๐
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's 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.
--keepalive argsโ A helper directive designed to simplify the expression of--pingand--ping-restart. ๐ซถ
Valid syntax:
keepalive interval timeout
Send ping once every interval seconds, restart if ping is not received for timeout seconds. Both values are limited to 86400 seconds. Since the server-side timeout is doubled, timeout is limited to 43200 seconds in server mode. math is math ๐
This option can be used on both client and server side, but it's enough to add this on the server side, since 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. teamwork ๐
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
--link-mtu nโ DEPRECATED ๐จ 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. like, really know.
Due to the variable header size of the IP header (20 bytes for IPv4 and 40 bytes for IPv6) and the dynamically negotiated data channel cipher, this option is not reliable. It's recommended to set tun-mtu with enough headroom instead. ๐
--localargs โ where u want OpenVPN to, like, live ๐ the valid syntax is:
local host|* [port] [protocol]
This is the local hostname or IP address + port to bind to. Specify it and OpenVPN will bind to that address, no cap. Leave it out and OpenVPN binds to all the interfaces, main character behavior fr.
'*' can be used as the hostname and it means "any host" โ OpenVPN will listen on whatever the OS hands back. On a client, or in point-to-point mode, you can only specify this once (that's 1 socket, bestie).
On an OpenVPN setup running as --server, you can specify this multiple times to open multiple listening sockets on different addresses and/or different ports ๐. To specify multiple listen ports without specifying an address, use '*' to signal "use what the operating system gives you as default", for "all IPv4 addresses" use "0.0.0.0", for "all IPv6 addresses" use '::'. Also --local implies --bind, periodt.
--lportport โ sets the default TCP/UDP port number ๐. Cannot be used together with the--nobindoption, that's a no. A port number of0is only honoured to achieve "bind() to a random assigned port number" if a bind-to IP address is specified with--local. iykyk.--markvalue โ marks 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 absolutely nothing on other operating systems ๐.--modem โ sets the OpenVPN major mode. By default, OpenVPN runs in point-to-point mode (p2p). OpenVPN 2.0 introduced a new mode (server) which implements a multi-client server capability. iconic.
--mssfixargs โ okay this one is a whole meal, valid syntax:
mssfix max [mtu]
mssfix max [fixed]
mssfix
It announces 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 1492 mtu. Use 0 as max to disable mssfix.
If the mtu parameter is specified, the max value is interpreted as the resulting packet size of VPN packets including the IP and UDP header. Support for the mtu parameter was added with OpenVPN version 2.6.0.
If the mtu parameter is not specified, 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 OpenVPN packets to be transmitted over IPv4 on a link with MTU 1478 or higher without IP level fragmentation (and 1498 for IPv6). ๐งฎ
If the fixed parameter is specified, OpenVPN will make no attempt to calculate the VPN encapsulation overhead but instead will set the MSS to limit the size of the payload IP packets to the specified number. IPv4 packets will have the MSS value lowered to mssfix - 40 and IPv6 packets to mssfix - 60.
if --mssfix is specified is specified without any parameter it inherits the parameters of --fragment if specified or uses the default for --mssfix otherwise.
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. ๐ซถ
--max-packet-size, --fragment, and --mssfix are designed to work around cases where Path MTU discovery is broken on the network path between OpenVPN peers.
The usual symptom of such a breakdown is an OpenVPN connection which successfully starts, but then stalls during active usage ๐ญ.
If --fragment and --mssfix are used together, --mssfix will take its default max parameter from the --fragment max option.
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:
--tun-mtu 1500 --fragment 1300 --mssfix
If the max-packet-size size option is used in the configuration it will also act as if mssfix size mtu was specified in the configuration.
--mtu-disctype โ 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 ๐ง.
Valid types:
noโ never send DF (Don't Fragment) framesmaybeโ use per-route hintsyesโ always DF (Don't Fragment)
--mtu-testโ to empirically measure MTU on connection startup, add the--mtu-testoption 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-testprocess normally takes about 3 minutes to complete. so grab a snack bestie ๐--nobindโ 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--remoteoption.--passtosโ set the TOS field of the tunnel packet to what the payload's TOS is. โจ--pingn โ ping remote over the TCP/UDP control channel if no packets have been sent for at least n seconds (specify--pingon both peers to cause ping packets to be sent in both directions since OpenVPN ping packets are not echoed like IP ping packets) ๐.
The maximum value for n is 86400 seconds.
This option has two intended uses:
- 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.
- To provide a basis for the remote to test the existence of its peer using the
--ping-exitoption.
When using OpenVPN in server mode see also --keepalive.
--ping-exitn โ 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,--pingand--ping-exitto create a two-tiered inactivity disconnect ๐.
The maximum value for n is 86400 seconds.
For example,
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.
--ping-restartn โ similar to--ping-exit, but trigger aSIGUSR1restart after n seconds pass without reception of a ping or other packet from remote ๐.
The maximum value for n is 86400 seconds.
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 https://www.nsupdate.info/ + 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.
See the signals section below for more information on SIGUSR1.
Note that the behavior of SIGUSR1 can be modified by the --persist-tun, --persist-local-ip and --persist-remote-ip options.
Also note that --ping-exit and --ping-restart are mutually exclusive and cannot be used together ๐ซ.
--ping-timer-remโ run the--ping-exit/--ping-restarttimer only if we have a remote address. Use this option if you are starting the daemon in listen mode (i.e. without an explicit--remotepeer), and you don't want to start clocking timeouts until a remote peer connects โณ.--protop โ use protocol p for communicating with remote host. p can beudp,tcp-client, ortcp-server. You can also limit OpenVPN to use only IPv4 or only IPv6 by specifying p asudp4,tcp4-client,tcp4-serverorudp6,tcp6-client,tcp6-server, respectively ๐.
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. lowkey a downgrade ngl ๐ฌ
This article outlines some of problems with tunneling IP over TCP:
https://web.archive.org/web/20141025181658/http://sites.inka.de/sites/bigred/devel/tcp-tcp.html
okay but ALSO โ there are certain cases where TCP is actually the superior choice, from a security AND robustness standpoint. Like when you're tunneling non-IP or application-level UDP protocols, or tunneling protocols that don't have their own built-in reliability layer. Those are the moments where TCP eats. ๐
--portport โ the TCP/UDP port number or port name, and it sets it for BOTH local and remote (it just sets both--lportand--rportto whatever you gave it). The current default is1194, which is the official IANA port assignment for OpenVPN and has been the vibe since version2.0-beta17. Older versions used port5000as the default, if you were wondering why your ancient config looks cursed. ๐ซถ--rportport โ sets the TCP/UDP port number or name that--remoteuses. Ngl you can also just set the port directly in the--remoteoption itself, so this is the โจseparateโจ way to do it.--replay-windowargs โ changes the replay protection sliding-window size and the time window. Two valid syntaxes, bestie:
replay-window n
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 (that's the IPSec default) and t is 15 seconds.
This option only matters in UDP mode, i.e. when either --proto udp is specified, or when no --proto option is specified at all.
So here's the lore: when OpenVPN tunnels IP packets over UDP, there's a real chance packets get dropped or delivered out of order. And because OpenVPN, like IPSec, is emulating the physical network layer, it will accept an out-of-order packet sequence and deliver those packets to the TCP/IP protocol stack in the same order they were received โ but ONLY if they satisfy several constraints:
- a. The packet cannot be a replay. ๐ซ
- b. If a packet arrives out of order, it's only 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's only accepted if it arrives no later than t seconds after any packet containing a higher sequence number.
If you're on a network link with a big pipeline (meaning the product of bandwidth and latency is high), you might wanna use a larger value for n. Satellite links especially often need this. ๐ฐ๏ธ
And listen โ if you run OpenVPN at --verb 4, you'll see the message "PID_ERR replay-window backtrack occurred [x]" every single time the maximum sequence number backtrack seen so far increases. That's your calibration tool for n, fr fr.
There's some controversy about the appropriate way to handle packet reordering at the security layer.
Specifically: to what extent should the security layer protect the encapsulated protocol from attacks that masquerade as the kinds of normal packet loss and reordering that happen 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 in sequence space.
OpenVPN also adds TCP transport as an option (something IPSec doesn't offer), and in that 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 just be assumed to be an attack. periodt.
In this sense, you could argue 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 that falls within the normal operational parameters of IP networks. So yeah, I'd 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 you'd expect from the physical IP layer. The problem is easily fixed by simply using TCP as the VPN transport layer. slay. ๐
--replay-persistfile โ persist replay-protection state across sessions, using file to save and reload the state.
This option keeps 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 if an OpenVPN session gets stopped and restarted, it'll reject any replays of packets that were already received by the prior session. ๐พ
This option only makes sense when replay protection is enabled (which it is by default) and you're using TLS mode with --tls-auth.
--session-timeoutn โ raisesSIGTERMfor the client instance after n seconds since the beginning of the session, forcing OpenVPN to disconnect. In client mode, OpenVPN will disconnect and exit, while in server mode all client sessions are terminated. ๐ญ
You can also specify this option in a client instance config file using --client-config-dir, or generate it dynamically using a --client-connect script. In those cases, only the related client session gets terminated. ๐ฏ
--socket-flagsflags โ applies the given flags to the OpenVPN transport socket. Currently, onlyTCP_NODELAYis supported.
The TCP_NODELAY socket flag is useful in TCP mode, and it causes the kernel to send tunnel packets immediately over the TCP connection without trying to group several smaller packets into a bigger packet. This can result in a considerably improvement in latency. โก
Since OpenVPN 2.7.6 TCP_NODELAY is enabled by default on every TCP socket, so specifying it here is no longer necessary. (yes bestie, it's giving legacy config energy ๐ซถ)
--tcp-nodelayโTCP_NODELAYis enabled by default on every TCP socket. In--mode serverthis option additionally pushessocket-flags TCP_NODELAYto connecting clients, so that clients older than2.7.6get it too. You can remove this option once such clients are no longer in use. ๐งน
The macro expands as follows:
if mode server:
push "socket-flags TCP_NODELAY"
--max-packet-sizesize โ this one tells OpenVPN to try to limit the maximum on-write packet size by restricting the control channel packet size and setting--mssfix. ๐ฆ
OpenVPN will try to keep its control channel messages below this size, but due to some constraints in the protocol this is not always possible. If the option isn't set, the control packet maximum size defaults to 1250. The control channel packet size will be restricted to values between 154 and 2048. The maximum packet size includes encapsulation overhead like UDP and IP.
In terms of --mssfix it will expand to:
mssfix size mtu
If you need to set --mssfix for the data channel and the control channel maximum packet size independently, use --max-packet-size first, followed by a --mssfix in the configuration. Order matters, bestie. ๐
In general the default size of 1250 should work almost universally apart from specific corner cases, especially since IPv6 requires a MTU of 1280 or larger.
๐ธ Virtual Network Adapter (VPN interface) ๐ธ
Options in this section relate to configuring the virtual tun/tap network interface, including setting the VPN IP address and network routing. ๐ฆ
--bind-devdevice โ (Linux only) set device to bind the server socket to a Virtual Routing and Forwarding device.--block-ipv6โ on the client, instead of sending IPv6 packets over the VPN tunnel, all IPv6 packets get answered with an ICMPv6 no route host message. On the server, all IPv6 packets from clients get answered with an ICMPv6 no route to host message. This option is intended for cases when IPv6 should be blocked and other options aren't available.--block-ipv6will use the remote IPv6 as the source address of the ICMPv6 packets if it's set, otherwise it'll usefe80::7as the source address. ๐
For this option to make sense you actually have to route traffic to the tun interface. The following example config block would send all IPv6 traffic to OpenVPN and answer all requests with no route to host, effectively blocking IPv6 (this avoids IPv6 connections from dual-stacked clients leaking around IPv4-only VPN services).
Client config
--ifconfig-ipv6 fd15:53b6:dead::2/64 fd15:53b6:dead::1
--redirect-gateway ipv6
--block-ipv6
Server config โ push a "valid" ipv6 config to the client and block on the server:
--push "ifconfig-ipv6 fd15:53b6:dead::2/64 fd15:53b6:dead::1"
--push "redirect-gateway ipv6"
--block-ipv6
Note: this option does not influence traffic sent from the server towards the client (neither on the server nor on the client side). That's not seen as necessary, since such traffic can be most easily avoided by not configuring IPv6 on the server tun, or by setting up a server-side firewall rule. ๐ฅ
--devdevice โ the TUN/TAP virtual network device, which can betunX,tapX,null, or an arbitrary name string (X can be omitted for a dynamic device).
If neither --dev nor --dev-type is specified, OpenVPN defaults to tun, i.e. it creates a dynamically-named tunX device and runs a layer-3 tunnel.
See the examples section below for an example on setting up a TUN device. ๐
You must use either tun devices on both ends of the connection or tap devices on both ends. You cannot mix them, because they represent different underlying network layers:
tunโ devices encapsulate IPv4 or IPv6 (OSI Layer 3)tapโ devices encapsulate Ethernet 802.3 (OSI Layer 2)
Valid syntaxes:
dev tun2
dev tap4
dev ovpn
What happens if the device name is not tun or tap is platform dependent. ๐ซ
On most platforms, tunN (e.g. tun2, tun30) and tapN (e.g. tap3) will create a numbered tun/tap interface with the number specified โ super useful if multiple OpenVPN instances are active and you need to know the instance-to-device mapping. Some platforms do not support "numbered tap", so trying --dev tap3 will fail. ๐
Arbitrary device names (like --dev tun-home) only work on FreeBSD (with the DCO kernel driver, for tun devices) and Linux (for tun <em>and</em> tap, DCO <em>and</em> the tun/tap driver). Slay ๐
If your device name starts with tun or tap (so like tun-home), OpenVPN will just vibe-check it and pick the right device type automatically, no thoughts needed โจ But if it doesn't start with either, bestie you have to tell it โ --dev-type tun or --dev-type tap, or it's giving confused.
On Windows, literally only the names tun and tap are supported. Picking between multiple installed drivers or driver instances? That's --dev-node's whole job ๐
--dev-nodenode โ okay so this one is highly system dependent, it's the option that influences tun/tap driver selection.- On Linux, tun/tap devices get created by accessing
/dev/net/tun, and you can change that device name with--dev-node .... - Under Mac OS X this option picks the default tun implementation.
--dev-node utunforces usage of the native Darwin tun kernel support. Use--dev-node utunNto select a specific utun instance. To force using thetun.kext(/dev/tunX) use--dev-node tun. When you don't specify a--dev-nodeoption at all, openvpn will first try to open utun, and fall back to tun.kext ๐ฆ - On Windows systems, select the TAP-Win32 adapter which is named node in the Network Connections Control Panel, or the raw GUID of the adapter enclosed by braces. The
--show-adaptersoption under Windows can also enumerate all available TAP-Win32 adapters and shows both the network connections control panel name and the GUID for each TAP-Win32 adapter ๐ - On other platforms,
--dev-nodenode will influence the naming of the created tun/tap device, if supported on that platform. If OpenVPN can't figure out whether node is a TUN or TAP device from the name, you should also specify--dev-type tunor--dev-type tap๐ - If node starts with the string
unix:, openvpn will treat the rest of the argument as a program. OpenVPN will start that program and create a temporary unix domain socket that gets passed to the program together with the tun configuration as environment variables. That temporary unix domain socket will be passed in the environment variableTUNTAP_SOCKET_FDโจ - This
unix:mode is designed mainly to use with the lwipovpn network emulator (https://github.com/OpenVPN/lwipovpn).
- On Linux, tun/tap devices get created by accessing
--dev-typedevice-type โ which device type are we even using, bestie? device-type should betun(OSI Layer 3) ortap(OSI Layer 2). Use this option only if the TUN/TAP device used with--devdoesn't begin withtunortap๐--dhcp-optionargs โ sets additional network parameters on supported platforms. May be specified on the client or pushed from the server. On Windows these are handled by the tap-windows6 driver by default, or directly by OpenVPN if dhcp is disabled. The OpenVPN for Android client also handles them internally ๐
On all other platforms these options are only saved in the client's environment under the name foreign_option_{n} before the --up script is called. A plugin or an --up script must be used to pick up and interpret these as required. Many Linux distributions include such scripts, and some third-party user interfaces such as tunnelblick also come with scripts that process these options ๐
Valid syntax:
dhcp-option type [parm]
DOMAINname โ set Connection-specific DNS Suffix to name.ADAPTER_DOMAIN_SUFFIXname โ alias toDOMAIN. This is a compatibility option, it should not be used in new deployments.DOMAIN-SEARCHname โ add name to the domain search list. Repeat this option to add more entries. Up to 10 domains are supported.DNSaddress โ set primary domain name server IPv4 or IPv6 address. Repeat this option to set secondary DNS server addresses.
Note: DNS IPv6 servers are currently set usingnetsh(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--upscript could act upon it if needed.
WINSaddress โ set primary WINS server address (NetBIOS over TCP/IP Name Server). Repeat this option to set secondary WINS server addresses.NBDDaddress โ set primary NBDD server address (NetBIOS over TCP/IP Datagram Distribution Server). Repeat this option to set secondary NBDD server addresses.NTPaddress โ set primary NTP server address (Network Time Protocol). Repeat this option to set secondary NTP server addresses.NBTtype โ 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)8โ h-node (query name server, then broadcast).
NBSscope-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, since 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 ofNeonSurge@abyss.com)DISABLE-NBTโ disable Netbios-over-TCP/IP.code PROXY_HTTPhost port โ sets a HTTP proxy that should be used when connected to the VPN.
This option currently only works on OpenVPN for Android and requires Android 10 or later.
--ifconfigargs โ set TUN/TAP adapter parameters. It requires the IP address of the local VPN endpoint. For TUN devices in point-to-point mode, the next argument must be the VPN IP address of the remote VPN endpoint. For TAP devices, or TUN devices used with--topology subnet, the second argument 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're attempting to connect to a remote ethernet bridge, the IP address and subnet should be set to values which would be valid on 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 ๐ซถ
Examples:
# tun device in net30/p2p mode
ifconfig 10.8.0.2 10.8.0.1
# tun/tap device in subnet mode
ifconfig 10.8.0.2 255.255.255.0
--ifconfig-ipv6args โ configure an IPv6 address on the tun device ๐ธ
Valid syntax:
ifconfig-ipv6 ipv6addr/bits [ipv6remote]
The ipv6addr/bits argument is the IPv6 address to use. The second parameter is used as route target for --route-ipv6 if no gateway is specified.
The --topology option has no influence with --ifconfig-ipv6 ๐ฆ
--ifconfig-noexecโ don't actually executeifconfig/netshcommands, instead pass--ifconfigparameters to scripts using environmental variables ๐--ifconfig-nowarnโ don't output an options consistency check warning if the--ifconfigoption 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-occoption) while only disabling the ifconfig component of the check ๐
For example, if you have a configuration where the local host uses --ifconfig but the remote host does not, use --ifconfig-nowarn on the local host.
This option will also silence warnings about potential address conflicts which occasionally annoy more experienced users by triggering "false positive" warnings ๐
--lladdraddress โ specify the link layer address, more commonly known as the MAC address. Only applied to TAP devices ๐--persist-tunโ don't close and reopen the TUN/TAP device, and don't run up/down scripts, acrossSIGUSR1or--ping-restartrestarts ๐ฅ
SIGUSR1 is a restart signal similar to SIGHUP, but which offers finer-grained control over reset options.
On Linux, this option can be useful when OpenVPN is not executed as root and the CAP_NET_ADMIN has not been granted, because the process would otherwise not be allowed to bring the interface down and back up ๐ญ
Okay so alongside all of that ๐, using --persist-tun lets the tunnel interface keep all its IP/route settings, which means you can cook up whatever advanced traffic-leaking protection you want ๐ก๏ธ (just a heads up bestie: for full protection you gotta have extra route/firewall rules in place, no cap).
๐ซ OPTIONS (the route-y saga continues) ๐ซ
--redirect-gateway flagsโ automatically runs routing commands so that all outgoing IP traffic gets redirected over the VPN โจ. This one is a client-side option, iykyk.
This option does three whole steps, in order, like a little routine ๐ :
- Create a static route for the
--remoteaddress that forwards to the pre-existing default gateway. Why? So that step (3) doesn't create a routing loop ๐. - Delete the default gateway route. bye ๐
- Set the new default gateway to be the VPN endpoint address (derived either from
--route-gatewayor the second parameter to--ifconfigwhen--dev tunis specified).
When the tunnel gets torn down, all of the above steps are reversed so your original default route comes back, slay ๐.
Option flags, bestie:
localโ Add the local flag if both OpenVPN peers are directly connected via a common subnet, like with wireless ๐ก. The local flag makes step (1) above get skipped entirely.autolocalโ Try to automatically figure out whether to enable thelocalflag above. detective mode ๐def1โ Use this flag to override the default gateway by using0.0.0.0/1and128.0.0.0/1rather than0.0.0.0/0. The benefit: it overrides the original default gateway without wiping it out ๐.bypass-dhcpโ Add a direct route to the DHCP server (if it's non-local) that 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're non-local) that bypasses the tunnel (Available on Windows clients, may not be available on non-Windows clients).block-localโ Block access to the local LAN while the tunnel is active, except for the LAN gateway itself ๐. This is done by routing the local LAN (except for the LAN gateway address) into the tunnel. On Windows, WFP filters are added on top of the routes, which block access to resources not routed through the VPN adapter. Push this flag to protect against TunnelCrack-type attacks (see:https://tunnelcrack.mathyvanhoef.com/) ๐ซถ.ipv6โ Redirect IPv6 routing into the tunnel. Works similar to thedef1flag, 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 pairipv6 !ipv4to redirect IPv6-only. not me ignoring IPv4 ๐
--redirect-private flagsโ Like--redirect-gateway, but it omits actually changing the default gateway. Super useful when pushing private subnets ๐ฆ.--route-table idโ Specify a default table id for use with--route. By default, OpenVPN installs routes in the main routing table of the operating system, but with this option you can use a user-defined routing table instead ๐๏ธ.
(Supported on Linux only, on other platforms this is a no-op. shrug ๐ )
--route argsโ Add a route to the routing table after the connection is established. You can specify multiple routes. Routes get automatically torn down in reverse order before the TUN/TAP device closes ๐ฅ.
Valid syntaxes:
route network/IP
route network/IP netmask
route network/IP netmask gateway
route network/IP netmask gateway metric
This option is meant as a convenience proxy for the route(8) shell command, while at the same time giving you portable semantics across OpenVPN's whole platform space ๐.
netmaskโ defaults to255.255.255.255when not given.gatewayโ default taken from--route-gatewayor the second parameter to--ifconfigwhen--dev tunis specified.metricโ default taken from--route-metricif set, otherwise0.
You can set the default 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 ๐:
vpn_gatewayโ The remote VPN endpoint address (derived either from--route-gatewayor the second parameter to--ifconfigwhen--dev tunis specified).net_gatewayโ The pre-existing IP default gateway, read from the routing table (not supported on all OSes).remote_hostโ The--remoteaddress if OpenVPN is being run in client mode, and is undefined in server mode.
--route-delay argsโ Valid syntaxes:
route-delay
route-delay n
route-delay n w
Delay n seconds (default 0) after connection establishment, before adding routes โณ. If n is 0, routes get added immediately upon connection establishment. If --route-delay is omitted, routes get 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 gives the DHCP handshake time to finish before routes get added ๐ซถ.
On Windows, --route-delay tries to be smarter by waiting w seconds (default 30) for the TAP-Win32 adapter to come up before adding routes.
--route-ipv6 argsโ Set up IPv6 routing in the system to send the specified IPv6 network into OpenVPN's tun ๐.
Valid syntaxes:
route-ipv6 ipv6addr/bits
route-ipv6 ipv6addr/bits gateway
route-ipv6 ipv6addr/bits gateway metric
gatewayโ Only used for IPv6 routes across tap devices, and if missing, theipv6remotefield from--ifconfig-ipv6or--route-ipv6-gatewayis used.metricโ default taken from--route-metricif set, otherwise0.
--route-gateway argโ Specify a default gateway 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.
Valid syntaxes:
route-gateway gateway
route-gateway dhcp
--route-ipv6-gateway gwโ Specify a default gatewaygwfor use with--route-ipv6๐.--route-metric mโ Specify a default metricmfor use with--route.--route-noexecโ Don't add or remove routes automatically. Instead, pass routes to the--route-upscript using environmental variables ๐ง.--route-nopullโ When used with--clientor--pull, accept options pushed by the server EXCEPT for routes,block-outside-dns, and dhcp options like DNS servers ๐ โโ๏ธ.
When used on the client, this option effectively bars the server from adding routes to the client's routing table, but note that this option still allows the server to set the TCP/IP properties of the client's TUN/TAP interface. sneaky ๐
--topology modeโ Configure virtual addressing topology when running in--dev tunmode. This directive has no meaning in--dev tapmode, which always uses a subnet topology ๐ .
If you set this directive on the server, the --server and --server-bridge directives will automatically push your chosen topology setting to clients too. 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:
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 tapand ethernet bridging mode. This mode allocates a single IP address per connecting client and works on Windows as well. This is the default โจ.net30โ Use a point-to-point topology, by allocating one/30subnet per client. Designed to allow point-to-point semantics when some or all of the connecting clients might be Windows systems ๐ช.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 ๐.
Note: Using --topology subnet changes the interpretation of the arguments of --ifconfig to mean "address netmask", and not "local remote" ๐.
--tun-mtu argsโ Valid syntaxes:
tun-mtu tun-mtu
tun-mtu tun-mtu occ-mtu
Take the TUN device MTU to be tun-mtu and derive the link MTU from it. In most cases, you'll probably want to leave this parameter at its default value ๐.
The default for tun-mtu is 1500.
The OCC MTU can be used to avoid warnings about mismatched MTU from clients. If occ-mtu is not specified, it defaults to the tun-mtu ๐ฆ.
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 and data channels be sent unfragmented ๐ฆ.
MTU problems often show up as connections that hang during periods of active usage ๐ญ.
It's best to use the --fragment and/or --mssfix options to deal with MTU sizing issues, fr fr.
Note: Depending on the platform, the operating system lets you receive packets larger than tun-mtu (e.g. Linux and FreeBSD) but other platforms (like macOS) limit received packets to the same size as the MTU ๐.
--tun-mtu-maxmaxmtu โ bestie this one sets the maximum MTU size that a server is allowed to push out, by sizing the internal buffers so they can hold at least a packet this big. Default for maxmtu is1600. Right now you can only go up from1600โ tryna shrink it below1600just gets straight-up ignored, no cap. ๐--tun-mtu-extran โ this is us assuming the TUN/TAP device might hand back as many as n bytes more than the--tun-mtusize when it reads. Default is0, which honestly covers most TUN devices. TAP devices tho? they can add extra overhead beyond the MTU size, so32is the default whenever TAP devices are in play. And this parameter only touches internal OpenVPN buffer sizing, so there's literally no transmission overhead from going bigger. slay. ๐
๐ซถ TUN/TAP standalone operations ๐ซถ
These two standalone operations are gonna need --dev and optionally --user and/or --group. periodt.
--mktunโ (Standalone) Creates a persistent tunnel on platforms that support them, like Linux. Normally TUN/TAP tunnels only exist while some app has them open, but this option flexes the TUN/TAP driver's ability to build persistent tunnels that survive multiple instantiations of OpenVPN and only die when they're deleted or the machine reboots.
One big W of persistent tunnels: you don't need separate --up and --down scripts running the ifconfig(8) and route(8) commands anymore. Those commands can just live in the same shell script that starts or stops an OpenVPN session.
Another W: open connections through the TUN/TAP-based tunnel won't get reset if the OpenVPN peer restarts. Super handy for keeping connectivity unbroken through the tunnel when the peer's public IP gets DHCP-reset (peep the --ipchange option above).
The L tho: it's harder to automatically configure their MTU value (see --link-mtu and --tun-mtu above).
And on some platforms like Windows, TAP-Win32 tunnels are persistent by default. iconic.
--rmtunโ (Standalone) Removes a persistent tunnel. bye bestie ๐ฆ
๐ Virtual Routing and Forwarding ๐
The options in this section are all about configuring virtual routing and forwarding in combo with the underlying operating system.
As of today this is only supported on Linux, and a kernel >= 4.9 is recommended.
This comes in handy when, say, the external network should only be used as a means to connect to some VPN endpoints, and all your regular traffic should only be routed through the tunnel(s). You can pull that off by setting up a VRF and configuring the interface connected to the external network to be part of the VRF. The examples below cover exactly this setup.
Another option would be to put the tun/tap interface into a VRF. You'd do that with an up-script that uses the ip link set command shown below.
๐ VRF setup with iproute2 ๐
Create VRF vrf_external and map it to routing table 1023:
ip link add vrf_external type vrf table 1023
Move eth0 into vrf_external:
ip link set master vrf_external dev eth0
Any prefixes configured on eth0 will be moved from the :code\main`routing table into routing table1023`.
๐ VRF setup with ifupdown ๐
For Debian based distributions, ifupdown2 provides an almost drop-in replacement for ifupdown, including VRFs and other features. A config for an interface eth0 being part of VRF code:vrf_external could look like this:
auto eth0
iface eth0
address 192.0.2.42/24
address 2001:db8:08:15::42/64
gateway 192.0.2.1
gateway 2001:db8:08:15::1
vrf vrf_external
auto vrf_external
iface vrf_external
vrf-table 1023
โญ OpenVPN configuration โญ
Your OpenVPN config needs to contain this line:
bind-dev vrf_external
๐ง Further reading ๐ง
Wikipedia has a cute little page on VRFs: https://en.wikipedia.org/wiki/Virtual_routing_and_forwarding
And this talk from the Network Track of FrOSCon 2018 gives you an overview of advanced layer 2 and layer 3 features of Linux:
- Slides: https://www.slideshare.net/BarbarossaTM/l2l3-fr-fortgeschrittene-helle-und-dunkle-magie-im-linuxnetzwerkstack
- Video (german): https://media.ccc.de/v/froscon2018-2247-l2_l3_fur_fortgeschrittene_-_helle_und_dunkle_magie_im_linux-netzwerkstack
โจ SCRIPTING INTEGRATION โจ
OpenVPN can run external scripts at various phases in the lifetime of the OpenVPN process. it's giving puppet master energy ๐ญ
๐ฆ Script Order of Execution ๐ฆ
--dns-updown
Executed after TCP/UDP socket bind and TUN/TAP open, before --up.
--up
Executed after TCP/UDP socket bind and TUN/TAP open, after --dns-updown.
--tls-verify
Executed when we have a still untrusted remote peer.
--ipchange
Executed after connection authentication, or remote IP address change.
--client-connect
Executed in --mode server mode immediately after client authentication.
--route-up
Executed after connection authentication โ either immediately after, or some number of seconds after as defined by the --route-delay option.
--route-pre-down
Executed right before the routes are removed.
--client-disconnect
Executed in --mode server mode on client instance shutdown.
--dns-updown
Executed before TCP/UDP and TUN/TAP close, before --down.
--down
Executed after TCP/UDP and TUN/TAP close, after --dns-updown.
--learn-address
Executed in --mode server mode whenever an IP address/route or MAC address is added to OpenVPN's internal routing table.
--auth-user-pass-verify
Executed in --mode server mode on new client connections, when the client is still untrusted.
--client-crresponse
Execute in --mode server whenever a client sends a CR_RESPONSE message
๐ฅ SCRIPT HOOKS ๐ฅ
--auth-user-pass-verifyargs โ requires the client to hand over a username/password (possibly on top of a client certificate) for authentication.
Valid syntax:
auth-user-pass-verify cmd method
OpenVPN will run command cmd to validate the username/password the client gave us.
cmd is a path to a 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.
If method is set to via-env, OpenVPN calls cmd with the environmental variables username and password set to the username/password strings the client provided. โ ๏ธ Beware: this method is insecure on some platforms that make a process's environment publicly visible to other unprivileged processes. not cute.
If method is set to via-file, OpenVPN writes the username and password to the first two lines of a temporary file. The filename gets passed as an argument to cmd, and the file is automatically deleted by OpenVPN after the script returns. Where that temp file lives is controlled by the --tmp-dir option. For security, consider setting it to a volatile storage medium such as /dev/shm (if available) so the username/password file never touches the hard drive.
The script should examine the username and password, and return a success exit code (0) if the client's authentication request is to be accepted, a failure code (1) to reject the client, or a 2 to say the authentication is deferred. If the auth is deferred, the script must fork/start a background or another non-blocking operation to keep the auth going in the background. When finishing the authentication, a 1 or 0 must be written to the file specified by the auth_control_file.
If the file specified by auth_failed_reason_file exists and has non-empty content, the content of this file will be used as the AUTH_FAILED message. To avoid race conditions, this file should be written before auth_control_file.
This auth fail reason can be something simple like "User has been permanently disabled" but there are also some special auth failed messages.
The TEMP message indicates that the authentication temporarily failed and that the client should keep retrying to connect. The server can optionally give a user readable message and hint the client a behavior for how to proceed. The keywords of the AUTH_FAILED,TEMP message are comma separated keys/values and provide a hint to the client how to proceed. Currently defined keywords are:
backoff sโ instructs the client to wait at least s seconds before the next connection attempt. If the client already uses a higher delay for reconnection attempts, the delay will not be shortened.advance addrโ Instructs the client to reconnect to the next (IP) address of the current server.advance remoteโ Instructs the client to skip the remaining IP addresses of the current server and instead connect to the next server specified in the configuration file.advance noโ Instructs the client to retry connecting to the same server again.
For example, the message TEMP[backoff 42,advance no]: No free IP addresses indicates that the VPN connection can currently not succeed and instructs the client to retry in 42 seconds again.
When deferred authentication is in use, the script can also request pending authentication by writing to the file specified by the auth_pending_file. The first line must be the timeout in seconds, the required method on the second line (e.g. crtext) and the third line must be the EXTRA as documented in the client-pending-auth section of doc/management.txt.
This directive is designed to enable a plugin-style interface for extending OpenVPN's authentication capabilities. ๐ซถ
To protect against a client passing a maliciously formed username or password string, the username string must consist only of these characters: alphanumeric, underbar (_), dash (-), dot (.), or at (@). The password string can consist of any printable characters except for CR or LF. Any illegal characters in either the username or password string will be converted to underbar (_). ๐
Care must be taken by any user-defined scripts to avoid creating a security vulnerability in the way that these strings are handled. Never use these strings in such a way that they might be escaped or evaluated by a shell interpreter. Like bestie, genuinely, do not let a shell touch these. ๐
For a sample script that performs PAM authentication, see sample-scripts/auth-pam.pl in the OpenVPN source distribution. โจ
--client-crresponse ๐
Executed when the client sends a text based challenge response.
Valid syntax:
client-crresponse cmd
OpenVPN will write the response of the client into a temporary file. The filename will be passed as an argument to cmd, and the file will automatically deleted by OpenVPN after the script returns. ๐ฆ
The response is passed as is from the client. The script needs to check itself if the input is valid, e.g. if the input is valid base64 encoding. (Yeah, it's on you, bestie, no validation hand-holding here.) ๐ญ
The script can either directly write the result of the verification to auth_control_file or further defer it. See --auth-user-pass-verify for details.
For a sample script that implement TOTP (RFC 6238) based two-factor authentication, see sample-scripts/totpauth.py. ๐ธ
--client-connect cmd ๐
Run command cmd on client connection.
cmd consists of a path to a 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. ๐ค
If a --client-connect wants to defer the generating of the configuration then the script needs to use the client_connect_deferred_file and client_connect_config_file environment variables, and write status accordingly into these files. See the Environmental Variables section for more details.
--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.
The --client-disconnect command is not passed any extra arguments (only those arguments specified in cmd, if any).
--dns-updown cmd ๐
Run command cmd, instead of the default DNS up/down command that comes with openvpn. If cmd is disable the --dns-updown command is not run.
If you write your own command, please make sure to ignore --dns server profiles that cannot be applied. Port, DNSSEC and secure transport settings need to be adhered to. If split DNS is not possible a full redirect can be used as a fallback. If not all of the server addresses or search domains can be configured, apply them in the order they are listed in. ๐
Note that --dns-updown is not supported on all platforms. On Windows DNS will always be set by the service. On Android DNS will be passed via management interface.
Note that DNS-related --dhcp-options might be converted so that they are available to this hook if no --dns options exist. If any --dns server option is present, DNS-related --dhcp-options will always be ignored. If an --up script is defined, foreign_option env vars will be generated from --dns options and passed to the script. The default --dns-updown command is not run if an --up script is defined. Both is done for backward compatibility. In case you want to run the --dns-updown command even if there is an --up defined, you can define a custom command or use force as cmd to run the default command. No DNS env vars will be passed to --up in this case. ๐
--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.
Note that if you reduce privileges by using --user and/or --group, your --down script will also run at reduced privilege. ๐
--down-pre โญ
Call --down cmd/script before, rather than after, TUN/TAP close.
--ipchange cmd ๐
Run command cmd when our remote ip-address is initially authenticated or changes.
cmd consists of a path to a 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:
cmd ip address port number
Don't use --ipchange in --mode server mode. Use a --client-connect script instead. ๐ญ
See the Environmental Variables section below for additional parameters passed as environmental variables.
If you are running in a dynamic IP address environment where the IP addresses of either peer could change without notice, you can use this script, for example, to edit the /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 re-establish a connection with its most recently authenticated peer on its new IP address. โจ
--learn-address cmd ๐
Run command cmd to validate client virtual addresses or routes.
cmd consists of a path to a 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:
$1- [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.$2- [address] โ The address being learned or unlearned. This can be:- an IPv4 address such as
"198.162.10.14", - an IPv4 subnet such as
"198.162.10.0/24", - an IPv6 address such as
"2001:db8:1:2:3:4:5:6", - an IPv6 subnet such as
"2001:db8:1:2:3:4:5::/112", or - an ethernet MAC address (when
--dev tapis being used) such as"00:FF:01:02:03:04".
- an IPv4 address such as
$3- [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.
A dual-stack client connecting to a dual-stack server will cause two calls to the cmd script in quick succession, as the server learns each of the IPv4 and IPv6 client addresses. ๐ฅ
--route-up cmd ๐ซถ
Run command cmd after routes are added, subject to --route-delay.
cmd consists of a path to a 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.
--route-pre-down cmd ๐
Run command cmd before routes are removed upon disconnection.
cmd consists of a path to a 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. (yeah bestie, we're gonna get to that whole section in a sec, stay with me ๐)
--setenvargs โ drops a custom environmental variable in the formname=valuethat gets passed along to your script. It's giving "here's a lil note for whoever runs next."
Valid syntaxes:
setenv name value
setenv FORWARD_COMPATIBLE 1
setenv opt config_option
So if you set FORWARD_COMPATIBLE to 1, the config file syntax checking gets relaxed โ unknown directives will trigger a warning but not a fatal error, based on the assumption that some unknown directive might be valid in future OpenVPN versions. (manifesting forward compatibility, honestly)
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.
You can also tag a single directive so it doesn't trigger a fatal error if it isn't recognized. To do that, prepend setenv opt before the directive. โจ
Heads up: versions prior to OpenVPN 2.3.3 will always ignore options set with the setenv opt directive.
See also --ignore-unknown-option
--setenv-safeargs โ sets a custom environmental variable namedOPENVPN_nameto value, to pass to scripts.
Valid syntaxes:
setenv-safe name value
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. (not a drill, bestie โ that prefix is armor ๐ก๏ธ)
--tls-verifycmd โ runs the 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 the--crl-verifydirective; the revocation test occurs after the--tls-verifytest, iykyk).
cmd should return 0 to allow the TLS handshake to proceed, or 1 to fail.
cmd consists of a path to a 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:
cmd certificate_depth subject
These arguments are, respectively, the current certificate depth and the X509 subject distinguished name (dn) 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. so picky, so valid ๐
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.
See the Environmental Variables section below for additional parameters passed as environmental variables.
--tls-export-certdir โ adds an environment variablepeer_certwhen calling the--tls-verifyscript or executing theOPENVPN_PLUGIN_TLS_VERIFYplugin hook to verify the certificate.
The environment variable contains the path to a PEM encoded certificate of the current peer certificate in the directory dir. (it's literally just handing your script the receipt ๐งพ)
--upcmd โ runs command cmd after a successful TUN/TAP device open (pre--userUID change).
cmd consists of a path to a 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 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 0 ifconfig_local_ip ifconfig_remote_ip [init | restart]
For --dev tap, execute as:
cmd tap_dev tap_mtu 0 ifconfig_local_ip ifconfig_netmask [init | restart]
See the Environmental Variables section below for additional parameters passed as environmental variables. The 0 argument used to be link_mtu which is no longer passed to scripts โ to keep the argument order, it was replaced with 0. (the zero is a lil ghost of argument orders past, sobbing)
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). fr fr, firewall first or don't run it at all ๐
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.
If --ifconfig is also specified, OpenVPN will pass the ifconfig local and remote endpoints on the command line to the --up script so that they can be used to configure routes such as:
route add -net 10.0.0.0 netmask 255.255.255.0 gw $5
--up-delayโ delay TUN/TAP open and possible--upscript execution until after TCP/UDP connection establishment with peer. (no device until the vibes are confirmed โ)
In --proto udp mode, this option normally requires the use of --ping to allow connection initiation to be sensed in the absence of tunnel data, since UDP is a "connectionless" protocol.
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.
--up-restartโ enable the--upand--downscripts to be called for restarts as well as initial program start. This option is described more fully above in the--upoption documentation. (yes it's a rerun, but like, a canonically important rerun)
โจ String Types and Remapping โจ
In certain cases, OpenVPN will perform remapping of characters in strings. Essentially, any characters outside the set of permitted characters for each string type will be converted to underbar ('_'). the underscore is the designated survivor bestie
- Q: Why is string remapping necessary? โ It's an important security feature to prevent the malicious coding of strings from untrusted sources to be passed as parameters to scripts, saved in the environment, used as a common name, translated to a filename, etc.
- Q: Can string remapping be disabled? โ No. The options
--no-name-remappingand--compat-nameshave been removed in 2.5 because they were considered too insecure. they're gone gone, no coming back ๐
Here is a brief rundown of OpenVPN's current string types and the permitted character class for each string:
- X509 Names โ Alphanumeric, underbar (
'_'), dash ('-'), dot ('.'), at ('@'), colon (':'), slash ('/'), and equal ('='). Alphanumeric is defined as a character which will cause the C libraryisalnum()function to return true. - Common Names โ Alphanumeric, underbar (
'_'), dash ('-'), dot ('.'), and at ('@'). --auth-user-passusername โ Same as Common Name, with one exception: The username is passed to theOPENVPN_PLUGIN_AUTH_USER_PASS_VERIFYplugin in its raw form, without string remapping.--auth-user-passpassword โ Any "printable" character except CR or LF. Printable is defined to be a character which will cause the C libraryisprint()function to return true.--client-config-dirfilename as derived from common name or username โ Alphanumeric, underbar ('_'), dash ('-'), at ('@'), and dot ('.') except for"."or".."as standalone strings.- Environmental variable names โ Alphanumeric or underbar (
'_'). - Environmental variable values โ Any printable character.
For all cases, characters in a string which are not members of the legal character class for that string type will be remapped to underbar ('_'). universal underscore moment, iconic honestly
๐ธ Environmental Variables ๐ธ
Once set, a variable is persisted indefinitely until it is reset by a new value or a restart,
In server mode, environmental variables set by OpenVPN are scoped according to the client objects they are associated with, so there should not be any issues with scripts having access to stale, previously set variables which refer to different client instances. (no cross-client gossip in this group chat ๐ซถ)
bytes_receivedโ Total number of bytes received from client during VPN session. Set prior to execution of the--client-disconnectscript.bytes_sentโ Total number of bytes sent to client during VPN session. Set prior to execution of the--client-disconnectscript.
client_connect_config_file โ the path to the config file that the --client-connect script is supposed to write to (it's optional, only if you want per-session config, bestie). It's literally the same filename that gets handed over as a command line argument when --client-connect gets called. ๐
client_connect_deferred_file โ okay so you can optionally write to this file to communicate a status code back from the --client-connect script or plugin. Only the very first character in the file matters. It's gotta be one of:
1โ normal script execution, all good, slay0โ an error (exactly the same energy as a non-zero exit status)2โ the script deferred returning the config file
For deferred (background) handling, the script or plugin MUST write 2 to the file to signal the deferral, and then return with exit code 0 to say "deferred handler started OK".
A background process (or something like it) then has to take care of writing the configuration into the file pointed at by the client_connect_config_file environment variable, and when it's done, write a 1 to this file (or 0 if something went wrong).
The absence of any character in the file when the script finishes executing is interpreted the same as 1. This is the whole reason scripts that were never written to support the defer mechanism can still be used unmodified. ๐ซถ
common_name โ the X509 common name of an authenticated client. Set prior to execution of --client-connect, --client-disconnect and --auth-user-pass-verify scripts.
config โ name of the first --config file. Set on program initiation and reset on SIGHUP.
daemon โ set to "1" if the --daemon directive is specified, or "0" otherwise. Set on program initiation and reset on SIGHUP.
daemon_log_redirect โ set to "1" if the --log or --log-append directives are specified, or "0" otherwise. Set on program initiation and reset on SIGHUP.
dev โ the actual name of the TUN/TAP device, unit number included if it has one. Set prior to --up or --down script execution.
dev_idx โ on Windows, the device index of the TUN/TAP adapter (you want this for netsh.exe calls, which sometimes just do not work right with interface names, no cap). Set prior to --up or --down script execution.
dns_* โ the --dns configuration options get made available to --dns-updown execution through this set of environment variables. Variables only appear if the corresponding option actually has a value assigned. For the semantics of each individual variable, please refer to the documentation for --dns. โจ
dns_search_domain_{n}dns_server_{n}_address_{m}dns_server_{n}_port_{m}dns_server_{n}_resolve_domain_{m}dns_server_{n}_dnssecdns_server_{n}_transportdns_server_{n}_sni
foreign_option_{n} โ an option pushed via --push to a client that doesn't natively support it (think --dhcp-option on a non-Windows system) gets recorded into this environmental variable sequence prior to --up script execution.
ifconfig_ipv6_local โ the local VPN endpoint IPv6 address specified in the --ifconfig-ipv6 option (first parameter). Set prior to OpenVPN calling the ifconfig or netsh (windows version of ifconfig) commands, which normally happens prior to --up script execution.
ifconfig_ipv6_netbits โ the prefix length of the IPv6 network on the VPN interface. Derived from the /nnn parameter of the IPv6 address in the --ifconfig-ipv6 option (first parameter). Set prior to OpenVPN calling the ifconfig or netsh (windows version of ifconfig) commands, which normally happens prior to --up script execution.
ifconfig_ipv6_remote โ the remote VPN endpoint IPv6 address specified in the --ifconfig-ipv6 option (second parameter). Set prior to OpenVPN calling the ifconfig or netsh (windows version of ifconfig) commands, which normally happens prior to --up script execution.
ifconfig_local โ the local VPN endpoint IP address specified in the --ifconfig option (first parameter). Set prior to OpenVPN calling the ifconfig or netsh (windows version of ifconfig) commands, which normally happens prior to --up script execution.
ifconfig_remote โ the remote VPN endpoint IP address specified in the --ifconfig option (second parameter) when --dev tun is used. Set prior to OpenVPN calling the ifconfig or netsh (windows version of ifconfig) commands, which normally happens prior to --up script execution.
ifconfig_netmask โ the subnet mask of the virtual ethernet segment specified as the second parameter to --ifconfig when --dev tap is being used. Set prior to OpenVPN calling the ifconfig or netsh (windows version of ifconfig) commands, which normally happens prior to --up script execution.
ifconfig_pool_local_ip โ the local virtual IPv4 address for the TUN/TAP tunnel, taken from an --ifconfig-push directive if one was specified, otherwise from the ifconfig pool (controlled by the --ifconfig-pool config file directive). Only set for --dev tun tunnels. This one is set on the server prior to execution of the --client-connect and --client-disconnect scripts.
ifconfig_pool_local_ip6 โ the local virtual IPv6 address for the TUN/TAP tunnel, taken from an --ifconfig-ipv6-push directive if one was specified, otherwise from the ifconfig pool (controlled by the --ifconfig-ipv6-pool config file directive). Only set for --dev tun tunnels. This one is set on the server prior to execution of the --client-connect and --client-disconnect scripts.
ifconfig_pool_netmask โ the virtual IPv4 netmask for the TUN/TAP tunnel, taken from an --ifconfig-push directive if one was specified, otherwise from the ifconfig pool (controlled by the --ifconfig-pool config file directive). Only set for --dev tap tunnels. This one is set on the server prior to execution of the --client-connect and --client-disconnect scripts.
ifconfig_pool_ip6_netbits โ the virtual IPv6 prefix length for the TUN/TAP tunnel, taken from an --ifconfig-ipv6-push directive if one was specified, otherwise from the ifconfig pool (controlled by the --ifconfig-ipv6-pool config file directive). Only set for --dev tap tunnels. This one is set on the server prior to execution of the --client-connect and --client-disconnect scripts.
ifconfig_pool_remote_ip โ the remote virtual IPv4 address for the TUN/TAP tunnel, taken from an --ifconfig-push directive if one was specified, otherwise from the ifconfig pool (controlled by the --ifconfig-pool config file directive). This one is set on the server prior to execution of the --client-connect and --client-disconnect scripts.
ifconfig_pool_remote_ip6 โ the remote virtual IPv6 address for the TUN/TAP tunnel, taken from an --ifconfig-ipv6-push directive if one was specified, otherwise from the ifconfig pool (controlled by the --ifconfig-ipv6-pool config file directive). This one is set on the server prior to execution of the --client-connect and --client-disconnect scripts.
link_mtu โ REMOVED. Not passed to scripts anymore since OpenVPN 2.6.0, bestie, it's gone gone. It used to be the maximum packet size (not including the IP header) of tunnel data in UDP tunnel transport mode.
local โ the --local parameter. Set on program initiation and reset on SIGHUP.
local_port โ the local port number or name, specified by --port or --lport. Set on program initiation and reset on SIGHUP.
password โ the password provided by a connecting client. Set prior to --auth-user-pass-verify script execution only when the via-env modifier is specified, and deleted from the environment after the script returns. ๐
peer_cert โ if the option --tls-export-cert is enabled, this one contains the path to the current peer certificate to be verified, in PEM format. See also the argument certificate_depth to the --tls-verify command.
proto โ the --proto parameter. Set on program initiation and reset on SIGHUP.
remote_{n} โ the --remote parameter. Set on program initiation and reset on SIGHUP.
remote_port_{n} โ the remote port number, specified by --port or --rport. Set on program initiation and reset on SIGHUP.
route_net_gateway โ the pre-existing default IP gateway in the system routing table. Set prior to --up script execution.
route_vpn_gateway โ the default gateway used by --route options, as specified in either the --route-gateway option or the second parameter to --ifconfig when --dev tun is specified. Set prior to --up script execution.
route_{parm}_{n} โ a whole set of variables that define each route to be added, all set prior to --up script execution. ๐
parm is gonna be one of network, netmask", gateway, or metric.
n is the OpenVPN route number, starting from 1.
If the network or gateway are resolvable DNS names, their IP address translations get recorded rather than their names as denoted on the command line or config file.
route_ipv6_{parm}_{n} โ a set of variables that define each IPv6 route to be added, all set prior to --up script execution.
parm is gonna be one of network, gateway or metric. route_ipv6_network_{n} contains netmask as /nnn, unlike IPv4 where it gets passed in a separate environment variable.
n is the OpenVPN route number, starting from 1.
If the network or gateway are resolvable DNS names, their IP address translations get recorded rather than their names as denoted on the command line or config file.
route_redirect_gateway_ipv4 route_redirect_gateway_ipv6 โ set to 1 if the corresponding default gateway should be redirected into the tunnel, and to 2 if also the local LAN segment should be blocked (block-local). Not set otherwise. Set prior to --up script execution.
script_context โ set to "init" or "restart" prior to up/down script execution. For more info, go look at the documentation for --up. ๐ฆ
script_typeโ bestie, right before any script runs, this gets set to which kind of script it is. It can be one of:up,down,ipchange,route-up,tls-verify,auth-user-pass-verify,client-connect,client-disconnectorlearn-address. Set prior to execution of any script. ๐signalโ the whole reason we're exiting or restarting, fr. Can be one ofsigusr1,sighup,sigterm,sigint,inactive(controlled by--inactiveoption),ping-exit(controlled by--ping-exitoption),ping-restart(controlled by--ping-restartoption),connection-reset(triggered on TCP connection reset),errororunknown(unknown signal). This one gets set just prior todownscript execution. ๐ญtime_asciiโ the client connection timestamp, but make it a human-readable time string. Set prior to execution of the--client-connectscript. โจtime_durationโ how long (in seconds) the client session that's now disconnecting actually lasted. Set prior to execution of the--client-disconnectscript. ๐ฐ๏ธtime_unixโ client connection timestamp, formatted as a unix integer date/time value. Set prior to execution of the--client-connectscript. ๐ขtls_digest_{n}/tls_digest_sha256_{n}โ holds the certificate SHA1 / SHA256 fingerprint, where n is the verification level. Only set for TLS connections, and only set prior to execution of--tls-verifyscript. ๐tls_id_{n}โ a whole series of certificate fields from the remote peer, where n is the verification level. Only set for TLS connections, set prior to execution of--tls-verifyscript. ๐ธtls_serial_{n}โ the serial number of the certificate from the remote peer, where n is the verification level. Only set for TLS connections, set prior to execution of--tls-verifyscript. It comes as a decimal string like"933971680", which is perfect for doing serial-based OCSP queries (with OpenSSL, do not prepend"0x"to the string, okay?). If something goes wrong while reading the value from the certificate it will be an empty string, so your code should check that โ no cap. See thecontrib/OCSP_check/OCSP_check.shscript for an example. ๐tls_serial_hex_{n}โ liketls_serial_{n}, but in hex form (e.g.12:34:56:78:9A). ๐ฆtun_mtuโ the MTU of the TUN/TAP device. Set prior to--upor--downscript execution. ๐trusted_ip/trusted_ip6)โ the actual IP address of the connecting client or peer that has been authenticated. Set prior to execution of--ipchange,--client-connectand--client-disconnectscripts. If you're using ipv6 endpoints (udp6,tcp6),trusted_ip6will be set instead. ๐ฅtrusted_portโ the actual port number of the connecting client or peer which has been authenticated. Set prior to execution of--ipchange,--client-connectand--client-disconnectscripts. ๐untrusted_ip/untrusted_ip6โ the actual IP address of the connecting client or peer which has not been authenticated yet. Sometimes used tonmapthe connecting host in a--tls-verifyscript to make sure it's firewalled properly. Set prior to execution of--tls-verifyand--auth-user-pass-verifyscripts. If you're using ipv6 endpoints (udp6,tcp6),untrusted_ip6will be set instead. ๐untrusted_portโ the actual port number of the connecting client or peer which has not been authenticated yet. Set prior to execution of--tls-verifyand--auth-user-pass-verifyscripts. ๐usernameโ the username provided by a connecting client. Set prior to--auth-user-pass-verifyscript execution only when thevia-envmodifier is specified. ๐ซถX509_{n}_{subject_field}โ an X509 subject field from the remote peer certificate, where n is the verification level. Only set for TLS connections. Set prior to execution of--tls-verifyscript. This variable is similar totls_id_{n}except the component X509 subject fields are broken out, and no string remapping occurs on these field values (except for remapping of control characters to"_"). For example, the following variables would be set on the OpenVPN server using the sample client certificate insample-keys(client.crt). Note that the verification level is0for the client certificate and1for the CA certificate. ๐ง
You can use the --x509-track option to export more or less information from the certificates.
X509_0_emailAddress=me@myhost.mydomain
X509_0_CN=Test-Client
X509_0_O=OpenVPN-TEST
X509_0_ST=NA
X509_0_C=KG
X509_1_emailAddress=me@myhost.mydomain
X509_1_O=OpenVPN-TEST
X509_1_L=BISHKEK
X509_1_ST=NA
X509_1_C=KG
๐๏ธ Management Interface Options ๐๏ธ
OpenVPN hands you a feature rich, socket based management interface โ and yes bestie, it works for both server and client mode operations. It's giving main character energy. ๐
--managementargs โ enable a management server on asocket-nameUnix socket on those platforms that support it, or on a designated TCP port.
Valid syntaxes:
management socket-name unix #
management socket-name unix pw-file # (recommended)
management IP port # (INSECURE)
management IP port pw-file #
pw-file, if specified, is a password file where the password must be on the first line. Instead of a filename it can use the keyword stdin, which will prompt the user for a password to use when OpenVPN is starting.
For unix sockets, the default behaviour is to create a unix domain socket that may be connected to by any process. Use the --management-client-user and --management-client-group directives to restrict access.
The management interface provides a special mode where the TCP management link can operate over the tunnel itself. To enable this mode, set IP to tunnel. Tunnel mode will cause the management interface to listen for a TCP connection on the local VPN address of the TUN/TAP interface.
BEWARE of enabling the management interface over TCP. In these cases you should ALWAYS make use ofpw-fileto password protect the management interface. Any user who can connect to this TCPIP:portwill be able to manage and control (and interfere with) the OpenVPN process. It is also strongly recommended to setIPto127.0.0.1(localhost) to restrict accessibility of the management server to local clients. ๐ฑ
While the management port is designed for programmatic control of OpenVPN by other applications, it is possible to telnet to the port, using a telnet client in "raw" mode. Once connected, type help for a list of commands.
For detailed documentation on the management interface, see the management-notes.txt file in the management folder of the OpenVPN source distribution. ๐
--management-clientโ the management interface will connect as a TCP/unix domain client toIP:portspecified by--management, rather than listen as a TCP server or on a unix domain socket.
If the client connection fails to connect or is disconnected, a SIGTERM signal will be generated causing OpenVPN to quit. ๐ต
--management-client-authโ gives the management interface client the responsibility to authenticate clients after their client certificate has been verified. Seemanagement-notes.txtin OpenVPN distribution for detailed notes. ๐--management-client-groupg โ when the management interface is listening on a unix domain socket, only allow connections from group g. ๐ฅ--management-client-useru โ when the management interface is listening on a unix domain socket, only allow connections from user u. ๐ค--management-external-certcertificate-hint โ allows usage of an external certificate instead of the--certoption (client-only). certificate-hint is an arbitrary string which is passed to a management interface client as an argument ofNEED-CERTIFICATEnotification. Requires--management-external-key. ๐ซ--management-external-keyargs โ allows usage of an external private key file instead of the--keyoption (client-only).
Valid syntaxes:
management-external-key
management-external-key nopadding
management-external-key pkcs1
management-external-key pss
or any combination like:
management-external-key nopadding pkcs1
management-external-key pkcs1 pss
The optional parameters nopadding, pkcs1 and pss signal support for different padding algorithms. See doc/mangement-notes.txt for a complete description of this feature. ๐
--management-forget-disconnectโ make OpenVPN forget passwords when the management session disconnects.
This directive does not affect the --http-proxy username/password. It is always cached. ๐ง
--management-holdโ start OpenVPN in a hibernating state, until a client of the management interface explicitly starts it with thehold releasecommand. ๐ด--management-log-cachen โ cache the most recent n lines of log file history for usage by the management channel. ๐--management-query-passwordsโ query the management channel for the private key password and--auth-user-passusername/password. Only query the management channel for inputs which ordinarily would have been queried from the console. โ--management-query-proxyโ query the management channel for proxy server information for a specific--remote(client-only). ๐--management-query-remoteโ allow the management interface to override--remotedirectives (client-only). ๐ฐ๏ธ--management-signalโ send aSIGUSR1signal to OpenVPN if the management session disconnects. This is useful when you wish to disconnect an OpenVPN session on user logoff. For--management-clientthis option is not needed since a disconnect will always generate aSIGTERM. ๐ถ--management-up-downโ report tunnel up/down events to the management interface. ๐๐
๐ Plug-in Interface Options ๐
OpenVPN can be extended by loading external plug-in modules at runtime. These plug-ins must be prebuilt and adhere to the OpenVPN Plug-In API. So like, bring your own modules, but they gotta follow the rules. โจ
--pluginargs โ loads an OpenVPN plug-in module.
Valid syntax:
plugin module-name plugin module-name "arguments"
so like, `module-name` HAS to be the very first argument bestie โ that's the plug-in you're loading. the second argument is an *optional* init string that gets yeeted **straight** into the plug-in. and if that init string is actually several arguments chillin' together, you gotta wrap the whole thing in double quotes (`"`). also!! you can load *multiple* plugin modules into one single OpenVPN process, no cap. ๐ซถ
the `module-name` can be a plain filename OR a filename with a relative or absolute path โ and the <hotpink>format of the filename and path</hotpink> is literally what decides whether the plug-in loads from the default plug-in directory or from somewhere outside it. it's giving โจpath-based destinyโจ:
- `--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`
<purple>`DEFAULT_DIR`</purple> gets swapped out for the default plug-in directory, which was configured at the **build time** of OpenVPN. and `CWD` is the current directory where OpenVPN was started, *or* the directory OpenVPN has switched into via the `--cd` option before the `--plugin` option. periodt. ๐
for more info and examples on how to build OpenVPN plug-in modules, go read the `README` file in the plugin folder of the OpenVPN source distribution. iconic behavior honestly.
if you're using an RPM install of OpenVPN, look at `/usr/share/openvpn/plugin` โ the documentation lives in `doc` and the actual plugin modules live in `lib`. ๐
multiple plugin modules can be **cascaded**, and modules can run in tandem with scripts. the modules get called by OpenVPN in the exact order they're declared in the config file. if both a plugin *and* a script are configured for the same callback, the script gets called **last**. and if the return code of the module/script controls an authentication function (like `tls-verify`, `auth-user-pass-verify`, or `client-connect`), then *every* module and script must return success (`0`) for the connection to be authenticated. no skipping, no shortcuts, everybody eats. ๐ฅ
> **WARNING:** Plug-ins may do deferred execution, meaning the plug-in will return the control back to the main OpenVPN process and provide the plug-in result later on via a different thread or process. OpenVPN does **NOT** support multiple authentication plug-ins where more than one plugin tries to do deferred authentication. If this behaviour is detected, OpenVPN will shut down upon first authentication. ๐ like, deadass, it just quits.
---
## ๐ช Windows-Specific Options ๐ช
okay so these options are considered <red>unknown</red> on non-Windows platforms, which results in a **fatal error** (except for `--route-method` btw, that one's the exception bestie). you might wanna use `--setenv opt` or `--ignore-unknown-option` to ignore said error. but note!! pushing unknown options from server does **not** trigger fatal errors. โจ
- **`--allow-nonadmin`** *TAP-adapter* โ (Standalone) Set *TAP-adapter* to allow access from non-administrative accounts. If *TAP-adapter* is omitted, **all** TAP adapters on the system will be configured to allow non-admin access. the non-admin access setting will only persist for the length of time that the TAP-Win32 device object and driver remain loaded, and will need to be re-enabled after a reboot, or if the driver is unloaded and reloaded. also this directive can **only** be used by an administrator. ๐
- **`--block-outside-dns`** โ Block DNS servers on other network adapters to prevent DNS leaks. this option prevents any application from accessing TCP or UDP port `53` except one inside the tunnel. it uses Windows Filtering Platform (WFP) and works on Windows Vista or later. ๐ฆ
- **`--cryptoapicert`** *select-string* โ (Windows/OpenSSL Only) Load the certificate and private key from the Windows Certificate System Store.
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 (SHA1 hash):
cryptoapicert "THUMB:f6 49 24 41 01 b4 ..."
the thumbprint hex string can easily be copy-and-pasted from the Windows Certificate Store GUI. the embedded spaces in the hex string are optional. ๐
To select a certificate based on a substring in certificate's issuer name:
cryptoapicert "ISSUER:Sample CA"
To select a certificate based on a certificate's template name or OID of the template:
cryptoapicert "TMPL:Name of Template" cryptoapicert "TMPL:1.3.6.1.4..."
the **first non-expired certificate** found in the user's store or the machine store that matches the *select-string* is used. ๐ฏ
- **`--dhcp-release`** โ Ask Windows to release the TAP adapter lease on shutdown. this option has no effect now, as it is enabled by default starting with OpenVPN `2.4.1`. lowkey obsolete but we still list it, bestie.
- **`--dhcp-renew`** โ 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. ๐
- **`--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 `0`. 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. ๐ง
- **`--pause-exit`** โ Put up a `"press any key to continue"` message on the console prior to OpenVPN program exit. This option is automatically used by the Windows explorer when OpenVPN is run on a configuration file using the right-click explorer menu. ๐ฑ๏ธโจ
- **`--register-dns`** โ runs `ipconfig /flushdns` and `ipconfig /registerdns` the moment the connection kicks off. It's a known trick to get Windows to actually *notice* the DNS servers that got pushed to it. No cap, Windows is just Like That. ๐ชโจ
- **`--route-method m`** โ which method `m` should we use for adding routes on Windows, bestie? Pick your fighter:
- **`adaptive`** (default) โ try the IP helper API first, and if that flops, fall back to the `route.exe` shell command. Flexible queen. ๐
- **`ipapi`** โ use the IP helper API. Periodt.
- **`exe`** โ just call the `route.exe` shell command directly.
- **`--service args`** โ use this when OpenVPN is getting auto-launched by some other program in a situation where there's literally no way for a human to interact with it โ no display, no keyboard, nothing. Total ghost mode. ๐ป
Valid syntax:
service exit-event [0|1]
Honestly, end-users should basically never need to type this by hand, because the OpenVPN service wrapper adds it automatically whenever a given OpenVPN config is being run as a service.
`exit-event` is the name of a Windows global event object, and OpenVPN will just... stare at that event object forever, watching its state, and bail out the second it becomes signaled. ๐
That second parameter sets the initial state of `exit-event`, and it normally defaults to `0`.
Multiple OpenVPN processes can run at the same time with the *same* `exit-event` parameter โ and in any case, the controlling process can signal `exit-event` and make every single one of those OpenVPN processes exit. Group exit, very demure. ๐
> Heads up: when you run an OpenVPN process with the `--service` directive, it probably won't have a console window to dump status/error messages into. So it's genuinely useful to pair it with `--log` or `--log-append` to write those messages to a file instead. ๐ฅ
- **`--show-adapters`** โ (Standalone) shows the available TAP-Win32 adapters you can pick from using the `--dev-node` option. On non-Windows systems, the `ifconfig(8)` command gives you similar functionality. Same energy, different platform. ๐
- **`--show-net`** โ (Standalone) shows OpenVPN's view of the system routing table *and* the network adapter list. Receipts. ๐งพ
- **`--show-net-up`** โ dumps OpenVPN's view of the system routing table and network adapter list to the syslog or log file, but only *after* the TUN/TAP adapter has been brought up and any routes have been added.
- **`--show-valid-subnets`** โ (Standalone) shows the valid subnets for `--dev tun` emulation. Here's the lore: the TAP-Win32 driver exports an ethernet interface to Windows, and TUN devices are point-to-point by nature, so the TAP-Win32 driver has to impose certain constraints on how TUN endpoint addresses get selected.
Specifically: the point-to-point endpoints used in TUN device emulation have to be the middle two addresses of a `/30` subnet (netmask `255.255.255.252`). That's just the rules, bestie. ๐ซถ
- **`--tap-sleep n`** โ makes OpenVPN sleep for `n` seconds right after the TAP-Win32 adapter state gets set to `"connected"`.
This one is for troubleshooting problems with the `--ifconfig` and `--ip-win32` options โ it gives the TAP-Win32 adapter time to actually come up before Windows IP Helper API operations get applied to it. Give her a sec to get ready. ๐
- **`--win-sys path`** โ sets the Windows system directory pathname to use when hunting for system executables like `route.exe` and `netsh.exe`. By default, if you don't specify this directive, OpenVPN uses the `SystemRoot` environment variable.
> This option changed behaviour back in OpenVPN 2.3. Back in the day you had to define `--win-sys env` to use the `SystemRoot` environment variable, otherwise it defaulted to `C:\\WINDOWS`. You do **not** need the `env` keyword any more, and if you use it, it'll just be ignored. A warning gets logged when it's found in the configuration file. R.I.P. `env` keyword, you were real. ๐
---
## ๐ฆ Standalone Debug Options ๐ฆ
- **`--show-gateway args`** โ (Standalone) shows the current IPv4 and IPv6 default gateway, plus the interface towards that gateway (if the protocol in question is enabled). Very main character diagnostic energy. ๐
Valid syntax:
--show-gateway --show-gateway IPv4-target --show-gateway IPv6-target
For IPv4 it looks for a `0.0.0.0/0` route, or the specified IPv4 address if the target can be parsed as an IPv4 address. For IPv6 it queries the route towards `::/128`, or the specified IPv6 target address if the argument is an IPv6 address.
Adding a target is genuinely helpful for diagnostics โ it lets you see whether OpenVPN will do the right thing when there are more specific IPv4/IPv6 routes pointing at a VPN server. ๐
---
## ๐ธ Advanced Expert Options ๐ธ
These are the options you only need when some special tweaking is required โ often when you're debugging or testing out special usage scenarios. Expert mode unlocked, iykyk. ๐ง
- **`--hash-size args`** โ sets the size of the real address hash table to `r` and the virtual address table to `v`.
Valid syntax:
hash-size r v
By default, both tables get sized at 4 times `--max-clients` buckets. With the default of `1024` for `--max-clients`, that gives you `4096` buckets. Math is beautiful actually. โจ
- **`--bcast-buffers n`** โ allocate `n` buffers for broadcast datagrams (default `256`).
- **`--persist-local-ip`** โ preserve the initially resolved local IP address and port number across `SIGUSR1` or `--ping-restart` restarts. She remembers where she came from. ๐
- **`--persist-remote-ip`** โ preserve the most recently authenticated remote IP address and port number across `SIGUSR1` or `--ping-restart` restarts.
- **`--rcvbuf size`** โ set the TCP/UDP socket receive buffer size. Defaults to the operating system default.
- **`--shaper n`** โ limit the bandwidth of outgoing tunnel data to `n` bytes per second on the TCP/UDP port. Quick note: this only works if mode is set to `p2p`. If you want to limit bandwidth in *both* directions, use this option on both peers. Teamwork makes the dream work. ๐ค
OpenVPN uses this 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, it waits a minimum of `(b / n)` seconds before queuing the next write. The maths is mathing. ๐งฎ
It should be noted that OpenVPN supports multiple tunnels between the same two peers, which means you can build full-speed *and* reduced-bandwidth tunnels at the same time โ routing low-priority data like off-site backups over the reduced-bandwidth tunnel, and everything else over the full-speed one. Iconic setup honestly. ๐ฅ
> Also note: for low bandwidth tunnels (under `1000` bytes per second), you should probably use lower MTU values too (see above), otherwise the packet latency will grow so large that it triggers timeouts in the TLS layer and in TCP connections running over the tunnel. Latency jump scare, no thank you. ๐ญ
OpenVPN allows `n` to be between `100` bytes/sec and `100` Mbytes/sec.
- **`--sndbuf size`** โ set the TCP/UDP socket send buffer size. Defaults to the operating system default.
- **`--tcp-queue-limit n`** โ maximum number of output packets queued before TCP (default `64`).
Here's the situation: when OpenVPN is tunneling data from a TUN/TAP device to a remote client over a TCP connection, it's possible the TUN/TAP device produces data faster than the TCP connection can handle. When the number of output packets queued before sending to the TCP socket hits this limit for a given client connection, OpenVPN starts dropping outgoing packets headed at that client. Dropped. Gone. Not invited to the party. ๐
- **`--txqueuelen n`** โ (Linux only) set the TX queue length on the TUN/TAP interface. Currently defaults to the operating system default. ๐ง
- **`--disable-dco`** โ disables the opportunistic use of data channel offloading if it's available. Without this option, OpenVPN will opportunistically use DCO mode if the config options and the running kernel support using DCO.
Data channel offload currently requires `data-ciphers` to contain only AEAD ciphers (AES-GCM and Chacha20-Poly1305), plus Linux with the `ovpn` module. The `ovpn` module has been integrated into the Linux kernel since `6.16`, or is available as a backport from `https://github.com/OpenVPN/ovpn-backports`. Very "we got an upgrade" of them. ๐
Note that some options have no effect or cannot be used when DCO mode is enabled. Know the limits, bestie.
On platforms that don't support DCO, `disable-dco` has no effect. Nothing to disable, nothing happens. ๐
# ๐ UNSUPPORTED OPTIONS ๐
okay so bestie, this whole section is a graveyard ๐โจ these options got **removed** from OpenVPN and are *no longer supported*. they're gone-gone. if you see them in an old config, that's a vintage piece, not a working setup ๐
- **`--client-cert-not-required`** โ removed back in OpenVPN 2.5 ๐
you should swap it for `--verify-client-cert none` instead, that's the glow-up.
- **`--fast-io`** โ ignored since OpenVPN 2.7. it became broken because of changes to the event loop, so now it just sits there. lowkey tragic.
- **`--http-proxy-retry`** โ removed in OpenVPN 2.4. all the retries are controlled by `--max-connect-retry` now.
- **`--http-proxy-timeout`** โ removed in OpenVPN 2.4. the connection timeout is controlled by `--connect-timeout` now.
- **`--ifconfig-pool-linear`** โ removed in OpenVPN 2.5. replace it with `--topology p2p` โจ
- **`--key-method`** โ removed in OpenVPN 2.5. do **not** use this, because using the old key-method weakens the VPN tunnel security ๐ญ the old key-method was also only needed when the remote side was older than OpenVPN 2.0. so like, ancient. periodt.
- **`--management-client-pf`** โ removed in OpenVPN 2.6. the built-in packet filtering (pf) functionality has been removed.
- **`--max-routes`** โ removed in OpenVPN 2.4. the limit was removed. bye ๐
- **`--ncp-disable`** โ removed in OpenVPN 2.6. it mainly served a role as a debug option when NCP was first introduced, so it should no longer be necessary.
- **`--no-iv`** โ removed in OpenVPN 2.5. don't use it, it weakens the VPN tunnel security ๐จ this has been a NOOP option since OpenVPN 2.4.
- **`--no-replay`** โ removed in OpenVPN 2.7. don't use it, it weakens the VPN tunnel security. and the tea here โ previously we claimed to have removed this in OpenVPN 2.5, but this wasn't actually the case. not us lying ๐ญ
- **`--prng`** โ removed in OpenVPN 2.6. we now always use the PRNG of the SSL library.
- **`--persist-key`** โ ignored since OpenVPN 2.7. keys are now always persisted across restarts, so she's just vibing there doing nothing.
- **`--opt-verify`** โ removed in OpenVPN 2.7. this option does not make sense anymore as option strings may not match due to the introduction of parameters negotiation.
- **`--socks-proxy-retry`** โ removed in OpenVPN 2.4. all retries are controlled by `--max-connect-retry`.
- **`--windows-driver`** โ removed in OpenVPN 2.7. OpenVPN will always use `ovpn-dco` as the default driver on Windows. it will fall back to `tap-windows6` if options are used that are incompatible with `ovpn-dco`.
---
# ๐ฆ CONNECTION PROFILES ๐ฆ
so a client config file can contain **multiple remote servers** and it'll just try to connect against all of them ๐ but some config options are tied to a specific `--remote` option, and *that's* where connection profiles come in. the solution. the moment. the main character energy โจ
by wrapping the `--remote` option and its related options inside `<connection>` and `</connection>`, those options get handled as a **group** ๐
an OpenVPN client will try each connection profile **sequentially** until it achieves a successful connection ๐
`--remote-random` can be used to initially "scramble" the connection list ๐
here's an example of connection profile usage, copied exactly, no notes:
client dev tun
<connection> remote 198.19.34.56 1194 udp </connection>
<connection> remote 198.19.34.56 443 tcp </connection>
<connection> remote 198.19.34.56 443 tcp http-proxy 192.168.0.8 8080 </connection>
<connection> remote 198.19.36.99 443 tcp http-proxy 192.168.0.8 8080 </connection>
persist-tun pkcs12 client.p12 remote-cert-tls server verb 3
so what's the plot here ๐ first we try to connect to a server at `198.19.34.56:1194` using UDP. if that fails, we then try to connect to `198.19.34.56:443` using TCP. if that *also* fails, then try connecting through an HTTP proxy at `192.168.0.8:8080` to `198.19.34.56:443` using TCP. finally, try to connect through the same proxy to a server at `198.19.36.99:443` using TCP. a whole journey ๐ญ
the following OpenVPN options may be used inside of a `<connection>` block:
`bind`, `connect-retry`, `connect-retry-max`, `connect-timeout`, `explicit-exit-notify`, `float`, `fragment`, `http-proxy`, `http-proxy-option`, `key-direction`, `link-mtu`, `local`, `lport`, `mssfix`, `mtu-disc`, `nobind`, `port`, `proto`, `remote`, `rport`, `socks-proxy`, `tls-auth`, `tls-crypt`, `tls-crypt-v2`, `tun-mtu` and, `tun-mtu-extra`.
there's also a **defaulting mechanism** for specifying options that apply to *all* `<connection>` profiles ๐
if any of the above options (with the exception of `remote`) appear **outside** of a `<connection>` block, but in a configuration file which has one or more `<connection>` blocks, the option setting will be used as a default for `<connection>` blocks which follow it in the configuration file. it's giving cascade โจ
for example, suppose the `nobind` option were placed in the sample configuration file above, near the top of the file, before the first `<connection>` block. the effect would be as if `nobind` were declared in all `<connection>` blocks below it ๐
---
# ๐ธ INLINE FILE SUPPORT ๐ธ
OpenVPN lets you include files **in the main configuration** for the `--ca`, `--cert`, `--dh`, `--extra-certs`, `--key`, `--pkcs12`, `--crl-verify`, `--http-proxy-user-pass`, `--tls-auth`, `--auth-gen-token-secret`, `--peer-fingerprint`, `--tls-crypt`, `--tls-crypt-v2`, `--verify-hash` and `--auth-user-pass` options ๐
each inline file is started by the line `<option>` and ended by the line `</option>`
here's an example of an inline file usage:
<cert> -----BEGIN CERTIFICATE----- [...] -----END CERTIFICATE----- </cert>
> ๐จ when using the inline file feature with `--pkcs12` the inline file **has to be base64 encoded**. encoding of a `.p12` file into base64 can be done for example with OpenSSL by running `openssl base64 -in input.p12`
---
# โญ SIGNALS โญ
- **`SIGHUP`** โ cause OpenVPN to close all TUN/TAP and network connections, restart, re-read the configuration file (if any), and reopen TUN/TAP and network connections. a full reset bestie ๐ซ
- **`SIGUSR1`** โ like `SIGHUP`, except don't re-read configuration file, and possibly don't close and reopen TUN/TAP device, re-read key files, preserve local IP address/port, or preserve most recently authenticated remote IP address/port based on `--persist-tun`, `--persist-local-ip` and `--persist-remote-ip` options respectively (see above). this signal may also be internally generated by a timeout condition, governed by the `--ping-restart` option. this signal, when combined with `--persist-remote-ip`, may be sent when the underlying parameters of the host's network interface change such as when the host is a DHCP client and is assigned a new IP address. see `--ipchange` for more information ๐ฆ
- **`SIGUSR2`** โ causes OpenVPN to display its current statistics (to the syslog file if `--daemon` is used, or stdout otherwise). stats check โจ
- **`SIGINT`, `SIGTERM`** โ causes OpenVPN to exit gracefully ๐ซถ
---
# โ FAQ โ
`https://community.openvpn.net/openvpn/wiki/FAQ`
---
# ๐ง HOWTO ๐ง
the manual `openvpn-examples(5)` gives some examples, especially for small setups ๐
for a more comprehensive guide to setting up OpenVPN in a production setting, see the OpenVPN HOWTO at `https://openvpn.net/community-resources/how-to/`
---
# ๐ฅ PROTOCOL ๐ฅ
an ongoing effort to document the OpenVPN protocol can be found under `https://github.com/openvpn/openvpn-rfc` ๐
---
# ๐ WEB ๐
OpenVPN's web site is at `https://community.openvpn.net/`
go here to download the latest version of OpenVPN, subscribe to the mailing lists, read the mailing list archives, or browse the Git repository ๐
---
# ๐ BUGS ๐
report all bugs to the OpenVPN team `info@openvpn.net` โ they wanna hear it, fr fr ๐
---
# ๐ SEE ALSO ๐
`openvpn-examples(5)`, `dhcpcd(8)`, `ifconfig(8)`, `openssl(1)`, `route(8)`, `scp(1)` `ssh(1)`
---
# ๐ NOTES ๐
this product includes software developed by the OpenSSL Project (`https://www.openssl.org/`)
for more information on the TLS protocol see: `https://tools.ietf.org/html/rfc2246`
for more information on the LZO real-time compression library see: `https://www.oberhumer.com/opensource/lzo/`
---
# ๐ COPYRIGHT ๐
Copyright (C) 2002-2025 OpenVPN Inc This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
---
# ๐ AUTHORS ๐
James Yonan `james@openvpn.net`
---
aaaand that's the whole page bestie, we did it ๐ฅน๐
<rainbow>you just read the entire **OPENVPN(8)** man page**</rainbow> โ the OpenVPN 8th-section manual, as rendered here as `OPENVPN(8)`. no cap, every single flag, signal, file path and copyright line made it to the end with us ๐ซถ go forth and tunnel responsibly, ily, byeee โจ๐
๐ฆ where this page comes from
- epel 10: openvpn 2.7.8-1.el10_3 ยท GPL-2.0-only
- fedora 44: openvpn 2.7.8-1.fc44 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms