svn cleanup
[anytun.git] / openvpn / openvpn.8
blob07beb0723b80b8a04c1a0ef2f839cfd32e31453d
1 .\"  OpenVPN -- An application to securely tunnel IP networks
2 .\"             over a single TCP/UDP port, with support for SSL/TLS-based
3 .\"             session authentication and key exchange,
4 .\"             packet encryption, packet authentication, and
5 .\"             packet compression.
6 .\"
7 .\"  Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net>
8 .\"
9 .\"  This program is free software; you can redistribute it and/or modify
10 .\"  it under the terms of the GNU General Public License version 2
11 .\"  as published by the Free Software Foundation.
12 .\"
13 .\"  This program is distributed in the hope that it will be useful,
14 .\"  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\"  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 .\"  GNU General Public License for more details.
17 .\"
18 .\"  You should have received a copy of the GNU General Public License
19 .\"  along with this program (see the file COPYING included with this
20 .\"  distribution); if not, write to the Free Software Foundation, Inc.,
21 .\"  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22 .\"
23 .\" Manual page for openvpn
24 .\" SH section heading
25 .\" SS subsection heading
26 .\" LP paragraph
27 .\" IP indented paragraph
28 .\" TP hanging label
29 .TH openvpn 8 "3 August 2005"
30 .\"*********************************************************
31 .SH NAME
32 openvpn \- secure IP tunnel daemon.
33 .\"*********************************************************
34 .SH SYNOPSIS
35 .LP
36 .nh
37 .in +4
38 .ti -4
39 .B openvpn
40 [\ \fB\-\-help\fR\ ]
41 .in -4
42 .ti +4
43 .hy
45 .nh
46 .in +4
47 .ti -4
48 .B openvpn
49 [\ \fB\-\-config\fR\ \fIfile\fR\ ]
50 .in -4
51 .ti +4
52 .hy
54 .nh
55 .in +4
56 .ti -4
57 .B openvpn
58 [\ \fB\-\-genkey\fR\ ]
59 [\ \fB\-\-secret\fR\ \fIfile\fR\ ]
60 .in -4
61 .ti +4
62 .hy
64 .nh
65 .in +4
66 .ti -4
67 .B openvpn
68 [\ \fB\-\-mktun\fR\ ]
69 [\ \fB\-\-rmtun\fR\ ]
70 [\ \fB\-\-dev\fR\ \fItunX\ |\ tapX\fR\ ]
71 [\ \fB\-\-dev\-type\fR\ \fIdevice\-type\fR\ ]
72 [\ \fB\-\-dev\-node\fR\ \fInode\fR\ ]
73 .in -4
74 .ti +4
75 .hy
77 .nh
78 .in +4
79 .ti -4
80 .B openvpn
81 [\ \fB\-\-test\-crypto\fR\ ]
82 [\ \fB\-\-secret\fR\ \fIfile\fR\ ]
83 [\ \fB\-\-auth\fR\ \fIalg\fR\ ]
84 [\ \fB\-\-cipher\fR\ \fIalg\fR\ ]
85 [\ \fB\-\-engine\fR\ ]
86 [\ \fB\-\-keysize\fR\ \fIn\fR\ ]
87 [\ \fB\-\-no\-replay\fR\ ]
88 [\ \fB\-\-no\-iv\fR\ ]
89 .in -4
90 .ti +4
91 .hy
93 .nh
94 .in +4
95 .ti -4
96 .B openvpn
97 [\ \fB\-\-askpass\fR\ \fI[file]\fR\ ]
98 [\ \fB\-\-auth\-nocache\fR\ ]
99 [\ \fB\-\-auth\-retry\fR\ \fItype\fR\ ]
100 [\ \fB\-\-auth\-user\-pass\-verify\fR\ \fIscript\fR\ ]
101 [\ \fB\-\-auth\-user\-pass\fR\ \fIup\fR\ ]
102 [\ \fB\-\-auth\fR\ \fIalg\fR\ ]
103 [\ \fB\-\-bcast\-buffers\fR\ \fIn\fR\ ]
104 [\ \fB\-\-ca\fR\ \fIfile\fR\ ]
105 [\ \fB\-\-ccd\-exclusive\fR\ ]
106 [\ \fB\-\-cd\fR\ \fIdir\fR\ ]
107 [\ \fB\-\-cert\fR\ \fIfile\fR\ ]
108 [\ \fB\-\-chroot\fR\ \fIdir\fR\ ]
109 [\ \fB\-\-cipher\fR\ \fIalg\fR\ ]
110 [\ \fB\-\-client\-cert\-not\-required\fR\ ]
111 [\ \fB\-\-client\-config\-dir\fR\ \fIdir\fR\ ]
112 [\ \fB\-\-client\-connect\fR\ \fIscript\fR\ ]
113 [\ \fB\-\-client\-disconnect\fR\ ]
114 [\ \fB\-\-client\-to\-client\fR\ ]
115 [\ \fB\-\-client\fR\ ]
116 [\ \fB\-\-comp\-lzo\fR\ ]
117 [\ \fB\-\-comp\-noadapt\fR\ ]
118 [\ \fB\-\-config\fR\ \fIfile\fR\ ]
119 [\ \fB\-\-connect\-freq\fR\ \fIn\ sec\fR\ ]
120 [\ \fB\-\-connect\-retry\fR\ \fIn\fR\ ]
121 [\ \fB\-\-crl\-verify\fR\ \fIcrl\fR\ ]
122 [\ \fB\-\-cryptoapicert\fR\ \fIselect\-string\fR\ ]
123 [\ \fB\-\-daemon\fR\ \fI[progname]\fR\ ]
124 [\ \fB\-\-dev\-node\fR\ \fInode\fR\ ]
125 [\ \fB\-\-dev\-type\fR\ \fIdevice\-type\fR\ ]
126 [\ \fB\-\-dev\fR\ \fItunX\ |\ tapX\ |\ null\fR\ ]
127 [\ \fB\-\-dev\fR\ \fItunX\ |\ tapX\fR\ ]
128 [\ \fB\-\-dh\fR\ \fIfile\fR\ ]
129 [\ \fB\-\-dhcp\-option\fR\ \fItype\ [parm]\fR\ ]
130 [\ \fB\-\-dhcp\-release\fR\ ]
131 [\ \fB\-\-dhcp\-renew\fR\ ]
132 [\ \fB\-\-disable\-occ\fR\ ]
133 [\ \fB\-\-disable\fR\ ]
134 [\ \fB\-\-down\-pre\fR\ ]
135 [\ \fB\-\-down\fR\ \fIcmd\fR\ ]
136 [\ \fB\-\-duplicate\-cn\fR\ ]
137 [\ \fB\-\-echo\fR\ \fI[parms...]\fR\ ]
138 [\ \fB\-\-engine\fR\ \fI[engine\-name]\fR\ ]
139 [\ \fB\-\-explicit\-exit\-notify\fR\ \fI[n]\fR\ ]
140 [\ \fB\-\-fast\-io\fR\ ]
141 [\ \fB\-\-float\fR\ ]
142 [\ \fB\-\-fragment\fR\ \fImax\fR\ ]
143 [\ \fB\-\-genkey\fR\ ]
144 [\ \fB\-\-group\fR\ \fIgroup\fR\ ]
145 [\ \fB\-\-hand\-window\fR\ \fIn\fR\ ]
146 [\ \fB\-\-hash\-size\fR\ \fIr\ v\fR\ ]
147 [\ \fB\-\-help\fR\ ]
148 [\ \fB\-\-http\-proxy\-option\fR\ \fItype\ [parm]\fR\ ]
149 [\ \fB\-\-http\-proxy\-retry\fR\ ]
150 [\ \fB\-\-http\-proxy\-timeout\fR\ \fIn\fR\ ]
151 [\ \fB\-\-http\-proxy\fR\ \fIserver\ port\ [authfile]\ [auth\-method]\fR\ ]
152 [\ \fB\-\-ifconfig\-noexec\fR\ ]
153 [\ \fB\-\-ifconfig\-nowarn\fR\ ]
154 [\ \fB\-\-ifconfig\-pool\-linear\fR\ ]
155 [\ \fB\-\-ifconfig\-pool\-persist\fR\ \fIfile\ [seconds]\fR\ ]
156 [\ \fB\-\-ifconfig\-pool\fR\ \fIstart\-IP\ end\-IP\ [netmask]\fR\ ]
157 [\ \fB\-\-ifconfig\-push\fR\ \fIlocal\ remote\-netmask\fR\ ]
158 [\ \fB\-\-ifconfig\fR\ \fIl\ rn\fR\ ]
159 [\ \fB\-\-inactive\fR\ \fIn\fR\ ]
160 [\ \fB\-\-inetd\fR\ \fI[wait|nowait]\ [progname]\fR\ ]
161 [\ \fB\-\-ip\-win32\fR\ \fImethod\fR\ ]
162 [\ \fB\-\-ipchange\fR\ \fIcmd\fR\ ]
163 [\ \fB\-\-iroute\fR\ \fInetwork\ [netmask]\fR\ ]
164 [\ \fB\-\-keepalive\fR\ \fIn\ m\fR\ ]
165 [\ \fB\-\-key\-method\fR\ \fIm\fR\ ]
166 [\ \fB\-\-key\fR\ \fIfile\fR\ ]
167 [\ \fB\-\-keysize\fR\ \fIn\fR\ ]
168 [\ \fB\-\-learn\-address\fR\ \fIcmd\fR\ ]
169 [\ \fB\-\-link\-mtu\fR\ \fIn\fR\ ]
170 [\ \fB\-\-local\fR\ \fIhost\fR\ ]
171 [\ \fB\-\-log\-append\fR\ \fIfile\fR\ ]
172 [\ \fB\-\-log\fR\ \fIfile\fR\ ]
173 [\ \fB\-\-suppress-timestamps\fR\ ]
174 [\ \fB\-\-lport\fR\ \fIport\fR\ ]
175 [\ \fB\-\-management\-hold\fR\ ]
176 [\ \fB\-\-management\-log\-cache\fR\ \fIn\fR\ ]
177 [\ \fB\-\-management\-query\-passwords\fR\ ]
178 [\ \fB\-\-management\fR\ \fIIP\ port\ [pw\-file]\fR\ ]
179 [\ \fB\-\-max\-clients\fR\ \fIn\fR\ ]
180 [\ \fB\-\-max\-routes\-per\-client\fR\ \fIn\fR\ ]
181 [\ \fB\-\-mktun\fR\ ]
182 [\ \fB\-\-mlock\fR\ ]
183 [\ \fB\-\-mode\fR\ \fIm\fR\ ]
184 [\ \fB\-\-mssfix\fR\ \fImax\fR\ ]
185 [\ \fB\-\-mtu\-disc\fR\ \fItype\fR\ ]
186 [\ \fB\-\-mtu\-test\fR\ ]
187 [\ \fB\-\-mute\-replay\-warnings\fR\ ]
188 [\ \fB\-\-mute\fR\ \fIn\fR\ ]
189 [\ \fB\-\-nice\fR\ \fIn\fR\ ]
190 [\ \fB\-\-no\-iv\fR\ ]
191 [\ \fB\-\-no\-replay\fR\ ]
192 [\ \fB\-\-nobind\fR\ ]
193 [\ \fB\-\-ns\-cert\-type\fR\ \fIclient|server\fR\ ]
194 [\ \fB\-\-passtos\fR\ ]
195 [\ \fB\-\-pause\-exit\fR\ ]
196 [\ \fB\-\-persist\-key\fR\ ]
197 [\ \fB\-\-persist\-local\-ip\fR\ ]
198 [\ \fB\-\-persist\-remote\-ip\fR\ ]
199 [\ \fB\-\-persist\-tun\fR\ ]
200 [\ \fB\-\-ping\-exit\fR\ \fIn\fR\ ]
201 [\ \fB\-\-ping\-restart\fR\ \fIn\fR\ ]
202 [\ \fB\-\-ping\-timer\-rem\fR\ ]
203 [\ \fB\-\-ping\fR\ \fIn\fR\ ]
204 [\ \fB\-\-pkcs12\fR\ \fIfile\fR\ ]
205 [\ \fB\-\-plugin\fR\ \fImodule\-pathname\ init\-string\fR\ ]
206 [\ \fB\-\-port\fR\ \fIport\fR\ ]
207 [\ \fB\-\-proto\fR\ \fIp\fR\ ]
208 [\ \fB\-\-pull\fR\ ]
209 [\ \fB\-\-push\-reset\fR\ ]
210 [\ \fB\-\-push\fR\ \fI"option"\fR\ ]
211 [\ \fB\-\-rcvbuf\fR\ \fIsize\fR\ ]
212 [\ \fB\-\-redirect\-gateway\fR\ \fI["local"]\ ["def1"]\fR\ ]
213 [\ \fB\-\-remap\-usr1\fR\ \fIsignal\fR\ ]
214 [\ \fB\-\-remote\-random\fR\ ]
215 [\ \fB\-\-remote\fR\ \fIhost\ [port]\fR\ ]
216 [\ \fB\-\-reneg\-bytes\fR\ \fIn\fR\ ]
217 [\ \fB\-\-reneg\-pkts\fR\ \fIn\fR\ ]
218 [\ \fB\-\-reneg\-sec\fR\ \fIn\fR\ ]
219 [\ \fB\-\-replay\-persist\fR\ \fIfile\fR\ ]
220 [\ \fB\-\-replay\-window\fR\ \fIn\ [t]\fR\ ]
221 [\ \fB\-\-resolv\-retry\fR\ \fIn\fR\ ]
222 [\ \fB\-\-rmtun\fR\ ]
223 [\ \fB\-\-route\-delay\fR\ \fI[n]\ [w]\fR\ ]
224 [\ \fB\-\-route\-gateway\fR\ \fIgw\fR\ ]
225 [\ \fB\-\-route\-method\fR\ \fIm\fR\ ]
226 [\ \fB\-\-route\-noexec\fR\ ]
227 [\ \fB\-\-route\-up\fR\ \fIcmd\fR\ ]
228 [\ \fB\-\-route\fR\ \fInetwork\ [netmask]\ [gateway]\ [metric]\fR\ ]
229 [\ \fB\-\-rport\fR\ \fIport\fR\ ]
230 [\ \fB\-\-secret\fR\ \fIfile\ [direction]\fR\ ]
231 [\ \fB\-\-secret\fR\ \fIfile\fR\ ]
232 [\ \fB\-\-server\-bridge\fR\ \fIgateway\ netmask\ pool\-start\-IP\ pool\-end\-IP\fR\ ]
233 [\ \fB\-\-server\fR\ \fInetwork\ netmask\fR\ ]
234 [\ \fB\-\-service\fR\ \fIexit\-event\ [0|1]\fR\ ]
235 [\ \fB\-\-setenv\fR\ \fIname\ value\fR\ ]
236 [\ \fB\-\-shaper\fR\ \fIn\fR\ ]
237 [\ \fB\-\-show\-adapters\fR\ ]
238 [\ \fB\-\-show\-ciphers\fR\ ]
239 [\ \fB\-\-show\-digests\fR\ ]
240 [\ \fB\-\-show\-engines\fR\ ]
241 [\ \fB\-\-show\-net\-up\fR\ ]
242 [\ \fB\-\-show\-net\fR\ ]
243 [\ \fB\-\-show\-tls\fR\ ]
244 [\ \fB\-\-show\-valid\-subnets\fR\ ]
245 [\ \fB\-\-single\-session\fR\ ]
246 [\ \fB\-\-sndbuf\fR\ \fIsize\fR\ ]
247 [\ \fB\-\-socks\-proxy\-retry\fR\ ]
248 [\ \fB\-\-socks\-proxy\fR\ \fIserver\ [port]\fR\ ]
249 [\ \fB\-\-status\fR\ \fIfile\ [n]\fR\ ]
250 [\ \fB\-\-status\-version\fR\ \fIn\fR\ ]
251 [\ \fB\-\-syslog\fR\ \fI[progname]\fR\ ]
252 [\ \fB\-\-tap\-sleep\fR\ \fIn\fR\ ]
253 [\ \fB\-\-tcp\-queue\-limit\fR\ \fIn\fR\ ]
254 [\ \fB\-\-test\-crypto\fR\ ]
255 [\ \fB\-\-tls\-auth\fR\ \fIfile\ [direction]\fR\ ]
256 [\ \fB\-\-tls\-cipher\fR\ \fIl\fR\ ]
257 [\ \fB\-\-tls\-client\fR\ ]
258 [\ \fB\-\-tls\-exit\fR\ ]
259 [\ \fB\-\-tls\-remote\fR\ \fIx509name\fR\ ]
260 [\ \fB\-\-tls\-server\fR\ ]
261 [\ \fB\-\-tls\-timeout\fR\ \fIn\fR\ ]
262 [\ \fB\-\-tls\-verify\fR\ \fIcmd\fR\ ]
263 [\ \fB\-\-tmp\-dir\fR\ \fIdir\fR\ ]
264 [\ \fB\-\-tran\-window\fR\ \fIn\fR\ ]
265 [\ \fB\-\-tun\-ipv6\fR\ ]
266 [\ \fB\-\-tun\-mtu\-extra\fR\ \fIn\fR\ ]
267 [\ \fB\-\-tun\-mtu\fR\ \fIn\fR\ ]
268 [\ \fB\-\-txqueuelen\fR\ \fIn\fR\ ]
269 [\ \fB\-\-up\-delay\fR\ ]
270 [\ \fB\-\-up\-restart\fR\ ]
271 [\ \fB\-\-up\fR\ \fIcmd\fR\ ]
272 [\ \fB\-\-user\fR\ \fIuser\fR\ ]
273 [\ \fB\-\-username\-as\-common\-name\fR\ ]
274 [\ \fB\-\-verb\fR\ \fIn\fR\ ]
275 [\ \fB\-\-writepid\fR\ \fIfile\fR\ ]
276 .in -4
277 .ti +4
279 .\"*********************************************************
280 .SH INTRODUCTION
282 OpenVPN is an open source VPN daemon by James Yonan.
283 Because OpenVPN tries to
284 be a universal VPN tool offering a great deal of flexibility,
285 there are a lot of options on this manual page.
286 If you're new to OpenVPN, you might want to skip ahead to the
287 examples section where you will see how to construct simple
288 VPNs on the command line without even needing a configuration file.
290 Also note that there's more documentation and examples on
291 the OpenVPN web site:
292 .I http://openvpn.net/
294 And if you would like to see a shorter version of this manual,
295 see the openvpn usage message which can be obtained by
296 running
297 .B openvpn
298 without any parameters.
299 .\"*********************************************************
300 .SH DESCRIPTION
302 OpenVPN is a robust and highly flexible VPN daemon.
303 OpenVPN supports SSL/TLS security, ethernet bridging,
304 TCP or UDP tunnel transport through proxies or NAT,
305 support for dynamic IP addresses and DHCP,
306 scalability to hundreds or thousands of users,
307 and portability to most major OS platforms.
309 OpenVPN is tightly bound to the OpenSSL library, and derives much
310 of its crypto capabilities from it.
312 OpenVPN supports
313 conventional encryption
314 using a pre-shared secret key
315 .B (Static Key mode)
317 public key security
318 .B (SSL/TLS mode)
319 using client & server certificates.
320 OpenVPN also
321 supports non-encrypted TCP/UDP tunnels.  
323 OpenVPN is designed to work with the
324 .B TUN/TAP
325 virtual networking interface that exists on most platforms.
327 Overall, OpenVPN aims to offer many of the key features of IPSec but
328 with a relatively lightweight footprint.
329 .\"*********************************************************
330 .SH OPTIONS
331 OpenVPN allows any option to be placed either on the command line
332 or in a configuration file.  Though all command line options are preceded
333 by a double-leading-dash ("--"), this prefix can be removed when
334 an option is placed in a configuration file.
335 .\"*********************************************************
337 .B --help
338 Show options.
339 .\"*********************************************************
341 .B --config file
342 Load additional config options from
343 .B file
344 where each line corresponds to one command line option,
345 but with the leading '--' removed.
348 .B --config file
349 is the only option to the openvpn command,
351 .B --config
352 can be removed, and the command can be given as
353 .B openvpn file
355 Note that
356 configuration files can be nested to a reasonable depth.
358 Double quotation characters ("") can be used
359 to enclose single parameters containing whitespace,
360 and "#" or ";" characters in the first column
361 can be used to denote comments.
363 Note that OpenVPN 2.0 and higher performs backslash-based shell
364 escaping, so the following mappings should be observed:
367 .ft 3
370 \\\\       Maps to a single backslash character (\\).
371 \\"       Pass a literal doublequote character ("), don't
372          interpret it as enclosing a parameter.
373 \\[SPACE] Pass a literal space or tab character, don't
374          interpret it as a parameter delimiter.
380 For example on Windows, use double backslashes to
381 represent pathnames:
384 .ft 3
387 secret "c:\\\\OpenVPN\\\\secret.key"
393 For examples of configuration files,
395 .I http://openvpn.net/examples.html
397 Here is an example configuration file:
399 .ft 3
403 # Sample OpenVPN configuration file for
404 # using a pre-shared static key.
406 # '#' or ';' may be used to delimit comments.
408 # Use a dynamic tun device.
409 dev tun
411 # Our remote peer
412 remote mypeer.mydomain
414 # 10.1.0.1 is our local VPN endpoint
415 # 10.1.0.2 is our remote VPN endpoint
416 ifconfig 10.1.0.1 10.1.0.2
418 # Our pre-shared static key
419 secret static.key
424 .\"*********************************************************
425 .SS Tunnel Options:
427 .B --mode m
428 Set OpenVPN major mode.  By default, OpenVPN runs in
429 point-to-point mode ("p2p").  OpenVPN 2.0 introduces
430 a new mode ("server") which implements a multi-client
431 server capability.
432 .\"*********************************************************
434 .B --local host
435 Local host name or IP address.
436 If specified, OpenVPN will bind to this address only.
437 If unspecified, OpenVPN will bind to all interfaces.
438 .\"*********************************************************
440 .B --remote host [port]
441 Remote host name or IP address.  On the client, multiple
442 .B --remote
443 options may be specified for redundancy, each referring
444 to a different OpenVPN server.
446 The OpenVPN client will try to connect to a server at
447 .B host:port
448 in the order specified by the list of
449 .B --remote
450 options.
452 The client will move on to the next host in the list,
453 in the event of connection failure.
454 Note that at any given time, the OpenVPN client
455 will at most be connected to
456 one server.
458 Note that since UDP is connectionless, connection failure
459 is defined by the
460 .B --ping
462 .B --ping-restart
463 options.
465 Note the following corner case:  If you use multiple
466 .B --remote
467 options, AND you are dropping root privileges on
468 the client with
469 .B --user
470 and/or
471 .B --group,
472 AND the client is running a non-Windows OS, if the client needs
473 to switch to a different server, and that server pushes
474 back different TUN/TAP or route settings, the client may lack
475 the necessary privileges to close and reopen the TUN/TAP interface.
476 This could cause the client to exit with a fatal error.
479 .B --remote
480 is unspecified, OpenVPN will listen
481 for packets from any IP address, but will not act on those packets unless
482 they pass all authentication tests.  This requirement for authentication
483 is binding on all potential peers, even those from known and supposedly
484 trusted IP addresses (it is very easy to forge a source IP address on
485 a UDP packet).
487 When used in TCP mode, 
488 .B --remote
489 will act as a filter, rejecting connections from any host which does
490 not match
491 .B host.
494 .B host
495 is a DNS name which resolves to multiple IP addresses,
496 one will be randomly
497 chosen, providing a sort of basic load-balancing and
498 failover capability.
499 .\"*********************************************************
501 .B --remote-random
502 When multiple
503 .B --remote
504 address/ports are specified, initially randomize the order of the list
505 as a kind of basic load-balancing measure.
506 .\"*********************************************************
508 .B --proto p
509 Use protocol
510 .B p
511 for communicating with remote host.
512 .B p
513 can be
514 .B udp,
515 .B tcp-client,
517 .B tcp-server.
519 The default protocol is
520 .B udp
521 when
522 .B --proto
523 is not specified.
525 For UDP operation,
526 .B --proto udp
527 should be specified on both peers.
529 For TCP operation, one peer must use
530 .B --proto tcp-server
531 and the other must use
532 .B --proto tcp-client.
533 A peer started with
534 .B tcp-server
535 will wait indefinitely for an incoming connection.  A peer
536 started with
537 .B tcp-client
538 will attempt to connect, and if that fails, will sleep for 5
539 seconds (adjustable via the
540 .B --connect-retry
541 option) and try again.  Both TCP client and server will simulate
542 a SIGUSR1 restart signal if either side resets the connection.
544 OpenVPN is designed to operate optimally over UDP, but TCP capability is provided
545 for situations where UDP cannot be used.
546 In comparison with UDP, TCP will usually be
547 somewhat less efficient and less robust when used over unreliable or congested
548 networks.
550 This article outlines some of problems with tunneling IP over TCP:
552 .I http://sites.inka.de/sites/bigred/devel/tcp-tcp.html
554 There are certain cases, however, where using TCP may be advantageous from
555 a security and robustness perspective, such as tunneling non-IP or
556 application-level UDP protocols, or tunneling protocols which don't
557 possess a built-in reliability layer.
558 .\"*********************************************************
560 .B --connect-retry n
562 .B --proto tcp-client,
563 take
564 .B n
565 as the
566 number of seconds to wait
567 between connection retries (default=5).
568 .\"*********************************************************
570 .B --http-proxy server port [authfile] [auth-method]
571 Connect to remote host through an HTTP proxy at address
572 .B server
573 and port
574 .B port.
575 If HTTP Proxy-Authenticate is required,
576 .B authfile
577 is a file containing a username and password on 2 lines, or
578 "stdin" to prompt from console.
580 .B auth-method
581 should be one of "none", "basic", or "ntlm". 
582 .\"*********************************************************
584 .B --http-proxy-retry
585 Retry indefinitely on HTTP proxy errors.  If an HTTP proxy error
586 occurs, simulate a SIGUSR1 reset.
587 .\"*********************************************************
589 .B --http-proxy-timeout n
590 Set proxy timeout to
591 .B n
592 seconds, default=5.
593 .\"*********************************************************
595 .B --http-proxy-option type [parm]
596 Set extended HTTP proxy options.
597 Repeat to set multiple options.
599 .B VERSION version --
600 Set HTTP version number to
601 .B version
602 (default=1.0).
604 .B AGENT user-agent --
605 Set HTTP "User-Agent" string to
606 .B user-agent.
607 .\"*********************************************************
609 .B --socks-proxy server [port]
610 Connect to remote host through a Socks5 proxy at address
611 .B server
612 and port
613 .B port
614 (default=1080).
615 .\"*********************************************************
617 .B --socks-proxy-retry
618 Retry indefinitely on Socks proxy errors.  If a Socks proxy error
619 occurs, simulate a SIGUSR1 reset.
620 .\"*********************************************************
622 .B --resolv-retry n
623 If hostname resolve fails for
624 .B --remote,
625 retry resolve for
626 .B n
627 seconds before failing.
630 .B n
631 to "infinite" to retry indefinitely.
633 By default,
634 .B --resolv-retry infinite
635 is enabled.  You can disable by setting n=0.
636 .\"*********************************************************
638 .B --float
639 Allow remote peer to change its IP address and/or port number, such as due to
640 DHCP (this is the default if
641 .B --remote
642 is not used).
643 .B --float
644 when specified with
645 .B --remote
646 allows an OpenVPN session to initially connect to a peer
647 at a known address, however if packets arrive from a new
648 address and pass all authentication tests, the new address
649 will take control of the session.  This is useful when
650 you are connecting to a peer which holds a dynamic address
651 such as a dial-in user or DHCP client.
653 Essentially,
654 .B --float
655 tells OpenVPN to accept authenticated packets
656 from any address, not only the address which was specified in the
657 .B --remote
658 option.
659 .\"*********************************************************
661 .B --ipchange cmd
662 Execute shell command
663 .B cmd
664 when our remote ip-address is initially authenticated or
665 changes.
667 Execute as:
669 .B cmd ip_address port_number
671 Don't use
672 .B --ipchange
674 .B --mode server
675 mode.  Use a
676 .B --client-connect
677 script instead.
679 See the "Environmental Variables" section below for
680 additional parameters passed as environmental variables.
682 Note that
683 .B cmd
684 can be a shell command with multiple arguments, in which
685 case all OpenVPN-generated arguments will be appended
687 .B cmd
688 to build a command line which will be passed to the script.
690 If you are running in a dynamic IP address environment where
691 the IP addresses of either peer could change without notice,
692 you can use this script, for example, to edit the
693 .I /etc/hosts
694 file with the current address of the peer.  The script will
695 be run every time the remote peer changes its IP address.
697 Similarly if
698 .I our
699 IP address changes due to DHCP, we should configure
700 our IP address change script (see man page for
701 .BR dhcpcd (8)
702 ) to deliver a
703 .B SIGHUP
705 .B SIGUSR1
706 signal to OpenVPN.  OpenVPN will then
707 reestablish a connection with its most recently authenticated
708 peer on its new IP address.
709 .\"*********************************************************
711 .B --port port
712 TCP/UDP port number for both local and remote.  The current
713 default of 1194 represents the official IANA port number
714 assignment for OpenVPN and has been used since version 2.0-beta17.
715 Previous versions used port 5000 as the default.
716 .\"*********************************************************
718 .B --lport port
719 TCP/UDP port number for local.
720 .\"*********************************************************
722 .B --rport port
723 TCP/UDP port number for remote.
724 .\"*********************************************************
726 .B --nobind
727 Do not bind to local address and port.  The IP stack will allocate
728 a dynamic port for returning packets.  Since the value of the dynamic port
729 could not be known in advance by a peer, this option is only suitable for
730 peers which will be initiating connections by using the
731 .B --remote
732 option.
733 .\"*********************************************************
735 .B --dev tunX | tapX | null
736 TUN/TAP virtual network device (
737 .B X
738 can be omitted for a dynamic device.)
740 See examples section below
741 for an example on setting up a TUN device.
743 You must use either tun devices on both ends of the connection
744 or tap devices on both ends.  You cannot mix them, as they
745 represent different underlying protocols.
747 .B tun
748 devices encapsulate IPv4 while
749 .B tap
750 devices encapsulate ethernet 802.3.
751 .\"*********************************************************
753 .B --dev-type device-type
754 Which device type are we using?
755 .B device-type
756 should be
757 .B tun
759 .B tap.
760 Use this option only if the TUN/TAP device used with
761 .B --dev
762 does not begin with
763 .B tun
765 .B tap.
766 .\"*********************************************************
768 .B --tun-ipv6
769 Build a tun link capable of forwarding IPv6 traffic.
770 Should be used in conjunction with
771 .B --dev tun
773 .B --dev tunX.
774 A warning will be displayed
775 if no specific IPv6 TUN support for your OS has been compiled into OpenVPN.
776 .\"*********************************************************
778 .B --dev-node node
779 Explicitly set the device node rather than using
780 /dev/net/tun, /dev/tun, /dev/tap, etc.  If OpenVPN
781 cannot figure out whether
782 .B node
783 is a TUN or TAP device based on the name, you should
784 also specify
785 .B --dev-type tun
787 .B --dev-type tap.
789 On Windows systems, select the TAP-Win32 adapter which
790 is named
791 .B node
792 in the Network Connections Control Panel or the
793 raw GUID of the adapter enclosed by braces.
795 .B --show-adapters
796 option under Windows can also be used
797 to enumerate all available TAP-Win32
798 adapters and will show both the network
799 connections control panel name and the GUID for
800 each TAP-Win32 adapter.
801 .\"*********************************************************
803 .B --ifconfig l rn
804 Set TUN/TAP adapter parameters. 
805 .B l
806 is the IP address of the local VPN endpoint.
807 For TUN devices,
808 .B rn
809 is the IP address of the remote VPN endpoint.
810 For TAP devices,
811 .B rn
812 is the subnet mask of the virtual ethernet segment
813 which is being created or connected to.
815 For TUN devices, which facilitate virtual
816 point-to-point IP connections,
817 the proper usage of
818 .B --ifconfig
819 is to use two private IP addresses
820 which are not a member of any
821 existing subnet which is in use.
822 The IP addresses may be consecutive
823 and should have their order reversed
824 on the remote peer.  After the VPN
825 is established, by pinging
826 .B rn,
827 you will be pinging across the VPN.
829 For TAP devices, which provide
830 the ability to create virtual
831 ethernet segments,
832 .B --ifconfig
833 is used to set an IP address and
834 subnet mask just as a physical
835 ethernet adapter would be
836 similarly configured.  If you are
837 attempting to connect to a remote
838 ethernet bridge, the IP address
839 and subnet should be set to values
840 which would be valid on the
841 the bridged ethernet segment (note
842 also that DHCP can be used for the
843 same purpose).
845 This option, while primarily a proxy for the
846 .BR ifconfig (8)
847 command, is designed to simplify TUN/TAP
848 tunnel configuration by providing a
849 standard interface to the different
850 ifconfig implementations on different
851 platforms.
853 .B --ifconfig
854 parameters which are IP addresses can
855 also be specified as a DNS or /etc/hosts
856 file resolvable name.
858 For TAP devices,
859 .B --ifconfig
860 should not be used if the TAP interface will be
861 getting an IP address lease from a DHCP
862 server.
863 .\"*********************************************************
865 .B --ifconfig-noexec
866 Don't actually execute ifconfig/netsh commands, instead
867 pass
868 .B --ifconfig
869 parameters to scripts using environmental variables.
870 .\"*********************************************************
872 .B --ifconfig-nowarn
873 Don't output an options consistency check warning
874 if the
875 .B --ifconfig
876 option on this side of the
877 connection doesn't match the remote side.  This is useful
878 when you want to retain the overall benefits of the
879 options consistency check (also see
880 .B --disable-occ
881 option) while only disabling the ifconfig component of
882 the check.
884 For example,
885 if you have a configuration where the local host uses
886 .B --ifconfig
887 but the remote host does not, use
888 .B --ifconfig-nowarn
889 on the local host.
891 This option will also silence warnings about potential
892 address conflicts which occasionally annoy more experienced
893 users by triggering "false positive" warnings.
894 .\"*********************************************************
896 .B --route network/IP [netmask] [gateway] [metric]
897 Add route to routing table after connection is established.
898 Multiple routes can be specified.  Routes will be
899 automatically torn down in reverse order prior to
900 TUN/TAP device close.
902 This option is intended as
903 a convenience proxy for the
904 .BR route (8)
905 shell command,
906 while at the same time providing portable semantics
907 across OpenVPN's platform space.
909 .B netmask
910 default -- 255.255.255.255
912 .B gateway
913 default -- taken from
914 .B --route-gateway
915 or the second parameter to
916 .B --ifconfig
917 when
918 .B --dev tun
919 is specified.
921 The default can be specified by leaving an option blank or setting
922 it to "default".
925 .B network
927 .B gateway
928 parameters can
929 also be specified as a DNS or /etc/hosts
930 file resolvable name, or as one of three special keywords:
932 .B vpn_gateway
933 -- The remote VPN endpoint address
934 (derived either from
935 .B --route-gateway
936 or the second parameter to
937 .B --ifconfig
938 when
939 .B --dev tun
940 is specified).
942 .B net_gateway
943 -- The pre-existing IP default gateway, read from the routing
944 table (not supported on all OSes).
946 .B remote_host
947 -- The
948 .B --remote
949 address if OpenVPN is being run in client mode, and is undefined in server mode.
950 .\"*********************************************************
952 .B --route-gateway gw
953 Specify a default gateway
954 .B gw
955 for use with
956 .B --route.
957 .\"*********************************************************
959 .B --route-delay [n] [w]
960 Delay
961 .B n
962 seconds (default=0) after connection
963 establishment, before adding routes. If
964 .B n
965 is 0, routes will be added immediately upon connection
966 establishment.  If
967 .B --route-delay
968 is omitted, routes will be added immediately after TUN/TAP device
969 open and
970 .B --up
971 script execution, before any
972 .B --user
973 or 
974 .B --group
975 privilege downgrade (or
976 .B --chroot
977 execution.)
979 This option is designed to be useful in scenarios where DHCP is
980 used to set
981 tap adapter addresses.  The delay will give the DHCP handshake
982 time to complete before routes are added.
984 On Windows,
985 .B --route-delay
986 tries to be more intelligent by waiting
987 .B w
988 seconds (w=30 by default)
989 for the TAP-Win32 adapter to come up before adding routes.
990 .\"*********************************************************
992 .B --route-up cmd
993 Execute shell command
994 .B cmd
995 after routes are added, subject to
996 .B --route-delay.
998 See the "Environmental Variables" section below for
999 additional parameters passed as environmental variables.
1001 Note that
1002 .B cmd
1003 can be a shell command with multiple arguments.
1004 .\"*********************************************************
1006 .B --route-noexec
1007 Don't add or remove routes automatically.  Instead pass routes to
1008 .B --route-up
1009 script using environmental variables.
1010 .\"*********************************************************
1012 .B --redirect-gateway ["local"] ["def1"]
1013 (Experimental) Automatically execute routing commands to cause all outgoing IP traffic
1014 to be redirected over the VPN.
1016 This option performs three steps:
1018 .B (1)
1019 Create a static route for the
1020 .B --remote
1021 address which forwards to the pre-existing default gateway.
1022 This is done so that
1023 .B (3)
1024 will not create a routing loop.
1026 .B (2)
1027 Delete the default gateway route.
1029 .B (3)
1030 Set the new default gateway to be the VPN endpoint address (derived either from
1031 .B --route-gateway
1032 or the second parameter to
1033 .B --ifconfig
1034 when
1035 .B --dev tun
1036 is specified).
1038 When the tunnel is torn down, all of the above steps are reversed so
1039 that the original default route is restored.
1041 Add the
1042 .B local
1043 flag if both OpenVPN servers are directly connected via a common subnet,
1044 such as with wireless.  The
1045 .B local
1046 flag will cause step
1047 .B 1
1048 above to be omitted.
1050 Add the
1051 .B def1
1052 flag to override
1053 the default gateway by using 0.0.0.0/1 and 128.0.0.0/1
1054 rather than 0.0.0.0/0.  This has the benefit of overriding
1055 but not wiping out the original default gateway. 
1057 Using the def1 flag is highly recommended, and is currently
1058 planned to become the default by OpenVPN 2.1.
1059 .\"*********************************************************
1061 .B --link-mtu n
1062 Sets an upper bound on the size of UDP packets which are sent
1063 between OpenVPN peers.  It's best not to set this parameter unless
1064 you know what you're doing.
1065 .\"*********************************************************
1067 .B --tun-mtu n
1068 Take the TUN device MTU to be
1069 .B n
1070 and derive the link MTU
1071 from it (default=1500).  In most cases, you will probably want to
1072 leave this parameter set to its default value.
1074 The MTU (Maximum Transmission Units) is
1075 the maximum datagram size in bytes that can be sent unfragmented
1076 over a particular network path.  OpenVPN requires that packets
1077 on the control or data channels be sent unfragmented.
1079 MTU problems often manifest themselves as connections which
1080 hang during periods of active usage.
1082 It's best to use the
1083 .B --fragment
1084 and/or
1085 .B --mssfix
1086 options to deal with MTU sizing issues.
1087 .\"*********************************************************
1089 .B --tun-mtu-extra n
1090 Assume that the TUN/TAP device might return as many as
1091 .B n
1092 bytes more than the
1093 .B --tun-mtu
1094 size on read.  This parameter defaults to 0, which is sufficient for
1095 most TUN devices.  TAP devices may introduce additional overhead in excess
1096 of the MTU size, and a setting of 32 is the default when TAP devices are used.
1097 This parameter only controls internal OpenVPN buffer sizing,
1098 so there is no transmission overhead associated with using a larger value.
1099 .\"*********************************************************
1101 .B --mtu-disc type
1102 Should we do Path MTU discovery on TCP/UDP channel?  Only supported on OSes such
1103 as Linux that supports the necessary system call to set.
1105 .B 'no'
1106 -- Never send DF (Don't Fragment) frames
1108 .B 'maybe'
1109 -- Use per-route hints
1111 .B 'yes'
1112 -- Always DF (Don't Fragment)
1114 .\"*********************************************************
1116 .B --mtu-test
1117 To empirically measure MTU on connection startup,
1118 add the
1119 .B --mtu-test
1120 option to your configuration.
1121 OpenVPN will send ping packets of various sizes
1122 to the remote peer and measure the largest packets
1123 which were successfully received.  The
1124 .B --mtu-test
1125 process normally takes about 3 minutes to complete.
1126 .\"*********************************************************
1128 .B --fragment max
1129 Enable internal datagram fragmentation so
1130 that no UDP datagrams are sent which
1131 are larger than
1132 .B max
1133 bytes.
1136 .B max
1137 parameter is interpreted in the same way as the
1138 .B --link-mtu
1139 parameter, i.e. the UDP packet size after encapsulation
1140 overhead has been added in, but not including
1141 the UDP header itself.
1144 .B --fragment
1145 option only makes sense when you are using the UDP protocol (
1146 .B --proto udp
1149 .B --fragment
1150 adds 4 bytes of overhead per datagram.
1152 See the
1153 .B --mssfix
1154 option below for an important related option to
1155 .B --fragment.
1157 It should also be noted that this option is not meant to replace
1158 UDP fragmentation at the IP stack level.  It is only meant as a
1159 last resort when path MTU discovery is broken.  Using this option
1160 is less efficient than fixing path MTU discovery for your IP link and
1161 using native IP fragmentation instead.
1163 Having said that, there are circumstances where using OpenVPN's
1164 internal fragmentation capability may be your only option, such
1165 as tunneling a UDP multicast stream which requires fragmentation.
1166 .\"*********************************************************
1168 .B --mssfix max
1169 Announce to TCP sessions running over the tunnel that they should limit
1170 their send packet sizes such that after OpenVPN has encapsulated them,
1171 the resulting UDP packet size that OpenVPN sends to its peer will not
1172 exceed
1173 .B max
1174 bytes.
1177 .B max
1178 parameter is interpreted in the same way as the
1179 .B --link-mtu
1180 parameter, i.e. the UDP packet size after encapsulation
1181 overhead has been added in, but not including
1182 the UDP header itself.
1185 .B --mssfix
1186 option only makes sense when you are using the UDP protocol
1187 for OpenVPN peer-to-peer communication, i.e.
1188 .B --proto udp.
1190 .B --mssfix
1192 .B --fragment
1193 can be ideally used together, where
1194 .B --mssfix
1195 will try to keep TCP from needing
1196 packet fragmentation in the first place,
1197 and if big packets come through anyhow
1198 (from protocols other than TCP),
1199 .B --fragment
1200 will internally fragment them.
1202 Both
1203 .B --fragment
1205 .B --mssfix
1206 are designed to work around cases where Path MTU discovery
1207 is broken on the network path between OpenVPN peers.
1209 The usual symptom of such a breakdown is an OpenVPN
1210 connection which successfully starts, but then stalls
1211 during active usage.
1214 .B --fragment
1216 .B --mssfix
1217 are used together,
1218 .B --mssfix
1219 will take its default
1220 .B max
1221 parameter from the
1222 .B --fragment max
1223 option.
1225 Therefore, one could lower the maximum UDP packet size
1226 to 1300 (a good first try for solving MTU-related
1227 connection problems) with the following options:
1229 .B --tun-mtu 1500 --fragment 1300 --mssfix
1230 .\"*********************************************************
1232 .B --sndbuf size
1233 Set the TCP/UDP socket send buffer size.
1234 Currently defaults to 65536 bytes.
1235 .\"*********************************************************
1237 .B --rcvbuf size
1238 Set the TCP/UDP socket receive buffer size.
1239 Currently defaults to 65536 bytes.
1240 .\"*********************************************************
1242 .B --txqueuelen n
1243 (Linux only) Set the TX queue length on the TUN/TAP interface.
1244 Currently defaults to 100.
1245 .\"*********************************************************
1247 .B --shaper n
1248 Limit bandwidth of outgoing tunnel data to
1249 .B n
1250 bytes per second on the TCP/UDP port.
1251 If you want to limit the bandwidth
1252 in both directions, use this option on both peers.
1254 OpenVPN uses the following algorithm to implement
1255 traffic shaping: Given a shaper rate of
1256 .I n
1257 bytes per second, after a datagram write of
1258 .I b
1259 bytes is queued on the TCP/UDP port, wait a minimum of
1260 .I (b / n)
1261 seconds before queuing the next write.
1263 It should be noted that OpenVPN supports multiple
1264 tunnels between the same two peers, allowing you
1265 to construct full-speed and reduced bandwidth tunnels
1266 at the same time,
1267 routing low-priority data such as off-site backups
1268 over the reduced bandwidth tunnel, and other data
1269 over the full-speed tunnel.
1271 Also note that for low bandwidth tunnels
1272 (under 1000 bytes per second), you should probably
1273 use lower MTU values as well (see above), otherwise
1274 the packet latency will grow so large as to trigger
1275 timeouts in the TLS layer and TCP connections running
1276 over the tunnel.
1278 OpenVPN allows
1279 .B n
1280 to be between 100 bytes/sec and 100 Mbytes/sec.
1281 .\"*********************************************************
1283 .B --inactive n
1284 (Experimental) Causes OpenVPN to exit after
1285 .B n
1286 seconds of inactivity on the TUN/TAP device.  The time length
1287 of inactivity is measured since the last incoming tunnel packet.
1288 .\"*********************************************************
1290 .B --ping n
1291 Ping remote over the TCP/UDP control channel
1292 if no packets have been sent for at least
1293 .B n
1294 seconds (specify
1295 .B --ping
1296 on both peers to cause ping packets to be sent in both directions since
1297 OpenVPN ping packets are not echoed like IP ping packets).
1298 When used in one of OpenVPN's secure modes (where
1299 .B --secret, --tls-server,
1301 .B --tls-client
1302 is specified), the ping packet
1303 will be cryptographically secure.
1305 This option has two intended uses:
1307 (1) Compatibility
1308 with stateful firewalls.  The periodic ping will ensure that
1309 a stateful firewall rule which allows OpenVPN UDP packets to
1310 pass will not time out.
1312 (2) To provide a basis for the remote to test the existence
1313 of its peer using the
1314 .B --ping-exit
1315 option.
1316 .\"*********************************************************
1318 .B --ping-exit n
1319 Causes OpenVPN to exit after
1320 .B n
1321 seconds pass without reception of a ping
1322 or other packet from remote.
1323 This option can be combined with
1324 .B --inactive, --ping,
1326 .B --ping-exit
1327 to create a two-tiered inactivity disconnect.
1329 For example,
1331 .B openvpn [options...] --inactive 3600 --ping 10 --ping-exit 60
1333 when used on both peers will cause OpenVPN to exit within 60
1334 seconds if its peer disconnects, but will exit after one
1335 hour if no actual tunnel data is exchanged.
1336 .\"*********************************************************
1338 .B --ping-restart n
1339 Similar to
1340 .B --ping-exit,
1341 but trigger a
1342 .B SIGUSR1
1343 restart after
1344 .B n
1345 seconds pass without reception of a ping
1346 or other packet from remote.
1348 This option is useful in cases
1349 where the remote peer has a dynamic IP address and
1350 a low-TTL DNS name is used to track the IP address using
1351 a service such as
1352 .I http://dyndns.org/
1353 + a dynamic DNS client such
1355 .B ddclient.
1357 If the peer cannot be reached, a restart will be triggered, causing
1358 the hostname used with
1359 .B --remote
1360 to be re-resolved (if
1361 .B --resolv-retry
1362 is also specified).
1364 In server mode,
1365 .B --ping-restart, --inactive,
1366 or any other type of internally generated signal will always be
1367 applied to
1368 individual client instance objects, never to whole server itself.
1369 Note also in server mode that any internally generated signal
1370 which would normally cause a restart, will cause the deletion
1371 of the client instance object instead.
1373 In client mode, the
1374 .B --ping-restart
1375 parameter is set to 120 seconds by default.  This default will
1376 hold until the client pulls a replacement value from the server, based on
1378 .B --keepalive
1379 setting in the server configuration.
1380 To disable the 120 second default, set
1381 .B --ping-restart 0
1382 on the client.
1384 See the signals section below for more information
1386 .B SIGUSR1.
1388 Note that the behavior of
1389 .B SIGUSR1
1390 can be modified by the
1391 .B --persist-tun, --persist-key, --persist-local-ip,
1393 .B --persist-remote-ip
1394 options.
1396 Also note that
1397 .B --ping-exit
1399 .B --ping-restart
1400 are mutually exclusive and cannot be used together.
1401 .\"*********************************************************
1403 .B --keepalive n m
1404 A helper directive designed to simplify the expression of
1405 .B --ping
1407 .B --ping-restart
1408 in server mode configurations.
1410 For example,
1411 .B --keepalive 10 60
1412 expands as follows:
1415 .ft 3
1418  if mode server:
1419    ping 10
1420    ping-restart 120
1421    push "ping 10"
1422    push "ping-restart 60"
1423  else
1424    ping 10
1425    ping-restart 60
1430 .\"*********************************************************
1432 .B --ping-timer-rem
1433 Run the
1434 .B --ping-exit
1436 .B --ping-restart
1437 timer only if we have a remote address.  Use this option if you are
1438 starting the daemon in listen mode (i.e. without an explicit
1439 .B --remote
1440 peer), and you don't want to start clocking timeouts until a remote
1441 peer connects.
1442 .\"*********************************************************
1444 .B --persist-tun
1445 Don't close and reopen TUN/TAP device or run up/down scripts
1446 across
1447 .B SIGUSR1
1449 .B --ping-restart
1450 restarts.
1452 .B SIGUSR1
1453 is a restart signal similar to
1454 .B SIGHUP,
1455 but which offers finer-grained control over
1456 reset options.
1457 .\"*********************************************************
1459 .B --persist-key
1460 Don't re-read key files across
1461 .B SIGUSR1
1463 .B --ping-restart.
1465 This option can be combined with
1466 .B --user nobody
1467 to allow restarts triggered by the
1468 .B SIGUSR1
1469 signal.
1470 Normally if you drop root privileges in OpenVPN,
1471 the daemon cannot be restarted since it will now be unable to re-read protected
1472 key files.
1474 This option solves the problem by persisting keys across
1475 .B SIGUSR1
1476 resets, so they don't need to be re-read.
1477 .\"*********************************************************
1479 .B --persist-local-ip
1480 Preserve initially resolved local IP address and port number
1481 across
1482 .B SIGUSR1
1484 .B --ping-restart
1485 restarts.
1486 .\"*********************************************************
1488 .B --persist-remote-ip
1489 Preserve most recently authenticated remote IP address and port number
1490 across
1491 .B SIGUSR1
1493 .B --ping-restart
1494 restarts.
1495 .\"*********************************************************
1497 .B --mlock
1498 Disable paging by calling the POSIX mlockall function.
1499 Requires that OpenVPN be initially run as root (though
1500 OpenVPN can subsequently downgrade its UID using the
1501 .B --user
1502 option).
1504 Using this option ensures that key material and tunnel
1505 data are never written to disk due to virtual
1506 memory paging operations which occur under most
1507 modern operating systems.  It ensures that even if an
1508 attacker was able to crack the box running OpenVPN, he
1509 would not be able to scan the system swap file to
1510 recover previously used
1511 ephemeral keys, which are used for a period of time
1512 governed by the
1513 .B --reneg
1514 options (see below), then are discarded.
1516 The downside
1517 of using
1518 .B --mlock
1519 is that it will reduce the amount of physical
1520 memory available to other applications.
1521 .\"*********************************************************
1523 .B --up cmd
1524 Shell command to run after successful TUN/TAP device open
1525 (pre
1526 .B --user
1527 UID change).  The up script is useful for specifying route
1528 commands which route IP traffic destined for
1529 private subnets which exist at the other
1530 end of the VPN connection into the tunnel.
1533 .B --dev tun
1534 execute as:
1536 .B cmd tun_dev tun_mtu link_mtu ifconfig_local_ip ifconfig_remote_ip [ init | restart ]
1539 .B --dev tap
1540 execute as:
1542 .B cmd tap_dev tap_mtu link_mtu ifconfig_local_ip ifconfig_netmask [ init | restart ]
1544 See the "Environmental Variables" section below for
1545 additional parameters passed as environmental variables.
1547 Note that
1548 .B cmd
1549 can be a shell command with multiple arguments, in which
1550 case all OpenVPN-generated arguments will be appended
1552 .B cmd
1553 to build a command line which will be passed to the shell.
1555 Typically,
1556 .B cmd
1557 will run a script to add routes to the tunnel.
1559 Normally the up script is called after the TUN/TAP device is opened.
1560 In this context, the last command line parameter passed to the script
1561 will be
1562 .I init.
1563 If the
1564 .B --up-restart
1565 option is also used, the up script will be called for restarts as
1566 well.  A restart is considered to be a partial reinitialization
1567 of OpenVPN where the TUN/TAP instance is preserved (the
1568 .B --persist-tun
1569 option will enable such preservation).  A restart
1570 can be generated by a SIGUSR1 signal, a
1571 .B --ping-restart
1572 timeout, or a connection reset when the TCP protocol is enabled
1573 with the
1574 .B --proto
1575 option.  If a restart occurs, and
1576 .B --up-restart
1577 has been specified, the up script will be called with
1578 .I restart
1579 as the last parameter.
1581 The following standalone example shows how the
1582 .B --up
1583 script can be called in both an initialization and restart context.
1584 (NOTE: for security reasons, don't run the following example unless UDP port
1585 9999 is blocked by your firewall.  Also, the example will run indefinitely,
1586 so you should abort with control-c).
1588 .B openvpn --dev tun --port 9999 --verb 4 --ping-restart 10 --up 'echo up' --down 'echo down' --persist-tun --up-restart
1590 Note that OpenVPN also provides the
1591 .B --ifconfig
1592 option to automatically ifconfig the TUN device,
1593 eliminating the need to define an
1594 .B --up
1595 script, unless you also want to configure routes
1596 in the
1597 .B --up
1598 script.
1601 .B --ifconfig
1602 is also specified, OpenVPN will pass the ifconfig local
1603 and remote endpoints on the command line to the
1604 .B --up
1605 script so that they can be used to configure routes such as:
1607 .B route add -net 10.0.0.0 netmask 255.255.255.0 gw $5
1608 .\"*********************************************************
1610 .B --up-delay
1611 Delay TUN/TAP open and possible
1612 .B --up
1613 script execution
1614 until after TCP/UDP connection establishment with peer.
1617 .B --proto udp
1618 mode, this option normally requires the use of
1619 .B --ping
1620 to allow connection initiation to be sensed in the absence
1621 of tunnel data, since UDP is a "connectionless" protocol.
1623 On Windows, this option will delay the TAP-Win32 media state
1624 transitioning to "connected" until connection establishment,
1625 i.e. the receipt of the first authenticated packet from the peer.
1626 .\"*********************************************************
1628 .B --down cmd
1629 Shell command to run after TUN/TAP device close
1630 (post
1631 .B --user
1632 UID change and/or
1633 .B --chroot
1634 ).  Called with the same parameters and environmental
1635 variables as the
1636 .B --up
1637 option above.
1639 Note that if you reduce privileges by using
1640 .B --user
1641 and/or
1642 .B --group,
1643 your
1644 .B --down
1645 script will also run at reduced privilege.
1646 .\"*********************************************************
1648 .B --down-pre
1649 Call
1650 .B --down
1651 cmd/script before, rather than after, TUN/TAP close.
1652 .\"*********************************************************
1654 .B --up-restart
1655 Enable the
1656 .B --up
1658 .B --down
1659 scripts to be called for restarts as well as initial program start.
1660 This option is described more fully above in the
1661 .B --up
1662 option documentation.
1663 .\"*********************************************************
1665 .B --setenv name value
1666 Set a custom environmental variable
1667 .B name=value
1668 to pass to script.
1669 .\"*********************************************************
1671 .B --disable-occ
1672 Don't output a warning message if option inconsistencies are detected between
1673 peers.  An example of an option inconsistency would be where one peer uses
1674 .B --dev tun
1675 while the other peer uses
1676 .B --dev tap.
1678 Use of this option is discouraged, but is provided as
1679 a temporary fix in situations where a recent version of OpenVPN must
1680 connect to an old version.
1681 .\"*********************************************************
1683 .B --user user
1684 Change the user ID of the OpenVPN process to
1685 .B user
1686 after initialization, dropping privileges in the process.
1687 This option is useful to protect the system
1688 in the event that some hostile party was able to gain control of
1689 an OpenVPN session.  Though OpenVPN's security features make
1690 this unlikely, it is provided as a second line of defense.
1692 By setting
1693 .B user
1695 .I nobody
1696 or somebody similarly unprivileged, the hostile party would be
1697 limited in what damage they could cause.  Of course once
1698 you take away privileges, you cannot return them
1699 to an OpenVPN session.  This means, for example, that if
1700 you want to reset an OpenVPN daemon with a
1701 .B SIGUSR1
1702 signal
1703 (for example in response
1704 to a DHCP reset), you should make use of one or more of the
1705 .B --persist
1706 options to ensure that OpenVPN doesn't need to execute any privileged
1707 operations in order to restart (such as re-reading key files
1708 or running
1709 .BR ifconfig
1710 on the TUN device).
1711 .\"*********************************************************
1713 .B --group group
1714 Similar to the
1715 .B --user
1716 option,
1717 this option changes the group ID of the OpenVPN process to
1718 .B group
1719 after initialization.
1720 .\"*********************************************************
1722 .B --cd dir
1723 Change directory to
1724 .B dir
1725 prior to reading any files such as
1726 configuration files, key files, scripts, etc.
1727 .B dir
1728 should be an absolute path, with a leading "/",
1729 and without any references
1730 to the current directory such as "." or "..".
1732 This option is useful when you are running
1733 OpenVPN in 
1734 .B --daemon
1735 mode, and you want to consolidate all of
1736 your OpenVPN control files in one location.
1737 .\"*********************************************************
1739 .B --chroot dir
1740 Chroot to
1741 .B dir
1742 after initialization.  
1743 .B --chroot
1744 essentially redefines
1745 .B dir
1746 as being the top
1747 level directory tree (/).  OpenVPN will therefore
1748 be unable to access any files outside this tree.
1749 This can be desirable from a security standpoint.
1751 Since the chroot operation is delayed until after
1752 initialization, most OpenVPN options that reference
1753 files will operate in a pre-chroot context.
1755 In many cases, the
1756 .B dir
1757 parameter can point to an empty directory, however
1758 complications can result when scripts or restarts
1759 are executed after the chroot operation.
1760 .\"*********************************************************
1762 .B --daemon [progname]
1763 Become a daemon after all initialization functions are completed.
1764 This option will cause all message and error output to
1765 be sent to the syslog file (such as /var/log/messages),
1766 except for the output of shell scripts and
1767 ifconfig commands,
1768 which will go to /dev/null unless otherwise redirected.
1769 The syslog redirection occurs immediately at the point
1770 that
1771 .B --daemon
1772 is parsed on the command line even though
1773 the daemonization point occurs later.  If one of the
1774 .B --log
1775 options is present, it will supercede syslog
1776 redirection.
1778 The optional
1779 .B progname
1780 parameter will cause OpenVPN to report its program name
1781 to the system logger as
1782 .B progname.
1783 This can be useful in linking OpenVPN messages
1784 in the syslog file with specific tunnels.
1785 When unspecified,
1786 .B progname
1787 defaults to "openvpn".
1789 When OpenVPN is run with the
1790 .B --daemon
1791 option, it will try to delay daemonization until the majority of initialization
1792 functions which are capable of generating fatal errors are complete.  This means
1793 that initialization scripts can test the return status of the
1794 openvpn command for a fairly reliable indication of whether the command
1795 has correctly initialized and entered the packet forwarding event loop.
1797 In OpenVPN, the vast majority of errors which occur after initialization are non-fatal.
1798 .\"*********************************************************
1800 .B --syslog [progname]
1801 Direct log output to system logger, but do not become a daemon.
1803 .B --daemon
1804 directive above for description of
1805 .B progname
1806 parameter.
1807 .\"*********************************************************
1809 .B --passtos
1810 Set the TOS field of the tunnel packet to what the payload's TOS is.
1811 .\"*********************************************************
1813 .B --inetd [wait|nowait] [progname]
1814 Use this option when OpenVPN is being run from the inetd or
1815 .BR xinetd(8)
1816 server.
1819 .B wait/nowait
1820 option must match what is specified in the inetd/xinetd
1821 config file.  The
1822 .B nowait
1823 mode can only be used with
1824 .B --proto tcp-server.
1825 The default is
1826 .B wait.
1828 .B nowait
1829 mode can be used to instantiate the OpenVPN daemon as a classic TCP server,
1830 where client connection requests are serviced on a single
1831 port number.  For additional information on this kind of configuration,
1832 see the OpenVPN FAQ:
1833 .I http://openvpn.net/faq.html#oneport
1835 This option precludes the use of
1836 .B --daemon, --local,
1838 .B --remote.
1839 Note that this option causes message and error output to be handled in the same
1840 way as the
1841 .B --daemon
1842 option.  The optional
1843 .B progname
1844 parameter is also handled exactly as in
1845 .B --daemon.
1847 Also note that in
1848 .B wait
1849 mode, each OpenVPN tunnel requires a separate TCP/UDP port and
1850 a separate inetd or xinetd entry.  See the OpenVPN 1.x HOWTO for an example
1851 on using OpenVPN with xinetd:
1852 .I http://openvpn.net/1xhowto.html
1853 .\"*********************************************************
1855 .B --log file
1856 Output logging messages to
1857 .B file,
1858 including output to stdout/stderr which
1859 is generated by called scripts.
1861 .B file
1862 already exists it will be truncated.
1863 This option takes effect
1864 immediately when it is parsed in the command line
1865 and will supercede syslog output if
1866 .B --daemon
1868 .B --inetd
1869 is also specified.
1870 This option is persistent over the entire course of
1871 an OpenVPN instantiation and will not be reset by SIGHUP,
1872 SIGUSR1, or
1873 .B --ping-restart.
1875 Note that on Windows, when OpenVPN is started as a service,
1876 logging occurs by default without the need to specify
1877 this option.
1878 .\"*********************************************************
1880 .B --log-append file
1881 Append logging messages to
1882 .B file.
1884 .B file
1885 does not exist, it will be created.
1886 This option behaves exactly like
1887 .B --log
1888 except that it appends to rather
1889 than truncating the log file.
1890 .\"*********************************************************
1892 .B --suppress-timestamps
1893 Avoid writing timestamps to log messages, even when they
1894 otherwise would be prepended. In particular, this applies to
1895 log messages sent to stdout.
1896 .\"*********************************************************
1898 .B --writepid file
1899 Write OpenVPN's main process ID to
1900 .B file.
1901 .\"*********************************************************
1903 .B --nice n
1904 Change process priority after initialization
1906 .B n
1907 greater than 0 is lower priority,
1908 .B n
1909 less than zero is higher priority).
1910 .\"*********************************************************
1911 .\".TP
1912 .\".B --nice-work n
1913 .\"Change priority of background TLS work thread.  The TLS thread
1914 .\"feature is enabled when OpenVPN is built
1915 .\"with pthread support, and you are running OpenVPN
1916 .\"in TLS mode (i.e. with
1917 .\".B --tls-client
1918 .\"or
1919 .\".B --tls-server
1920 .\"specified).
1922 .\"Using a TLS thread offloads the CPU-intensive process of SSL/TLS-based
1923 .\"key exchange to a background thread so that it does not become
1924 .\"a latency bottleneck in the tunnel packet forwarding process.
1926 .\"The parameter
1927 .\".B n
1928 .\"is interpreted exactly as with the
1929 .\".B --nice
1930 .\"option above, but in relation to the work thread rather
1931 .\"than the main thread.
1932 .\"*********************************************************
1934 .B --fast-io
1935 (Experimental) Optimize TUN/TAP/UDP I/O writes by avoiding
1936 a call to poll/epoll/select prior to the write operation.  The purpose
1937 of such a call would normally be to block until the device
1938 or socket is ready to accept the write.  Such blocking is unnecessary
1939 on some platforms which don't support write blocking on UDP sockets
1940 or TUN/TAP devices.  In such cases, one can optimize the event loop
1941 by avoiding the poll/epoll/select call, improving CPU efficiency
1942 by 5% to 10%.
1944 This option can only be used on non-Windows systems, when
1945 .B --proto udp
1946 is specified, and when
1947 .B --shaper
1948 is NOT specified.
1949 .\"*********************************************************
1951 .B --echo [parms...]
1952 Echo
1953 .B parms
1954 to log output.
1956 Designed to be used to send messages to a controlling application
1957 which is receiving the OpenVPN log output.
1958 .\"*********************************************************
1960 .B --remap-usr1 signal
1961 Control whether internally or externally
1962 generated SIGUSR1 signals are remapped to
1963 SIGHUP (restart without persisting state) or
1964 SIGTERM (exit).
1966 .B signal
1967 can be set to "SIGHUP" or "SIGTERM".  By default, no remapping
1968 occurs.
1969 .\"*********************************************************
1971 .B --verb n
1972 Set output verbosity to
1973 .B n
1974 (default=1).  Each level shows all info from the previous levels.
1975 Level 3 is recommended if you want a good summary
1976 of what's happening without being swamped by output.
1978 .B 0 --
1979 No output except fatal errors.
1981 .B 1 to 4 --
1982 Normal usage range.
1984 .B 5 --
1985 Output
1986 .B R
1988 .B W
1989 characters to the console for each packet read and write, uppercase is
1990 used for TCP/UDP packets and lowercase is used for TUN/TAP packets.
1992 .B 6 to 11 --
1993 Debug info range (see errlevel.h for additional
1994 information on debug levels).
1995 .\"*********************************************************
1997 .B --status file [n]
1998 Write operational status to
1999 .B file
2000 every
2001 .B n
2002 seconds.
2004 Status can also be written to the syslog by sending a
2005 .B SIGUSR2
2006 signal.
2007 .\"*********************************************************
2009 .B --status-version [n]
2010 Choose the status file format version number.  Currently
2011 .B n
2012 can be 1 or 2 and defaults to 1.
2013 .\"*********************************************************
2015 .B --mute n
2016 Log at most
2017 .B n
2018 consecutive messages in the same category.  This is useful to
2019 limit repetitive logging of similar message types.
2020 .\"*********************************************************
2022 .B --comp-lzo
2023 Use fast LZO compression -- may add up to 1 byte per
2024 packet for incompressible data.
2025 .\"*********************************************************
2027 .B --comp-noadapt
2028 When used in conjunction with
2029 .B --comp-lzo,
2030 this option will disable OpenVPN's adaptive compression algorithm.
2031 Normally, adaptive compression is enabled with
2032 .B --comp-lzo.
2034 Adaptive compression tries to optimize the case where you have
2035 compression enabled, but you are sending predominantly uncompressible
2036 (or pre-compressed) packets over the tunnel, such as an FTP or rsync transfer
2037 of a large, compressed file.  With adaptive compression,
2038 OpenVPN will periodically sample the compression process to measure its
2039 efficiency.  If the data being sent over the tunnel is already compressed,
2040 the compression efficiency will be very low, triggering openvpn to disable
2041 compression for a period of time until the next re-sample test.
2042 .\"*********************************************************
2044 .B --management IP port [pw-file]
2045 Enable a TCP server on
2046 .B IP:port
2047 to handle daemon management functions.
2048 .B pw-file,
2049 if specified,
2050 is a password file (password on first line)
2051 or "stdin" to prompt from standard input.  The password
2052 provided will set the password which TCP clients will need
2053 to provide in order to access management functions.
2055 The management interface provides a special mode where the TCP
2056 management link can operate over the tunnel itself.  To enable this mode,
2058 .B IP
2059 = "tunnel".  Tunnel mode will cause the management interface
2060 to listen for a TCP connection on the local VPN address of the
2061 TUN/TAP interface.
2063 While the management port is designed for programmatic control
2064 of OpenVPN by other applications, it is possible to telnet
2065 to the port, using a telnet client in "raw" mode.  Once connected,
2066 type "help" for a list of commands.
2068 For detailed documentation on the management interface, see
2069 the management-notes.txt file in the
2070 .B management
2071 folder of
2072 the OpenVPN source distribution.
2074 It is strongly recommended that
2075 .B IP
2076 be set to 127.0.0.1
2077 (localhost) to restrict accessibility of the management
2078 server to local clients. 
2079 .\"*********************************************************
2081 .B --management-query-passwords
2082 Query management channel for private key password and
2083 .B --auth-user-pass
2084 username/password.  Only query the management channel
2085 for inputs which ordinarily would have been queried from the
2086 console.
2087 .\"*********************************************************
2089 .B --management-hold
2090 Start OpenVPN in a hibernating state, until a client
2091 of the management interface explicitly starts it
2092 with the
2093 .B hold release
2094 command.
2095 .\"*********************************************************
2097 .B --management-log-cache n
2098 Cache the most recent
2099 .B n
2100 lines of log file history for usage
2101 by the management channel.
2102 .\"*********************************************************
2104 .B --plugin module-pathname [init-string]
2105 Load plug-in module from the file
2106 .B module-pathname,
2107 passing
2108 .B init-string
2109 as an argument
2110 to the module initialization function.  Multiple
2111 plugin modules may be loaded into one OpenVPN
2112 process.
2114 For more information and examples on how to build OpenVPN
2115 plug-in modules, see the README file in the
2116 .B plugin
2117 folder of the OpenVPN source distribution.
2119 If you are using an RPM install of OpenVPN, see
2120 /usr/share/openvpn/plugin.  The documentation is
2122 .B doc
2123 and the actual plugin modules are in
2124 .B lib.
2126 Multiple plugin modules can be cascaded, and modules can be
2127 used in tandem with scripts.  The modules will be called by
2128 OpenVPN in the order that they are declared in the config
2129 file.  If both a plugin and script are configured for the same
2130 callback, the script will be called last.  If the
2131 return code of the module/script controls an authentication
2132 function (such as tls-verify, auth-user-pass-verify, or
2133 client-connect), then
2134 every module and script must return success (0) in order for
2135 the connection to be authenticated.
2136 .\"*********************************************************
2137 .SS Server Mode
2138 Starting with OpenVPN 2.0, a multi-client TCP/UDP server mode
2139 is supported, and can be enabled with the
2140 .B --mode server
2141 option.  In server mode, OpenVPN will listen on a single
2142 port for incoming client connections.  All client
2143 connections will be routed through a single tun or tap
2144 interface.  This mode is designed for scalability and should
2145 be able to support hundreds or even thousands of clients
2146 on sufficiently fast hardware.  SSL/TLS authentication must
2147 be used in this mode.
2148 .\"*********************************************************
2150 .B --server network netmask
2151 A helper directive designed to simplify the configuration
2152 of OpenVPN's server mode.  This directive will set up an
2153 OpenVPN server which will allocate addresses to clients
2154 out of the given network/netmask.  The server itself
2155 will take the ".1" address of the given network
2156 for use as the server-side endpoint of the local
2157 TUN/TAP interface.
2159 For example,
2160 .B --server 10.8.0.0 255.255.255.0
2161 expands as follows:
2164 .ft 3
2167  mode server
2168  tls-server
2170  if dev tun:
2171    ifconfig 10.8.0.1 10.8.0.2 
2172    ifconfig-pool 10.8.0.4 10.8.0.251
2173    route 10.8.0.0 255.255.255.0
2174    if client-to-client:
2175      push "route 10.8.0.0 255.255.255.0"
2176    else
2177      push "route 10.8.0.1"
2179  if dev tap:
2180    ifconfig 10.8.0.1 255.255.255.0
2181    ifconfig-pool 10.8.0.2 10.8.0.254 255.255.255.0
2182    push "route-gateway 10.8.0.1"
2188 Don't use
2189 .B --server
2190 if you are ethernet bridging.  Use
2191 .B --server-bridge
2192 instead.
2193 .\"*********************************************************
2195 .B --server-bridge gateway netmask pool-start-IP pool-end-IP
2197 A helper directive similar to
2198 .B --server
2199 which is designed to simplify the configuration
2200 of OpenVPN's server mode in ethernet bridging configurations.
2202 To configure ethernet bridging, you 
2203 must first use your OS's bridging capability
2204 to bridge the TAP interface with the ethernet
2205 NIC interface.  For example, on Linux this is done
2206 with the
2207 .B brctl
2208 tool, and with Windows XP it is done in the Network
2209 Connections Panel by selecting the ethernet and
2210 TAP adapters and right-clicking on "Bridge Connections".
2212 Next you you must manually set the
2213 IP/netmask on the bridge interface.  The
2214 .B gateway
2216 .B netmask
2217 parameters to
2218 .B --server-bridge
2219 can be set to either the IP/netmask of the
2220 bridge interface, or the IP/netmask of the
2221 default gateway/router on the bridged
2222 subnet.
2224 Finally, set aside a IP range in the bridged
2225 subnet,
2226 denoted by
2227 .B pool-start-IP
2229 .B pool-end-IP,
2230 for OpenVPN to allocate to connecting
2231 clients.
2233 For example,
2234 .B server-bridge 10.8.0.4 255.255.255.0 10.8.0.128 10.8.0.254
2235 expands as follows:
2238 .ft 3
2241 mode server
2242 tls-server
2244 ifconfig-pool 10.8.0.128 10.8.0.254 255.255.255.0
2245 push "route-gateway 10.8.0.4"
2250 .\"*********************************************************
2252 .B --push "option"
2253 Push a config file option back to the client for remote
2254 execution.  Note that
2256 option
2257 must be enclosed in double quotes ("").  The client must specify
2258 .B --pull
2259 in its config file.  The set of options which can be
2260 pushed is limited by both feasibility and security.
2261 Some options such as those which would execute scripts
2262 are banned, since they would effectively allow a compromised
2263 server to execute arbitrary code on the client.
2264 Other options such as TLS or MTU parameters
2265 cannot be pushed because the client needs to know
2266 them before the connection to the server can be initiated.
2268 This is a partial list of options which can currently be pushed:
2269 .B --route, --route-gateway, --route-delay, --redirect-gateway,
2270 .B --ip-win32, --dhcp-option,
2271 .B --inactive, --ping, --ping-exit, --ping-restart,
2272 .B --setenv,
2273 .B --persist-key, --persist-tun, --echo
2274 .\"*********************************************************
2276 .B --push-reset
2277 Don't inherit the global push list for a specific client instance.
2278 Specify this option in a client-specific context such
2279 as with a
2280 .B --client-config-dir
2281 configuration file.  This option will ignore
2282 .B --push
2283 options at the global config file level.
2284 .\"*********************************************************
2286 .B --disable
2287 Disable a particular client (based on the common name)
2288 from connecting.  Don't use this option to disable a client
2289 due to key or password compromise.  Use a CRL (certificate
2290 revocation list) instead (see the
2291 .B --crl-verify
2292 option).
2294 This option must be associated with a specific client instance,
2295 which means that it must be specified either in a client
2296 instance config file using
2297 .B --client-config-dir
2298 or dynamically generated using a
2299 .B --client-connect
2300 script.
2301 .\"*********************************************************
2303 .B --ifconfig-pool start-IP end-IP [netmask]
2304 Set aside a pool of subnets to be
2305 dynamically allocated to connecting clients, similar
2306 to a DHCP server.  For tun-style
2307 tunnels, each client will be given a /30 subnet (for
2308 interoperability with Windows clients).  For tap-style
2309 tunnels, individual addresses will be allocated, and the
2310 optional
2311 .B netmask
2312 parameter will also be pushed to clients.
2314 .\"*********************************************************
2316 .B --ifconfig-pool-persist file [seconds]
2317 Persist/unpersist ifconfig-pool
2318 data to
2319 .B file,
2321 .B seconds
2322 intervals (default=600), as well as on program startup and
2323 shutdown.
2325 The goal of this option is to provide a long-term association
2326 between clients (denoted by their common name) and the virtual
2327 IP address assigned to them from the ifconfig-pool.
2328 Maintaining a long-term
2329 association is good for clients because it allows them
2330 to effectively use the
2331 .B --persist-tun
2332 option.
2334 .B file
2335 is a comma-delimited ASCII file, formatted as
2336 <Common-Name>,<IP-address>.
2339 .B seconds
2340 = 0,
2341 .B file
2342 will be treated as read-only.  This is useful if
2343 you would like to treat
2344 .B file
2345 as a configuration file.
2347 Note that the entries in this file are treated by OpenVPN as
2348 suggestions only, based on past associations between
2349 a common name and IP address.  They do not guarantee that the given common
2350 name will always receive the given IP address.  If you want guaranteed
2351 assignment, use
2352 .B --ifconfig-push
2353 .\"*********************************************************
2355 .B --ifconfig-pool-linear
2356 Modifies the
2357 .B --ifconfig-pool
2358 directive to
2359 allocate individual TUN interface addresses for
2360 clients rather than /30 subnets.  NOTE:  This option
2361 is incompatible with Windows clients.
2362 .\"*********************************************************
2364 .B --ifconfig-push local remote-netmask
2365 Push virtual IP endpoints for client tunnel,
2366 overriding the --ifconfig-pool dynamic allocation.
2368 The parameters
2369 .B local
2371 .B remote-netmask
2372 are set according to the
2373 .B --ifconfig
2374 directive which you want to execute on the client machine to
2375 configure the remote end of the tunnel.  Note that the parameters
2376 .B local
2378 .B remote-netmask
2379 are from the perspective of the client, not the server.  They may be
2380 DNS names rather than IP addresses, in which case they will be resolved
2381 on the server at the time of client connection.
2383 This option must be associated with a specific client instance,
2384 which means that it must be specified either in a client
2385 instance config file using
2386 .B --client-config-dir
2387 or dynamically generated using a
2388 .B --client-connect
2389 script.
2391 Remember also to include a
2392 .B --route
2393 directive in the main OpenVPN config file which encloses
2394 .B local,
2395 so that the kernel will know to route it
2396 to the server's TUN/TAP interface.
2398 OpenVPN's internal client IP address selection algorithm works as
2399 follows:
2401 .B 1
2402 -- Use
2403 .B --client-connect script
2404 generated file for static IP (first choice).
2406 .B 2
2407 -- Use 
2408 .B --client-config-dir
2409 file for static IP (next choice).
2411 .B 3
2412 -- Use
2413 .B --ifconfig-pool
2414 allocation for dynamic IP (last choice).
2416 .\"*********************************************************
2418 .B --iroute network [netmask]
2419 Generate an internal route to a specific
2420 client. The
2421 .B netmask
2422 parameter, if omitted, defaults to 255.255.255.255.
2424 This directive can be used to route a fixed subnet from
2425 the server to a particular client, regardless
2426 of where the client is connecting from.  Remember
2427 that you must also add the route to the system
2428 routing table as well (such as by using the
2429 .B --route
2430 directive).  The reason why two routes are needed
2431 is that the
2432 .B --route
2433 directive routes the packet from the kernel
2434 to OpenVPN.  Once in OpenVPN, the
2435 .B --iroute
2436 directive routes to the specific client.
2438 This option must be specified either in a client
2439 instance config file using
2440 .B --client-config-dir
2441 or dynamically generated using a
2442 .B --client-connect
2443 script.
2446 .B --iroute
2447 directive also has an important interaction with
2448 .B --push
2449 "route ...".
2450 .B --iroute
2451 essentially defines a subnet which is owned by a
2452 particular client (we will call this client A).
2453 If you would like other clients to be able to reach A's
2454 subnet, you can use
2455 .B --push
2456 "route ..."
2457 together with
2458 .B --client-to-client
2459 to effect this.  In order for all clients to see
2460 A's subnet, OpenVPN must push this route to all clients
2461 EXCEPT for A, since the subnet is already owned by A.
2462 OpenVPN accomplishes this by not
2463 not pushing a route to a client
2464 if it matches one of the client's iroutes.
2465 .\"*********************************************************
2467 .B --client-to-client
2468 Because the OpenVPN server mode handles multiple clients
2469 through a single tun or tap interface, it is effectively
2470 a router.  The
2471 .B --client-to-client
2472 flag tells OpenVPN to internally route client-to-client
2473 traffic rather than pushing all client-originating traffic
2474 to the TUN/TAP interface.
2476 When this option is used, each client will "see" the other
2477 clients which are currently connected.  Otherwise, each
2478 client will only see the server.  Don't use this option
2479 if you want to firewall tunnel traffic using
2480 custom, per-client rules.
2481 .\"*********************************************************
2483 .B --duplicate-cn
2484 Allow multiple clients with the same common name to concurrently connect.
2485 In the absence of this option, OpenVPN will disconnect a client instance
2486 upon connection of a new client having the same common name.
2487 .\"*********************************************************
2489 .B --client-connect script
2491 .B script
2492 on client connection.  The script is passed the common name
2493 and IP address of the just-authenticated client
2494 as environmental variables (see environmental variable section
2495 below).  The script is also passed
2496 the pathname of a not-yet-created temporary file as $1
2497 (i.e. the first command line argument), to be used by the script
2498 to pass dynamically generated config file directives back to OpenVPN.
2500 If the script wants to generate a dynamic config file
2501 to be applied on the server when the client connects,
2502 it should write it to the file named by $1.
2504 See the
2505 .B --client-config-dir
2506 option below for options which
2507 can be legally used in a dynamically generated config file.
2509 Note that the return value of
2510 .B script
2511 is significant.  If
2512 .B script
2513 returns a non-zero error status, it will cause the client
2514 to be disconnected.
2515 .\"*********************************************************
2517 .B --client-disconnect
2518 Like
2519 .B --client-connect
2520 but called on client instance shutdown.  Will not be called
2521 unless the
2522 .B --client-connect
2523 script and plugins (if defined)
2524 were previously called on this instance with
2525 successful (0) status returns.
2527 The exception to this rule is if the
2528 .B --client-disconnect
2529 script or plugins are cascaded, and at least one client-connect
2530 function succeeded, then ALL of the client-disconnect functions for
2531 scripts and plugins will be called on client instance object deletion,
2532 even in cases where some of the related client-connect functions returned
2533 an error status.
2534 .B 
2535 .\"*********************************************************
2537 .B --client-config-dir dir
2538 Specify a directory
2539 .B dir
2540 for custom client config files.  After
2541 a connecting client has been authenticated, OpenVPN will
2542 look in this directory for a file having the same name
2543 as the client's X509 common name.  If a matching file
2544 exists, it will be opened and parsed for client-specific
2545 configuration options.  If no matching file is found, OpenVPN
2546 will instead try to open and parse a default file called
2547 "DEFAULT", which may be provided but is not required.
2549 This file can specify a fixed IP address for a given
2550 client using
2551 .B --ifconfig-push,
2552 as well as fixed subnets owned by the client using
2553 .B --iroute.
2555 One of the useful properties of this option is that it
2556 allows client configuration files to be conveniently
2557 created, edited, or removed while the server is live,
2558 without needing to restart the server.
2560 The following
2561 options are legal in a client-specific context:
2562 .B --push, --push-reset, --iroute, --ifconfig-push,
2564 .B --config.
2565 .\"*********************************************************
2567 .B --ccd-exclusive
2568 Require, as a
2569 condition of authentication, that a connecting client has a
2570 .B --client-config-dir
2571 file.
2572 .\"*********************************************************
2574 .B --tmp-dir dir
2575 Specify a directory
2576 .B dir
2577 for temporary files.  This directory will be used by
2578 .B --client-connect
2579 scripts to dynamically generate client-specific
2580 configuration files.
2581 .\"*********************************************************
2583 .B --hash-size r v
2584 Set the size of the real address hash table to
2585 .B r
2586 and the virtual address table to
2587 .B v.
2588 By default, both tables are sized at 256 buckets.
2589 .\"*********************************************************
2591 .B --bcast-buffers n
2592 Allocate
2593 .B n
2594 buffers for broadcast datagrams (default=256).
2595 .\"*********************************************************
2597 .B --tcp-queue-limit n
2598 Maximum number of queued TCP output packets (default=64).
2600 When OpenVPN is tunneling data from a TUN/TAP device to a
2601 remote client over a TCP connection, it is possible that the TUN/TAP device
2602 might produce data at a faster rate than the TCP connection
2603 can support.  When the number of queued TCP output packets reaches
2604 this limit for a given client connection,
2605 OpenVPN will start to drop outgoing packets directed
2606 at this client.
2607 .\"*********************************************************
2609 .B --max-clients n
2610 Limit server to a maximum of
2611 .B n
2612 concurrent clients.
2613 .\"*********************************************************
2615 .B --max-routes-per-client n
2616 Allow a maximum of
2617 .B n
2618 internal routes per client (default=256).
2619 This is designed to
2620 help contain DoS attacks where an authenticated client floods the
2621 server with packets appearing to come from many unique MAC addresses,
2622 forcing the server to deplete
2623 virtual memory as its internal routing table expands.
2624 This directive can be used in a
2625 .B --client-config-dir
2626 file or auto-generated by a
2627 .B --client-connect
2628 script to override the global value for a particular client.
2630 Note that this
2631 directive affects OpenVPN's internal routing table, not the
2632 kernel routing table.
2633 .\"*********************************************************
2635 .B --connect-freq n sec
2636 Allow a maximum of
2637 .B n
2638 new connections per
2639 .B sec 
2640 seconds from clients.  This is designed to contain DoS attacks which flood
2641 the server with connection requests using certificates which
2642 will ultimately fail to authenticate.
2644 This is an imperfect solution however, because in a real
2645 DoS scenario, legitimate connections might also be refused.
2647 For the best protection against DoS attacks in server mode,
2649 .B --proto udp
2651 .B --tls-auth.
2652 .\"*********************************************************
2654 .B --learn-address cmd
2655 Run script or shell command
2656 .B cmd
2657 to validate client virtual addresses or routes.
2659 .B cmd
2660 will be executed with 3 parameters:
2662 .B [1] operation --
2663 "add", "update", or "delete" based on whether or not
2664 the address is being added to, modified, or deleted from
2665 OpenVPN's internal routing table.
2667 .B [2] address --
2668 The address being learned or unlearned.  This can be
2669 an IPv4 address such as "198.162.10.14", an IPv4 subnet
2670 such as "198.162.10.0/24", or an ethernet MAC address (when
2671 .B --dev tap
2672 is being used) such as "00:FF:01:02:03:04".
2674 .B [3] common name --
2675 The common name on the certificate associated with the
2676 client linked to this address.  Only present for "add"
2677 or "update" operations, not "delete".
2679 On "add" or "update" methods, if the script returns
2680 a failure code (non-zero), OpenVPN will reject the address
2681 and will not modify its internal routing table.
2683 Normally, the
2684 .B cmd
2685 script will use the information provided above to set
2686 appropriate firewall entries on the VPN TUN/TAP interface.
2687 Since OpenVPN provides the association between virtual IP
2688 or MAC address and the client's authenticated common name,
2689 it allows a user-defined script to configure firewall access
2690 policies with regard to the client's high-level common name,
2691 rather than the low level client virtual addresses.
2692 .\"*********************************************************
2694 .B --auth-user-pass-verify script method
2695 Require the client to provide a username/password (possibly
2696 in addition to a client certificate) for authentication.
2698 OpenVPN will execute
2699 .B script
2700 as a shell command to validate the username/password
2701 provided by the client.
2704 .B method
2705 is set to "via-env", OpenVPN will call
2706 .B script
2707 with the environmental variables
2708 .B username
2710 .B password
2711 set to the username/password strings provided by the client.
2712 Be aware that this method is insecure on some platforms which
2713 make the environment of a process publicly visible to other
2714 unprivileged processes.
2717 .B method
2718 is set to "via-file", OpenVPN will write the username and
2719 password to the first two lines of a temporary file.  The filename
2720 will be passed as an argument to
2721 .B script,
2722 and the file will be automatically deleted by OpenVPN after
2723 the script returns.  The location of the temporary file is
2724 controlled by the
2725 .B --tmp-dir
2726 option, and will default to the current directory if unspecified.
2727 For security, consider setting 
2728 .B --tmp-dir
2729 to a volatile storage medium such as
2730 .B /dev/shm
2731 (if available) to prevent the username/password file from touching the hard drive.
2733 The script should examine the username
2734 and password,
2735 returning a success exit code (0) if the
2736 client's authentication request is to be accepted, or a failure
2737 code (1) to reject the client.
2739 This directive is designed to enable a plugin-style interface
2740 for extending OpenVPN's authentication capabilities.
2742 To protect against a client passing a maliciously formed
2743 username or password string, the username string must
2744 consist only of these characters: alphanumeric, underbar
2745 ('_'), dash ('-'), dot ('.'), or at ('@').  The password
2746 string can consist of any printable characters except for
2747 CR or LF.  Any illegal characters in either the username
2748 or password string will be converted to underbar ('_').
2750 Care must be taken by any user-defined scripts to avoid
2751 creating a security vulnerability in the way that these
2752 strings are handled.  Never use these strings in such a way
2753 that they might be escaped or evaluated by a shell interpreter.
2755 For a sample script that performs PAM authentication, see
2756 .B sample-scripts/auth-pam.pl
2757 in the OpenVPN source distribution.
2758 .\"*********************************************************
2760 .B --client-cert-not-required
2761 Don't require client certificate, client will authenticate
2762 using username/password only.  Be aware that using this directive
2763 is less secure than requiring certificates from all clients.
2765 If you use this directive, the
2766 entire responsibility of authentication will rest on your
2767 .B --auth-user-pass-verify
2768 script, so keep in mind that bugs in your script
2769 could potentially compromise the security of your VPN.
2771 If you don't use this directive, but you also specify an
2772 .B --auth-user-pass-verify
2773 script, then OpenVPN will perform double authentication.  The
2774 client certificate verification AND the
2775 .B --auth-user-pass-verify
2776 script will need to succeed in order for a client to be
2777 authenticated and accepted onto the VPN.
2778 .\"*********************************************************
2780 .B --username-as-common-name
2782 .B --auth-user-pass-verify
2783 authentication, use
2784 the authenticated username as the common name,
2785 rather than the common name from the client cert.
2786 .\"*********************************************************
2787 .SS Client Mode
2788 Use client mode when connecting to an OpenVPN server
2789 which has
2790 .B --server, --server-bridge,
2792 .B --mode server
2793 in it's configuration.
2794 .\"*********************************************************
2796 .B --client
2797 A helper directive designed to simplify the configuration
2798 of OpenVPN's client mode.  This directive is equivalent to:
2801 .ft 3
2804  pull
2805  tls-client
2810 .\"*********************************************************
2812 .B --pull
2813 This option must be used on a client which is connecting
2814 to a multi-client server.  It indicates to OpenVPN that it
2815 should accept options pushed by the server, provided they
2816 are part of the legal set of pushable options (note that the
2817 .B --pull
2818 option is implied by
2819 .B --client
2822 In particular,
2823 .B --pull
2824 allows the server to push routes to the client, so you should
2825 not use
2826 .B --pull
2828 .B --client
2829 in situations where you don't trust the server to have control
2830 over the client's routing table.
2831 .\"*********************************************************
2833 .B --auth-user-pass [up]
2834 Authenticate with server using username/password.
2835 .B up
2836 is a file containing username/password on 2 lines (Note: OpenVPN
2837 will only read passwords from a file if it has been built
2838 with the --enable-password-save configure option, or on Windows
2839 by defining ENABLE_PASSWORD_SAVE in config-win32.h).
2842 .B up
2843 is omitted, username/password will be prompted from the
2844 console.
2846 The server configuration must specify an
2847 .B --auth-user-pass-verify
2848 script to verify the username/password provided by
2849 the client.
2850 .\"*********************************************************
2852 .B --auth-retry type
2853 Controls how OpenVPN responds to username/password verification
2854 errors such as the client-side response to an AUTH_FAILED message from the server
2855 or verification failure of the private key password.
2857 Normally used to prevent auth errors from being fatal
2858 on the client side, and to permit username/password requeries in case
2859 of error.
2861 An AUTH_FAILED message is generated by the server if the client
2862 fails
2863 .B --auth-user-pass
2864 authentication, or if the server-side
2865 .B --client-connect
2866 script returns an error status when the client
2867 tries to connect.
2869 .B type
2870 can be one of:
2872 .B none --
2873 Client will exit with a fatal error (this is the default).
2875 .B nointeract --
2876 Client will retry the connection without requerying for an
2877 .B --auth-user-pass
2878 username/password.  Use this option for unattended clients.
2880 .B interact --
2881 Client will requery for an
2882 .B --auth-user-pass
2883 username/password and/or private key password before attempting a reconnection.
2885 Note that while this option cannot be pushed, it can be controlled
2886 from the management interface.
2887 .\"*********************************************************
2889 .B --explicit-exit-notify [n]
2890 In UDP client mode or point-to-point mode, send server/peer an exit notification
2891 if tunnel is restarted or OpenVPN process is exited.  In client mode, on
2892 exit/restart, this
2893 option will tell the server to immediately close its client instance object
2894 rather than waiting for a timeout.  The
2895 .B n
2896 parameter (default=1) controls the maximum number of retries that the client
2897 will attempt to resend the exit notification message.
2898 .\"*********************************************************
2899 .SS Data Channel Encryption Options:
2900 These options are meaningful for both Static & TLS-negotiated key modes
2901 (must be compatible between peers).
2902 .\"*********************************************************
2904 .B --secret file [direction]
2905 Enable Static Key encryption mode (non-TLS).
2906 Use pre-shared secret
2907 .B file
2908 which was generated with
2909 .B --genkey.
2911 The optional
2912 .B direction
2913 parameter enables the use of 4 distinct keys
2914 (HMAC-send, cipher-encrypt, HMAC-receive, cipher-decrypt), so that
2915 each data flow direction has a different set of HMAC and cipher keys.
2916 This has a number of desirable security properties including
2917 eliminating certain kinds of DoS and message replay attacks.
2919 When the
2920 .B direction
2921 parameter is omitted, 2 keys are used bidirectionally, one for HMAC
2922 and the other for encryption/decryption.
2925 .B direction
2926 parameter should always be complementary on either side of the connection,
2927 i.e. one side should use "0" and the other should use "1", or both sides
2928 should omit it altogether.
2931 .B direction
2932 parameter requires that
2933 .B file
2934 contains a 2048 bit key.  While pre-1.5 versions of OpenVPN
2935 generate 1024 bit key files, any version of OpenVPN which
2936 supports the
2937 .B direction
2938 parameter, will also support 2048 bit key file generation
2939 using the
2940 .B --genkey
2941 option.
2943 Static key encryption mode has certain advantages,
2944 the primary being ease of configuration.
2946 There are no certificates
2947 or certificate authorities or complicated negotiation handshakes and protocols.
2948 The only requirement is that you have a pre-existing secure channel with
2949 your peer (such as
2950 .B ssh
2951 ) to initially copy the key.  This requirement, along with the
2952 fact that your key never changes unless you manually generate a new one,
2953 makes it somewhat less secure than TLS mode (see below).  If an attacker
2954 manages to steal your key, everything that was ever encrypted with
2955 it is compromised.  Contrast that to the perfect forward secrecy features of
2956 TLS mode (using Diffie Hellman key exchange), where even if an attacker
2957 was able to steal your private key, he would gain no information to help
2958 him decrypt past sessions.
2960 Another advantageous aspect of Static Key encryption mode is that
2961 it is a handshake-free protocol 
2962 without any distinguishing signature or feature
2963 (such as a header or protocol handshake sequence) 
2964 that would mark the ciphertext packets as being
2965 generated by OpenVPN.  Anyone eavesdropping on the wire
2966 would see nothing
2967 but random-looking data.
2968 .\"*********************************************************
2970 .B --auth alg
2971 Authenticate packets with HMAC using message
2972 digest algorithm
2973 .B alg.
2974 (The default is
2975 .B SHA1
2977 HMAC is a commonly used message authentication algorithm (MAC) that uses
2978 a data string, a secure hash algorithm, and a key, to produce
2979 a digital signature.
2981 OpenVPN's usage of HMAC is to first encrypt a packet, then HMAC the resulting ciphertext.
2983 In static-key encryption mode, the HMAC key
2984 is included in the key file generated by
2985 .B --genkey.
2986 In TLS mode, the HMAC key is dynamically generated and shared
2987 between peers via the TLS control channel.  If OpenVPN receives a packet with
2988 a bad HMAC it will drop the packet.
2989 HMAC usually adds 16 or 20 bytes per packet.
2991 .B alg=none
2992 to disable authentication.
2994 For more information on HMAC see
2995 .I http://www.cs.ucsd.edu/users/mihir/papers/hmac.html
2996 .\"*********************************************************
2998 .B --cipher alg
2999 Encrypt packets with cipher algorithm
3000 .B alg.
3001 The default is
3002 .B BF-CBC,
3003 an abbreviation for Blowfish in Cipher Block Chaining mode.
3004 Blowfish has the advantages of being fast, very secure, and allowing key sizes
3005 of up to 448 bits.  Blowfish is designed to be used in situations where
3006 keys are changed infrequently.
3008 For more information on blowfish, see
3009 .I http://www.counterpane.com/blowfish.html
3011 To see other ciphers that are available with
3012 OpenVPN, use the
3013 .B --show-ciphers
3014 option.
3016 OpenVPN supports the CBC, CFB, and OFB cipher modes.
3019 .B alg=none
3020 to disable encryption.
3021 .\"*********************************************************
3023 .B --keysize n
3024 Size of cipher key in bits (optional).
3025 If unspecified, defaults to cipher-specific default.  The
3026 .B --show-ciphers
3027 option (see below) shows all available OpenSSL ciphers,
3028 their default key sizes, and whether the key size can
3029 be changed.  Use care in changing a cipher's default
3030 key size.  Many ciphers have not been extensively
3031 cryptanalyzed with non-standard key lengths, and a
3032 larger key may offer no real guarantee of greater
3033 security, or may even reduce security.
3034 .\"*********************************************************
3036 .B --engine [engine-name]
3037 Enable OpenSSL hardware-based crypto engine functionality.
3040 .B engine-name
3041 is specified,
3042 use a specific crypto engine.  Use the
3043 .B --show-engines
3044 standalone option to list the crypto engines which are
3045 supported by OpenSSL.
3046 .\"*********************************************************
3048 .B --no-replay
3049 Disable OpenVPN's protection against replay attacks.
3050 Don't use this option unless you are prepared to make
3051 a tradeoff of greater efficiency in exchange for less
3052 security.
3054 OpenVPN provides datagram replay protection by default.
3056 Replay protection is accomplished
3057 by tagging each outgoing datagram with an identifier
3058 that is guaranteed to be unique for the key being used.
3059 The peer that receives the datagram will check for
3060 the uniqueness of the identifier.  If the identifier
3061 was already received in a previous datagram, OpenVPN
3062 will drop the packet.  Replay protection is important
3063 to defeat attacks such as a SYN flood attack, where
3064 the attacker listens in the wire, intercepts a TCP
3065 SYN packet (identifying it by the context in which
3066 it occurs in relation to other packets), then floods
3067 the receiving peer with copies of this packet.
3069 OpenVPN's replay protection is implemented in slightly
3070 different ways, depending on the key management mode
3071 you have selected.
3073 In Static Key mode
3074 or when using an CFB or OFB mode cipher, OpenVPN uses a
3075 64 bit unique identifier that combines a time stamp with
3076 an incrementing sequence number.
3078 When using TLS mode for key exchange and a CBC cipher
3079 mode, OpenVPN uses only a 32 bit sequence number without
3080 a time stamp, since OpenVPN can guarantee the uniqueness
3081 of this value for each key.  As in IPSec, if the sequence number is
3082 close to wrapping back to zero, OpenVPN will trigger
3083 a new key exchange.
3085 To check for replays, OpenVPN uses
3087 .I sliding window
3088 algorithm used
3089 by IPSec.
3090 .\"*********************************************************
3092 .B --replay-window n [t]
3093 Use a replay protection sliding-window of size
3094 .B n
3095 and a time window of
3096 .B t
3097 seconds.
3099 By default
3100 .B n
3101 is 64 (the IPSec default) and
3102 .B t
3103 is 15 seconds.
3105 This option is only relevant in UDP mode, i.e.
3106 when either
3107 .B --proto udp
3108 is specifed, or no
3109 .B --proto
3110 option is specified.
3112 When OpenVPN tunnels IP packets over UDP, there is the possibility that
3113 packets might be dropped or delivered out of order.  Because OpenVPN, like IPSec,
3114 is emulating the physical network layer,
3115 it will accept an out-of-order packet sequence, and
3116 will deliver such packets in the same order they were received to
3117 the TCP/IP protocol stack, provided they satisfy several constraints.
3119 .B (a)
3120 The packet cannot be a replay (unless
3121 .B --no-replay
3122 is specified, which disables replay protection altogether).
3124 .B (b)
3125 If a packet arrives out of order, it will only be accepted if the difference
3126 between its sequence number and the highest sequence number received
3127 so far is less than
3128 .B n.
3130 .B (c)
3131 If a packet arrives out of order, it will only be accepted if it arrives no later
3132 than
3133 .B t
3134 seconds after any packet containing a higher sequence number.
3136 If you are using a network link with a large pipeline (meaning that
3137 the product of bandwidth and latency is high), you may want to use
3138 a larger value for
3139 .B n.
3140 Satellite links in particular often require this.
3142 If you run OpenVPN at
3143 .B --verb 4,
3144 you will see the message "Replay-window backtrack occurred [x]"
3145 every time the maximum sequence number backtrack seen thus far
3146 increases.  This can be used to calibrate
3147 .B n.
3149 There is some controversy on the appropriate method of handling packet
3150 reordering at the security layer.
3152 Namely, to what extent should the
3153 security layer protect the encapsulated protocol from attacks which masquerade
3154 as the kinds of normal packet loss and reordering that occur over IP networks?
3156 The IPSec and OpenVPN approach is to allow packet reordering within a certain
3157 fixed sequence number window.
3159 OpenVPN adds to the IPSec model by limiting the window size in time as well as
3160 sequence space.
3162 OpenVPN also adds TCP transport as an option (not offered by IPSec) in which
3163 case OpenVPN can adopt a very strict attitude towards message deletion and
3164 reordering:  Don't allow it.  Since TCP guarantees reliability, any packet
3165 loss or reordering event can be assumed to be an attack.
3167 In this sense, it could be argued that TCP tunnel transport is preferred when
3168 tunneling non-IP or UDP application protocols which might be vulnerable to a
3169 message deletion or reordering attack which falls within the normal
3170 operational parameters of IP networks.
3172 So I would make the statement that one should never tunnel a non-IP protocol
3173 or UDP application protocol over UDP, if the protocol might be vulnerable to a
3174 message deletion or reordering attack that falls within the normal operating
3175 parameters of what is to be expected from the physical IP layer.  The problem
3176 is easily fixed by simply using TCP as the VPN transport layer.
3177 .\"*********************************************************
3179 .B --mute-replay-warnings
3180 Silence the output of replay warnings, which are a common
3181 false alarm on WiFi networks.  This option preserves
3182 the security of the replay protection code without
3183 the verbosity associated with warnings about duplicate
3184 packets.
3185 .\"*********************************************************
3187 .B --replay-persist file
3188 Persist replay-protection state across sessions using
3189 .B file
3190 to save and reload the state.
3192 This option will strengthen protection against replay attacks,
3193 especially when you are using OpenVPN in a dynamic context (such
3194 as with
3195 .B --inetd)
3196 when OpenVPN sessions are frequently started and stopped. 
3198 This option will keep a disk copy of the current replay protection
3199 state (i.e. the most recent packet timestamp and sequence number
3200 received from the remote peer), so that if an OpenVPN session
3201 is stopped and restarted, it will reject any replays of packets
3202 which were already received by the prior session.
3204 This option only makes sense when replay protection is enabled
3205 (the default) and you are using either
3206 .B --secret
3207 (shared-secret key mode) or TLS mode with
3208 .B --tls-auth.
3209 .\"*********************************************************
3211 .B --no-iv
3212 Disable OpenVPN's use of IV (cipher initialization vector).
3213 Don't use this option unless you are prepared to make
3214 a tradeoff of greater efficiency in exchange for less
3215 security.
3217 OpenVPN uses an IV by default, and requires it for CFB and
3218 OFB cipher modes (which are totally insecure without it).
3219 Using an IV is important for security when multiple
3220 messages are being encrypted/decrypted with the same key.
3222 IV is implemented differently depending on the cipher mode used.
3224 In CBC mode, OpenVPN uses a pseudo-random IV for each packet.
3226 In CFB/OFB mode, OpenVPN uses a unique sequence number and time stamp
3227 as the IV.  In fact, in CFB/OFB mode, OpenVPN uses a datagram
3228 space-saving optimization that uses the unique identifier for
3229 datagram replay protection as the IV.
3230 .\"*********************************************************
3232 .B --test-crypto
3233 Do a self-test of OpenVPN's crypto options by encrypting and
3234 decrypting test packets using the data channel encryption options
3235 specified above.  This option does not require a peer to function,
3236 and therefore can be specified without
3237 .B --dev
3239 .B --remote.
3241 The typical usage of
3242 .B --test-crypto
3243 would be something like this:
3245 .B openvpn --test-crypto --secret key
3249 .B openvpn --test-crypto --secret key --verb 9
3251 This option is very useful to test OpenVPN after it has been ported to
3252 a new platform, or to isolate problems in the compiler, OpenSSL
3253 crypto library, or OpenVPN's crypto code.  Since it is a self-test mode,
3254 problems with encryption and authentication can be debugged independently
3255 of network and tunnel issues.
3256 .\"*********************************************************
3257 .SS TLS Mode Options:
3258 TLS mode is the most powerful crypto mode of OpenVPN in both security and flexibility.
3259 TLS mode works by establishing control and
3260 data channels which are multiplexed over a single TCP/UDP port.  OpenVPN initiates
3261 a TLS session over the control channel and uses it to exchange cipher
3262 and HMAC keys to protect the data channel.  TLS mode uses a robust reliability
3263 layer over the UDP connection for all control channel communication, while
3264 the data channel, over which encrypted tunnel data passes, is forwarded without
3265 any mediation.  The result is the best of both worlds: a fast data channel
3266 that forwards over UDP with only the overhead of encrypt,
3267 decrypt, and HMAC functions,
3268 and a control channel that provides all of the security features of TLS,
3269 including certificate-based authentication and Diffie Hellman forward secrecy.
3271 To use TLS mode, each peer that runs OpenVPN should have its own local
3272 certificate/key pair (
3273 .B --cert
3275 .B --key
3276 ), signed by the root certificate which is specified
3278 .B --ca.
3280 When two OpenVPN peers connect, each presents its local certificate to the
3281 other.  Each peer will then check that its partner peer presented a
3282 certificate which was signed by the master root certificate as specified in
3283 .B --ca.
3285 If that check on both peers succeeds, then the TLS negotiation
3286 will succeed, both OpenVPN
3287 peers will exchange temporary session keys, and the tunnel will begin
3288 passing data.
3290 The OpenVPN distribution contains a set of scripts for
3291 managing RSA certificates & keys,
3292 located in the
3293 .I easy-rsa
3294 subdirectory.
3296 The easy-rsa package is also rendered in web form here:
3297 .I http://openvpn.net/easyrsa.html
3298 .\"*********************************************************
3300 .B --tls-server
3301 Enable TLS and assume server role during TLS handshake.  Note that
3302 OpenVPN is designed as a peer-to-peer application.  The designation
3303 of client or server is only for the purpose of negotiating the TLS
3304 control channel.
3305 .\"*********************************************************
3307 .B --tls-client
3308 Enable TLS and assume client role during TLS handshake.
3309 .\"*********************************************************
3311 .B --ca file
3312 Certificate authority (CA) file in .pem format, also referred to as the
3313 .I root
3314 certificate.  This file can have multiple
3315 certificates in .pem format, concatenated together.  You can construct your own
3316 certificate authority certificate and private key by using a command such as:
3318 .B openssl req -nodes -new -x509 -keyout tmp-ca.key -out tmp-ca.crt
3320 Then edit your openssl.cnf file and edit the
3321 .B certificate
3322 variable to point to your new root certificate
3323 .B tmp-ca.crt.
3325 For testing purposes only, the OpenVPN distribution includes a sample
3326 CA certificate (tmp-ca.crt).
3327 Of course you should never use
3328 the test certificates and test keys distributed with OpenVPN in a
3329 production environment, since by virtue of the fact that
3330 they are distributed with OpenVPN, they are totally insecure.
3331 .\"*********************************************************
3333 .B --dh file
3334 File containing Diffie Hellman parameters
3335 in .pem format (required for
3336 .B --tls-server
3337 only). Use
3339 .B openssl dhparam -out dh1024.pem 1024
3341 to generate your own, or use the existing dh1024.pem file
3342 included with the OpenVPN distribution.  Diffie Hellman parameters
3343 may be considered public.
3344 .\"*********************************************************
3346 .B --cert file
3347 Local peer's signed certificate in .pem format -- must be signed
3348 by a certificate authority whose certificate is in
3349 .B --ca file.
3350 Each peer in an OpenVPN link running in TLS mode should have its own
3351 certificate and private key file.  In addition, each certificate should
3352 have been signed by the key of a certificate
3353 authority whose public key resides in the
3354 .B --ca
3355 certificate authority file.
3356 You can easily make your own certificate authority (see above) or pay money
3357 to use a commercial service such as thawte.com (in which case you will be
3358 helping to finance the world's second space tourist :).
3359 To generate a certificate,
3360 you can use a command such as:
3362 .B openssl req -nodes -new -keyout mycert.key -out mycert.csr
3364 If your certificate authority private key lives on another machine, copy
3365 the certificate signing request (mycert.csr) to this other machine (this can
3366 be done over an insecure channel such as email).  Now sign the certificate
3367 with a command such as:
3369 .B openssl ca -out mycert.crt -in mycert.csr
3371 Now copy the certificate (mycert.crt)
3372 back to the peer which initially generated the .csr file (this
3373 can be over a public medium).
3374 Note that the
3375 .B openssl ca
3376 command reads the location of the certificate authority key from its
3377 configuration file such as
3378 .B /usr/share/ssl/openssl.cnf
3379 -- note also
3380 that for certificate authority functions, you must set up the files
3381 .B index.txt
3382 (may be empty) and
3383 .B serial
3384 (initialize to
3385 .B 
3388 .\"*********************************************************
3390 .B --key file
3391 Local peer's private key in .pem format.  Use the private key which was generated
3392 when you built your peer's certificate (see
3393 .B -cert file
3394 above).
3395 .\"*********************************************************
3397 .B --pkcs12 file
3398 Specify a PKCS #12 file containing local private key,
3399 local certificate, and root CA certificate.
3400 This option can be used instead of
3401 .B --ca, --cert,
3403 .B --key.
3404 .\"*********************************************************
3406 .B --cryptoapicert select-string
3407 Load the certificate and private key from the
3408 Windows Certificate System Store (Windows Only).
3410 Use this option instead of
3411 .B --cert
3413 .B --key.
3415 This makes
3416 it possible to use any smart card, supported by Windows, but also any
3417 kind of certificate, residing in the Cert Store, where you have access to
3418 the private key.  This option has been tested with a couple of different
3419 smart cards (GemSAFE, Cryptoflex, and Swedish Post Office eID) on the
3420 client side, and also an imported PKCS12 software certificate on the
3421 server side.
3423 To select a certificate, based on a substring search in the
3424 certificate's subject:
3426 .B cryptoapicert
3427 "SUBJ:Peter Runestig"
3429 To select a certificate, based on certificate's thumbprint:
3431 .B cryptoapicert
3432 "THUMB:f6 49 24 41 01 b4 ..."
3434 The thumbprint hex string can easily be copy-and-pasted from the Windows
3435 Certificate Store GUI.
3437 .\"*********************************************************
3439 .B --key-method m
3440 Use data channel key negotiation method
3441 .B m.
3442 The key method must match on both sides of the connection.
3444 After OpenVPN negotiates a TLS session, a new set of keys
3445 for protecting the tunnel data channel is generated and
3446 exchanged over the TLS session.
3448 In method 1 (the default for OpenVPN 1.x), both sides generate
3449 random encrypt and HMAC-send keys which are forwarded to
3450 the other host over the TLS channel.
3452 In method 2, (the default for OpenVPN 2.0)
3453 the client generates a random key.  Both client
3454 and server also generate some random seed material.  All key source
3455 material is exchanged over the TLS channel. The actual
3456 keys are generated using the TLS PRF function, taking source
3457 entropy from both client and server.  Method 2 is designed to
3458 closely parallel the key generation process used by TLS 1.0.
3460 Note that in TLS mode, two separate levels 
3461 of keying occur:
3463 (1) The TLS connection is initially negotiated, with both sides
3464 of the connection producing certificates and verifying the certificate
3465 (or other authentication info provided) of
3466 the other side.  The
3467 .B --key-method
3468 parameter has no effect on this process.
3470 (2) After the TLS connection is established, the tunnel session keys are
3471 separately negotiated over the existing secure TLS channel.  Here,
3472 .B --key-method
3473 determines the derivation of the tunnel session keys.
3474 .\"*********************************************************
3476 .B --tls-cipher l
3477 A list
3478 .B l
3479 of allowable TLS ciphers delimited by a colon (":").
3480 If you require a high level of security,
3481 you may want to set this parameter manually, to prevent a
3482 version rollback attack where a man-in-the-middle attacker tries
3483 to force two peers to negotiate to the lowest level
3484 of security they both support.
3486 .B --show-tls
3487 to see a list of supported TLS ciphers.
3488 .\"*********************************************************
3490 .B --tls-timeout n
3491 Packet retransmit timeout on TLS control channel
3492 if no acknowledgment from remote within
3493 .B n
3494 seconds (default=2).  When OpenVPN sends a control
3495 packet to its peer, it will expect to receive an
3496 acknowledgement within
3497 .B n
3498 seconds or it will retransmit the packet, subject
3499 to a TCP-like exponential backoff algorithm.  This parameter
3500 only applies to control channel packets.  Data channel
3501 packets (which carry encrypted tunnel data) are never
3502 acknowledged, sequenced, or retransmitted by OpenVPN because
3503 the higher level network protocols running on top of the tunnel
3504 such as TCP expect this role to be left to them.
3505 .\"*********************************************************
3507 .B --reneg-bytes n
3508 Renegotiate data channel key after
3509 .B n
3510 bytes sent or received (disabled by default).
3511 OpenVPN allows the lifetime of a key
3512 to be expressed as a number of bytes encrypted/decrypted, a number of packets, or
3513 a number of seconds.  A key renegotiation will be forced
3514 if any of these three criteria are met by either peer.
3515 .\"*********************************************************
3517 .B --reneg-pkts n
3518 Renegotiate data channel key after
3519 .B n
3520 packets sent and received (disabled by default).
3521 .\"*********************************************************
3523 .B --reneg-sec n
3524 Renegotiate data channel key after
3525 .B n
3526 seconds (default=3600).
3527 .\"*********************************************************
3529 .B --hand-window n
3530 Handshake Window -- the TLS-based key exchange must finalize within
3531 .B n
3532 seconds
3533 of handshake initiation by any peer (default = 60 seconds).
3534 If the handshake fails
3535 we will attempt to reset our connection with our peer and try again.
3536 Even in the event of handshake failure we will still use
3537 our expiring key for up to
3538 .B --tran-window
3539 seconds to maintain continuity of transmission of tunnel
3540 data.
3541 .\"*********************************************************
3543 .B --tran-window n
3544 Transition window -- our old key can live this many seconds
3545 after a new a key renegotiation begins (default = 3600 seconds).
3546 This feature allows for a graceful transition from old to new
3547 key, and removes the key renegotiation sequence from the critical
3548 path of tunnel data forwarding.
3549 .\"*********************************************************
3551 .B --single-session
3552 After initially connecting to a remote peer, disallow any new connections.
3553 Using this
3554 option means that a remote peer cannot connect, disconnect, and then
3555 reconnect.
3557 If the daemon is reset by a signal or
3558 .B --ping-restart,
3559 it will allow one new connection.
3561 .B --single-session
3562 can be used with
3563 .B --ping-exit
3565 .B --inactive
3566 to create a single dynamic session that will exit when finished.
3567 .\"*********************************************************
3569 .B --tls-exit
3570 Exit on TLS negotiation failure.
3571 .\"*********************************************************
3573 .B --tls-auth file [direction]
3574 Add an additional layer of HMAC authentication on top of the TLS
3575 control channel to protect against DoS attacks.
3577 In a nutshell,
3578 .B --tls-auth
3579 enables a kind of "HMAC firewall" on OpenVPN's TCP/UDP port,
3580 where TLS control channel packets
3581 bearing an incorrect HMAC signature can be dropped immediately without
3582 response.
3584 .B file
3585 (required) is a key file which can be in one of two formats:
3587 .B (1)
3588 An OpenVPN static key file generated by
3589 .B --genkey
3590 (required if
3591 .B direction
3592 parameter is used).
3594 .B (2)
3595 A freeform passphrase file.  In this case the HMAC key will
3596 be derived by taking a secure hash of this file, similar to
3598 .BR md5sum (1)
3600 .BR sha1sum (1)
3601 commands.
3603 OpenVPN will first try format (1), and if the file fails to parse as
3604 a static key file, format (2) will be used.
3606 See the
3607 .B --secret
3608 option for more information on the optional
3609 .B direction
3610 parameter.
3612 .B --tls-auth
3613 is recommended when you are running OpenVPN in a mode where
3614 it is listening for packets from any IP address, such as when
3615 .B --remote
3616 is not specified, or
3617 .B --remote
3618 is specified with
3619 .B --float.
3621 The rationale for
3622 this feature is as follows.  TLS requires a multi-packet exchange
3623 before it is able to authenticate a peer.  During this time
3624 before authentication, OpenVPN is allocating resources (memory
3625 and CPU) to this potential peer.  The potential peer is also
3626 exposing many parts of OpenVPN and the OpenSSL library to the packets
3627 it is sending.  Most successful network attacks today seek
3628 to either exploit bugs in programs (such as buffer overflow attacks) or
3629 force a program to consume so many resources that it becomes unusable.
3630 Of course the first line of defense is always to produce clean,
3631 well-audited code.  OpenVPN has been written with buffer overflow
3632 attack prevention as a top priority.
3633 But as history has shown, many of the most widely used
3634 network applications have, from time to time,
3635 fallen to buffer overflow attacks.
3637 So as a second line of defense, OpenVPN offers
3638 this special layer of authentication on top of the TLS control channel so that
3639 every packet on the control channel is authenticated by an
3640 HMAC signature and a unique ID for replay protection.
3641 This signature will also help protect against DoS (Denial of Service) attacks.
3642 An important rule of thumb in reducing vulnerability to DoS attacks is to
3643 minimize the amount of resources a potential, but as yet unauthenticated,
3644 client is able to consume.
3646 .B --tls-auth
3647 does this by signing every TLS control channel packet with an HMAC signature,
3648 including packets which are sent before the TLS level has had a chance
3649 to authenticate the peer.
3650 The result is that packets without
3651 the correct signature can be dropped immediately upon reception,
3652 before they have a chance to consume additional system resources
3653 such as by initiating a TLS handshake.
3654 .B --tls-auth
3655 can be strengthened by adding the
3656 .B --replay-persist
3657 option which will keep OpenVPN's replay protection state
3658 in a file so that it is not lost across restarts.
3660 It should be emphasized that this feature is optional and that the
3661 passphrase/key file used with
3662 .B --tls-auth
3663 gives a peer nothing more than the power to initiate a TLS
3664 handshake.  It is not used to encrypt or authenticate any tunnel data.
3665 .\"*********************************************************
3667 .B --askpass [file]
3668 Get certificate password from console or
3669 .B file
3670 before we daemonize.
3672 For the extremely
3673 security conscious, it is possible to protect your private key with
3674 a password.  Of course this means that every time the OpenVPN
3675 daemon is started you must be there to type the password.  The
3676 .B --askpass
3677 option allows you to start OpenVPN from the command line.  It will
3678 query you for a password before it daemonizes.  To protect a private
3679 key with a password you should omit the
3680 .B -nodes
3681 option when you use the
3682 .B openssl
3683 command line tool to manage certificates and private keys.
3686 .B file
3687 is specified, read the password from the first line of
3688 .B file.
3689 Keep in mind that storing your password in a file
3690 to a certain extent invalidates the extra security provided by
3691 using an encrypted key (Note: OpenVPN
3692 will only read passwords from a file if it has been built
3693 with the --enable-password-save configure option, or on Windows
3694 by defining ENABLE_PASSWORD_SAVE in config-win32.h).
3695 .\"*********************************************************
3697 .B --auth-nocache
3698 Don't cache
3699 .B --askpass
3701 .B --auth-user-pass
3702 username/passwords in virtual memory.
3704 If specified, this directive will cause OpenVPN to immediately
3705 forget username/password inputs after they are used.  As a result,
3706 when OpenVPN needs a username/password, it will prompt for input
3707 from stdin, which may be multiple times during the duration of an
3708 OpenVPN session.
3710 This directive does not affect the
3711 .B --http-proxy
3712 username/password.  It is always cached.
3713 .\"*********************************************************
3715 .B --tls-verify cmd
3716 Execute shell command
3717 .B cmd
3718 to verify the X509 name of a
3719 pending TLS connection that has otherwise passed all other
3720 tests of certification (except for revocation via
3721 .B --crl-verify
3722 directive; the revocation test occurs after the
3723 .B --tls-verify
3724 test).
3726 .B cmd
3727 should return 0 to allow the TLS handshake to proceed, or 1 to fail.
3728 .B cmd
3729 is executed as
3731 .B cmd certificate_depth X509_NAME_oneline
3733 This feature is useful if the peer you want to trust has a certificate
3734 which was signed by a certificate authority who also signed many
3735 other certificates, where you don't necessarily want to trust all of them,
3736 but rather be selective about which
3737 peer certificate you will accept.  This feature allows you to write a script
3738 which will test the X509 name on a certificate and decide whether or
3739 not it should be accepted.  For a simple perl script which will test
3740 the common name field on the certificate, see the file
3741 .B verify-cn
3742 in the OpenVPN distribution.
3744 See the "Environmental Variables" section below for
3745 additional parameters passed as environmental variables.
3747 Note that
3748 .B cmd
3749 can be a shell command with multiple arguments, in which
3750 case all OpenVPN-generated arguments will be appended
3752 .B cmd
3753 to build a command line which will be passed to the script.
3754 .\"*********************************************************
3756 .B --tls-remote name
3757 Accept connections only from a host with X509 name
3758 or common name equal to
3759 .B name.
3760 The remote host must also pass all other tests
3761 of verification.
3763 Name can also be a common name prefix, for example if you
3764 want a client to only accept connections to "Server-1",
3765 "Server-2", etc., you can simply use
3766 .B --tls-remote Server
3768 Using a common name prefix is a useful alternative to managing
3769 a CRL (Certificate Revocation List) on the client, since it allows the client
3770 to refuse all certificates except for those associated
3771 with designated servers.
3773 .B --tls-remote
3774 is a useful replacement for the
3775 .B --tls-verify
3776 option to verify the remote host, because
3777 .B --tls-remote
3778 works in a
3779 .B --chroot
3780 environment too.
3781 .\"*********************************************************
3783 .B --ns-cert-type client|server
3784 Require that peer certificate was signed with an explicit
3785 .B nsCertType
3786 designation of "client" or "server".
3788 This is a useful security option for clients, to ensure that
3789 the host they connect with is a designated server.
3791 See the easy-rsa/build-key-server script for an example
3792 of how to generate a certificate with the
3793 .B nsCertType
3794 field set to "server".
3796 If the server certificate's nsCertType field is set
3797 to "server", then the clients can verify this with
3798 .B --ns-cert-type server.
3800 This is an important security precaution to protect against
3801 a man-in-the-middle attack where an authorized client
3802 attempts to connect to another client by impersonating the server.
3803 The attack is easily prevented by having clients verify
3804 the server certificate using any one of
3805 .B --ns-cert-type, --tls-remote,
3807 .B --tls-verify.
3808 .\"*********************************************************
3810 .B --crl-verify crl
3811 Check peer certificate against the file
3812 .B crl
3813 in PEM format.
3815 A CRL (certificate revocation list) is used when a particular key is
3816 compromised but when the overall PKI is still intact.
3818 Suppose you had a PKI consisting of a CA, root certificate, and a number of
3819 client certificates.  Suppose a laptop computer containing a client key and
3820 certificate was stolen.  By adding the stolen certificate to the CRL file,
3821 you could reject any connection which attempts to use it, while preserving the
3822 overall integrity of the PKI.
3824 The only time when it would be necessary to rebuild the entire PKI from scratch would be
3825 if the root certificate key itself was compromised.
3826 .\"*********************************************************
3827 .SS SSL Library information:
3828 .\"*********************************************************
3830 .B --show-ciphers
3831 (Standalone)
3832 Show all cipher algorithms to use with the
3833 .B --cipher
3834 option.
3835 .\"*********************************************************
3837 .B --show-digests
3838 (Standalone)
3839 Show all message digest algorithms to use with the
3840 .B --auth
3841 option.
3842 .\"*********************************************************
3844 .B --show-tls
3845 (Standalone)
3846 Show all TLS ciphers (TLS used only as a control channel).  The TLS
3847 ciphers will be sorted from highest preference (most secure) to
3848 lowest.
3849 .\"*********************************************************
3851 .B --show-engines
3852 (Standalone)
3853 Show currently available hardware-based crypto acceleration
3854 engines supported by the OpenSSL library.
3855 .\"*********************************************************
3856 .SS Generate a random key:
3857 Used only for non-TLS static key encryption mode.
3858 .\"*********************************************************
3860 .B --genkey
3861 (Standalone)
3862 Generate a random key to be used as a shared secret,
3863 for use with the
3864 .B --secret
3865 option.  This file must be shared with the
3866 peer over a pre-existing secure channel such as
3867 .BR scp (1)
3869 .\"*********************************************************
3871 .B --secret file
3872 Write key to
3873 .B file.
3874 .\"*********************************************************
3875 .SS TUN/TAP persistent tunnel config mode:
3876 Available with linux 2.4.7+.  These options comprise a standalone mode
3877 of OpenVPN which can be used to create and delete persistent tunnels.
3878 .\"*********************************************************
3880 .B --mktun
3881 (Standalone)
3882 Create a persistent tunnel on platforms which support them such
3883 as Linux.  Normally TUN/TAP tunnels exist only for
3884 the period of time that an application has them open.  This option
3885 takes advantage of the TUN/TAP driver's ability to build persistent
3886 tunnels that live through multiple instantiations of OpenVPN and die
3887 only when they are deleted or the machine is rebooted.
3889 One of the advantages of persistent tunnels is that they eliminate the
3890 need for separate
3891 .B --up
3893 .B --down
3894 scripts to run the appropriate
3895 .BR ifconfig (8)
3897 .BR route (8)
3898 commands.  These commands can be placed in the the same shell script
3899 which starts or terminates an OpenVPN session.
3901 Another advantage is that open connections through the TUN/TAP-based tunnel
3902 will not be reset if the OpenVPN peer restarts.  This can be useful to
3903 provide uninterrupted connectivity through the tunnel in the event of a DHCP
3904 reset of the peer's public IP address (see the
3905 .B --ipchange
3906 option above).
3908 One disadvantage of persistent tunnels is that it is harder to automatically
3909 configure their MTU value (see
3910 .B --link-mtu
3912 .B --tun-mtu
3913 above).
3915 On some platforms such as Windows, TAP-Win32 tunnels are persistent by
3916 default.
3917 .\"*********************************************************
3919 .B --rmtun
3920 (Standalone)
3921 Remove a persistent tunnel.
3922 .\"*********************************************************
3924 .B --dev tunX | tapX
3925 TUN/TAP device
3926 .\"*********************************************************
3927 .SS Windows-Specific Options:
3928 .\"*********************************************************
3930 .B --ip-win32 method
3931 When using
3932 .B --ifconfig
3933 on Windows, set the TAP-Win32 adapter
3934 IP address and netmask using
3935 .B method.
3936 Don't use this option unless you are also using
3937 .B --ifconfig.
3939 .B manual --
3940 Don't set the IP address or netmask automatically.
3941 Instead output a message
3942 to the console telling the user to configure the
3943 adapter manually and indicating the IP/netmask which
3944 OpenVPN expects the adapter to be set to.
3946 .B dynamic [offset] [lease-time] --
3947 (Default) Automatically set the IP address and netmask by replying to
3948 DHCP query messages generated by the kernel.  This mode is
3949 probably the "cleanest" solution
3950 for setting the TCP/IP properties since it uses the well-known
3951 DHCP protocol.  There are, however, two prerequisites for using
3952 this mode: (1) The TCP/IP properties for the TAP-Win32
3953 adapter must be set to "Obtain an IP address automatically," and
3954 (2) OpenVPN needs to claim an IP address in the subnet for use
3955 as the virtual DHCP server address.  By default in
3956 .B --dev tap
3957 mode, OpenVPN will
3958 take the normally unused first address in the subnet.  For example,
3959 if your subnet is 192.168.4.0 netmask 255.255.255.0, then
3960 OpenVPN will take the IP address 192.168.4.0 to use as the
3961 virtual DHCP server address.  In
3962 .B --dev tun
3963 mode, OpenVPN will cause the DHCP server to masquerade as if it were
3964 coming from the remote endpoint.  The optional offset parameter is
3965 an integer which is > -256 and < 256 and which defaults to 0.
3966 If offset is positive, the DHCP server will masquerade as the IP
3967 address at network address + offset.
3968 If offset is negative, the DHCP server will masquerade as the IP
3969 address at broadcast address + offset.  The Windows
3970 .B ipconfig /all
3971 command can be used to show what Windows thinks the DHCP server
3972 address is.  OpenVPN will "claim" this address, so make sure to
3973 use a free address.  Having said that, different OpenVPN instantiations,
3974 including different ends of the same connection, can share the same
3975 virtual DHCP server address.  The
3976 .B lease-time
3977 parameter controls the lease time of the DHCP assignment given to
3978 the TAP-Win32 adapter, and is denoted in seconds.
3979 Normally a very long lease time is preferred
3980 because it prevents routes involving the TAP-Win32 adapter from
3981 being lost when the system goes to sleep.  The default
3982 lease time is one year.
3984 .B netsh --
3985 Automatically set the IP address and netmask using
3986 the Windows command-line "netsh"
3987 command.  This method appears to work correctly on
3988 Windows XP but not Windows 2000.
3990 .B ipapi --
3991 Automatically set the IP address and netmask using the
3992 Windows IP Helper API.  This approach
3993 does not have ideal semantics, though testing has indicated
3994 that it works okay in practice.  If you use this option,
3995 it is best to leave the TCP/IP properties for the TAP-Win32
3996 adapter in their default state, i.e. "Obtain an IP address
3997 automatically."
3998 .\"*********************************************************
4000 .B --route-method m
4001 Which method
4002 .B m
4003 to use for adding routes on Windows?
4005 .B ipapi
4006 (default) -- Use IP helper API.
4008 .B exe
4009 -- Call the route.exe shell command.
4010 .\"*********************************************************
4012 .B --dhcp-option type [parm]
4013 Set extended TAP-Win32 TCP/IP properties, must
4014 be used with
4015 .B --ip-win32 dynamic.
4016 This option can be used to set additional TCP/IP properties
4017 on the TAP-Win32 adapter, and is particularly useful for
4018 configuring an OpenVPN client to access a Samba server
4019 across the VPN.
4021 .B DOMAIN name --
4022 Set Connection-specific DNS Suffix.
4024 .B DNS addr --
4025 Set primary domain name server address.  Repeat
4026 this option to set secondary DNS server addresses.
4028 .B WINS addr --
4029 Set primary WINS server address (NetBIOS over TCP/IP Name Server).
4030 Repeat this option to set secondary WINS server addresses.
4032 .B NBDD addr --
4033 Set primary NBDD server address (NetBIOS over TCP/IP Datagram Distribution Server)
4034 Repeat this option
4035 to set secondary NBDD server addresses.
4037 .B NTP addr --
4038 Set primary NTP server address (Network Time Protocol).
4039 Repeat this option
4040 to set secondary NTP server addresses.
4042 .B NBT type --
4043 Set NetBIOS over TCP/IP Node type.  Possible options:
4044 .B 1
4045 = b-node (broadcasts),
4046 .B 2
4047 = p-node (point-to-point
4048 name queries to a WINS server),
4049 .B 4
4050 = m-node (broadcast
4051 then query name server), and
4052 .B 8
4053 = h-node (query name server, then broadcast).
4055 .B NBS scope-id --
4056 Set NetBIOS over TCP/IP Scope. A NetBIOS Scope ID provides an extended
4057 naming service for the NetBIOS over TCP/IP (Known as NBT) module. The
4058 primary purpose of a NetBIOS scope ID is to isolate NetBIOS traffic on
4059 a single network to only those nodes with the same NetBIOS scope ID.
4060 The NetBIOS scope ID is a character string that is appended to the NetBIOS
4061 name. The NetBIOS scope ID on two hosts must match, or the two hosts
4062 will not be able to communicate. The NetBIOS Scope ID also allows
4063 computers to use the same computer name, as they have different
4064 scope IDs. The Scope ID becomes a part of the NetBIOS name, making the name unique.
4065 (This description of NetBIOS scopes courtesy of NeonSurge@abyss.com)
4067 .B DISABLE-NBT --
4068 Disable Netbios-over-TCP/IP.
4070 Note that if
4071 .B --dhcp-option
4072 is pushed via
4073 .B --push
4074 to a non-windows client, the option will be saved in the client's
4075 environment before the up script is called, under
4076 the name "foreign_option_{n}".
4077 .\"*********************************************************
4079 .B --tap-sleep n
4080 Cause OpenVPN to sleep for
4081 .B n
4082 seconds immediately after the TAP-Win32 adapter state
4083 is set to "connected".
4085 This option is intended to be used to troubleshoot problems
4086 with the
4087 .B --ifconfig
4089 .B --ip-win32
4090 options, and is used to give
4091 the TAP-Win32 adapter time to come up before
4092 Windows IP Helper API operations are applied to it.
4093 .\"*********************************************************
4095 .B --show-net-up
4096 Output OpenVPN's view of the system routing table and network
4097 adapter list to the syslog or log file after the TUN/TAP adapter
4098 has been brought up and any routes have been added.
4099 .\"*********************************************************
4101 .B --dhcp-renew
4102 Ask Windows to renew the TAP adapter lease on startup.
4103 This option is normally unnecessary, as Windows automatically
4104 triggers a DHCP renegotiation on the TAP adapter when it
4105 comes up, however if you set the TAP-Win32 adapter
4106 Media Status property to "Always Connected", you may need this
4107 flag.
4108 .\"*********************************************************
4110 .B --dhcp-release
4111 Ask Windows to release the TAP adapter lease on shutdown.
4112 This option has the same caveats as
4113 .B --dhcp-renew
4114 above.
4115 .\"*********************************************************
4117 .B --pause-exit
4118 Put up a "press any key to continue" message on the console prior
4119 to OpenVPN program exit.  This option is automatically used by the
4120 Windows explorer when OpenVPN is run on a configuration
4121 file using the right-click explorer menu.
4122 .\"*********************************************************
4124 .B --service exit-event [0|1]
4125 Should be used when OpenVPN is being automatically executed by another
4126 program in such
4127 a context that no interaction with the user via display or keyboard
4128 is possible.  In general, end-users should never need to explicitly
4129 use this option, as it is automatically added by the OpenVPN service wrapper
4130 when a given OpenVPN configuration is being run as a service.
4132 .B exit-event
4133 is the name of a Windows global event object, and OpenVPN will continuously
4134 monitor the state of this event object and exit when it becomes signaled.
4136 The second parameter indicates the initial state of
4137 .B exit-event
4138 and normally defaults to 0.
4140 Multiple OpenVPN processes can be simultaneously executed with the same
4141 .B exit-event
4142 parameter.  In any case, the controlling process can signal
4143 .B exit-event,
4144 causing all such OpenVPN processes to exit.
4146 When executing an OpenVPN process using the
4147 .B --service
4148 directive, OpenVPN will probably not have a console
4149 window to output status/error
4150 messages, therefore it is useful to use
4151 .B --log
4153 .B --log-append
4154 to write these messages to a file.
4155 .\"*********************************************************
4157 .B --show-adapters
4158 (Standalone)
4159 Show available TAP-Win32 adapters which can be selected using the
4160 .B --dev-node
4161 option.  On non-Windows systems, the
4162 .BR ifconfig (8)
4163 command provides similar functionality.
4164 .\"*********************************************************
4166 .B --show-valid-subnets
4167 (Standalone)
4168 Show valid subnets for
4169 .B --dev tun
4170 emulation.  Since the TAP-Win32 driver
4171 exports an ethernet interface to Windows, and since TUN devices are
4172 point-to-point in nature, it is necessary for the TAP-Win32 driver
4173 to impose certain constraints on TUN endpoint address selection.
4175 Namely, the point-to-point endpoints used in TUN device emulation
4176 must be the middle two addresses of a /30 subnet (netmask 255.255.255.252).
4177 .\"*********************************************************
4179 .B --show-net
4180 (Standalone)
4181 Show OpenVPN's view of the system routing table and network
4182 adapter list.
4183 .\"*********************************************************
4184 .SH SCRIPTING AND ENVIRONMENTAL VARIABLES
4185 OpenVPN exports a series
4186 of environmental variables for use by user-defined scripts.
4187 .\"*********************************************************
4188 .SS Script Order of Execution
4189 .\"*********************************************************
4191 .B --up
4192 Executed after TCP/UDP socket bind and TUN/TAP open.
4193 .\"*********************************************************
4195 .B --tls-verify
4196 Executed when we have a still untrusted remote peer.
4197 .\"*********************************************************
4199 .B --ipchange
4200 Executed after connection authentication, or remote IP address change.
4201 .\"*********************************************************
4203 .B --client-connect
4204 Executed in
4205 .B --mode server
4206 mode immediately after client authentication.
4207 .\"*********************************************************
4209 .B --route-up
4210 Executed after connection authentication, either
4211 immediately after, or some number of seconds after
4212 as defined by the
4213 .B --route-delay
4214 option.
4215 .\"*********************************************************
4217 .B --client-disconnect
4218 Executed in
4219 .B --mode server
4220 mode on client instance shutdown.
4221 .\"*********************************************************
4223 .B --down
4224 Executed after TCP/UDP and TUN/TAP close.
4225 .\"*********************************************************
4227 .B --learn-address
4228 Executed in
4229 .B --mode server
4230 mode whenever an IPv4 address/route or MAC address is added to OpenVPN's
4231 internal routing table.
4232 .\"*********************************************************
4234 .B --auth-user-pass-verify
4235 Executed in
4236 .B --mode server
4237 mode on new client connections, when the client is
4238 still untrusted.
4239 .\"*********************************************************
4240 .SS String Types and Remapping
4241 In certain cases, OpenVPN will perform remapping of characters
4242 in strings.  Essentially, any characters outside the set of
4243 permitted characters for each string type will be converted
4244 to underbar ('_').
4246 .B Q:
4247 Why is string remapping necessary?
4249 .B A:
4250 It's an important security feature to prevent the malicious coding of
4251 strings from untrusted sources to be passed as parameters to scripts,
4252 saved in the environment, used as a common name, translated to a filename,
4253 etc.
4255 Here is a brief rundown of OpenVPN's current string types and the 
4256 permitted character class for each string:
4258 .B X509 Names:
4259 Alphanumeric, underbar ('_'), dash ('-'), dot ('.'), at 
4260 ('@'), colon (':'), slash ('/'), and equal ('=').  Alphanumeric is defined 
4261 as a character which will cause the C library isalnum() function to return 
4262 true.
4264 .B Common Names:
4265 Alphanumeric, underbar ('_'), dash ('-'), dot ('.'), and at                
4266 ('@').
4268 .B --auth-user-pass username:
4269 Same as Common Name, with one exception: starting with OpenVPN 2.0.1,
4270 the username is passed to the OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY plugin in its raw form,
4271 without string remapping.
4273 .B --auth-user-pass password:
4274 Any "printable" character except CR or LF.  
4275 Printable is defined to be a character which will cause the C library 
4276 isprint() function to return true.
4278 .B --client-config-dir filename as derived from common name or username:
4279 Alphanumeric, underbar ('_'), dash ('-'), and dot ('.') except for "." or 
4280 ".." as standalone strings.  As of 2.0.1-rc6, the at ('@') character has
4281 been added as well for compatibility with the common name character class.
4283 .B Environmental variable names:
4284 Alphanumeric or underbar ('_').
4286 .B Environmental variable values:
4287 Any printable character.
4289 For all cases, characters in a string which are not members of the legal 
4290 character class for that string type will be remapped to underbar ('_').
4291 .\"*********************************************************
4292 .SS Environmental Variables
4293 Once set, a variable is persisted
4294 indefinitely until it is reset by a new value or a restart,
4296 As of OpenVPN 2.0-beta12, in server mode, environmental
4297 variables set by OpenVPN
4298 are scoped according to the client objects
4299 they are
4300 associated with, so there should not be any issues with
4301 scripts having access to stale, previously set variables
4302 which refer to different client instances.
4303 .\"*********************************************************
4305 .B bytes_received
4306 Total number of bytes received from client during VPN session.
4307 Set prior to execution of the
4308 .B --client-disconnect
4309 script.
4310 .\"*********************************************************
4312 .B bytes_sent
4313 Total number of bytes sent to client during VPN session.
4314 Set prior to execution of the
4315 .B --client-disconnect
4316 script.
4317 .\"*********************************************************
4319 .B common_name
4320 The X509 common name of an authenticated client.
4321 Set prior to execution of
4322 .B --client-connect, --client-disconnect,
4324 .B --auth-user-pass-verify
4325 scripts.
4326 .\"*********************************************************
4328 .B config
4329 Name of first
4330 .B --config
4331 file.
4332 Set on program initiation and reset on SIGHUP.
4333 .\"*********************************************************
4335 .B daemon
4336 Set to "1" if the
4337 .B --daemon
4338 directive is specified, or "0" otherwise.
4339 Set on program initiation and reset on SIGHUP.
4340 .\"*********************************************************
4342 .B daemon_log_redirect
4343 Set to "1" if the
4344 .B --log
4346 .B --log-append
4347 directives are specified, or "0" otherwise.
4348 Set on program initiation and reset on SIGHUP.
4349 .\"*********************************************************
4351 .B dev
4352 The actual name of the TUN/TAP device, including
4353 a unit number if it exists.
4354 Set prior to
4355 .B --up
4357 .B --down
4358 script execution.
4359 .\"*********************************************************
4361 .B foreign_option_{n}
4362 An option pushed via
4363 .B --push
4364 to a client which does not natively support it,
4365 such as
4366 .B --dhcp-option
4367 on a non-Windows system, will be recorded to this
4368 environmental variable sequence prior to
4369 .B --up
4370 script execution.
4371 .\"*********************************************************
4373 .B ifconfig_broadcast
4374 The broadcast address for the virtual
4375 ethernet segment which is derived from the
4376 .B --ifconfig
4377 option when
4378 .B --dev tap
4379 is used.
4380 Set prior to OpenVPN calling the
4381 .I ifconfig
4383 .I netsh
4384 (windows version of ifconfig) commands which
4385 normally occurs prior to
4386 .B --up
4387 script execution.
4388 .\"*********************************************************
4390 .B ifconfig_local
4391 The local VPN endpoint IP address specified in the
4392 .B --ifconfig
4393 option (first parameter).
4394 Set prior to OpenVPN calling the
4395 .I ifconfig
4397 .I netsh
4398 (windows version of ifconfig) commands which
4399 normally occurs prior to
4400 .B --up
4401 script execution.
4402 .\"*********************************************************
4404 .B ifconfig_remote
4405 The remote VPN endpoint IP address specified in the
4406 .B --ifconfig
4407 option (second parameter) when
4408 .B --dev tun
4409 is used.
4410 Set prior to OpenVPN calling the
4411 .I ifconfig
4413 .I netsh
4414 (windows version of ifconfig) commands which
4415 normally occurs prior to
4416 .B --up
4417 script execution.
4418 .\"*********************************************************
4420 .B ifconfig_netmask
4421 The subnet mask of the virtual ethernet segment
4422 that is specified as the second parameter to
4423 .B --ifconfig
4424 when
4425 .B --dev tap
4426 is being used.
4427 Set prior to OpenVPN calling the
4428 .I ifconfig
4430 .I netsh
4431 (windows version of ifconfig) commands which
4432 normally occurs prior to
4433 .B --up
4434 script execution.
4435 .\"*********************************************************
4437 .B ifconfig_pool_local_ip
4438 The local
4439 virtual IP address for the TUN/TAP tunnel taken from an
4440 .B --ifconfig-push
4441 directive if specified, or otherwise from
4442 the ifconfig pool (controlled by the
4443 .B --ifconfig-pool
4444 config file directive).
4445 Only set for
4446 .B --dev tun
4447 tunnels.
4448 This option is set on the server prior to execution
4449 of the
4450 .B --client-connect
4452 .B --client-disconnect
4453 scripts.
4454 .\"*********************************************************
4456 .B ifconfig_pool_netmask
4458 virtual IP netmask for the TUN/TAP tunnel taken from an
4459 .B --ifconfig-push
4460 directive if specified, or otherwise from
4461 the ifconfig pool (controlled by the
4462 .B --ifconfig-pool
4463 config file directive).
4464 Only set for
4465 .B --dev tap
4466 tunnels.
4467 This option is set on the server prior to execution
4468 of the
4469 .B --client-connect
4471 .B --client-disconnect
4472 scripts.
4473 .\"*********************************************************
4475 .B ifconfig_pool_remote_ip
4476 The remote
4477 virtual IP address for the TUN/TAP tunnel taken from an
4478 .B --ifconfig-push
4479 directive if specified, or otherwise from
4480 the ifconfig pool (controlled by the
4481 .B --ifconfig-pool
4482 config file directive).
4483 This option is set on the server prior to execution
4484 of the
4485 .B --client-connect
4487 .B --client-disconnect
4488 scripts.
4489 .\"*********************************************************
4491 .B link_mtu
4492 The maximum packet size (not including the IP header)
4493 of tunnel data in UDP tunnel transport mode.
4494 Set prior to
4495 .B --up
4497 .B --down
4498 script execution.
4499 .\"*********************************************************
4501 .B local
4503 .B --local
4504 parameter.
4505 Set on program initiation and reset on SIGHUP.
4506 .\"*********************************************************
4508 .B local_port
4509 The local port number, specified by
4510 .B --port
4512 .B --lport.
4513 Set on program initiation and reset on SIGHUP.
4514 .\"*********************************************************
4516 .B password
4517 The password provided by a connecting client.
4518 Set prior to
4519 .B --auth-user-pass-verify
4520 script execution only when the
4521 .B via-env
4522 modifier is specified, and deleted from the environment
4523 after the script returns.
4524 .\"*********************************************************
4526 .B proto
4528 .B --proto
4529 parameter.
4530 Set on program initiation and reset on SIGHUP.
4531 .\"*********************************************************
4533 .B remote_{n}
4535 .B --remote
4536 parameter.
4537 Set on program initiation and reset on SIGHUP.
4538 .\"*********************************************************
4540 .B remote_port_{n}
4541 The remote port number, specified by
4542 .B --port
4544 .B --rport.
4545 Set on program initiation and reset on SIGHUP.
4546 .\"*********************************************************
4548 .B route_net_gateway
4549 The pre-existing default IP gateway in the system routing
4550 table.
4551 Set prior to
4552 .B --up
4553 script execution.
4554 .\"*********************************************************
4556 .B route_vpn_gateway
4557 The default gateway used by
4558 .B --route
4559 options, as specified in either the
4560 .B --route-gateway
4561 option or the second parameter to
4562 .B --ifconfig
4563 when
4564 .B --dev tun
4565 is specified.
4566 Set prior to
4567 .B --up
4568 script execution.
4569 .\"*********************************************************
4571 .B route_{parm}_{n}
4572 A set of variables which define each route to be added, and
4573 are set prior to
4574 .B --up
4575 script execution.
4577 .B parm
4578 will be one of "network", "netmask", "gateway", or "metric".
4580 .B n
4581 is the OpenVPN route number, starting from 1.
4583 If the network or gateway are resolvable DNS names,
4584 their IP address translations will be recorded rather
4585 than their names as denoted on the command line
4586 or configuration file.
4587 .\"*********************************************************
4589 .B script_context
4590 Set to "init" or "restart" prior to up/down script execution.
4591 For more information, see
4592 documentation for
4593 .B --up.
4594 .\"*********************************************************
4596 .B script_type
4597 One of
4598 .B up, down, ipchange, route-up, tls-verify, auth-user-pass-verify,
4599 .B client-connect, client-disconnect, 
4601 .B learn-address.
4602 Set prior to execution of any script.
4603 .\"*********************************************************
4605 .B signal
4606 The reason for exit or restart.  Can be one of
4607 .B sigusr1, sighup, sigterm, sigint, inactive
4608 (controlled by
4609 .B --inactive
4610 option),
4611 .B ping-exit
4612 (controlled by
4613 .B --ping-exit
4614 option),
4615 .B ping-restart
4616 (controlled by
4617 .B --ping-restart
4618 option),
4619 .B connection-reset
4620 (triggered on TCP connection reset),
4621 .B error,
4623 .B unknown
4624 (unknown signal).  This variable is set just prior to down script execution.
4625 .\"*********************************************************
4627 .B tls_id_{n}
4628 A series of certificate fields from the remote peer,
4629 where
4630 .B n
4631 is the verification level.  Only set for TLS connections.  Set prior
4632 to execution of
4633 .B --tls-verify
4634 script.
4635 .\"*********************************************************
4637 .B tls_serial_{n}
4638 The serial number of the certificate from the remote peer,
4639 where
4640 .B n
4641 is the verification level.  Only set for TLS connections.  Set prior
4642 to execution of
4643 .B --tls-verify
4644 script.
4645 .\"*********************************************************
4647 .B tun_mtu
4648 The MTU of the TUN/TAP device.
4649 Set prior to
4650 .B --up
4652 .B --down
4653 script execution.
4654 .\"*********************************************************
4656 .B trusted_ip
4657 Actual IP address of connecting client or peer which has been authenticated.
4658 Set prior to execution of
4659 .B --ipchange, --client-connect,
4661 .B --client-disconnect
4662 scripts.
4663 .\"*********************************************************
4665 .B trusted_port
4666 Actual port number of connecting client or peer which has been authenticated.
4667 Set prior to execution of
4668 .B --ipchange, --client-connect,
4670 .B --client-disconnect
4671 scripts.
4672 .\"*********************************************************
4674 .B untrusted_ip
4675 Actual IP address of connecting client or peer which has not been authenticated
4676 yet.  Sometimes used to
4677 .B nmap
4678 the connecting host in a
4679 .B --tls-verify
4680 script to ensure it is firewalled properly.
4681 Set prior to execution of
4682 .B --tls-verify
4684 .B --auth-user-pass-verify
4685 scripts.
4686 .\"*********************************************************
4688 .B untrusted_port
4689 Actual port number of connecting client or peer which has not been authenticated
4690 yet.
4691 Set prior to execution of
4692 .B --tls-verify
4694 .B --auth-user-pass-verify
4695 scripts.
4696 .\"*********************************************************
4698 .B username
4699 The username provided by a connecting client.
4700 Set prior to
4701 .B --auth-user-pass-verify
4702 script execution only when the
4703 .B via-env
4704 modifier is specified.
4705 .\"*********************************************************
4706 .SH SIGNALS
4708 .B SIGHUP
4709 Cause OpenVPN to close all TUN/TAP and
4710 network connections,
4711 restart, re-read the configuration file (if any),
4712 and reopen TUN/TAP and network connections.
4713 .\"*********************************************************
4715 .B SIGUSR1
4716 Like 
4717 .B SIGHUP,
4718 except don't re-read configuration file, and possibly don't close and reopen TUN/TAP
4719 device, re-read key files, preserve local IP address/port, or preserve most recently authenticated
4720 remote IP address/port based on
4721 .B --persist-tun, --persist-key, --persist-local-ip,
4723 .B --persist-remote-ip
4724 options respectively (see above).
4726 This signal may also be internally generated by a timeout condition, governed
4727 by the
4728 .B --ping-restart
4729 option.
4731 This signal, when combined with
4732 .B --persist-remote-ip,
4733 may be
4734 sent when the underlying parameters of the host's network interface change
4735 such as when the host is a DHCP client and is assigned a new IP address.
4737 .B --ipchange
4738 above for more information.
4739 .\"*********************************************************
4741 .B SIGUSR2
4742 Causes OpenVPN to display its current statistics (to the syslog
4743 file if
4744 .B --daemon
4745 is used, or stdout otherwise).
4746 .\"*********************************************************
4748 .B SIGINT, SIGTERM
4749 Causes OpenVPN to exit gracefully.
4750 .\"*********************************************************
4751 .SH TUN/TAP DRIVER SETUP
4752 If you are running Linux 2.4.7 or higher, you probably have the TUN/TAP driver
4753 already installed.  If so, there are still a few things you need to do:
4755 Make device:
4756 .B mknod /dev/net/tun c 10 200
4758 Load driver:
4759 .B modprobe tun
4761 If you have Linux 2.2 or earlier, you should obtain version 1.1 of the
4762 TUN/TAP driver from
4763 .I http://vtun.sourceforge.net/tun/
4764 and follow the installation instructions.
4765 .\"*********************************************************
4766 .SH EXAMPLES
4767 Prior to running these examples, you should have OpenVPN installed on two
4768 machines with network connectivity between them.  If you have not
4769 yet installed OpenVPN, consult the INSTALL file included in the OpenVPN
4770 distribution.
4771 .\"*********************************************************
4772 .SS TUN/TAP Setup:
4773 If you are using Linux 2.4 or higher,
4774 make the tun device node and load the tun module:
4776 .B mknod /dev/net/tun c 10 200
4779 .B modprobe tun
4781 If you installed from RPM, the
4782 .B mknod
4783 step may be omitted, because the RPM install does that for you.
4785 If you have Linux 2.2, you should obtain version 1.1 of the
4786 TUN/TAP driver from
4787 .I http://vtun.sourceforge.net/tun/
4788 and follow the installation instructions.
4790 For other platforms, consult the INSTALL file at
4791 .I http://openvpn.net/install.html
4792 for more information.
4793 .\"*********************************************************
4794 .SS Firewall Setup:
4795 If firewalls exist between
4796 the two machines, they should be set to forward UDP port 1194
4797 in both directions.  If you do not have control over the firewalls
4798 between the two machines, you may still be able to use OpenVPN by adding
4799 .B --ping 15
4800 to each of the
4801 .B openvpn
4802 commands used below in the examples (this will cause each peer to send out
4803 a UDP ping to its remote peer once every 15 seconds which will cause many
4804 stateful firewalls to forward packets in both directions
4805 without an explicit firewall rule).
4807 If you are using a Linux iptables-based firewall, you may need to enter
4808 the following command to allow incoming packets on the TUN device:
4810 .B iptables -A INPUT -i tun+ -j ACCEPT
4812 See the firewalls section below for more information on configuring firewalls
4813 for use with OpenVPN.
4814 .\"*********************************************************
4815 .SS VPN Address Setup:
4816 For purposes
4817 of our example, our two machines will be called
4818 .B may.kg
4820 .B june.kg.
4821 If you are constructing a VPN over the internet, then replace
4822 .B may.kg
4824 .B june.kg
4825 with the internet hostname or IP address that each machine will use
4826 to contact the other over the internet.
4828 Now we will choose the tunnel endpoints.  Tunnel endpoints are
4829 private IP addresses that only have meaning in the context of
4830 the VPN.  Each machine will use the tunnel endpoint of the other
4831 machine to access it over the VPN.  In our example,
4832 the tunnel endpoint for may.kg
4833 will be 10.4.0.1 and for june.kg, 10.4.0.2.
4835 Once the VPN is established, you have essentially
4836 created a secure alternate path between the two hosts
4837 which is addressed by using the tunnel endpoints.  You can
4838 control which network
4839 traffic passes between the hosts 
4840 (a) over the VPN or (b) independently of the VPN, by choosing whether to use
4841 (a) the VPN endpoint address or (b) the public internet address,
4842 to access the remote host. For example if you are on may.kg and you wish to connect to june.kg
4844 .B ssh
4845 without using the VPN (since
4846 .B ssh
4847 has its own built-in security) you would use the command
4848 .B ssh june.kg.
4849 However in the same scenario, you could also use the command
4850 .B telnet 10.4.0.2
4851 to create a telnet session with june.kg over the VPN, that would
4852 use the VPN to secure the session rather than
4853 .B ssh.
4855 You can use any address you wish for the
4856 tunnel endpoints
4857 but make sure that they are private addresses
4858 (such as those that begin with 10 or 192.168) and that they are
4859 not part of any existing subnet on the networks of
4860 either peer, unless you are bridging.  If you use an address that is part of
4861 your local subnet for either of the tunnel endpoints,
4862 you will get a weird feedback loop.
4863 .\"*********************************************************
4864 .SS Example 1: A simple tunnel without security
4866 On may:
4868 .B openvpn --remote june.kg --dev tun1 --ifconfig 10.4.0.1 10.4.0.2 --verb 9
4870 On june:
4872 .B openvpn --remote may.kg --dev tun1 --ifconfig 10.4.0.2 10.4.0.1 --verb 9
4874 Now verify the tunnel is working by pinging across the tunnel.
4876 On may:
4878 .B ping 10.4.0.2
4880 On june:
4882 .B ping 10.4.0.1
4885 .B --verb 9
4886 option will produce verbose output, similar to the
4887 .BR tcpdump (8)
4888 program.  Omit the
4889 .B --verb 9
4890 option to have OpenVPN run quietly.
4891 .\"*********************************************************
4892 .SS Example 2: A tunnel with static-key security (i.e. using a pre-shared secret)
4893 First build a static key on may.
4895 .B openvpn --genkey --secret key
4897 This command will build a random key file called
4898 .B key
4899 (in ascii format).
4900 Now copy
4901 .B key
4902 to june over a secure medium such as by
4903 using the
4904 .BR scp (1)
4905 program.
4907 On may:
4909 .B openvpn --remote june.kg --dev tun1 --ifconfig 10.4.0.1 10.4.0.2 --verb 5 --secret key
4911 On june:
4913 .B openvpn --remote may.kg --dev tun1 --ifconfig 10.4.0.2 10.4.0.1 --verb 5 --secret key
4915 Now verify the tunnel is working by pinging across the tunnel.
4917 On may:
4919 .B ping 10.4.0.2
4921 On june:
4923 .B ping 10.4.0.1
4924 .\"*********************************************************
4925 .SS Example 3: A tunnel with full TLS-based security
4926 For this test, we will designate
4927 .B may
4928 as the TLS client and
4929 .B june
4930 as the TLS server.
4931 .I Note that client or server designation only has meaning for the TLS subsystem.  It has no bearing on OpenVPN's peer-to-peer, UDP-based communication model.
4933 First, build a separate certificate/key pair
4934 for both may and june (see above where
4935 .B --cert
4936 is discussed for more info).  Then construct
4937 Diffie Hellman parameters (see above where
4938 .B --dh
4939 is discussed for more info).  You can also use the
4940 included test files client.crt, client.key,
4941 server.crt, server.key and tmp-ca.crt.
4942 The .crt files are certificates/public-keys, the .key
4943 files are private keys, and tmp-ca.crt is a certification
4944 authority who has signed both
4945 client.crt and server.crt.  For Diffie Hellman
4946 parameters you can use the included file dh1024.pem.
4947 .I Note that all client, server, and certificate authority certificates and keys included in the OpenVPN distribution are totally insecure and should be used for testing only.
4949 On may:
4951 .B openvpn --remote june.kg --dev tun1 --ifconfig 10.4.0.1 10.4.0.2 --tls-client --ca tmp-ca.crt --cert client.crt --key client.key --reneg-sec 60 --verb 5
4953 On june:
4955 .B openvpn --remote may.kg --dev tun1 --ifconfig 10.4.0.2 10.4.0.1 --tls-server --dh dh1024.pem --ca tmp-ca.crt --cert server.crt --key server.key --reneg-sec 60 --verb 5
4957 Now verify the tunnel is working by pinging across the tunnel.
4959 On may:
4961 .B ping 10.4.0.2
4963 On june:
4965 .B ping 10.4.0.1
4967 Notice the
4968 .B --reneg-sec 60
4969 option we used above.  That tells OpenVPN to renegotiate
4970 the data channel keys every minute.
4971 Since we used
4972 .B --verb 5
4973 above, you will see status information on each new key negotiation.
4975 For production operations, a key renegotiation interval of 60 seconds
4976 is probably too frequent.  Omit the
4977 .B --reneg-sec 60
4978 option to use OpenVPN's default key renegotiation interval of one hour.
4979 .\"*********************************************************
4980 .SS Routing:
4981 Assuming you can ping across the tunnel,
4982 the next step is to route a real subnet over
4983 the secure tunnel.  Suppose that may and june have two network
4984 interfaces each, one connected
4985 to the internet, and the other to a private
4986 network.  Our goal is to securely connect
4987 both private networks.  We will assume that may's private subnet
4988 is 10.0.0.0/24 and june's is 10.0.1.0/24.
4990 First, ensure that IP forwarding is enabled on both peers.
4991 On Linux, enable routing:
4993 .B echo 1 > /proc/sys/net/ipv4/ip_forward
4995 and enable TUN packet forwarding through the firewall:
4997 .B iptables -A FORWARD -i tun+ -j ACCEPT
4999 On may:
5001 .B route add -net 10.0.1.0 netmask 255.255.255.0 gw 10.4.0.2
5003 On june:
5005 .B route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.4.0.1
5007 Now any machine on the 10.0.0.0/24 subnet can
5008 access any machine on the 10.0.1.0/24 subnet
5009 over the secure tunnel (or vice versa).
5011 In a production environment, you could put the route command(s)
5012 in a shell script and execute with the
5013 .B --up
5014 option.
5015 .\"*********************************************************
5016 .SH FIREWALLS
5017 OpenVPN's usage of a single UDP port makes it fairly firewall-friendly.
5018 You should add an entry to your firewall rules to allow incoming OpenVPN
5019 packets.  On Linux 2.4+:
5021 .B iptables -A INPUT -p udp -s 1.2.3.4 --dport 1194 -j ACCEPT
5023 This will allow incoming packets on UDP port 1194 (OpenVPN's default UDP port)
5024 from an OpenVPN peer at 1.2.3.4.
5026 If you are using HMAC-based packet authentication (the default in any of
5027 OpenVPN's secure modes), having the firewall filter on source
5028 address can be considered optional, since HMAC packet authentication
5029 is a much more secure method of verifying the authenticity of
5030 a packet source.  In that case:
5032 .B iptables -A INPUT -p udp --dport 1194 -j ACCEPT
5034 would be adequate and would not render the host inflexible with
5035 respect to its peer having a dynamic IP address.
5037 OpenVPN also works well on stateful firewalls.  In some cases, you may
5038 not need to add any static rules to the firewall list if you are
5039 using a stateful firewall that knows how to track UDP connections.
5040 If you specify
5041 .B --ping n,
5042 OpenVPN will be guaranteed
5043 to send a packet to its peer at least once every
5044 .B n
5045 seconds.  If
5046 .B n
5047 is less than the stateful firewall connection timeout, you can
5048 maintain an OpenVPN connection indefinitely without explicit
5049 firewall rules.
5051 You should also add firewall rules to allow incoming IP traffic on
5052 TUN or TAP devices such as:
5054 .B iptables -A INPUT -i tun+ -j ACCEPT
5056 to allow input packets from tun devices,
5058 .B iptables -A FORWARD -i tun+ -j ACCEPT
5060 to allow input packets from tun devices to be forwarded to
5061 other hosts on the local network,
5063 .B iptables -A INPUT -i tap+ -j ACCEPT
5065 to allow input packets from tap devices, and
5067 .B iptables -A FORWARD -i tap+ -j ACCEPT
5069 to allow input packets from tap devices to be forwarded to
5070 other hosts on the local network.
5072 These rules are secure if you use packet authentication,
5073 since no incoming packets will arrive on a TUN or TAP
5074 virtual device
5075 unless they first pass an HMAC authentication test.
5076 .\"*********************************************************
5077 .SH FAQ
5078 .I http://openvpn.net/faq.html
5079 .\"*********************************************************
5080 .SH HOWTO
5081 For a more comprehensive guide to setting up OpenVPN
5082 in a production setting, see the OpenVPN HOWTO at
5083 .I http://openvpn.net/howto.html
5084 .\"*********************************************************
5085 .SH PROTOCOL
5086 For a description of OpenVPN's underlying protocol,
5087 see 
5088 .I http://openvpn.net/security.html
5089 .\"*********************************************************
5090 .SH WEB
5091 OpenVPN's web site is at
5092 .I http://openvpn.net/
5094 Go here to download the latest version of OpenVPN, subscribe
5095 to the mailing lists, read the mailing list
5096 archives, or browse the CVS repository.
5097 .\"*********************************************************
5098 .SH BUGS
5099 Report all bugs to the OpenVPN users list <openvpn-users@lists.sourceforge.net>.
5100 To subscribe to the list or see the archives, go to
5101 .I http://openvpn.net/mail.html
5102 .\"*********************************************************
5103 .SH "SEE ALSO"
5104 .BR dhcpcd (8),
5105 .BR ifconfig (8),
5106 .BR openssl (1),
5107 .BR route (8),
5108 .BR scp (1)
5109 .BR ssh (1)
5110 .\"*********************************************************
5111 .SH NOTES 
5113 This product includes software developed by the
5114 OpenSSL Project (
5115 .I http://www.openssl.org/
5118 For more information on the TLS protocol, see
5119 .I http://www.ietf.org/rfc/rfc2246.txt
5121 For more information on the LZO real-time compression library see
5122 .I http://www.oberhumer.com/opensource/lzo/
5123 .\"*********************************************************
5124 .SH COPYRIGHT
5125 Copyright (C) 2002-2005 OpenVPN Solutions LLC. This program is free software;
5126 you can redistribute it and/or modify
5127 it under the terms of the GNU General Public License version 2
5128 as published by the Free Software Foundation.
5129 .\"*********************************************************
5130 .SH AUTHORS
5131 James Yonan <jim@yonan.net>