~ubuntu-branches/ubuntu/trusty/openvpn/trusty-security

« back to all changes in this revision

Viewing changes to .pc/route_default_nil.patch/openvpn.8

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-05-05 03:06:19 UTC
  • mfrom: (10.2.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100505030619-cwre0snhgx1mql53
Tags: 2.1.0-2ubuntu1
* Merge from debian unstable.  Remaining changes:
  + debian/openvpn.init.d:
    - Do not use start-stop-daemon and use </dev/null to avoid blocking boot
    - Show per-VPN result messages
    - Add "--script-security 2" by default for backwards compatablitiy
   + debian/control: Add lsb-base >= 3.2-14 to allow status_of_proc() 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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-2009 OpenVPN Technologies, Inc. <sales@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
.\"
 
25
.\" SH section heading
 
26
.\" SS subsection heading
 
27
.\" LP paragraph
 
28
.\" IP indented paragraph
 
29
.\" TP hanging label
 
30
.\"
 
31
.\" .nf -- no formatting
 
32
.\" .fi -- resume formatting
 
33
.\" .ft 3 -- boldface
 
34
.\" .ft -- normal face
 
35
.\" .in +|-{n} -- indent
 
36
.\"
 
37
.TH openvpn 8 "17 November 2008"
 
38
.\"*********************************************************
 
39
.SH NAME
 
40
openvpn \- secure IP tunnel daemon.
 
41
.\"*********************************************************
 
42
.SH SYNOPSIS
 
43
.ft 3
 
44
openvpn [ options ... ]
 
45
.ft
 
46
.\"*********************************************************
 
47
.SH INTRODUCTION
 
48
.LP
 
49
OpenVPN is an open source VPN daemon by James Yonan.
 
50
Because OpenVPN tries to
 
51
be a universal VPN tool offering a great deal of flexibility,
 
52
there are a lot of options on this manual page.
 
53
If you're new to OpenVPN, you might want to skip ahead to the
 
54
examples section where you will see how to construct simple
 
55
VPNs on the command line without even needing a configuration file.
 
56
 
 
57
Also note that there's more documentation and examples on
 
58
the OpenVPN web site:
 
59
.I http://openvpn.net/
 
60
 
 
61
And if you would like to see a shorter version of this manual,
 
62
see the openvpn usage message which can be obtained by
 
63
running
 
64
.B openvpn
 
65
without any parameters.
 
66
.\"*********************************************************
 
67
.SH DESCRIPTION
 
68
.LP
 
69
OpenVPN is a robust and highly flexible VPN daemon.
 
70
OpenVPN supports SSL/TLS security, ethernet bridging,
 
71
TCP or UDP tunnel transport through proxies or NAT,
 
72
support for dynamic IP addresses and DHCP,
 
73
scalability to hundreds or thousands of users,
 
74
and portability to most major OS platforms.
 
75
 
 
76
OpenVPN is tightly bound to the OpenSSL library, and derives much
 
77
of its crypto capabilities from it.
 
78
 
 
79
OpenVPN supports
 
80
conventional encryption
 
81
using a pre-shared secret key
 
82
.B (Static Key mode)
 
83
or
 
84
public key security
 
85
.B (SSL/TLS mode)
 
86
using client & server certificates.
 
87
OpenVPN also
 
88
supports non-encrypted TCP/UDP tunnels.  
 
89
 
 
90
OpenVPN is designed to work with the
 
91
.B TUN/TAP
 
92
virtual networking interface that exists on most platforms.
 
93
 
 
94
Overall, OpenVPN aims to offer many of the key features of IPSec but
 
95
with a relatively lightweight footprint.
 
96
.\"*********************************************************
 
97
.SH OPTIONS
 
98
OpenVPN allows any option to be placed either on the command line
 
99
or in a configuration file.  Though all command line options are preceded
 
100
by a double-leading-dash ("\-\-"), this prefix can be removed when
 
101
an option is placed in a configuration file.
 
102
.\"*********************************************************
 
103
.TP
 
104
.B \-\-help
 
105
Show options.
 
106
.\"*********************************************************
 
107
.TP
 
108
.B \-\-config file
 
109
Load additional config options from
 
110
.B file
 
111
where each line corresponds to one command line option,
 
112
but with the leading '\-\-' removed.
 
113
 
 
114
If
 
115
.B \-\-config file
 
116
is the only option to the openvpn command,
 
117
the
 
118
.B \-\-config
 
119
can be removed, and the command can be given as
 
120
.B openvpn file
 
121
 
 
122
Note that
 
123
configuration files can be nested to a reasonable depth.
 
124
 
 
125
Double quotation or single quotation characters ("", '')
 
126
can be used to enclose single parameters containing whitespace,
 
127
and "#" or ";" characters in the first column
 
128
can be used to denote comments.
 
129
 
 
130
Note that OpenVPN 2.0 and higher performs backslash-based shell
 
131
escaping for characters not in single quotations,
 
132
so the following mappings should be observed:
 
133
 
 
134
.nf
 
135
.ft 3
 
136
.in +4
 
137
\\\\       Maps to a single backslash character (\\).
 
138
\\"       Pass a literal doublequote character ("), don't
 
139
         interpret it as enclosing a parameter.
 
140
\\[SPACE] Pass a literal space or tab character, don't
 
141
         interpret it as a parameter delimiter.
 
142
.in -4
 
143
.ft
 
144
.fi
 
145
 
 
146
For example on Windows, use double backslashes to
 
147
represent pathnames:
 
148
 
 
149
.nf
 
150
.ft 3
 
151
.in +4
 
152
secret "c:\\\\OpenVPN\\\\secret.key"
 
153
.in -4
 
154
.ft
 
155
.fi
 
156
 
 
157
For examples of configuration files,
 
158
see
 
159
.I http://openvpn.net/examples.html
 
160
 
 
161
Here is an example configuration file:
 
162
 
 
163
.nf
 
164
.ft 3
 
165
.in +4
 
166
#
 
167
# Sample OpenVPN configuration file for
 
168
# using a pre-shared static key.
 
169
#
 
170
# '#' or ';' may be used to delimit comments.
 
171
 
 
172
# Use a dynamic tun device.
 
173
dev tun
 
174
 
 
175
# Our remote peer
 
176
remote mypeer.mydomain
 
177
 
 
178
# 10.1.0.1 is our local VPN endpoint
 
179
# 10.1.0.2 is our remote VPN endpoint
 
180
ifconfig 10.1.0.1 10.1.0.2
 
181
 
 
182
# Our pre-shared static key
 
183
secret static.key
 
184
.in -4
 
185
.ft
 
186
.fi
 
187
.\"*********************************************************
 
188
.SS Tunnel Options:
 
189
.TP
 
190
.B \-\-mode m
 
191
Set OpenVPN major mode.  By default, OpenVPN runs in
 
192
point-to-point mode ("p2p").  OpenVPN 2.0 introduces
 
193
a new mode ("server") which implements a multi-client
 
194
server capability.
 
195
.\"*********************************************************
 
196
.TP
 
197
.B \-\-local host
 
198
Local host name or IP address for bind.
 
199
If specified, OpenVPN will bind to this address only.
 
200
If unspecified, OpenVPN will bind to all interfaces.
 
201
.\"*********************************************************
 
202
.TP
 
203
.B \-\-remote host [port] [proto]
 
204
Remote host name or IP address.  On the client, multiple
 
205
.B \-\-remote
 
206
options may be specified for redundancy, each referring
 
207
to a different OpenVPN server.  Specifying multiple
 
208
.B \-\-remote
 
209
options for this purpose is a special case of the more
 
210
general connection-profile feature.  See the
 
211
.B <connection>
 
212
documentation below.
 
213
 
 
214
The OpenVPN client will try to connect to a server at
 
215
.B host:port
 
216
in the order specified by the list of
 
217
.B \-\-remote
 
218
options.
 
219
 
 
220
.B proto
 
221
indicates the protocol to use when connecting with the
 
222
remote, and may be "tcp" or "udp".
 
223
 
 
224
The client will move on to the next host in the list,
 
225
in the event of connection failure.
 
226
Note that at any given time, the OpenVPN client
 
227
will at most be connected to
 
228
one server.
 
229
 
 
230
Note that since UDP is connectionless, connection failure
 
231
is defined by the
 
232
.B \-\-ping
 
233
and
 
234
.B \-\-ping-restart
 
235
options.
 
236
 
 
237
Note the following corner case:  If you use multiple
 
238
.B \-\-remote
 
239
options, AND you are dropping root privileges on
 
240
the client with
 
241
.B \-\-user
 
242
and/or
 
243
.B \-\-group,
 
244
AND the client is running a non-Windows OS, if the client needs
 
245
to switch to a different server, and that server pushes
 
246
back different TUN/TAP or route settings, the client may lack
 
247
the necessary privileges to close and reopen the TUN/TAP interface.
 
248
This could cause the client to exit with a fatal error.
 
249
 
 
250
If
 
251
.B \-\-remote
 
252
is unspecified, OpenVPN will listen
 
253
for packets from any IP address, but will not act on those packets unless
 
254
they pass all authentication tests.  This requirement for authentication
 
255
is binding on all potential peers, even those from known and supposedly
 
256
trusted IP addresses (it is very easy to forge a source IP address on
 
257
a UDP packet).
 
258
 
 
259
When used in TCP mode, 
 
260
.B \-\-remote
 
261
will act as a filter, rejecting connections from any host which does
 
262
not match
 
263
.B host.
 
264
 
 
265
If
 
266
.B host
 
267
is a DNS name which resolves to multiple IP addresses,
 
268
one will be randomly
 
269
chosen, providing a sort of basic load-balancing and
 
270
failover capability.
 
271
.\"*********************************************************
 
272
.TP
 
273
.B <connection>
 
274
Define a client connection
 
275
profile.  Client connection profiles are groups of OpenVPN options that
 
276
describe how to connect to a given OpenVPN server.  Client connection
 
277
profiles are specified within an OpenVPN configuration file, and
 
278
each profile is bracketed by
 
279
.B <connection>
 
280
and
 
281
.B </connection>.
 
282
 
 
283
An OpenVPN client will try each connection profile sequentially
 
284
until it achieves a successful connection.  
 
285
 
 
286
.B \-\-remote-random
 
287
can be used to initially "scramble" the connection
 
288
list.
 
289
 
 
290
Here is an example of connection profile usage:
 
291
 
 
292
.nf
 
293
.ft 3
 
294
.in +4
 
295
client
 
296
dev tun
 
297
 
 
298
<connection>
 
299
remote 198.19.34.56 1194 udp
 
300
</connection>
 
301
 
 
302
<connection>
 
303
remote 198.19.34.56 443 tcp
 
304
</connection>
 
305
 
 
306
<connection>
 
307
remote 198.19.34.56 443 tcp
 
308
http-proxy 192.168.0.8 8080
 
309
http-proxy-retry
 
310
</connection>
 
311
 
 
312
<connection>
 
313
remote 198.19.36.99 443 tcp
 
314
http-proxy 192.168.0.8 8080
 
315
http-proxy-retry
 
316
</connection>
 
317
 
 
318
persist-key
 
319
persist-tun
 
320
pkcs12 client.p12
 
321
ns-cert-type server
 
322
verb 3
 
323
.in -4
 
324
.ft
 
325
.fi
 
326
 
 
327
First we try to connect to a server at 198.19.34.56:1194 using UDP.
 
328
If that fails, we then try to connect to 198.19.34.56:443 using TCP.
 
329
If that also fails, then try connecting through an HTTP proxy at 
 
330
192.168.0.8:8080 to 198.19.34.56:443 using TCP.  Finally, try to
 
331
connect through the same proxy to a server at 198.19.36.99:443
 
332
using TCP.
 
333
 
 
334
The following OpenVPN options may be used inside of
 
335
a
 
336
.B <connection>
 
337
block:
 
338
 
 
339
.B bind,
 
340
.B connect-retry,
 
341
.B connect-retry-max,
 
342
.B connect-timeout,
 
343
.B float,
 
344
.B http-proxy,
 
345
.B http-proxy-option,
 
346
.B http-proxy-retry,
 
347
.B http-proxy-timeout,
 
348
.B local,
 
349
.B lport,
 
350
.B nobind,
 
351
.B port,
 
352
.B proto,
 
353
.B remote,
 
354
.B rport,
 
355
.B socks-proxy, and
 
356
.B socks-proxy-retry.
 
357
 
 
358
A defaulting mechanism exists for specifying options to apply to
 
359
all
 
360
.B <connection>
 
361
profiles.  If any of the above options (with the exception of
 
362
.B remote
 
363
) appear outside of a
 
364
.B <connection>
 
365
block, but in a configuration file which has one or more
 
366
.B <connection>
 
367
blocks, the option setting will be used as a default for
 
368
.B <connection>
 
369
blocks which follow it in the configuration file.
 
370
 
 
371
For example, suppose the
 
372
.B nobind
 
373
option were placed in the sample configuration file above, near
 
374
the top of the file, before the first
 
375
.B <connection>
 
376
block.  The effect would be as if
 
377
.B nobind
 
378
were declared in all
 
379
.B <connection>
 
380
blocks below it.
 
381
 
 
382
.\"*********************************************************
 
383
.TP
 
384
.B \-\-remote-random
 
385
When multiple
 
386
.B \-\-remote
 
387
address/ports are specified, or if connection profiles are being
 
388
used, initially randomize the order of the list
 
389
as a kind of basic load-balancing measure.
 
390
.\"*********************************************************
 
391
.TP
 
392
.B \-\-proto p
 
393
Use protocol
 
394
.B p
 
395
for communicating with remote host.
 
396
.B p
 
397
can be
 
398
.B udp,
 
399
.B tcp-client,
 
400
or
 
401
.B tcp-server.
 
402
 
 
403
The default protocol is
 
404
.B udp
 
405
when
 
406
.B \-\-proto
 
407
is not specified.
 
408
 
 
409
For UDP operation,
 
410
.B \-\-proto udp
 
411
should be specified on both peers.
 
412
 
 
413
For TCP operation, one peer must use
 
414
.B \-\-proto tcp-server
 
415
and the other must use
 
416
.B \-\-proto tcp-client.
 
417
A peer started with
 
418
.B tcp-server
 
419
will wait indefinitely for an incoming connection.  A peer
 
420
started with
 
421
.B tcp-client
 
422
will attempt to connect, and if that fails, will sleep for 5
 
423
seconds (adjustable via the
 
424
.B \-\-connect-retry
 
425
option) and try again infinite or up to N retries (adjustable via the
 
426
.B \-\-connect-retry-max
 
427
option).  Both TCP client and server will simulate
 
428
a SIGUSR1 restart signal if either side resets the connection.
 
429
 
 
430
OpenVPN is designed to operate optimally over UDP, but TCP capability is provided
 
431
for situations where UDP cannot be used.
 
432
In comparison with UDP, TCP will usually be
 
433
somewhat less efficient and less robust when used over unreliable or congested
 
434
networks.
 
435
 
 
436
This article outlines some of problems with tunneling IP over TCP:
 
437
 
 
438
.I http://sites.inka.de/sites/bigred/devel/tcp-tcp.html
 
439
 
 
440
There are certain cases, however, where using TCP may be advantageous from
 
441
a security and robustness perspective, such as tunneling non-IP or
 
442
application-level UDP protocols, or tunneling protocols which don't
 
443
possess a built-in reliability layer.
 
444
.\"*********************************************************
 
445
.TP
 
446
.B \-\-connect-retry n
 
447
For
 
448
.B \-\-proto tcp-client,
 
449
take
 
450
.B n
 
451
as the
 
452
number of seconds to wait
 
453
between connection retries (default=5).
 
454
.\"*********************************************************
 
455
.TP
 
456
.B \-\-connect-retry-max n
 
457
For
 
458
.B \-\-proto tcp-client,
 
459
take
 
460
.B n
 
461
as the
 
462
number of retries of connection attempt (default=infinite).
 
463
.\"*********************************************************
 
464
.TP
 
465
.B \-\-auto-proxy
 
466
Try to sense HTTP or SOCKS proxy settings automatically.
 
467
If no settings are present, a direct connection will be attempted.
 
468
If both HTTP and SOCKS settings are present, HTTP will be preferred.
 
469
If the HTTP proxy server requires a password, it will be queried from
 
470
stdin or the management interface.  If the underlying OS doesn't support an API for
 
471
returning proxy settings, a direct connection will be attempted.
 
472
Currently, only Windows clients support this option via the
 
473
InternetQueryOption API.
 
474
This option exists in OpenVPN 2.1 or higher.
 
475
.\"*********************************************************
 
476
.TP
 
477
.B \-\-http-proxy server port [authfile|'auto'] [auth-method]
 
478
Connect to remote host through an HTTP proxy at address
 
479
.B server
 
480
and port
 
481
.B port.
 
482
If HTTP Proxy-Authenticate is required,
 
483
.B authfile
 
484
is a file containing a username and password on 2 lines, or
 
485
"stdin" to prompt from console.
 
486
 
 
487
.B auth-method
 
488
should be one of "none", "basic", or "ntlm".
 
489
 
 
490
The
 
491
.B auto
 
492
flag causes OpenVPN to automatically determine the
 
493
.B auth-method
 
494
and query stdin or the management interface for
 
495
username/password credentials, if required.  This flag
 
496
exists on OpenVPN 2.1 or higher.
 
497
.\"*********************************************************
 
498
.TP
 
499
.B \-\-http-proxy-retry
 
500
Retry indefinitely on HTTP proxy errors.  If an HTTP proxy error
 
501
occurs, simulate a SIGUSR1 reset.
 
502
.\"*********************************************************
 
503
.TP
 
504
.B \-\-http-proxy-timeout n
 
505
Set proxy timeout to
 
506
.B n
 
507
seconds, default=5.
 
508
.\"*********************************************************
 
509
.TP
 
510
.B \-\-http-proxy-option type [parm]
 
511
Set extended HTTP proxy options.
 
512
Repeat to set multiple options.
 
513
 
 
514
.B VERSION version \-\-
 
515
Set HTTP version number to
 
516
.B version
 
517
(default=1.0).
 
518
 
 
519
.B AGENT user-agent \-\-
 
520
Set HTTP "User-Agent" string to
 
521
.B user-agent.
 
522
.\"*********************************************************
 
523
.TP
 
524
.B \-\-socks-proxy server [port]
 
525
Connect to remote host through a Socks5 proxy at address
 
526
.B server
 
527
and port
 
528
.B port
 
529
(default=1080).
 
530
.\"*********************************************************
 
531
.TP
 
532
.B \-\-socks-proxy-retry
 
533
Retry indefinitely on Socks proxy errors.  If a Socks proxy error
 
534
occurs, simulate a SIGUSR1 reset.
 
535
.\"*********************************************************
 
536
.TP
 
537
.B \-\-resolv-retry n
 
538
If hostname resolve fails for
 
539
.B \-\-remote,
 
540
retry resolve for
 
541
.B n
 
542
seconds before failing.
 
543
 
 
544
Set
 
545
.B n
 
546
to "infinite" to retry indefinitely.
 
547
 
 
548
By default,
 
549
.B \-\-resolv-retry infinite
 
550
is enabled.  You can disable by setting n=0.
 
551
.\"*********************************************************
 
552
.TP
 
553
.B \-\-float
 
554
Allow remote peer to change its IP address and/or port number, such as due to
 
555
DHCP (this is the default if
 
556
.B \-\-remote
 
557
is not used).
 
558
.B \-\-float
 
559
when specified with
 
560
.B \-\-remote
 
561
allows an OpenVPN session to initially connect to a peer
 
562
at a known address, however if packets arrive from a new
 
563
address and pass all authentication tests, the new address
 
564
will take control of the session.  This is useful when
 
565
you are connecting to a peer which holds a dynamic address
 
566
such as a dial-in user or DHCP client.
 
567
 
 
568
Essentially,
 
569
.B \-\-float
 
570
tells OpenVPN to accept authenticated packets
 
571
from any address, not only the address which was specified in the
 
572
.B \-\-remote
 
573
option.
 
574
.\"*********************************************************
 
575
.TP
 
576
.B \-\-ipchange cmd
 
577
Execute shell command
 
578
.B cmd
 
579
when our remote ip-address is initially authenticated or
 
580
changes.
 
581
 
 
582
Execute as:
 
583
 
 
584
.B cmd ip_address port_number
 
585
 
 
586
Don't use
 
587
.B \-\-ipchange
 
588
in
 
589
.B \-\-mode server
 
590
mode.  Use a
 
591
.B \-\-client-connect
 
592
script instead.
 
593
 
 
594
See the "Environmental Variables" section below for
 
595
additional parameters passed as environmental variables.
 
596
 
 
597
Note that
 
598
.B cmd
 
599
can be a shell command with multiple arguments, in which
 
600
case all OpenVPN-generated arguments will be appended
 
601
to
 
602
.B cmd
 
603
to build a command line which will be passed to the script.
 
604
 
 
605
If you are running in a dynamic IP address environment where
 
606
the IP addresses of either peer could change without notice,
 
607
you can use this script, for example, to edit the
 
608
.I /etc/hosts
 
609
file with the current address of the peer.  The script will
 
610
be run every time the remote peer changes its IP address.
 
611
 
 
612
Similarly if
 
613
.I our
 
614
IP address changes due to DHCP, we should configure
 
615
our IP address change script (see man page for
 
616
.BR dhcpcd (8)
 
617
) to deliver a
 
618
.B SIGHUP
 
619
or
 
620
.B SIGUSR1
 
621
signal to OpenVPN.  OpenVPN will then
 
622
reestablish a connection with its most recently authenticated
 
623
peer on its new IP address.
 
624
.\"*********************************************************
 
625
.TP
 
626
.B \-\-port port
 
627
TCP/UDP port number for both local and remote.  The current
 
628
default of 1194 represents the official IANA port number
 
629
assignment for OpenVPN and has been used since version 2.0-beta17.
 
630
Previous versions used port 5000 as the default.
 
631
.\"*********************************************************
 
632
.TP
 
633
.B \-\-lport port
 
634
TCP/UDP port number for bind.
 
635
.\"*********************************************************
 
636
.TP
 
637
.B \-\-rport port
 
638
TCP/UDP port number for remote.
 
639
.\"*********************************************************
 
640
.TP
 
641
.B \-\-bind
 
642
Bind to local address and port. This is the default unless any of 
 
643
.B \-\-proto tcp-client
 
644
,
 
645
.B \-\-http-proxy
 
646
or
 
647
.B \-\-socks-proxy
 
648
are used.
 
649
.\"*********************************************************
 
650
.TP
 
651
.B \-\-nobind
 
652
Do not bind to local address and port.  The IP stack will allocate
 
653
a dynamic port for returning packets.  Since the value of the dynamic port
 
654
could not be known in advance by a peer, this option is only suitable for
 
655
peers which will be initiating connections by using the
 
656
.B \-\-remote
 
657
option.
 
658
.\"*********************************************************
 
659
.TP
 
660
.B \-\-dev tunX | tapX | null
 
661
TUN/TAP virtual network device (
 
662
.B X
 
663
can be omitted for a dynamic device.)
 
664
 
 
665
See examples section below
 
666
for an example on setting up a TUN device.
 
667
 
 
668
You must use either tun devices on both ends of the connection
 
669
or tap devices on both ends.  You cannot mix them, as they
 
670
represent different underlying network layers.
 
671
 
 
672
.B tun
 
673
devices encapsulate IPv4 or IPv6 (OSI Layer 3) while
 
674
.B tap
 
675
devices encapsulate Ethernet 802.3 (OSI Layer 2).
 
676
.\"*********************************************************
 
677
.TP
 
678
.B \-\-dev-type device-type
 
679
Which device type are we using?
 
680
.B device-type
 
681
should be
 
682
.B tun
 
683
(OSI Layer 3)
 
684
or
 
685
.B tap
 
686
(OSI Layer 2).
 
687
Use this option only if the TUN/TAP device used with
 
688
.B \-\-dev
 
689
does not begin with
 
690
.B tun
 
691
or
 
692
.B tap.
 
693
.\"*********************************************************
 
694
.TP
 
695
.B \-\-topology mode
 
696
Configure virtual addressing topology when running in
 
697
.B \-\-dev tun
 
698
mode.  This directive has no meaning in
 
699
.B \-\-dev tap
 
700
mode, which always uses a
 
701
.B subnet
 
702
topology.
 
703
 
 
704
If you set this directive on the server, the
 
705
.B \-\-server
 
706
and
 
707
.B \-\-server-bridge
 
708
directives will automatically push your chosen topology setting to clients
 
709
as well.  This directive can also be manually pushed to clients.  Like the
 
710
.B \-\-dev
 
711
directive, this directive must always be compatible between client and server.
 
712
 
 
713
.B mode
 
714
can be one of:
 
715
 
 
716
.B net30 \-\-
 
717
Use a point-to-point topology, by allocating one /30 subnet per client.
 
718
This is designed to allow point-to-point semantics when some
 
719
or all of the connecting clients might be Windows systems.  This is the
 
720
default on OpenVPN 2.0.
 
721
 
 
722
.B p2p \-\-
 
723
Use a point-to-point topology where the remote endpoint of the client's
 
724
tun interface always points to the local endpoint of the server's tun interface.
 
725
This mode allocates a single IP address per connecting client.
 
726
Only use
 
727
when none of the connecting clients are Windows systems.  This mode
 
728
is functionally equivalent to the
 
729
.B \-\-ifconfig-pool-linear
 
730
directive which is available in OpenVPN 2.0 and is now deprecated.
 
731
 
 
732
.B subnet \-\-
 
733
Use a subnet rather than a point-to-point topology by
 
734
configuring the tun interface with a local IP address and subnet mask,
 
735
similar to the topology used in
 
736
.B \-\-dev tap
 
737
and ethernet bridging mode.
 
738
This mode allocates a single IP address per connecting client and works on
 
739
Windows as well.  Only available when server and clients are OpenVPN 2.1 or
 
740
higher, or OpenVPN 2.0.x which has been manually patched with the
 
741
.B \-\-topology
 
742
directive code.  When used on Windows, requires version 8.2 or higher
 
743
of the TAP-Win32 driver.  When used on *nix, requires that the tun
 
744
driver supports an
 
745
.BR ifconfig (8)
 
746
command which sets a subnet instead of a remote endpoint IP address.
 
747
 
 
748
This option exists in OpenVPN 2.1 or higher.
 
749
.\"*********************************************************
 
750
.TP
 
751
.B \-\-tun-ipv6
 
752
Build a tun link capable of forwarding IPv6 traffic.
 
753
Should be used in conjunction with
 
754
.B \-\-dev tun
 
755
or
 
756
.B \-\-dev tunX.
 
757
A warning will be displayed
 
758
if no specific IPv6 TUN support for your OS has been compiled into OpenVPN.
 
759
.\"*********************************************************
 
760
.TP
 
761
.B \-\-dev-node node
 
762
Explicitly set the device node rather than using
 
763
/dev/net/tun, /dev/tun, /dev/tap, etc.  If OpenVPN
 
764
cannot figure out whether
 
765
.B node
 
766
is a TUN or TAP device based on the name, you should
 
767
also specify
 
768
.B \-\-dev-type tun
 
769
or
 
770
.B \-\-dev-type tap.
 
771
 
 
772
On Windows systems, select the TAP-Win32 adapter which
 
773
is named
 
774
.B node
 
775
in the Network Connections Control Panel or the
 
776
raw GUID of the adapter enclosed by braces.
 
777
The
 
778
.B \-\-show-adapters
 
779
option under Windows can also be used
 
780
to enumerate all available TAP-Win32
 
781
adapters and will show both the network
 
782
connections control panel name and the GUID for
 
783
each TAP-Win32 adapter.
 
784
.TP
 
785
.B \-\-lladdr address
 
786
Specify the link layer address, more commonly known as the MAC address.
 
787
Only applied to TAP devices.
 
788
.\"*********************************************************
 
789
.TP
 
790
.B \-\-iproute cmd
 
791
Set alternate command to execute instead of default iproute2 command.
 
792
May be used in order to execute OpenVPN in unprivileged environment.
 
793
.\"*********************************************************
 
794
.TP
 
795
.B \-\-ifconfig l rn
 
796
Set TUN/TAP adapter parameters. 
 
797
.B l
 
798
is the IP address of the local VPN endpoint.
 
799
For TUN devices,
 
800
.B rn
 
801
is the IP address of the remote VPN endpoint.
 
802
For TAP devices,
 
803
.B rn
 
804
is the subnet mask of the virtual ethernet segment
 
805
which is being created or connected to.
 
806
 
 
807
For TUN devices, which facilitate virtual
 
808
point-to-point IP connections,
 
809
the proper usage of
 
810
.B \-\-ifconfig
 
811
is to use two private IP addresses
 
812
which are not a member of any
 
813
existing subnet which is in use.
 
814
The IP addresses may be consecutive
 
815
and should have their order reversed
 
816
on the remote peer.  After the VPN
 
817
is established, by pinging
 
818
.B rn,
 
819
you will be pinging across the VPN.
 
820
 
 
821
For TAP devices, which provide
 
822
the ability to create virtual
 
823
ethernet segments,
 
824
.B \-\-ifconfig
 
825
is used to set an IP address and
 
826
subnet mask just as a physical
 
827
ethernet adapter would be
 
828
similarly configured.  If you are
 
829
attempting to connect to a remote
 
830
ethernet bridge, the IP address
 
831
and subnet should be set to values
 
832
which would be valid on the
 
833
the bridged ethernet segment (note
 
834
also that DHCP can be used for the
 
835
same purpose).
 
836
 
 
837
This option, while primarily a proxy for the
 
838
.BR ifconfig (8)
 
839
command, is designed to simplify TUN/TAP
 
840
tunnel configuration by providing a
 
841
standard interface to the different
 
842
ifconfig implementations on different
 
843
platforms.
 
844
 
 
845
.B \-\-ifconfig
 
846
parameters which are IP addresses can
 
847
also be specified as a DNS or /etc/hosts
 
848
file resolvable name.
 
849
 
 
850
For TAP devices,
 
851
.B \-\-ifconfig
 
852
should not be used if the TAP interface will be
 
853
getting an IP address lease from a DHCP
 
854
server.
 
855
.\"*********************************************************
 
856
.TP
 
857
.B \-\-ifconfig-noexec
 
858
Don't actually execute ifconfig/netsh commands, instead
 
859
pass
 
860
.B \-\-ifconfig
 
861
parameters to scripts using environmental variables.
 
862
.\"*********************************************************
 
863
.TP
 
864
.B \-\-ifconfig-nowarn
 
865
Don't output an options consistency check warning
 
866
if the
 
867
.B \-\-ifconfig
 
868
option on this side of the
 
869
connection doesn't match the remote side.  This is useful
 
870
when you want to retain the overall benefits of the
 
871
options consistency check (also see
 
872
.B \-\-disable-occ
 
873
option) while only disabling the ifconfig component of
 
874
the check.
 
875
 
 
876
For example,
 
877
if you have a configuration where the local host uses
 
878
.B \-\-ifconfig
 
879
but the remote host does not, use
 
880
.B \-\-ifconfig-nowarn
 
881
on the local host.
 
882
 
 
883
This option will also silence warnings about potential
 
884
address conflicts which occasionally annoy more experienced
 
885
users by triggering "false positive" warnings.
 
886
.\"*********************************************************
 
887
.TP
 
888
.B \-\-route network/IP [netmask] [gateway] [metric]
 
889
Add route to routing table after connection is established.
 
890
Multiple routes can be specified.  Routes will be
 
891
automatically torn down in reverse order prior to
 
892
TUN/TAP device close.
 
893
 
 
894
This option is intended as
 
895
a convenience proxy for the
 
896
.BR route (8)
 
897
shell command,
 
898
while at the same time providing portable semantics
 
899
across OpenVPN's platform space.
 
900
 
 
901
.B netmask
 
902
default \-\- 255.255.255.255
 
903
 
 
904
.B gateway
 
905
default \-\- taken from
 
906
.B \-\-route-gateway
 
907
or the second parameter to
 
908
.B \-\-ifconfig
 
909
when
 
910
.B \-\-dev tun
 
911
is specified.
 
912
 
 
913
.B metric
 
914
default \-\- taken from
 
915
.B \-\-route-metric
 
916
otherwise 0.
 
917
 
 
918
The default can be specified by leaving an option blank or setting
 
919
it to "default".
 
920
 
 
921
The
 
922
.B network
 
923
and
 
924
.B gateway
 
925
parameters can
 
926
also be specified as a DNS or /etc/hosts
 
927
file resolvable name, or as one of three special keywords:
 
928
 
 
929
.B vpn_gateway
 
930
-- The remote VPN endpoint address
 
931
(derived either from
 
932
.B \-\-route-gateway
 
933
or the second parameter to
 
934
.B \-\-ifconfig
 
935
when
 
936
.B \-\-dev tun
 
937
is specified).
 
938
 
 
939
.B net_gateway
 
940
-- The pre-existing IP default gateway, read from the routing
 
941
table (not supported on all OSes).
 
942
 
 
943
.B remote_host
 
944
-- The
 
945
.B \-\-remote
 
946
address if OpenVPN is being run in client mode, and is undefined in server mode.
 
947
.\"*********************************************************
 
948
.TP
 
949
.B \-\-max-routes n
 
950
Allow a maximum number of n
 
951
.B \-\-route
 
952
options to be specified, either in the local configuration file,
 
953
or pulled from an OpenVPN server.  By default, n=100.
 
954
.\"*********************************************************
 
955
.TP
 
956
.B \-\-route-gateway gw|'dhcp'
 
957
Specify a default gateway
 
958
.B gw
 
959
for use with
 
960
.B \-\-route.
 
961
 
 
962
If
 
963
.B dhcp
 
964
is specified as the parameter,
 
965
the gateway address will be extracted from a DHCP
 
966
negotiation with the OpenVPN server-side LAN.
 
967
.\"*********************************************************
 
968
.TP
 
969
.B \-\-route-metric m
 
970
Specify a default metric
 
971
.B m
 
972
for use with
 
973
.B \-\-route.
 
974
.\"*********************************************************
 
975
.TP
 
976
.B \-\-route-delay [n] [w]
 
977
Delay
 
978
.B n
 
979
seconds (default=0) after connection
 
980
establishment, before adding routes. If
 
981
.B n
 
982
is 0, routes will be added immediately upon connection
 
983
establishment.  If
 
984
.B \-\-route-delay
 
985
is omitted, routes will be added immediately after TUN/TAP device
 
986
open and
 
987
.B \-\-up
 
988
script execution, before any
 
989
.B \-\-user
 
990
or 
 
991
.B \-\-group
 
992
privilege downgrade (or
 
993
.B \-\-chroot
 
994
execution.)
 
995
 
 
996
This option is designed to be useful in scenarios where DHCP is
 
997
used to set
 
998
tap adapter addresses.  The delay will give the DHCP handshake
 
999
time to complete before routes are added.
 
1000
 
 
1001
On Windows,
 
1002
.B \-\-route-delay
 
1003
tries to be more intelligent by waiting
 
1004
.B w
 
1005
seconds (w=30 by default)
 
1006
for the TAP-Win32 adapter to come up before adding routes.
 
1007
.\"*********************************************************
 
1008
.TP
 
1009
.B \-\-route-up cmd
 
1010
Execute shell command
 
1011
.B cmd
 
1012
after routes are added, subject to
 
1013
.B \-\-route-delay.
 
1014
 
 
1015
See the "Environmental Variables" section below for
 
1016
additional parameters passed as environmental variables.
 
1017
 
 
1018
Note that
 
1019
.B cmd
 
1020
can be a shell command with multiple arguments.
 
1021
.\"*********************************************************
 
1022
.TP
 
1023
.B \-\-route-noexec
 
1024
Don't add or remove routes automatically.  Instead pass routes to
 
1025
.B \-\-route-up
 
1026
script using environmental variables.
 
1027
.\"*********************************************************
 
1028
.TP
 
1029
.B \-\-route-nopull
 
1030
When used with
 
1031
.B \-\-client
 
1032
or
 
1033
.B \-\-pull,
 
1034
accept options pushed by server EXCEPT for routes.
 
1035
 
 
1036
When used on the client, this option effectively bars the
 
1037
server from adding routes to the client's routing table,
 
1038
however note that this option still allows the server
 
1039
to set the TCP/IP properties of the client's TUN/TAP interface.
 
1040
.\"*********************************************************
 
1041
.TP
 
1042
.B \-\-allow-pull-fqdn
 
1043
Allow client to pull DNS names from server (rather than being limited
 
1044
to IP address) for
 
1045
.B \-\-ifconfig,
 
1046
.B \-\-route,
 
1047
and
 
1048
.B \-\-route-gateway.
 
1049
.\"*********************************************************
 
1050
.TP
 
1051
.B \-\-redirect-gateway flags...
 
1052
(Experimental) Automatically execute routing commands to cause all outgoing IP traffic
 
1053
to be redirected over the VPN.
 
1054
 
 
1055
This option performs three steps:
 
1056
 
 
1057
.B (1)
 
1058
Create a static route for the
 
1059
.B \-\-remote
 
1060
address which forwards to the pre-existing default gateway.
 
1061
This is done so that
 
1062
.B (3)
 
1063
will not create a routing loop.
 
1064
 
 
1065
.B (2)
 
1066
Delete the default gateway route.
 
1067
 
 
1068
.B (3)
 
1069
Set the new default gateway to be the VPN endpoint address (derived either from
 
1070
.B \-\-route-gateway
 
1071
or the second parameter to
 
1072
.B \-\-ifconfig
 
1073
when
 
1074
.B \-\-dev tun
 
1075
is specified).
 
1076
 
 
1077
When the tunnel is torn down, all of the above steps are reversed so
 
1078
that the original default route is restored.
 
1079
 
 
1080
Option flags:
 
1081
 
 
1082
.B local \-\-
 
1083
Add the
 
1084
.B local
 
1085
flag if both OpenVPN servers are directly connected via a common subnet,
 
1086
such as with wireless.  The
 
1087
.B local
 
1088
flag will cause step
 
1089
.B 1
 
1090
above to be omitted.
 
1091
 
 
1092
.B def1 \-\-
 
1093
Use this flag to override
 
1094
the default gateway by using 0.0.0.0/1 and 128.0.0.0/1
 
1095
rather than 0.0.0.0/0.  This has the benefit of overriding
 
1096
but not wiping out the original default gateway. 
 
1097
 
 
1098
.B bypass-dhcp \-\-
 
1099
Add a direct route to the DHCP server (if it is non-local) which
 
1100
bypasses the tunnel
 
1101
(Available on Windows clients, may not be available
 
1102
on non-Windows clients).
 
1103
 
 
1104
.B bypass-dns \-\-
 
1105
Add a direct route to the DNS server(s) (if they are non-local) which
 
1106
bypasses the tunnel
 
1107
(Available on Windows clients, may not be available
 
1108
on non-Windows clients).
 
1109
 
 
1110
Using the def1 flag is highly recommended.
 
1111
.\"*********************************************************
 
1112
.TP
 
1113
.B \-\-link-mtu n
 
1114
Sets an upper bound on the size of UDP packets which are sent
 
1115
between OpenVPN peers.  It's best not to set this parameter unless
 
1116
you know what you're doing.
 
1117
.\"*********************************************************
 
1118
.TP
 
1119
.B \-\-tun-mtu n
 
1120
Take the TUN device MTU to be
 
1121
.B n
 
1122
and derive the link MTU
 
1123
from it (default=1500).  In most cases, you will probably want to
 
1124
leave this parameter set to its default value.
 
1125
 
 
1126
The MTU (Maximum Transmission Units) is
 
1127
the maximum datagram size in bytes that can be sent unfragmented
 
1128
over a particular network path.  OpenVPN requires that packets
 
1129
on the control or data channels be sent unfragmented.
 
1130
 
 
1131
MTU problems often manifest themselves as connections which
 
1132
hang during periods of active usage.
 
1133
 
 
1134
It's best to use the
 
1135
.B \-\-fragment
 
1136
and/or
 
1137
.B \-\-mssfix
 
1138
options to deal with MTU sizing issues.
 
1139
.\"*********************************************************
 
1140
.TP
 
1141
.B \-\-tun-mtu-extra n
 
1142
Assume that the TUN/TAP device might return as many as
 
1143
.B n
 
1144
bytes more than the
 
1145
.B \-\-tun-mtu
 
1146
size on read.  This parameter defaults to 0, which is sufficient for
 
1147
most TUN devices.  TAP devices may introduce additional overhead in excess
 
1148
of the MTU size, and a setting of 32 is the default when TAP devices are used.
 
1149
This parameter only controls internal OpenVPN buffer sizing,
 
1150
so there is no transmission overhead associated with using a larger value.
 
1151
.\"*********************************************************
 
1152
.TP
 
1153
.B \-\-mtu-disc type
 
1154
Should we do Path MTU discovery on TCP/UDP channel?  Only supported on OSes such
 
1155
as Linux that supports the necessary system call to set.
 
1156
 
 
1157
.B 'no'
 
1158
\-\- Never send DF (Don't Fragment) frames
 
1159
.br
 
1160
.B 'maybe'
 
1161
\-\- Use per-route hints
 
1162
.br
 
1163
.B 'yes'
 
1164
\-\- Always DF (Don't Fragment)
 
1165
.br
 
1166
.\"*********************************************************
 
1167
.TP
 
1168
.B \-\-mtu-test
 
1169
To empirically measure MTU on connection startup,
 
1170
add the
 
1171
.B \-\-mtu-test
 
1172
option to your configuration.
 
1173
OpenVPN will send ping packets of various sizes
 
1174
to the remote peer and measure the largest packets
 
1175
which were successfully received.  The
 
1176
.B \-\-mtu-test
 
1177
process normally takes about 3 minutes to complete.
 
1178
.\"*********************************************************
 
1179
.TP
 
1180
.B \-\-fragment max
 
1181
Enable internal datagram fragmentation so
 
1182
that no UDP datagrams are sent which
 
1183
are larger than
 
1184
.B max
 
1185
bytes.
 
1186
 
 
1187
The
 
1188
.B max
 
1189
parameter is interpreted in the same way as the
 
1190
.B \-\-link-mtu
 
1191
parameter, i.e. the UDP packet size after encapsulation
 
1192
overhead has been added in, but not including
 
1193
the UDP header itself.
 
1194
 
 
1195
The
 
1196
.B \-\-fragment
 
1197
option only makes sense when you are using the UDP protocol (
 
1198
.B \-\-proto udp
 
1199
).
 
1200
 
 
1201
.B \-\-fragment
 
1202
adds 4 bytes of overhead per datagram.
 
1203
 
 
1204
See the
 
1205
.B \-\-mssfix
 
1206
option below for an important related option to
 
1207
.B \-\-fragment.
 
1208
 
 
1209
It should also be noted that this option is not meant to replace
 
1210
UDP fragmentation at the IP stack level.  It is only meant as a
 
1211
last resort when path MTU discovery is broken.  Using this option
 
1212
is less efficient than fixing path MTU discovery for your IP link and
 
1213
using native IP fragmentation instead.
 
1214
 
 
1215
Having said that, there are circumstances where using OpenVPN's
 
1216
internal fragmentation capability may be your only option, such
 
1217
as tunneling a UDP multicast stream which requires fragmentation.
 
1218
.\"*********************************************************
 
1219
.TP
 
1220
.B \-\-mssfix max
 
1221
Announce to TCP sessions running over the tunnel that they should limit
 
1222
their send packet sizes such that after OpenVPN has encapsulated them,
 
1223
the resulting UDP packet size that OpenVPN sends to its peer will not
 
1224
exceed
 
1225
.B max
 
1226
bytes.
 
1227
 
 
1228
The
 
1229
.B max
 
1230
parameter is interpreted in the same way as the
 
1231
.B \-\-link-mtu
 
1232
parameter, i.e. the UDP packet size after encapsulation
 
1233
overhead has been added in, but not including
 
1234
the UDP header itself.
 
1235
 
 
1236
The
 
1237
.B \-\-mssfix
 
1238
option only makes sense when you are using the UDP protocol
 
1239
for OpenVPN peer-to-peer communication, i.e.
 
1240
.B \-\-proto udp.
 
1241
 
 
1242
.B \-\-mssfix
 
1243
and
 
1244
.B \-\-fragment
 
1245
can be ideally used together, where
 
1246
.B \-\-mssfix
 
1247
will try to keep TCP from needing
 
1248
packet fragmentation in the first place,
 
1249
and if big packets come through anyhow
 
1250
(from protocols other than TCP),
 
1251
.B \-\-fragment
 
1252
will internally fragment them.
 
1253
 
 
1254
Both
 
1255
.B \-\-fragment
 
1256
and
 
1257
.B \-\-mssfix
 
1258
are designed to work around cases where Path MTU discovery
 
1259
is broken on the network path between OpenVPN peers.
 
1260
 
 
1261
The usual symptom of such a breakdown is an OpenVPN
 
1262
connection which successfully starts, but then stalls
 
1263
during active usage.
 
1264
 
 
1265
If
 
1266
.B \-\-fragment
 
1267
and
 
1268
.B \-\-mssfix
 
1269
are used together,
 
1270
.B \-\-mssfix
 
1271
will take its default
 
1272
.B max
 
1273
parameter from the
 
1274
.B \-\-fragment max
 
1275
option.
 
1276
 
 
1277
Therefore, one could lower the maximum UDP packet size
 
1278
to 1300 (a good first try for solving MTU-related
 
1279
connection problems) with the following options:
 
1280
 
 
1281
.B \-\-tun-mtu 1500 \-\-fragment 1300 \-\-mssfix
 
1282
.\"*********************************************************
 
1283
.TP
 
1284
.B \-\-sndbuf size
 
1285
Set the TCP/UDP socket send buffer size.
 
1286
Currently defaults to 65536 bytes.
 
1287
.\"*********************************************************
 
1288
.TP
 
1289
.B \-\-rcvbuf size
 
1290
Set the TCP/UDP socket receive buffer size.
 
1291
Currently defaults to 65536 bytes.
 
1292
.\"*********************************************************
 
1293
.TP
 
1294
.B \-\-socket-flags flags...
 
1295
Apply the given flags to the OpenVPN transport socket.
 
1296
Currently, only
 
1297
.B TCP_NODELAY
 
1298
is supported.
 
1299
 
 
1300
The
 
1301
.B TCP_NODELAY
 
1302
socket flag is useful in TCP mode, and causes the kernel
 
1303
to send tunnel packets immediately over the TCP connection without
 
1304
trying to group several smaller packets into a larger packet.
 
1305
This can result in a considerably improvement in latency.
 
1306
 
 
1307
This option is pushable from server to client, and should be used
 
1308
on both client and server for maximum effect.
 
1309
.\"*********************************************************
 
1310
.TP
 
1311
.B \-\-txqueuelen n
 
1312
(Linux only) Set the TX queue length on the TUN/TAP interface.
 
1313
Currently defaults to 100.
 
1314
.\"*********************************************************
 
1315
.TP
 
1316
.B \-\-shaper n
 
1317
Limit bandwidth of outgoing tunnel data to
 
1318
.B n
 
1319
bytes per second on the TCP/UDP port.
 
1320
If you want to limit the bandwidth
 
1321
in both directions, use this option on both peers.
 
1322
 
 
1323
OpenVPN uses the following algorithm to implement
 
1324
traffic shaping: Given a shaper rate of
 
1325
.I n
 
1326
bytes per second, after a datagram write of
 
1327
.I b
 
1328
bytes is queued on the TCP/UDP port, wait a minimum of
 
1329
.I (b / n)
 
1330
seconds before queuing the next write.
 
1331
 
 
1332
It should be noted that OpenVPN supports multiple
 
1333
tunnels between the same two peers, allowing you
 
1334
to construct full-speed and reduced bandwidth tunnels
 
1335
at the same time,
 
1336
routing low-priority data such as off-site backups
 
1337
over the reduced bandwidth tunnel, and other data
 
1338
over the full-speed tunnel.
 
1339
 
 
1340
Also note that for low bandwidth tunnels
 
1341
(under 1000 bytes per second), you should probably
 
1342
use lower MTU values as well (see above), otherwise
 
1343
the packet latency will grow so large as to trigger
 
1344
timeouts in the TLS layer and TCP connections running
 
1345
over the tunnel.
 
1346
 
 
1347
OpenVPN allows
 
1348
.B n
 
1349
to be between 100 bytes/sec and 100 Mbytes/sec.
 
1350
.\"*********************************************************
 
1351
.TP
 
1352
.B \-\-inactive n [bytes]
 
1353
Causes OpenVPN to exit after
 
1354
.B n
 
1355
seconds of inactivity on the TUN/TAP device.  The time length
 
1356
of inactivity is measured since the last incoming tunnel packet.
 
1357
 
 
1358
If the optional
 
1359
.B bytes
 
1360
parameter is included,
 
1361
exit after n seconds of activity on tun/tap device
 
1362
produces a combined in/out byte count that is less than
 
1363
.B bytes.
 
1364
.\"*********************************************************
 
1365
.TP
 
1366
.B \-\-ping n
 
1367
Ping remote over the TCP/UDP control channel
 
1368
if no packets have been sent for at least
 
1369
.B n
 
1370
seconds (specify
 
1371
.B \-\-ping
 
1372
on both peers to cause ping packets to be sent in both directions since
 
1373
OpenVPN ping packets are not echoed like IP ping packets).
 
1374
When used in one of OpenVPN's secure modes (where
 
1375
.B \-\-secret, \-\-tls-server,
 
1376
or
 
1377
.B \-\-tls-client
 
1378
is specified), the ping packet
 
1379
will be cryptographically secure.
 
1380
 
 
1381
This option has two intended uses:
 
1382
 
 
1383
(1) Compatibility
 
1384
with stateful firewalls.  The periodic ping will ensure that
 
1385
a stateful firewall rule which allows OpenVPN UDP packets to
 
1386
pass will not time out.
 
1387
 
 
1388
(2) To provide a basis for the remote to test the existence
 
1389
of its peer using the
 
1390
.B \-\-ping-exit
 
1391
option.
 
1392
.\"*********************************************************
 
1393
.TP
 
1394
.B \-\-ping-exit n
 
1395
Causes OpenVPN to exit after
 
1396
.B n
 
1397
seconds pass without reception of a ping
 
1398
or other packet from remote.
 
1399
This option can be combined with
 
1400
.B \-\-inactive, \-\-ping,
 
1401
and
 
1402
.B \-\-ping-exit
 
1403
to create a two-tiered inactivity disconnect.
 
1404
 
 
1405
For example,
 
1406
 
 
1407
.B openvpn [options...] \-\-inactive 3600 \-\-ping 10 \-\-ping-exit 60
 
1408
 
 
1409
when used on both peers will cause OpenVPN to exit within 60
 
1410
seconds if its peer disconnects, but will exit after one
 
1411
hour if no actual tunnel data is exchanged.
 
1412
.\"*********************************************************
 
1413
.TP
 
1414
.B \-\-ping-restart n
 
1415
Similar to
 
1416
.B \-\-ping-exit,
 
1417
but trigger a
 
1418
.B SIGUSR1
 
1419
restart after
 
1420
.B n
 
1421
seconds pass without reception of a ping
 
1422
or other packet from remote.
 
1423
 
 
1424
This option is useful in cases
 
1425
where the remote peer has a dynamic IP address and
 
1426
a low-TTL DNS name is used to track the IP address using
 
1427
a service such as
 
1428
.I http://dyndns.org/
 
1429
+ a dynamic DNS client such
 
1430
as
 
1431
.B ddclient.
 
1432
 
 
1433
If the peer cannot be reached, a restart will be triggered, causing
 
1434
the hostname used with
 
1435
.B \-\-remote
 
1436
to be re-resolved (if
 
1437
.B \-\-resolv-retry
 
1438
is also specified).
 
1439
 
 
1440
In server mode,
 
1441
.B \-\-ping-restart, \-\-inactive,
 
1442
or any other type of internally generated signal will always be
 
1443
applied to
 
1444
individual client instance objects, never to whole server itself.
 
1445
Note also in server mode that any internally generated signal
 
1446
which would normally cause a restart, will cause the deletion
 
1447
of the client instance object instead.
 
1448
 
 
1449
In client mode, the
 
1450
.B \-\-ping-restart
 
1451
parameter is set to 120 seconds by default.  This default will
 
1452
hold until the client pulls a replacement value from the server, based on
 
1453
the
 
1454
.B \-\-keepalive
 
1455
setting in the server configuration.
 
1456
To disable the 120 second default, set
 
1457
.B \-\-ping-restart 0
 
1458
on the client.
 
1459
 
 
1460
See the signals section below for more information
 
1461
on
 
1462
.B SIGUSR1.
 
1463
 
 
1464
Note that the behavior of
 
1465
.B SIGUSR1
 
1466
can be modified by the
 
1467
.B \-\-persist-tun, \-\-persist-key, \-\-persist-local-ip,
 
1468
and
 
1469
.B \-\-persist-remote-ip
 
1470
options.
 
1471
 
 
1472
Also note that
 
1473
.B \-\-ping-exit
 
1474
and
 
1475
.B \-\-ping-restart
 
1476
are mutually exclusive and cannot be used together.
 
1477
.\"*********************************************************
 
1478
.TP
 
1479
.B \-\-keepalive n m
 
1480
A helper directive designed to simplify the expression of
 
1481
.B \-\-ping
 
1482
and
 
1483
.B \-\-ping-restart
 
1484
in server mode configurations.
 
1485
 
 
1486
For example,
 
1487
.B \-\-keepalive 10 60
 
1488
expands as follows:
 
1489
 
 
1490
.nf
 
1491
.ft 3
 
1492
.in +4
 
1493
 if mode server:
 
1494
   ping 10
 
1495
   ping-restart 120
 
1496
   push "ping 10"
 
1497
   push "ping-restart 60"
 
1498
 else
 
1499
   ping 10
 
1500
   ping-restart 60
 
1501
.in -4
 
1502
.ft
 
1503
.fi
 
1504
.\"*********************************************************
 
1505
.TP
 
1506
.B \-\-ping-timer-rem
 
1507
Run the
 
1508
.B \-\-ping-exit
 
1509
/
 
1510
.B \-\-ping-restart
 
1511
timer only if we have a remote address.  Use this option if you are
 
1512
starting the daemon in listen mode (i.e. without an explicit
 
1513
.B \-\-remote
 
1514
peer), and you don't want to start clocking timeouts until a remote
 
1515
peer connects.
 
1516
.\"*********************************************************
 
1517
.TP
 
1518
.B \-\-persist-tun
 
1519
Don't close and reopen TUN/TAP device or run up/down scripts
 
1520
across
 
1521
.B SIGUSR1
 
1522
or
 
1523
.B \-\-ping-restart
 
1524
restarts.
 
1525
 
 
1526
.B SIGUSR1
 
1527
is a restart signal similar to
 
1528
.B SIGHUP,
 
1529
but which offers finer-grained control over
 
1530
reset options.
 
1531
.\"*********************************************************
 
1532
.TP
 
1533
.B \-\-persist-key
 
1534
Don't re-read key files across
 
1535
.B SIGUSR1
 
1536
or
 
1537
.B \-\-ping-restart.
 
1538
 
 
1539
This option can be combined with
 
1540
.B \-\-user nobody
 
1541
to allow restarts triggered by the
 
1542
.B SIGUSR1
 
1543
signal.
 
1544
Normally if you drop root privileges in OpenVPN,
 
1545
the daemon cannot be restarted since it will now be unable to re-read protected
 
1546
key files.
 
1547
 
 
1548
This option solves the problem by persisting keys across
 
1549
.B SIGUSR1
 
1550
resets, so they don't need to be re-read.
 
1551
.\"*********************************************************
 
1552
.TP
 
1553
.B \-\-persist-local-ip
 
1554
Preserve initially resolved local IP address and port number
 
1555
across
 
1556
.B SIGUSR1
 
1557
or
 
1558
.B \-\-ping-restart
 
1559
restarts.
 
1560
.\"*********************************************************
 
1561
.TP
 
1562
.B \-\-persist-remote-ip
 
1563
Preserve most recently authenticated remote IP address and port number
 
1564
across
 
1565
.B SIGUSR1
 
1566
or
 
1567
.B \-\-ping-restart
 
1568
restarts.
 
1569
.\"*********************************************************
 
1570
.TP
 
1571
.B \-\-mlock
 
1572
Disable paging by calling the POSIX mlockall function.
 
1573
Requires that OpenVPN be initially run as root (though
 
1574
OpenVPN can subsequently downgrade its UID using the
 
1575
.B \-\-user
 
1576
option).
 
1577
 
 
1578
Using this option ensures that key material and tunnel
 
1579
data are never written to disk due to virtual
 
1580
memory paging operations which occur under most
 
1581
modern operating systems.  It ensures that even if an
 
1582
attacker was able to crack the box running OpenVPN, he
 
1583
would not be able to scan the system swap file to
 
1584
recover previously used
 
1585
ephemeral keys, which are used for a period of time
 
1586
governed by the
 
1587
.B \-\-reneg
 
1588
options (see below), then are discarded.
 
1589
 
 
1590
The downside
 
1591
of using
 
1592
.B \-\-mlock
 
1593
is that it will reduce the amount of physical
 
1594
memory available to other applications.
 
1595
.\"*********************************************************
 
1596
.TP
 
1597
.B \-\-up cmd
 
1598
Shell command to run after successful TUN/TAP device open
 
1599
(pre
 
1600
.B \-\-user
 
1601
UID change).  The up script is useful for specifying route
 
1602
commands which route IP traffic destined for
 
1603
private subnets which exist at the other
 
1604
end of the VPN connection into the tunnel.
 
1605
 
 
1606
For
 
1607
.B \-\-dev tun
 
1608
execute as:
 
1609
 
 
1610
.B cmd tun_dev tun_mtu link_mtu ifconfig_local_ip ifconfig_remote_ip [ init | restart ]
 
1611
 
 
1612
For
 
1613
.B \-\-dev tap
 
1614
execute as:
 
1615
 
 
1616
.B cmd tap_dev tap_mtu link_mtu ifconfig_local_ip ifconfig_netmask [ init | restart ]
 
1617
 
 
1618
See the "Environmental Variables" section below for
 
1619
additional parameters passed as environmental variables.
 
1620
 
 
1621
Note that
 
1622
.B cmd
 
1623
can be a shell command with multiple arguments, in which
 
1624
case all OpenVPN-generated arguments will be appended
 
1625
to
 
1626
.B cmd
 
1627
to build a command line which will be passed to the shell.
 
1628
 
 
1629
Typically,
 
1630
.B cmd
 
1631
will run a script to add routes to the tunnel.
 
1632
 
 
1633
Normally the up script is called after the TUN/TAP device is opened.
 
1634
In this context, the last command line parameter passed to the script
 
1635
will be
 
1636
.I init.
 
1637
If the
 
1638
.B \-\-up-restart
 
1639
option is also used, the up script will be called for restarts as
 
1640
well.  A restart is considered to be a partial reinitialization
 
1641
of OpenVPN where the TUN/TAP instance is preserved (the
 
1642
.B \-\-persist-tun
 
1643
option will enable such preservation).  A restart
 
1644
can be generated by a SIGUSR1 signal, a
 
1645
.B \-\-ping-restart
 
1646
timeout, or a connection reset when the TCP protocol is enabled
 
1647
with the
 
1648
.B \-\-proto
 
1649
option.  If a restart occurs, and
 
1650
.B \-\-up-restart
 
1651
has been specified, the up script will be called with
 
1652
.I restart
 
1653
as the last parameter.
 
1654
 
 
1655
The following standalone example shows how the
 
1656
.B \-\-up
 
1657
script can be called in both an initialization and restart context.
 
1658
(NOTE: for security reasons, don't run the following example unless UDP port
 
1659
9999 is blocked by your firewall.  Also, the example will run indefinitely,
 
1660
so you should abort with control-c).
 
1661
 
 
1662
.B openvpn \-\-dev tun \-\-port 9999 \-\-verb 4 \-\-ping-restart 10 \-\-up 'echo up' \-\-down 'echo down' \-\-persist-tun \-\-up-restart
 
1663
 
 
1664
Note that OpenVPN also provides the
 
1665
.B \-\-ifconfig
 
1666
option to automatically ifconfig the TUN device,
 
1667
eliminating the need to define an
 
1668
.B \-\-up
 
1669
script, unless you also want to configure routes
 
1670
in the
 
1671
.B \-\-up
 
1672
script.
 
1673
 
 
1674
If
 
1675
.B \-\-ifconfig
 
1676
is also specified, OpenVPN will pass the ifconfig local
 
1677
and remote endpoints on the command line to the
 
1678
.B \-\-up
 
1679
script so that they can be used to configure routes such as:
 
1680
 
 
1681
.B route add -net 10.0.0.0 netmask 255.255.255.0 gw $5
 
1682
.\"*********************************************************
 
1683
.TP
 
1684
.B \-\-up-delay
 
1685
Delay TUN/TAP open and possible
 
1686
.B \-\-up
 
1687
script execution
 
1688
until after TCP/UDP connection establishment with peer.
 
1689
 
 
1690
In
 
1691
.B \-\-proto udp
 
1692
mode, this option normally requires the use of
 
1693
.B \-\-ping
 
1694
to allow connection initiation to be sensed in the absence
 
1695
of tunnel data, since UDP is a "connectionless" protocol.
 
1696
 
 
1697
On Windows, this option will delay the TAP-Win32 media state
 
1698
transitioning to "connected" until connection establishment,
 
1699
i.e. the receipt of the first authenticated packet from the peer.
 
1700
.\"*********************************************************
 
1701
.TP
 
1702
.B \-\-down cmd
 
1703
Shell command to run after TUN/TAP device close
 
1704
(post
 
1705
.B \-\-user
 
1706
UID change and/or
 
1707
.B \-\-chroot
 
1708
).  Called with the same parameters and environmental
 
1709
variables as the
 
1710
.B \-\-up
 
1711
option above.
 
1712
 
 
1713
Note that if you reduce privileges by using
 
1714
.B \-\-user
 
1715
and/or
 
1716
.B \-\-group,
 
1717
your
 
1718
.B \-\-down
 
1719
script will also run at reduced privilege.
 
1720
.\"*********************************************************
 
1721
.TP
 
1722
.B \-\-down-pre
 
1723
Call
 
1724
.B \-\-down
 
1725
cmd/script before, rather than after, TUN/TAP close.
 
1726
.\"*********************************************************
 
1727
.TP
 
1728
.B \-\-up-restart
 
1729
Enable the
 
1730
.B \-\-up
 
1731
and
 
1732
.B \-\-down
 
1733
scripts to be called for restarts as well as initial program start.
 
1734
This option is described more fully above in the
 
1735
.B \-\-up
 
1736
option documentation.
 
1737
.\"*********************************************************
 
1738
.TP
 
1739
.B \-\-setenv name value
 
1740
Set a custom environmental variable
 
1741
.B name=value
 
1742
to pass to script.
 
1743
.\"*********************************************************
 
1744
.TP
 
1745
.B \-\-setenv FORWARD_COMPATIBLE 1
 
1746
Relax config file syntax checking so that unknown directives
 
1747
will trigger a warning but not a fatal error,
 
1748
on the assumption that a given unknown directive might be valid
 
1749
in future OpenVPN versions.
 
1750
 
 
1751
This option should be used with caution, as there are good security
 
1752
reasons for having OpenVPN fail if it detects problems in a
 
1753
config file.  Having said that, there are valid reasons for wanting
 
1754
new software features to gracefully degrade when encountered by
 
1755
older software versions.
 
1756
.\"*********************************************************
 
1757
.TP
 
1758
.B \-\-setenv-safe name value
 
1759
Set a custom environmental variable
 
1760
.B OPENVPN_name=value
 
1761
to pass to script.
 
1762
 
 
1763
This directive is designed to be pushed by the server to clients,
 
1764
and the prepending of "OPENVPN_" to the environmental variable
 
1765
is a safety precaution to prevent a LD_PRELOAD style attack
 
1766
from a malicious or compromised server.
 
1767
.\"*********************************************************
 
1768
.TP
 
1769
.B \-\-script-security level [method]
 
1770
This directive offers policy-level control over OpenVPN's usage of external programs
 
1771
and scripts.  Lower
 
1772
.B level
 
1773
values are more restrictive, higher values are more permissive.  Settings for
 
1774
.B level:
 
1775
 
 
1776
.B 0 --
 
1777
Strictly no calling of external programs.
 
1778
.br
 
1779
.B 1 --
 
1780
(Default) Only call built-in executables such as ifconfig, ip, route, or netsh.
 
1781
.br
 
1782
.B 2 --
 
1783
Allow calling of built-in executables and user-defined scripts.
 
1784
.br
 
1785
.B 3 --
 
1786
Allow passwords to be passed to scripts via environmental variables (potentially unsafe).
 
1787
 
 
1788
The
 
1789
.B method
 
1790
parameter indicates how OpenVPN should call external commands and scripts.
 
1791
Settings for
 
1792
.B method:
 
1793
 
 
1794
.B execve --
 
1795
(default) Use execve() function on Unix family OSes and CreateProcess() on Windows.
 
1796
.br
 
1797
.B system --
 
1798
Use system() function (deprecated and less safe since the external program command
 
1799
line is subject to shell expansion).
 
1800
 
 
1801
The
 
1802
.B \-\-script-security
 
1803
option was introduced in OpenVPN 2.1_rc9.  For configuration file compatibility
 
1804
with previous OpenVPN versions, use:
 
1805
.B \-\-script-security 3 system
 
1806
.\"*********************************************************
 
1807
.TP
 
1808
.B \-\-disable-occ
 
1809
Don't output a warning message if option inconsistencies are detected between
 
1810
peers.  An example of an option inconsistency would be where one peer uses
 
1811
.B \-\-dev tun
 
1812
while the other peer uses
 
1813
.B \-\-dev tap.
 
1814
 
 
1815
Use of this option is discouraged, but is provided as
 
1816
a temporary fix in situations where a recent version of OpenVPN must
 
1817
connect to an old version.
 
1818
.\"*********************************************************
 
1819
.TP
 
1820
.B \-\-user user
 
1821
Change the user ID of the OpenVPN process to
 
1822
.B user
 
1823
after initialization, dropping privileges in the process.
 
1824
This option is useful to protect the system
 
1825
in the event that some hostile party was able to gain control of
 
1826
an OpenVPN session.  Though OpenVPN's security features make
 
1827
this unlikely, it is provided as a second line of defense.
 
1828
 
 
1829
By setting
 
1830
.B user
 
1831
to
 
1832
.I nobody
 
1833
or somebody similarly unprivileged, the hostile party would be
 
1834
limited in what damage they could cause.  Of course once
 
1835
you take away privileges, you cannot return them
 
1836
to an OpenVPN session.  This means, for example, that if
 
1837
you want to reset an OpenVPN daemon with a
 
1838
.B SIGUSR1
 
1839
signal
 
1840
(for example in response
 
1841
to a DHCP reset), you should make use of one or more of the
 
1842
.B \-\-persist
 
1843
options to ensure that OpenVPN doesn't need to execute any privileged
 
1844
operations in order to restart (such as re-reading key files
 
1845
or running
 
1846
.BR ifconfig
 
1847
on the TUN device).
 
1848
.\"*********************************************************
 
1849
.TP
 
1850
.B \-\-group group
 
1851
Similar to the
 
1852
.B \-\-user
 
1853
option,
 
1854
this option changes the group ID of the OpenVPN process to
 
1855
.B group
 
1856
after initialization.
 
1857
.\"*********************************************************
 
1858
.TP
 
1859
.B \-\-cd dir
 
1860
Change directory to
 
1861
.B dir
 
1862
prior to reading any files such as
 
1863
configuration files, key files, scripts, etc.
 
1864
.B dir
 
1865
should be an absolute path, with a leading "/",
 
1866
and without any references
 
1867
to the current directory such as "." or "..".
 
1868
 
 
1869
This option is useful when you are running
 
1870
OpenVPN in 
 
1871
.B \-\-daemon
 
1872
mode, and you want to consolidate all of
 
1873
your OpenVPN control files in one location.
 
1874
.\"*********************************************************
 
1875
.TP
 
1876
.B \-\-chroot dir
 
1877
Chroot to
 
1878
.B dir
 
1879
after initialization.  
 
1880
.B \-\-chroot
 
1881
essentially redefines
 
1882
.B dir
 
1883
as being the top
 
1884
level directory tree (/).  OpenVPN will therefore
 
1885
be unable to access any files outside this tree.
 
1886
This can be desirable from a security standpoint.
 
1887
 
 
1888
Since the chroot operation is delayed until after
 
1889
initialization, most OpenVPN options that reference
 
1890
files will operate in a pre-chroot context.
 
1891
 
 
1892
In many cases, the
 
1893
.B dir
 
1894
parameter can point to an empty directory, however
 
1895
complications can result when scripts or restarts
 
1896
are executed after the chroot operation.
 
1897
.\"*********************************************************
 
1898
.TP
 
1899
.B \-\-setcon context
 
1900
Apply SELinux
 
1901
.B context
 
1902
after initialization. This
 
1903
essentially provides the ability to restrict OpenVPN's
 
1904
rights to only network I/O operations, thanks to
 
1905
SELinux. This goes further than
 
1906
.B \-\-user
 
1907
and
 
1908
.B \-\-chroot
 
1909
in that those two, while being great security features,
 
1910
unfortunately do not protect against privilege escalation
 
1911
by exploitation of a vulnerable system call. You can of
 
1912
course combine all three, but please note that since
 
1913
setcon requires access to /proc you will have to provide
 
1914
it inside the chroot directory (e.g. with mount \-\-bind).
 
1915
 
 
1916
Since the setcon operation is delayed until after
 
1917
initialization, OpenVPN can be restricted to just
 
1918
network-related system calls, whereas by applying the
 
1919
context before startup (such as the OpenVPN one provided
 
1920
in the SELinux Reference Policies) you will have to
 
1921
allow many things required only during initialization.
 
1922
 
 
1923
Like with chroot, complications can result when scripts
 
1924
or restarts are executed after the setcon operation,
 
1925
which is why you should really consider using the
 
1926
.B \-\-persist-key
 
1927
and
 
1928
.B \-\-persist-tun
 
1929
options.
 
1930
.\"*********************************************************
 
1931
.TP
 
1932
.B \-\-daemon [progname]
 
1933
Become a daemon after all initialization functions are completed.
 
1934
This option will cause all message and error output to
 
1935
be sent to the syslog file (such as /var/log/messages),
 
1936
except for the output of shell scripts and
 
1937
ifconfig commands,
 
1938
which will go to /dev/null unless otherwise redirected.
 
1939
The syslog redirection occurs immediately at the point
 
1940
that
 
1941
.B \-\-daemon
 
1942
is parsed on the command line even though
 
1943
the daemonization point occurs later.  If one of the
 
1944
.B \-\-log
 
1945
options is present, it will supercede syslog
 
1946
redirection.
 
1947
 
 
1948
The optional
 
1949
.B progname
 
1950
parameter will cause OpenVPN to report its program name
 
1951
to the system logger as
 
1952
.B progname.
 
1953
This can be useful in linking OpenVPN messages
 
1954
in the syslog file with specific tunnels.
 
1955
When unspecified,
 
1956
.B progname
 
1957
defaults to "openvpn".
 
1958
 
 
1959
When OpenVPN is run with the
 
1960
.B \-\-daemon
 
1961
option, it will try to delay daemonization until the majority of initialization
 
1962
functions which are capable of generating fatal errors are complete.  This means
 
1963
that initialization scripts can test the return status of the
 
1964
openvpn command for a fairly reliable indication of whether the command
 
1965
has correctly initialized and entered the packet forwarding event loop.
 
1966
 
 
1967
In OpenVPN, the vast majority of errors which occur after initialization are non-fatal.
 
1968
.\"*********************************************************
 
1969
.TP
 
1970
.B \-\-syslog [progname]
 
1971
Direct log output to system logger, but do not become a daemon.
 
1972
See
 
1973
.B \-\-daemon
 
1974
directive above for description of
 
1975
.B progname
 
1976
parameter.
 
1977
.\"*********************************************************
 
1978
.TP
 
1979
.B \-\-passtos
 
1980
Set the TOS field of the tunnel packet to what the payload's TOS is.
 
1981
.\"*********************************************************
 
1982
.TP
 
1983
.B \-\-inetd [wait|nowait] [progname]
 
1984
Use this option when OpenVPN is being run from the inetd or
 
1985
.BR xinetd(8)
 
1986
server.
 
1987
 
 
1988
The
 
1989
.B wait/nowait
 
1990
option must match what is specified in the inetd/xinetd
 
1991
config file.  The
 
1992
.B nowait
 
1993
mode can only be used with
 
1994
.B \-\-proto tcp-server.
 
1995
The default is
 
1996
.B wait.
 
1997
The
 
1998
.B nowait
 
1999
mode can be used to instantiate the OpenVPN daemon as a classic TCP server,
 
2000
where client connection requests are serviced on a single
 
2001
port number.  For additional information on this kind of configuration,
 
2002
see the OpenVPN FAQ:
 
2003
.I http://openvpn.net/faq.html#oneport
 
2004
 
 
2005
This option precludes the use of
 
2006
.B \-\-daemon, \-\-local,
 
2007
or
 
2008
.B \-\-remote.
 
2009
Note that this option causes message and error output to be handled in the same
 
2010
way as the
 
2011
.B \-\-daemon
 
2012
option.  The optional
 
2013
.B progname
 
2014
parameter is also handled exactly as in
 
2015
.B \-\-daemon.
 
2016
 
 
2017
Also note that in
 
2018
.B wait
 
2019
mode, each OpenVPN tunnel requires a separate TCP/UDP port and
 
2020
a separate inetd or xinetd entry.  See the OpenVPN 1.x HOWTO for an example
 
2021
on using OpenVPN with xinetd:
 
2022
.I http://openvpn.net/1xhowto.html
 
2023
.\"*********************************************************
 
2024
.TP
 
2025
.B \-\-log file
 
2026
Output logging messages to
 
2027
.B file,
 
2028
including output to stdout/stderr which
 
2029
is generated by called scripts.
 
2030
If
 
2031
.B file
 
2032
already exists it will be truncated.
 
2033
This option takes effect
 
2034
immediately when it is parsed in the command line
 
2035
and will supercede syslog output if
 
2036
.B \-\-daemon
 
2037
or
 
2038
.B \-\-inetd
 
2039
is also specified.
 
2040
This option is persistent over the entire course of
 
2041
an OpenVPN instantiation and will not be reset by SIGHUP,
 
2042
SIGUSR1, or
 
2043
.B \-\-ping-restart.
 
2044
 
 
2045
Note that on Windows, when OpenVPN is started as a service,
 
2046
logging occurs by default without the need to specify
 
2047
this option.
 
2048
.\"*********************************************************
 
2049
.TP
 
2050
.B \-\-log-append file
 
2051
Append logging messages to
 
2052
.B file.
 
2053
If
 
2054
.B file
 
2055
does not exist, it will be created.
 
2056
This option behaves exactly like
 
2057
.B \-\-log
 
2058
except that it appends to rather
 
2059
than truncating the log file.
 
2060
.\"*********************************************************
 
2061
.TP
 
2062
.B \-\-suppress-timestamps
 
2063
Avoid writing timestamps to log messages, even when they
 
2064
otherwise would be prepended. In particular, this applies to
 
2065
log messages sent to stdout.
 
2066
.\"*********************************************************
 
2067
.TP
 
2068
.B \-\-writepid file
 
2069
Write OpenVPN's main process ID to
 
2070
.B file.
 
2071
.\"*********************************************************
 
2072
.TP
 
2073
.B \-\-nice n
 
2074
Change process priority after initialization
 
2075
(
 
2076
.B n
 
2077
greater than 0 is lower priority,
 
2078
.B n
 
2079
less than zero is higher priority).
 
2080
.\"*********************************************************
 
2081
.\".TP
 
2082
.\".B \-\-nice-work n
 
2083
.\"Change priority of background TLS work thread.  The TLS thread
 
2084
.\"feature is enabled when OpenVPN is built
 
2085
.\"with pthread support, and you are running OpenVPN
 
2086
.\"in TLS mode (i.e. with
 
2087
.\".B \-\-tls-client
 
2088
.\"or
 
2089
.\".B \-\-tls-server
 
2090
.\"specified).
 
2091
.\"
 
2092
.\"Using a TLS thread offloads the CPU-intensive process of SSL/TLS-based
 
2093
.\"key exchange to a background thread so that it does not become
 
2094
.\"a latency bottleneck in the tunnel packet forwarding process.
 
2095
.\"
 
2096
.\"The parameter
 
2097
.\".B n
 
2098
.\"is interpreted exactly as with the
 
2099
.\".B \-\-nice
 
2100
.\"option above, but in relation to the work thread rather
 
2101
.\"than the main thread.
 
2102
.\"*********************************************************
 
2103
.TP
 
2104
.B \-\-fast-io
 
2105
(Experimental) Optimize TUN/TAP/UDP I/O writes by avoiding
 
2106
a call to poll/epoll/select prior to the write operation.  The purpose
 
2107
of such a call would normally be to block until the device
 
2108
or socket is ready to accept the write.  Such blocking is unnecessary
 
2109
on some platforms which don't support write blocking on UDP sockets
 
2110
or TUN/TAP devices.  In such cases, one can optimize the event loop
 
2111
by avoiding the poll/epoll/select call, improving CPU efficiency
 
2112
by 5% to 10%.
 
2113
 
 
2114
This option can only be used on non-Windows systems, when
 
2115
.B \-\-proto udp
 
2116
is specified, and when
 
2117
.B \-\-shaper
 
2118
is NOT specified.
 
2119
.\"*********************************************************
 
2120
.TP
 
2121
.B \-\-multihome
 
2122
Configure a multi-homed UDP server.  This option can be used when
 
2123
OpenVPN has been configured to listen on all interfaces, and will
 
2124
attempt to bind client sessions to the interface on which packets
 
2125
are being received, so that outgoing packets will be sent out
 
2126
of the same interface.  Note that this option is only relevant for
 
2127
UDP servers and currently is only implemented on Linux.
 
2128
 
 
2129
Note: clients connecting to a
 
2130
.B \-\-multihome
 
2131
server should always use the
 
2132
.B \-\-nobind
 
2133
option.
 
2134
.\"*********************************************************
 
2135
.TP
 
2136
.B \-\-echo [parms...]
 
2137
Echo
 
2138
.B parms
 
2139
to log output.
 
2140
 
 
2141
Designed to be used to send messages to a controlling application
 
2142
which is receiving the OpenVPN log output.
 
2143
.\"*********************************************************
 
2144
.TP
 
2145
.B \-\-remap-usr1 signal
 
2146
Control whether internally or externally
 
2147
generated SIGUSR1 signals are remapped to
 
2148
SIGHUP (restart without persisting state) or
 
2149
SIGTERM (exit).
 
2150
 
 
2151
.B signal
 
2152
can be set to "SIGHUP" or "SIGTERM".  By default, no remapping
 
2153
occurs.
 
2154
.\"*********************************************************
 
2155
.TP
 
2156
.B \-\-verb n
 
2157
Set output verbosity to
 
2158
.B n
 
2159
(default=1).  Each level shows all info from the previous levels.
 
2160
Level 3 is recommended if you want a good summary
 
2161
of what's happening without being swamped by output.
 
2162
 
 
2163
.B 0 \-\-
 
2164
No output except fatal errors.
 
2165
.br
 
2166
.B 1 to 4 \-\-
 
2167
Normal usage range.
 
2168
.br
 
2169
.B 5 \-\-
 
2170
Output
 
2171
.B R
 
2172
and
 
2173
.B W
 
2174
characters to the console for each packet read and write, uppercase is
 
2175
used for TCP/UDP packets and lowercase is used for TUN/TAP packets.
 
2176
.br
 
2177
.B 6 to 11 \-\-
 
2178
Debug info range (see errlevel.h for additional
 
2179
information on debug levels).
 
2180
.\"*********************************************************
 
2181
.TP
 
2182
.B \-\-status file [n]
 
2183
Write operational status to
 
2184
.B file
 
2185
every
 
2186
.B n
 
2187
seconds.
 
2188
 
 
2189
Status can also be written to the syslog by sending a
 
2190
.B SIGUSR2
 
2191
signal.
 
2192
.\"*********************************************************
 
2193
.TP
 
2194
.B \-\-status-version [n]
 
2195
Choose the status file format version number.  Currently
 
2196
.B n
 
2197
can be 1, 2, or 3 and defaults to 1.
 
2198
.\"*********************************************************
 
2199
.TP
 
2200
.B \-\-mute n
 
2201
Log at most
 
2202
.B n
 
2203
consecutive messages in the same category.  This is useful to
 
2204
limit repetitive logging of similar message types.
 
2205
.\"*********************************************************
 
2206
.TP
 
2207
.B \-\-comp-lzo [mode]
 
2208
Use fast LZO compression -- may add up to 1 byte per
 
2209
packet for incompressible data.
 
2210
.B mode
 
2211
may be "yes", "no", or "adaptive" (default).
 
2212
 
 
2213
In a server mode setup, it is possible to selectively turn
 
2214
compression on or off for individual clients.
 
2215
 
 
2216
First, make sure the client-side config file enables selective
 
2217
compression by having at least one
 
2218
.B \-\-comp-lzo
 
2219
directive, such as
 
2220
.B \-\-comp-lzo no.
 
2221
This will turn off compression by default,
 
2222
but allow a future directive push from the server to
 
2223
dynamically change the
 
2224
on/off/adaptive setting.
 
2225
 
 
2226
Next in a
 
2227
.B \-\-client-config-dir
 
2228
file, specify the compression setting for the client,
 
2229
for example:
 
2230
 
 
2231
.nf
 
2232
.ft 3
 
2233
.in +4
 
2234
comp-lzo yes
 
2235
push "comp-lzo yes"
 
2236
.in -4
 
2237
.ft
 
2238
.fi
 
2239
 
 
2240
The first line sets the
 
2241
.B comp-lzo
 
2242
setting for the server
 
2243
side of the link, the second sets the client side.
 
2244
.\"*********************************************************
 
2245
.TP
 
2246
.B \-\-comp-noadapt
 
2247
When used in conjunction with
 
2248
.B \-\-comp-lzo,
 
2249
this option will disable OpenVPN's adaptive compression algorithm.
 
2250
Normally, adaptive compression is enabled with
 
2251
.B \-\-comp-lzo.
 
2252
 
 
2253
Adaptive compression tries to optimize the case where you have
 
2254
compression enabled, but you are sending predominantly uncompressible
 
2255
(or pre-compressed) packets over the tunnel, such as an FTP or rsync transfer
 
2256
of a large, compressed file.  With adaptive compression,
 
2257
OpenVPN will periodically sample the compression process to measure its
 
2258
efficiency.  If the data being sent over the tunnel is already compressed,
 
2259
the compression efficiency will be very low, triggering openvpn to disable
 
2260
compression for a period of time until the next re-sample test.
 
2261
.\"*********************************************************
 
2262
.TP
 
2263
.B \-\-management IP port [pw-file]
 
2264
Enable a TCP server on
 
2265
.B IP:port
 
2266
to handle daemon management functions.
 
2267
.B pw-file,
 
2268
if specified,
 
2269
is a password file (password on first line)
 
2270
or "stdin" to prompt from standard input.  The password
 
2271
provided will set the password which TCP clients will need
 
2272
to provide in order to access management functions.
 
2273
 
 
2274
The management interface can also listen on a unix domain socket,
 
2275
for those platforms that support it.  To use a unix domain socket, specify
 
2276
the unix socket pathname in place of
 
2277
.B IP
 
2278
and set
 
2279
.B port
 
2280
to 'unix'.  While the default behavior is to create a unix domain socket
 
2281
that may be connected to by any process, the
 
2282
.B \-\-management-client-user
 
2283
and
 
2284
.B \-\-management-client-group
 
2285
directives can be used to restrict access.
 
2286
 
 
2287
The management interface provides a special mode where the TCP
 
2288
management link can operate over the tunnel itself.  To enable this mode,
 
2289
set
 
2290
.B IP
 
2291
= "tunnel".  Tunnel mode will cause the management interface
 
2292
to listen for a TCP connection on the local VPN address of the
 
2293
TUN/TAP interface.
 
2294
 
 
2295
While the management port is designed for programmatic control
 
2296
of OpenVPN by other applications, it is possible to telnet
 
2297
to the port, using a telnet client in "raw" mode.  Once connected,
 
2298
type "help" for a list of commands.
 
2299
 
 
2300
For detailed documentation on the management interface, see
 
2301
the management-notes.txt file in the
 
2302
.B management
 
2303
folder of
 
2304
the OpenVPN source distribution.
 
2305
 
 
2306
It is strongly recommended that
 
2307
.B IP
 
2308
be set to 127.0.0.1
 
2309
(localhost) to restrict accessibility of the management
 
2310
server to local clients. 
 
2311
.\"*********************************************************
 
2312
.TP
 
2313
.B \-\-management-query-passwords
 
2314
Query management channel for private key password and
 
2315
.B \-\-auth-user-pass
 
2316
username/password.  Only query the management channel
 
2317
for inputs which ordinarily would have been queried from the
 
2318
console.
 
2319
.\"*********************************************************
 
2320
.TP
 
2321
.B \-\-management-forget-disconnect
 
2322
Make OpenVPN forget passwords when management session
 
2323
disconnects.
 
2324
 
 
2325
This directive does not affect the
 
2326
.B \-\-http-proxy
 
2327
username/password.  It is always cached.
 
2328
.\"*********************************************************
 
2329
.TP
 
2330
.B \-\-management-hold
 
2331
Start OpenVPN in a hibernating state, until a client
 
2332
of the management interface explicitly starts it
 
2333
with the
 
2334
.B hold release
 
2335
command.
 
2336
.\"*********************************************************
 
2337
.TP
 
2338
.B \-\-management-signal
 
2339
Send SIGUSR1 signal to OpenVPN if management session disconnects.
 
2340
This is useful when you wish to disconnect an OpenVPN session on
 
2341
user logoff.
 
2342
.\"*********************************************************
 
2343
.TP
 
2344
.B \-\-management-log-cache n
 
2345
Cache the most recent
 
2346
.B n
 
2347
lines of log file history for usage
 
2348
by the management channel.
 
2349
.\"*********************************************************
 
2350
.TP
 
2351
.B \-\-management-client-auth
 
2352
Gives management interface client the responsibility
 
2353
to authenticate clients after their client certificate
 
2354
has been verified.  See management-notes.txt in OpenVPN
 
2355
distribution for detailed notes.
 
2356
.\"*********************************************************
 
2357
.TP
 
2358
.B \-\-management-client-pf
 
2359
Management interface clients must specify a packet
 
2360
filter file for each connecting client.  See management-notes.txt
 
2361
in OpenVPN distribution for detailed notes.
 
2362
.\"*********************************************************
 
2363
.TP
 
2364
.B \-\-management-client-user u
 
2365
When the management interface is listening on a unix domain socket,
 
2366
only allow connections from user
 
2367
.B u.
 
2368
.\"*********************************************************
 
2369
.TP
 
2370
.B \-\-management-client-group g
 
2371
When the management interface is listening on a unix domain socket,
 
2372
only allow connections from group
 
2373
.B g.
 
2374
.\"*********************************************************
 
2375
.TP
 
2376
.B \-\-plugin module-pathname [init-string]
 
2377
Load plug-in module from the file
 
2378
.B module-pathname,
 
2379
passing
 
2380
.B init-string
 
2381
as an argument
 
2382
to the module initialization function.  Multiple
 
2383
plugin modules may be loaded into one OpenVPN
 
2384
process.
 
2385
 
 
2386
For more information and examples on how to build OpenVPN
 
2387
plug-in modules, see the README file in the
 
2388
.B plugin
 
2389
folder of the OpenVPN source distribution.
 
2390
 
 
2391
If you are using an RPM install of OpenVPN, see
 
2392
/usr/share/openvpn/plugin.  The documentation is
 
2393
in
 
2394
.B doc
 
2395
and the actual plugin modules are in
 
2396
.B lib.
 
2397
 
 
2398
Multiple plugin modules can be cascaded, and modules can be
 
2399
used in tandem with scripts.  The modules will be called by
 
2400
OpenVPN in the order that they are declared in the config
 
2401
file.  If both a plugin and script are configured for the same
 
2402
callback, the script will be called last.  If the
 
2403
return code of the module/script controls an authentication
 
2404
function (such as tls-verify, auth-user-pass-verify, or
 
2405
client-connect), then
 
2406
every module and script must return success (0) in order for
 
2407
the connection to be authenticated.
 
2408
.\"*********************************************************
 
2409
.SS Server Mode
 
2410
Starting with OpenVPN 2.0, a multi-client TCP/UDP server mode
 
2411
is supported, and can be enabled with the
 
2412
.B \-\-mode server
 
2413
option.  In server mode, OpenVPN will listen on a single
 
2414
port for incoming client connections.  All client
 
2415
connections will be routed through a single tun or tap
 
2416
interface.  This mode is designed for scalability and should
 
2417
be able to support hundreds or even thousands of clients
 
2418
on sufficiently fast hardware.  SSL/TLS authentication must
 
2419
be used in this mode.
 
2420
.\"*********************************************************
 
2421
.TP
 
2422
.B \-\-server network netmask
 
2423
A helper directive designed to simplify the configuration
 
2424
of OpenVPN's server mode.  This directive will set up an
 
2425
OpenVPN server which will allocate addresses to clients
 
2426
out of the given network/netmask.  The server itself
 
2427
will take the ".1" address of the given network
 
2428
for use as the server-side endpoint of the local
 
2429
TUN/TAP interface.
 
2430
 
 
2431
For example,
 
2432
.B \-\-server 10.8.0.0 255.255.255.0
 
2433
expands as follows:
 
2434
 
 
2435
.nf
 
2436
.ft 3
 
2437
.in +4
 
2438
 mode server
 
2439
 tls-server
 
2440
 push "topology [topology]"
 
2441
 
 
2442
 if dev tun AND (topology == net30 OR topology == p2p):
 
2443
   ifconfig 10.8.0.1 10.8.0.2
 
2444
   if !nopool:
 
2445
     ifconfig-pool 10.8.0.4 10.8.0.251
 
2446
   route 10.8.0.0 255.255.255.0
 
2447
   if client-to-client:
 
2448
     push "route 10.8.0.0 255.255.255.0"
 
2449
   else if topology == net30:
 
2450
     push "route 10.8.0.1"
 
2451
 
 
2452
 if dev tap OR (dev tun AND topology == subnet):
 
2453
   ifconfig 10.8.0.1 255.255.255.0
 
2454
   if !nopool:
 
2455
     ifconfig-pool 10.8.0.2 10.8.0.254 255.255.255.0
 
2456
   push "route-gateway 10.8.0.1"
 
2457
.in -4
 
2458
.ft
 
2459
.fi
 
2460
 
 
2461
Don't use
 
2462
.B \-\-server
 
2463
if you are ethernet bridging.  Use
 
2464
.B \-\-server-bridge
 
2465
instead.
 
2466
.\"*********************************************************
 
2467
.TP
 
2468
.B \-\-server-bridge gateway netmask pool-start-IP pool-end-IP
 
2469
.TP
 
2470
.B \-\-server-bridge ['nogw']
 
2471
 
 
2472
A helper directive similar to
 
2473
.B \-\-server
 
2474
which is designed to simplify the configuration
 
2475
of OpenVPN's server mode in ethernet bridging configurations.
 
2476
 
 
2477
If
 
2478
.B \-\-server-bridge
 
2479
is used without any parameters, it will enable a DHCP-proxy
 
2480
mode, where connecting OpenVPN clients will receive an IP
 
2481
address for their TAP adapter from the DHCP server running
 
2482
on the OpenVPN server-side LAN.
 
2483
Note that only clients that support
 
2484
the binding of a DHCP client with the TAP adapter (such as
 
2485
Windows) can support this mode.  The optional 
 
2486
.B nogw
 
2487
flag (advanced) indicates that gateway information should not be
 
2488
pushed to the client.
 
2489
 
 
2490
To configure ethernet bridging, you 
 
2491
must first use your OS's bridging capability
 
2492
to bridge the TAP interface with the ethernet
 
2493
NIC interface.  For example, on Linux this is done
 
2494
with the
 
2495
.B brctl
 
2496
tool, and with Windows XP it is done in the Network
 
2497
Connections Panel by selecting the ethernet and
 
2498
TAP adapters and right-clicking on "Bridge Connections".
 
2499
 
 
2500
Next you you must manually set the
 
2501
IP/netmask on the bridge interface.  The
 
2502
.B gateway
 
2503
and
 
2504
.B netmask
 
2505
parameters to
 
2506
.B \-\-server-bridge
 
2507
can be set to either the IP/netmask of the
 
2508
bridge interface, or the IP/netmask of the
 
2509
default gateway/router on the bridged
 
2510
subnet.
 
2511
 
 
2512
Finally, set aside a IP range in the bridged
 
2513
subnet,
 
2514
denoted by
 
2515
.B pool-start-IP
 
2516
and
 
2517
.B pool-end-IP,
 
2518
for OpenVPN to allocate to connecting
 
2519
clients.
 
2520
 
 
2521
For example,
 
2522
.B server-bridge 10.8.0.4 255.255.255.0 10.8.0.128 10.8.0.254
 
2523
expands as follows:
 
2524
 
 
2525
.nf
 
2526
.ft 3
 
2527
.in +4
 
2528
mode server
 
2529
tls-server
 
2530
 
 
2531
ifconfig-pool 10.8.0.128 10.8.0.254 255.255.255.0
 
2532
push "route-gateway 10.8.0.4"
 
2533
.in -4
 
2534
.ft
 
2535
.fi
 
2536
 
 
2537
In another example,
 
2538
.B \-\-server-bridge
 
2539
(without parameters) expands as follows:
 
2540
 
 
2541
.nf
 
2542
.ft 3
 
2543
.in +4
 
2544
mode server
 
2545
tls-server
 
2546
 
 
2547
push "route-gateway dhcp"
 
2548
.in -4
 
2549
.ft
 
2550
.fi
 
2551
 
 
2552
Or
 
2553
.B \-\-server-bridge nogw
 
2554
expands as follows:
 
2555
 
 
2556
.nf
 
2557
.ft 3
 
2558
.in +4
 
2559
mode server
 
2560
tls-server
 
2561
.in -4
 
2562
.ft
 
2563
.fi
 
2564
.\"*********************************************************
 
2565
.TP
 
2566
.B \-\-push "option"
 
2567
Push a config file option back to the client for remote
 
2568
execution.  Note that
 
2569
.B
 
2570
option
 
2571
must be enclosed in double quotes ("").  The client must specify
 
2572
.B \-\-pull
 
2573
in its config file.  The set of options which can be
 
2574
pushed is limited by both feasibility and security.
 
2575
Some options such as those which would execute scripts
 
2576
are banned, since they would effectively allow a compromised
 
2577
server to execute arbitrary code on the client.
 
2578
Other options such as TLS or MTU parameters
 
2579
cannot be pushed because the client needs to know
 
2580
them before the connection to the server can be initiated.
 
2581
 
 
2582
This is a partial list of options which can currently be pushed:
 
2583
.B \-\-route, \-\-route-gateway, \-\-route-delay, \-\-redirect-gateway,
 
2584
.B \-\-ip-win32, \-\-dhcp-option,
 
2585
.B \-\-inactive, \-\-ping, \-\-ping-exit, \-\-ping-restart,
 
2586
.B \-\-setenv,
 
2587
.B \-\-persist-key, \-\-persist-tun, \-\-echo,
 
2588
.B \-\-comp-lzo,
 
2589
.B \-\-socket-flags,
 
2590
.B \-\-sndbuf, \-\-rcvbuf
 
2591
.\"*********************************************************
 
2592
.TP
 
2593
.B \-\-push-reset
 
2594
Don't inherit the global push list for a specific client instance.
 
2595
Specify this option in a client-specific context such
 
2596
as with a
 
2597
.B \-\-client-config-dir
 
2598
configuration file.  This option will ignore
 
2599
.B \-\-push
 
2600
options at the global config file level.
 
2601
.\"*********************************************************
 
2602
.TP
 
2603
.B \-\-disable
 
2604
Disable a particular client (based on the common name)
 
2605
from connecting.  Don't use this option to disable a client
 
2606
due to key or password compromise.  Use a CRL (certificate
 
2607
revocation list) instead (see the
 
2608
.B \-\-crl-verify
 
2609
option).
 
2610
 
 
2611
This option must be associated with a specific client instance,
 
2612
which means that it must be specified either in a client
 
2613
instance config file using
 
2614
.B \-\-client-config-dir
 
2615
or dynamically generated using a
 
2616
.B \-\-client-connect
 
2617
script.
 
2618
.\"*********************************************************
 
2619
.TP
 
2620
.B \-\-ifconfig-pool start-IP end-IP [netmask]
 
2621
Set aside a pool of subnets to be
 
2622
dynamically allocated to connecting clients, similar
 
2623
to a DHCP server.  For tun-style
 
2624
tunnels, each client will be given a /30 subnet (for
 
2625
interoperability with Windows clients).  For tap-style
 
2626
tunnels, individual addresses will be allocated, and the
 
2627
optional
 
2628
.B netmask
 
2629
parameter will also be pushed to clients.
 
2630
 
 
2631
.\"*********************************************************
 
2632
.TP
 
2633
.B \-\-ifconfig-pool-persist file [seconds]
 
2634
Persist/unpersist ifconfig-pool
 
2635
data to
 
2636
.B file,
 
2637
at
 
2638
.B seconds
 
2639
intervals (default=600), as well as on program startup and
 
2640
shutdown.
 
2641
 
 
2642
The goal of this option is to provide a long-term association
 
2643
between clients (denoted by their common name) and the virtual
 
2644
IP address assigned to them from the ifconfig-pool.
 
2645
Maintaining a long-term
 
2646
association is good for clients because it allows them
 
2647
to effectively use the
 
2648
.B \-\-persist-tun
 
2649
option.
 
2650
 
 
2651
.B file
 
2652
is a comma-delimited ASCII file, formatted as
 
2653
<Common-Name>,<IP-address>.
 
2654
 
 
2655
If
 
2656
.B seconds
 
2657
= 0,
 
2658
.B file
 
2659
will be treated as read-only.  This is useful if
 
2660
you would like to treat
 
2661
.B file
 
2662
as a configuration file.
 
2663
 
 
2664
Note that the entries in this file are treated by OpenVPN as
 
2665
suggestions only, based on past associations between
 
2666
a common name and IP address.  They do not guarantee that the given common
 
2667
name will always receive the given IP address.  If you want guaranteed
 
2668
assignment, use
 
2669
.B \-\-ifconfig-push
 
2670
.\"*********************************************************
 
2671
.TP
 
2672
.B \-\-ifconfig-pool-linear
 
2673
Modifies the
 
2674
.B \-\-ifconfig-pool
 
2675
directive to
 
2676
allocate individual TUN interface addresses for
 
2677
clients rather than /30 subnets.  NOTE:  This option
 
2678
is incompatible with Windows clients.
 
2679
 
 
2680
This option is deprecated, and should be replaced with
 
2681
.B \-\-topology p2p
 
2682
which is functionally equivalent.
 
2683
.\"*********************************************************
 
2684
.TP
 
2685
.B \-\-ifconfig-push local remote-netmask
 
2686
Push virtual IP endpoints for client tunnel,
 
2687
overriding the \-\-ifconfig-pool dynamic allocation.
 
2688
 
 
2689
The parameters
 
2690
.B local
 
2691
and
 
2692
.B remote-netmask
 
2693
are set according to the
 
2694
.B \-\-ifconfig
 
2695
directive which you want to execute on the client machine to
 
2696
configure the remote end of the tunnel.  Note that the parameters
 
2697
.B local
 
2698
and
 
2699
.B remote-netmask
 
2700
are from the perspective of the client, not the server.  They may be
 
2701
DNS names rather than IP addresses, in which case they will be resolved
 
2702
on the server at the time of client connection.
 
2703
 
 
2704
This option must be associated with a specific client instance,
 
2705
which means that it must be specified either in a client
 
2706
instance config file using
 
2707
.B \-\-client-config-dir
 
2708
or dynamically generated using a
 
2709
.B \-\-client-connect
 
2710
script.
 
2711
 
 
2712
Remember also to include a
 
2713
.B \-\-route
 
2714
directive in the main OpenVPN config file which encloses
 
2715
.B local,
 
2716
so that the kernel will know to route it
 
2717
to the server's TUN/TAP interface.
 
2718
 
 
2719
OpenVPN's internal client IP address selection algorithm works as
 
2720
follows:
 
2721
 
 
2722
.B 1
 
2723
\-\- Use
 
2724
.B \-\-client-connect script
 
2725
generated file for static IP (first choice).
 
2726
.br
 
2727
.B 2
 
2728
\-\- Use
 
2729
.B \-\-client-config-dir
 
2730
file for static IP (next choice).
 
2731
.br
 
2732
.B 3
 
2733
\-\- Use
 
2734
.B \-\-ifconfig-pool
 
2735
allocation for dynamic IP (last choice).
 
2736
.br
 
2737
.\"*********************************************************
 
2738
.TP
 
2739
.B \-\-iroute network [netmask]
 
2740
Generate an internal route to a specific
 
2741
client. The
 
2742
.B netmask
 
2743
parameter, if omitted, defaults to 255.255.255.255.
 
2744
 
 
2745
This directive can be used to route a fixed subnet from
 
2746
the server to a particular client, regardless
 
2747
of where the client is connecting from.  Remember
 
2748
that you must also add the route to the system
 
2749
routing table as well (such as by using the
 
2750
.B \-\-route
 
2751
directive).  The reason why two routes are needed
 
2752
is that the
 
2753
.B \-\-route
 
2754
directive routes the packet from the kernel
 
2755
to OpenVPN.  Once in OpenVPN, the
 
2756
.B \-\-iroute
 
2757
directive routes to the specific client.
 
2758
 
 
2759
This option must be specified either in a client
 
2760
instance config file using
 
2761
.B \-\-client-config-dir
 
2762
or dynamically generated using a
 
2763
.B \-\-client-connect
 
2764
script.
 
2765
 
 
2766
The
 
2767
.B \-\-iroute
 
2768
directive also has an important interaction with
 
2769
.B \-\-push
 
2770
"route ...".
 
2771
.B \-\-iroute
 
2772
essentially defines a subnet which is owned by a
 
2773
particular client (we will call this client A).
 
2774
If you would like other clients to be able to reach A's
 
2775
subnet, you can use
 
2776
.B \-\-push
 
2777
"route ..."
 
2778
together with
 
2779
.B \-\-client-to-client
 
2780
to effect this.  In order for all clients to see
 
2781
A's subnet, OpenVPN must push this route to all clients
 
2782
EXCEPT for A, since the subnet is already owned by A.
 
2783
OpenVPN accomplishes this by not
 
2784
not pushing a route to a client
 
2785
if it matches one of the client's iroutes.
 
2786
.\"*********************************************************
 
2787
.TP
 
2788
.B \-\-client-to-client
 
2789
Because the OpenVPN server mode handles multiple clients
 
2790
through a single tun or tap interface, it is effectively
 
2791
a router.  The
 
2792
.B \-\-client-to-client
 
2793
flag tells OpenVPN to internally route client-to-client
 
2794
traffic rather than pushing all client-originating traffic
 
2795
to the TUN/TAP interface.
 
2796
 
 
2797
When this option is used, each client will "see" the other
 
2798
clients which are currently connected.  Otherwise, each
 
2799
client will only see the server.  Don't use this option
 
2800
if you want to firewall tunnel traffic using
 
2801
custom, per-client rules.
 
2802
.\"*********************************************************
 
2803
.TP
 
2804
.B \-\-duplicate-cn
 
2805
Allow multiple clients with the same common name to concurrently connect.
 
2806
In the absence of this option, OpenVPN will disconnect a client instance
 
2807
upon connection of a new client having the same common name.
 
2808
.\"*********************************************************
 
2809
.TP
 
2810
.B \-\-client-connect script
 
2811
Run
 
2812
.B script
 
2813
on client connection.  The script is passed the common name
 
2814
and IP address of the just-authenticated client
 
2815
as environmental variables (see environmental variable section
 
2816
below).  The script is also passed
 
2817
the pathname of a not-yet-created temporary file as $1
 
2818
(i.e. the first command line argument), to be used by the script
 
2819
to pass dynamically generated config file directives back to OpenVPN.
 
2820
 
 
2821
If the script wants to generate a dynamic config file
 
2822
to be applied on the server when the client connects,
 
2823
it should write it to the file named by $1.
 
2824
 
 
2825
See the
 
2826
.B \-\-client-config-dir
 
2827
option below for options which
 
2828
can be legally used in a dynamically generated config file.
 
2829
 
 
2830
Note that the return value of
 
2831
.B script
 
2832
is significant.  If
 
2833
.B script
 
2834
returns a non-zero error status, it will cause the client
 
2835
to be disconnected.
 
2836
.\"*********************************************************
 
2837
.TP
 
2838
.B \-\-client-disconnect
 
2839
Like
 
2840
.B \-\-client-connect
 
2841
but called on client instance shutdown.  Will not be called
 
2842
unless the
 
2843
.B \-\-client-connect
 
2844
script and plugins (if defined)
 
2845
were previously called on this instance with
 
2846
successful (0) status returns.
 
2847
 
 
2848
The exception to this rule is if the
 
2849
.B \-\-client-disconnect
 
2850
script or plugins are cascaded, and at least one client-connect
 
2851
function succeeded, then ALL of the client-disconnect functions for
 
2852
scripts and plugins will be called on client instance object deletion,
 
2853
even in cases where some of the related client-connect functions returned
 
2854
an error status.
 
2855
.B 
 
2856
.\"*********************************************************
 
2857
.TP
 
2858
.B \-\-client-config-dir dir
 
2859
Specify a directory
 
2860
.B dir
 
2861
for custom client config files.  After
 
2862
a connecting client has been authenticated, OpenVPN will
 
2863
look in this directory for a file having the same name
 
2864
as the client's X509 common name.  If a matching file
 
2865
exists, it will be opened and parsed for client-specific
 
2866
configuration options.  If no matching file is found, OpenVPN
 
2867
will instead try to open and parse a default file called
 
2868
"DEFAULT", which may be provided but is not required.
 
2869
 
 
2870
This file can specify a fixed IP address for a given
 
2871
client using
 
2872
.B \-\-ifconfig-push,
 
2873
as well as fixed subnets owned by the client using
 
2874
.B \-\-iroute.
 
2875
 
 
2876
One of the useful properties of this option is that it
 
2877
allows client configuration files to be conveniently
 
2878
created, edited, or removed while the server is live,
 
2879
without needing to restart the server.
 
2880
 
 
2881
The following
 
2882
options are legal in a client-specific context:
 
2883
.B \-\-push, \-\-push-reset, \-\-iroute, \-\-ifconfig-push,
 
2884
and
 
2885
.B \-\-config.
 
2886
.\"*********************************************************
 
2887
.TP
 
2888
.B \-\-ccd-exclusive
 
2889
Require, as a
 
2890
condition of authentication, that a connecting client has a
 
2891
.B \-\-client-config-dir
 
2892
file.
 
2893
.\"*********************************************************
 
2894
.TP
 
2895
.B \-\-tmp-dir dir
 
2896
Specify a directory
 
2897
.B dir
 
2898
for temporary files.  This directory will be used by
 
2899
.B \-\-client-connect
 
2900
scripts to dynamically generate client-specific
 
2901
configuration files.
 
2902
.\"*********************************************************
 
2903
.TP
 
2904
.B \-\-hash-size r v
 
2905
Set the size of the real address hash table to
 
2906
.B r
 
2907
and the virtual address table to
 
2908
.B v.
 
2909
By default, both tables are sized at 256 buckets.
 
2910
.\"*********************************************************
 
2911
.TP
 
2912
.B \-\-bcast-buffers n
 
2913
Allocate
 
2914
.B n
 
2915
buffers for broadcast datagrams (default=256).
 
2916
.\"*********************************************************
 
2917
.TP
 
2918
.B \-\-tcp-queue-limit n
 
2919
Maximum number of output packets queued before TCP (default=64).
 
2920
 
 
2921
When OpenVPN is tunneling data from a TUN/TAP device to a
 
2922
remote client over a TCP connection, it is possible that the TUN/TAP device
 
2923
might produce data at a faster rate than the TCP connection
 
2924
can support.  When the number of output packets queued before sending to
 
2925
the TCP socket reaches this limit for a given client connection,
 
2926
OpenVPN will start to drop outgoing packets directed
 
2927
at this client.
 
2928
.\"*********************************************************
 
2929
.TP
 
2930
.B \-\-tcp-nodelay
 
2931
This macro sets the TCP_NODELAY socket flag on the server
 
2932
as well as pushes it to connecting clients.  The TCP_NODELAY
 
2933
flag disables the Nagle algorithm on TCP sockets causing
 
2934
packets to be transmitted immediately with low latency,
 
2935
rather than waiting a short period of time in order
 
2936
to aggregate several packets into a larger containing
 
2937
packet.  In VPN applications over TCP, TCP_NODELAY
 
2938
is generally a good latency optimization.
 
2939
 
 
2940
The macro expands as follows:
 
2941
 
 
2942
.nf
 
2943
.ft 3
 
2944
.in +4
 
2945
 if mode server:
 
2946
   socket-flags TCP_NODELAY
 
2947
   push "socket-flags TCP_NODELAY"
 
2948
.in -4
 
2949
.ft
 
2950
.fi
 
2951
.\"*********************************************************
 
2952
.TP
 
2953
.B \-\-max-clients n
 
2954
Limit server to a maximum of
 
2955
.B n
 
2956
concurrent clients.
 
2957
.\"*********************************************************
 
2958
.TP
 
2959
.B \-\-max-routes-per-client n
 
2960
Allow a maximum of
 
2961
.B n
 
2962
internal routes per client (default=256).
 
2963
This is designed to
 
2964
help contain DoS attacks where an authenticated client floods the
 
2965
server with packets appearing to come from many unique MAC addresses,
 
2966
forcing the server to deplete
 
2967
virtual memory as its internal routing table expands.
 
2968
This directive can be used in a
 
2969
.B \-\-client-config-dir
 
2970
file or auto-generated by a
 
2971
.B \-\-client-connect
 
2972
script to override the global value for a particular client.
 
2973
 
 
2974
Note that this
 
2975
directive affects OpenVPN's internal routing table, not the
 
2976
kernel routing table.
 
2977
.\"*********************************************************
 
2978
.TP
 
2979
.B \-\-connect-freq n sec
 
2980
Allow a maximum of
 
2981
.B n
 
2982
new connections per
 
2983
.B sec 
 
2984
seconds from clients.  This is designed to contain DoS attacks which flood
 
2985
the server with connection requests using certificates which
 
2986
will ultimately fail to authenticate.
 
2987
 
 
2988
This is an imperfect solution however, because in a real
 
2989
DoS scenario, legitimate connections might also be refused.
 
2990
 
 
2991
For the best protection against DoS attacks in server mode,
 
2992
use
 
2993
.B \-\-proto udp
 
2994
and
 
2995
.B \-\-tls-auth.
 
2996
.\"*********************************************************
 
2997
.TP
 
2998
.B \-\-learn-address cmd
 
2999
Run script or shell command
 
3000
.B cmd
 
3001
to validate client virtual addresses or routes.
 
3002
 
 
3003
.B cmd
 
3004
will be executed with 3 parameters:
 
3005
 
 
3006
.B [1] operation \-\-
 
3007
"add", "update", or "delete" based on whether or not
 
3008
the address is being added to, modified, or deleted from
 
3009
OpenVPN's internal routing table.
 
3010
.br
 
3011
.B [2] address \-\-
 
3012
The address being learned or unlearned.  This can be
 
3013
an IPv4 address such as "198.162.10.14", an IPv4 subnet
 
3014
such as "198.162.10.0/24", or an ethernet MAC address (when
 
3015
.B \-\-dev tap
 
3016
is being used) such as "00:FF:01:02:03:04".
 
3017
.br
 
3018
.B [3] common name \-\-
 
3019
The common name on the certificate associated with the
 
3020
client linked to this address.  Only present for "add"
 
3021
or "update" operations, not "delete".
 
3022
 
 
3023
On "add" or "update" methods, if the script returns
 
3024
a failure code (non-zero), OpenVPN will reject the address
 
3025
and will not modify its internal routing table.
 
3026
 
 
3027
Normally, the
 
3028
.B cmd
 
3029
script will use the information provided above to set
 
3030
appropriate firewall entries on the VPN TUN/TAP interface.
 
3031
Since OpenVPN provides the association between virtual IP
 
3032
or MAC address and the client's authenticated common name,
 
3033
it allows a user-defined script to configure firewall access
 
3034
policies with regard to the client's high-level common name,
 
3035
rather than the low level client virtual addresses.
 
3036
.\"*********************************************************
 
3037
.TP
 
3038
.B \-\-auth-user-pass-verify script method
 
3039
Require the client to provide a username/password (possibly
 
3040
in addition to a client certificate) for authentication.
 
3041
 
 
3042
OpenVPN will execute
 
3043
.B script
 
3044
as a shell command to validate the username/password
 
3045
provided by the client.
 
3046
 
 
3047
If
 
3048
.B method
 
3049
is set to "via-env", OpenVPN will call
 
3050
.B script
 
3051
with the environmental variables
 
3052
.B username
 
3053
and
 
3054
.B password
 
3055
set to the username/password strings provided by the client.
 
3056
Be aware that this method is insecure on some platforms which
 
3057
make the environment of a process publicly visible to other
 
3058
unprivileged processes.
 
3059
 
 
3060
If
 
3061
.B method
 
3062
is set to "via-file", OpenVPN will write the username and
 
3063
password to the first two lines of a temporary file.  The filename
 
3064
will be passed as an argument to
 
3065
.B script,
 
3066
and the file will be automatically deleted by OpenVPN after
 
3067
the script returns.  The location of the temporary file is
 
3068
controlled by the
 
3069
.B \-\-tmp-dir
 
3070
option, and will default to the current directory if unspecified.
 
3071
For security, consider setting 
 
3072
.B \-\-tmp-dir
 
3073
to a volatile storage medium such as
 
3074
.B /dev/shm
 
3075
(if available) to prevent the username/password file from touching the hard drive.
 
3076
 
 
3077
The script should examine the username
 
3078
and password,
 
3079
returning a success exit code (0) if the
 
3080
client's authentication request is to be accepted, or a failure
 
3081
code (1) to reject the client.
 
3082
 
 
3083
This directive is designed to enable a plugin-style interface
 
3084
for extending OpenVPN's authentication capabilities.
 
3085
 
 
3086
To protect against a client passing a maliciously formed
 
3087
username or password string, the username string must
 
3088
consist only of these characters: alphanumeric, underbar
 
3089
('_'), dash ('-'), dot ('.'), or at ('@').  The password
 
3090
string can consist of any printable characters except for
 
3091
CR or LF.  Any illegal characters in either the username
 
3092
or password string will be converted to underbar ('_').
 
3093
 
 
3094
Care must be taken by any user-defined scripts to avoid
 
3095
creating a security vulnerability in the way that these
 
3096
strings are handled.  Never use these strings in such a way
 
3097
that they might be escaped or evaluated by a shell interpreter.
 
3098
 
 
3099
For a sample script that performs PAM authentication, see
 
3100
.B sample-scripts/auth-pam.pl
 
3101
in the OpenVPN source distribution.
 
3102
.\"*********************************************************
 
3103
.TP
 
3104
.B \-\-opt-verify
 
3105
Clients that connect with options that are incompatible
 
3106
with those of the server will be disconnected.
 
3107
 
 
3108
Options that will be compared for compatibility include
 
3109
dev-type, link-mtu, tun-mtu, proto, tun-ipv6, ifconfig,
 
3110
comp-lzo, fragment, keydir, cipher, auth, keysize, secret,
 
3111
no-replay, no-iv, tls-auth, key-method, tls-server, and tls-client.
 
3112
 
 
3113
This option requires that
 
3114
.B \-\-disable-occ
 
3115
NOT be used.
 
3116
.\"*********************************************************
 
3117
.TP
 
3118
.B \-\-auth-user-pass-optional
 
3119
Allow connections by clients that do not specify a username/password.
 
3120
Normally, when
 
3121
.B \-\-auth-user-pass-verify
 
3122
or
 
3123
.B \-\-management-client-auth
 
3124
is specified (or an authentication plugin module), the
 
3125
OpenVPN server daemon will require connecting clients to specify a
 
3126
username and password.  This option makes the submission of a username/password
 
3127
by clients optional, passing the responsibility to the user-defined authentication
 
3128
module/script to accept or deny the client based on other factors
 
3129
(such as the setting of X509 certificate fields).  When this option is used,
 
3130
and a connecting client does not submit a username/password, the user-defined
 
3131
authentication module/script will see the username and password as being set
 
3132
to empty strings ("").  The authentication module/script MUST have logic
 
3133
to detect this condition and respond accordingly.
 
3134
.\"*********************************************************
 
3135
.TP
 
3136
.B \-\-client-cert-not-required
 
3137
Don't require client certificate, client will authenticate
 
3138
using username/password only.  Be aware that using this directive
 
3139
is less secure than requiring certificates from all clients.
 
3140
 
 
3141
If you use this directive, the
 
3142
entire responsibility of authentication will rest on your
 
3143
.B \-\-auth-user-pass-verify
 
3144
script, so keep in mind that bugs in your script
 
3145
could potentially compromise the security of your VPN.
 
3146
 
 
3147
If you don't use this directive, but you also specify an
 
3148
.B \-\-auth-user-pass-verify
 
3149
script, then OpenVPN will perform double authentication.  The
 
3150
client certificate verification AND the
 
3151
.B \-\-auth-user-pass-verify
 
3152
script will need to succeed in order for a client to be
 
3153
authenticated and accepted onto the VPN.
 
3154
.\"*********************************************************
 
3155
.TP
 
3156
.B \-\-username-as-common-name
 
3157
For
 
3158
.B \-\-auth-user-pass-verify
 
3159
authentication, use
 
3160
the authenticated username as the common name,
 
3161
rather than the common name from the client cert.
 
3162
.\"*********************************************************
 
3163
.TP
 
3164
.B \-\-no-name-remapping
 
3165
Allow Common Name, X509 Subject, and username strings to include
 
3166
any printable character including space, but excluding control
 
3167
characters such as tab, newline, and carriage-return.
 
3168
 
 
3169
By default, OpenVPN will remap
 
3170
any character other than alphanumeric, underbar ('_'), dash
 
3171
('-'), dot ('.'), and slash ('/') to underbar ('_').  The X509
 
3172
Subject string as returned by the
 
3173
.B tls_id
 
3174
environmental variable, can additionally contain colon (':') or
 
3175
equal ('=').
 
3176
 
 
3177
While name remapping is performed for security reasons to reduce
 
3178
the possibility of introducing string expansion security vulnerabilities
 
3179
in user-defined authentication
 
3180
scripts, this option is provided for those cases where it is desirable to
 
3181
disable the remapping feature.  Don't use this option unless you 
 
3182
know what you are doing!
 
3183
.\"*********************************************************
 
3184
.TP
 
3185
.B \-\-port-share host port
 
3186
When run in TCP server mode, share the OpenVPN port with
 
3187
another application, such as an HTTPS server.  If OpenVPN
 
3188
senses a connection to its port which is using a non-OpenVPN
 
3189
protocol, it will proxy the connection to the server at
 
3190
.B host:port.
 
3191
Currently only designed to work with HTTP/HTTPS,
 
3192
though it would be theoretically possible to extend to
 
3193
other protocols such as ssh.
 
3194
 
 
3195
Not implemented on Windows.
 
3196
.\"*********************************************************
 
3197
.SS Client Mode
 
3198
Use client mode when connecting to an OpenVPN server
 
3199
which has
 
3200
.B \-\-server, \-\-server-bridge,
 
3201
or
 
3202
.B \-\-mode server
 
3203
in it's configuration.
 
3204
.\"*********************************************************
 
3205
.TP
 
3206
.B \-\-client
 
3207
A helper directive designed to simplify the configuration
 
3208
of OpenVPN's client mode.  This directive is equivalent to:
 
3209
 
 
3210
.nf
 
3211
.ft 3
 
3212
.in +4
 
3213
 pull
 
3214
 tls-client
 
3215
.in -4
 
3216
.ft
 
3217
.fi
 
3218
.\"*********************************************************
 
3219
.TP
 
3220
.B \-\-pull
 
3221
This option must be used on a client which is connecting
 
3222
to a multi-client server.  It indicates to OpenVPN that it
 
3223
should accept options pushed by the server, provided they
 
3224
are part of the legal set of pushable options (note that the
 
3225
.B \-\-pull
 
3226
option is implied by
 
3227
.B \-\-client
 
3228
).
 
3229
 
 
3230
In particular,
 
3231
.B \-\-pull
 
3232
allows the server to push routes to the client, so you should
 
3233
not use
 
3234
.B \-\-pull
 
3235
or
 
3236
.B \-\-client
 
3237
in situations where you don't trust the server to have control
 
3238
over the client's routing table.
 
3239
.\"*********************************************************
 
3240
.TP
 
3241
.B \-\-auth-user-pass [up]
 
3242
Authenticate with server using username/password.
 
3243
.B up
 
3244
is a file containing username/password on 2 lines (Note: OpenVPN
 
3245
will only read passwords from a file if it has been built
 
3246
with the \-\-enable-password-save configure option, or on Windows
 
3247
by defining ENABLE_PASSWORD_SAVE in config-win32.h).
 
3248
 
 
3249
If
 
3250
.B up
 
3251
is omitted, username/password will be prompted from the
 
3252
console.
 
3253
 
 
3254
The server configuration must specify an
 
3255
.B \-\-auth-user-pass-verify
 
3256
script to verify the username/password provided by
 
3257
the client.
 
3258
.\"*********************************************************
 
3259
.TP
 
3260
.B \-\-auth-retry type
 
3261
Controls how OpenVPN responds to username/password verification
 
3262
errors such as the client-side response to an AUTH_FAILED message from the server
 
3263
or verification failure of the private key password.
 
3264
 
 
3265
Normally used to prevent auth errors from being fatal
 
3266
on the client side, and to permit username/password requeries in case
 
3267
of error.
 
3268
 
 
3269
An AUTH_FAILED message is generated by the server if the client
 
3270
fails
 
3271
.B \-\-auth-user-pass
 
3272
authentication, or if the server-side
 
3273
.B \-\-client-connect
 
3274
script returns an error status when the client
 
3275
tries to connect.
 
3276
 
 
3277
.B type
 
3278
can be one of:
 
3279
 
 
3280
.B none --
 
3281
Client will exit with a fatal error (this is the default).
 
3282
.br
 
3283
.B nointeract --
 
3284
Client will retry the connection without requerying for an
 
3285
.B \-\-auth-user-pass
 
3286
username/password.  Use this option for unattended clients.
 
3287
.br
 
3288
.B interact --
 
3289
Client will requery for an
 
3290
.B \-\-auth-user-pass
 
3291
username/password and/or private key password before attempting a reconnection.
 
3292
 
 
3293
Note that while this option cannot be pushed, it can be controlled
 
3294
from the management interface.
 
3295
.\"*********************************************************
 
3296
.TP
 
3297
.B \-\-server-poll-timeout n
 
3298
when polling possible remote servers to connect to
 
3299
in a round-robin fashion, spend no more than
 
3300
.B n
 
3301
seconds waiting for a response before trying the next server.
 
3302
.\"*********************************************************
 
3303
.TP
 
3304
.B \-\-explicit-exit-notify [n]
 
3305
In UDP client mode or point-to-point mode, send server/peer an exit notification
 
3306
if tunnel is restarted or OpenVPN process is exited.  In client mode, on
 
3307
exit/restart, this
 
3308
option will tell the server to immediately close its client instance object
 
3309
rather than waiting for a timeout.  The
 
3310
.B n
 
3311
parameter (default=1) controls the maximum number of retries that the client
 
3312
will attempt to resend the exit notification message.
 
3313
.\"*********************************************************
 
3314
.SS Data Channel Encryption Options:
 
3315
These options are meaningful for both Static & TLS-negotiated key modes
 
3316
(must be compatible between peers).
 
3317
.\"*********************************************************
 
3318
.TP
 
3319
.B \-\-secret file [direction]
 
3320
Enable Static Key encryption mode (non-TLS).
 
3321
Use pre-shared secret
 
3322
.B file
 
3323
which was generated with
 
3324
.B \-\-genkey.
 
3325
 
 
3326
The optional
 
3327
.B direction
 
3328
parameter enables the use of 4 distinct keys
 
3329
(HMAC-send, cipher-encrypt, HMAC-receive, cipher-decrypt), so that
 
3330
each data flow direction has a different set of HMAC and cipher keys.
 
3331
This has a number of desirable security properties including
 
3332
eliminating certain kinds of DoS and message replay attacks.
 
3333
 
 
3334
When the
 
3335
.B direction
 
3336
parameter is omitted, 2 keys are used bidirectionally, one for HMAC
 
3337
and the other for encryption/decryption.
 
3338
 
 
3339
The
 
3340
.B direction
 
3341
parameter should always be complementary on either side of the connection,
 
3342
i.e. one side should use "0" and the other should use "1", or both sides
 
3343
should omit it altogether.
 
3344
 
 
3345
The
 
3346
.B direction
 
3347
parameter requires that
 
3348
.B file
 
3349
contains a 2048 bit key.  While pre-1.5 versions of OpenVPN
 
3350
generate 1024 bit key files, any version of OpenVPN which
 
3351
supports the
 
3352
.B direction
 
3353
parameter, will also support 2048 bit key file generation
 
3354
using the
 
3355
.B \-\-genkey
 
3356
option.
 
3357
 
 
3358
Static key encryption mode has certain advantages,
 
3359
the primary being ease of configuration.
 
3360
 
 
3361
There are no certificates
 
3362
or certificate authorities or complicated negotiation handshakes and protocols.
 
3363
The only requirement is that you have a pre-existing secure channel with
 
3364
your peer (such as
 
3365
.B ssh
 
3366
) to initially copy the key.  This requirement, along with the
 
3367
fact that your key never changes unless you manually generate a new one,
 
3368
makes it somewhat less secure than TLS mode (see below).  If an attacker
 
3369
manages to steal your key, everything that was ever encrypted with
 
3370
it is compromised.  Contrast that to the perfect forward secrecy features of
 
3371
TLS mode (using Diffie Hellman key exchange), where even if an attacker
 
3372
was able to steal your private key, he would gain no information to help
 
3373
him decrypt past sessions.
 
3374
 
 
3375
Another advantageous aspect of Static Key encryption mode is that
 
3376
it is a handshake-free protocol 
 
3377
without any distinguishing signature or feature
 
3378
(such as a header or protocol handshake sequence) 
 
3379
that would mark the ciphertext packets as being
 
3380
generated by OpenVPN.  Anyone eavesdropping on the wire
 
3381
would see nothing
 
3382
but random-looking data.
 
3383
.\"*********************************************************
 
3384
.TP
 
3385
.B \-\-auth alg
 
3386
Authenticate packets with HMAC using message
 
3387
digest algorithm
 
3388
.B alg.
 
3389
(The default is
 
3390
.B SHA1
 
3391
).
 
3392
HMAC is a commonly used message authentication algorithm (MAC) that uses
 
3393
a data string, a secure hash algorithm, and a key, to produce
 
3394
a digital signature.
 
3395
 
 
3396
OpenVPN's usage of HMAC is to first encrypt a packet, then HMAC the resulting ciphertext.
 
3397
 
 
3398
In static-key encryption mode, the HMAC key
 
3399
is included in the key file generated by
 
3400
.B \-\-genkey.
 
3401
In TLS mode, the HMAC key is dynamically generated and shared
 
3402
between peers via the TLS control channel.  If OpenVPN receives a packet with
 
3403
a bad HMAC it will drop the packet.
 
3404
HMAC usually adds 16 or 20 bytes per packet.
 
3405
Set
 
3406
.B alg=none
 
3407
to disable authentication.
 
3408
 
 
3409
For more information on HMAC see
 
3410
.I http://www.cs.ucsd.edu/users/mihir/papers/hmac.html
 
3411
.\"*********************************************************
 
3412
.TP
 
3413
.B \-\-cipher alg
 
3414
Encrypt packets with cipher algorithm
 
3415
.B alg.
 
3416
The default is
 
3417
.B BF-CBC,
 
3418
an abbreviation for Blowfish in Cipher Block Chaining mode.
 
3419
Blowfish has the advantages of being fast, very secure, and allowing key sizes
 
3420
of up to 448 bits.  Blowfish is designed to be used in situations where
 
3421
keys are changed infrequently.
 
3422
 
 
3423
For more information on blowfish, see
 
3424
.I http://www.counterpane.com/blowfish.html
 
3425
 
 
3426
To see other ciphers that are available with
 
3427
OpenVPN, use the
 
3428
.B \-\-show-ciphers
 
3429
option.
 
3430
 
 
3431
OpenVPN supports the CBC, CFB, and OFB cipher modes,
 
3432
however CBC is recommended and CFB and OFB should
 
3433
be considered advanced modes.
 
3434
 
 
3435
Set
 
3436
.B alg=none
 
3437
to disable encryption.
 
3438
.\"*********************************************************
 
3439
.TP
 
3440
.B \-\-keysize n
 
3441
Size of cipher key in bits (optional).
 
3442
If unspecified, defaults to cipher-specific default.  The
 
3443
.B \-\-show-ciphers
 
3444
option (see below) shows all available OpenSSL ciphers,
 
3445
their default key sizes, and whether the key size can
 
3446
be changed.  Use care in changing a cipher's default
 
3447
key size.  Many ciphers have not been extensively
 
3448
cryptanalyzed with non-standard key lengths, and a
 
3449
larger key may offer no real guarantee of greater
 
3450
security, or may even reduce security.
 
3451
.\"*********************************************************
 
3452
.TP
 
3453
.B \-\-prng alg [nsl]
 
3454
(Advanced) For PRNG (Pseudo-random number generator),
 
3455
use digest algorithm
 
3456
.B alg
 
3457
(default=sha1), and set
 
3458
.B nsl
 
3459
(default=16)
 
3460
to the size in bytes of the nonce secret length (between 16 and 64).
 
3461
 
 
3462
Set
 
3463
.B alg=none
 
3464
to disable the PRNG and use the OpenSSL RAND_bytes function
 
3465
instead for all of OpenVPN's pseudo-random number needs.
 
3466
.\"*********************************************************
 
3467
.TP
 
3468
.B \-\-engine [engine-name]
 
3469
Enable OpenSSL hardware-based crypto engine functionality.
 
3470
 
 
3471
If
 
3472
.B engine-name
 
3473
is specified,
 
3474
use a specific crypto engine.  Use the
 
3475
.B \-\-show-engines
 
3476
standalone option to list the crypto engines which are
 
3477
supported by OpenSSL.
 
3478
.\"*********************************************************
 
3479
.TP
 
3480
.B \-\-no-replay
 
3481
(Advanced) Disable OpenVPN's protection against replay attacks.
 
3482
Don't use this option unless you are prepared to make
 
3483
a tradeoff of greater efficiency in exchange for less
 
3484
security.
 
3485
 
 
3486
OpenVPN provides datagram replay protection by default.
 
3487
 
 
3488
Replay protection is accomplished
 
3489
by tagging each outgoing datagram with an identifier
 
3490
that is guaranteed to be unique for the key being used.
 
3491
The peer that receives the datagram will check for
 
3492
the uniqueness of the identifier.  If the identifier
 
3493
was already received in a previous datagram, OpenVPN
 
3494
will drop the packet.  Replay protection is important
 
3495
to defeat attacks such as a SYN flood attack, where
 
3496
the attacker listens in the wire, intercepts a TCP
 
3497
SYN packet (identifying it by the context in which
 
3498
it occurs in relation to other packets), then floods
 
3499
the receiving peer with copies of this packet.
 
3500
 
 
3501
OpenVPN's replay protection is implemented in slightly
 
3502
different ways, depending on the key management mode
 
3503
you have selected.
 
3504
 
 
3505
In Static Key mode
 
3506
or when using an CFB or OFB mode cipher, OpenVPN uses a
 
3507
64 bit unique identifier that combines a time stamp with
 
3508
an incrementing sequence number.
 
3509
 
 
3510
When using TLS mode for key exchange and a CBC cipher
 
3511
mode, OpenVPN uses only a 32 bit sequence number without
 
3512
a time stamp, since OpenVPN can guarantee the uniqueness
 
3513
of this value for each key.  As in IPSec, if the sequence number is
 
3514
close to wrapping back to zero, OpenVPN will trigger
 
3515
a new key exchange.
 
3516
 
 
3517
To check for replays, OpenVPN uses
 
3518
the
 
3519
.I sliding window
 
3520
algorithm used
 
3521
by IPSec.
 
3522
.\"*********************************************************
 
3523
.TP
 
3524
.B \-\-replay-window n [t]
 
3525
Use a replay protection sliding-window of size
 
3526
.B n
 
3527
and a time window of
 
3528
.B t
 
3529
seconds.
 
3530
 
 
3531
By default
 
3532
.B n
 
3533
is 64 (the IPSec default) and
 
3534
.B t
 
3535
is 15 seconds.
 
3536
 
 
3537
This option is only relevant in UDP mode, i.e.
 
3538
when either
 
3539
.B \-\-proto udp
 
3540
is specifed, or no
 
3541
.B \-\-proto
 
3542
option is specified.
 
3543
 
 
3544
When OpenVPN tunnels IP packets over UDP, there is the possibility that
 
3545
packets might be dropped or delivered out of order.  Because OpenVPN, like IPSec,
 
3546
is emulating the physical network layer,
 
3547
it will accept an out-of-order packet sequence, and
 
3548
will deliver such packets in the same order they were received to
 
3549
the TCP/IP protocol stack, provided they satisfy several constraints.
 
3550
 
 
3551
.B (a)
 
3552
The packet cannot be a replay (unless
 
3553
.B \-\-no-replay
 
3554
is specified, which disables replay protection altogether).
 
3555
 
 
3556
.B (b)
 
3557
If a packet arrives out of order, it will only be accepted if the difference
 
3558
between its sequence number and the highest sequence number received
 
3559
so far is less than
 
3560
.B n.
 
3561
 
 
3562
.B (c)
 
3563
If a packet arrives out of order, it will only be accepted if it arrives no later
 
3564
than
 
3565
.B t
 
3566
seconds after any packet containing a higher sequence number.
 
3567
 
 
3568
If you are using a network link with a large pipeline (meaning that
 
3569
the product of bandwidth and latency is high), you may want to use
 
3570
a larger value for
 
3571
.B n.
 
3572
Satellite links in particular often require this.
 
3573
 
 
3574
If you run OpenVPN at
 
3575
.B \-\-verb 4,
 
3576
you will see the message "Replay-window backtrack occurred [x]"
 
3577
every time the maximum sequence number backtrack seen thus far
 
3578
increases.  This can be used to calibrate
 
3579
.B n.
 
3580
 
 
3581
There is some controversy on the appropriate method of handling packet
 
3582
reordering at the security layer.
 
3583
 
 
3584
Namely, to what extent should the
 
3585
security layer protect the encapsulated protocol from attacks which masquerade
 
3586
as the kinds of normal packet loss and reordering that occur over IP networks?
 
3587
 
 
3588
The IPSec and OpenVPN approach is to allow packet reordering within a certain
 
3589
fixed sequence number window.
 
3590
 
 
3591
OpenVPN adds to the IPSec model by limiting the window size in time as well as
 
3592
sequence space.
 
3593
 
 
3594
OpenVPN also adds TCP transport as an option (not offered by IPSec) in which
 
3595
case OpenVPN can adopt a very strict attitude towards message deletion and
 
3596
reordering:  Don't allow it.  Since TCP guarantees reliability, any packet
 
3597
loss or reordering event can be assumed to be an attack.
 
3598
 
 
3599
In this sense, it could be argued that TCP tunnel transport is preferred when
 
3600
tunneling non-IP or UDP application protocols which might be vulnerable to a
 
3601
message deletion or reordering attack which falls within the normal
 
3602
operational parameters of IP networks.
 
3603
 
 
3604
So I would make the statement that one should never tunnel a non-IP protocol
 
3605
or UDP application protocol over UDP, if the protocol might be vulnerable to a
 
3606
message deletion or reordering attack that falls within the normal operating
 
3607
parameters of what is to be expected from the physical IP layer.  The problem
 
3608
is easily fixed by simply using TCP as the VPN transport layer.
 
3609
.\"*********************************************************
 
3610
.TP
 
3611
.B \-\-mute-replay-warnings
 
3612
Silence the output of replay warnings, which are a common
 
3613
false alarm on WiFi networks.  This option preserves
 
3614
the security of the replay protection code without
 
3615
the verbosity associated with warnings about duplicate
 
3616
packets.
 
3617
.\"*********************************************************
 
3618
.TP
 
3619
.B \-\-replay-persist file
 
3620
Persist replay-protection state across sessions using
 
3621
.B file
 
3622
to save and reload the state.
 
3623
 
 
3624
This option will strengthen protection against replay attacks,
 
3625
especially when you are using OpenVPN in a dynamic context (such
 
3626
as with
 
3627
.B \-\-inetd)
 
3628
when OpenVPN sessions are frequently started and stopped. 
 
3629
 
 
3630
This option will keep a disk copy of the current replay protection
 
3631
state (i.e. the most recent packet timestamp and sequence number
 
3632
received from the remote peer), so that if an OpenVPN session
 
3633
is stopped and restarted, it will reject any replays of packets
 
3634
which were already received by the prior session.
 
3635
 
 
3636
This option only makes sense when replay protection is enabled
 
3637
(the default) and you are using either
 
3638
.B \-\-secret
 
3639
(shared-secret key mode) or TLS mode with
 
3640
.B \-\-tls-auth.
 
3641
.\"*********************************************************
 
3642
.TP
 
3643
.B \-\-no-iv
 
3644
(Advanced) Disable OpenVPN's use of IV (cipher initialization vector).
 
3645
Don't use this option unless you are prepared to make
 
3646
a tradeoff of greater efficiency in exchange for less
 
3647
security.
 
3648
 
 
3649
OpenVPN uses an IV by default, and requires it for CFB and
 
3650
OFB cipher modes (which are totally insecure without it).
 
3651
Using an IV is important for security when multiple
 
3652
messages are being encrypted/decrypted with the same key.
 
3653
 
 
3654
IV is implemented differently depending on the cipher mode used.
 
3655
 
 
3656
In CBC mode, OpenVPN uses a pseudo-random IV for each packet.
 
3657
 
 
3658
In CFB/OFB mode, OpenVPN uses a unique sequence number and time stamp
 
3659
as the IV.  In fact, in CFB/OFB mode, OpenVPN uses a datagram
 
3660
space-saving optimization that uses the unique identifier for
 
3661
datagram replay protection as the IV.
 
3662
.\"*********************************************************
 
3663
.TP
 
3664
.B \-\-test-crypto
 
3665
Do a self-test of OpenVPN's crypto options by encrypting and
 
3666
decrypting test packets using the data channel encryption options
 
3667
specified above.  This option does not require a peer to function,
 
3668
and therefore can be specified without
 
3669
.B \-\-dev
 
3670
or
 
3671
.B \-\-remote.
 
3672
 
 
3673
The typical usage of
 
3674
.B \-\-test-crypto
 
3675
would be something like this:
 
3676
 
 
3677
.B openvpn \-\-test-crypto \-\-secret key
 
3678
 
 
3679
or
 
3680
 
 
3681
.B openvpn \-\-test-crypto \-\-secret key \-\-verb 9
 
3682
 
 
3683
This option is very useful to test OpenVPN after it has been ported to
 
3684
a new platform, or to isolate problems in the compiler, OpenSSL
 
3685
crypto library, or OpenVPN's crypto code.  Since it is a self-test mode,
 
3686
problems with encryption and authentication can be debugged independently
 
3687
of network and tunnel issues.
 
3688
.\"*********************************************************
 
3689
.SS TLS Mode Options:
 
3690
TLS mode is the most powerful crypto mode of OpenVPN in both security and flexibility.
 
3691
TLS mode works by establishing control and
 
3692
data channels which are multiplexed over a single TCP/UDP port.  OpenVPN initiates
 
3693
a TLS session over the control channel and uses it to exchange cipher
 
3694
and HMAC keys to protect the data channel.  TLS mode uses a robust reliability
 
3695
layer over the UDP connection for all control channel communication, while
 
3696
the data channel, over which encrypted tunnel data passes, is forwarded without
 
3697
any mediation.  The result is the best of both worlds: a fast data channel
 
3698
that forwards over UDP with only the overhead of encrypt,
 
3699
decrypt, and HMAC functions,
 
3700
and a control channel that provides all of the security features of TLS,
 
3701
including certificate-based authentication and Diffie Hellman forward secrecy.
 
3702
 
 
3703
To use TLS mode, each peer that runs OpenVPN should have its own local
 
3704
certificate/key pair (
 
3705
.B \-\-cert
 
3706
and
 
3707
.B \-\-key
 
3708
), signed by the root certificate which is specified
 
3709
in
 
3710
.B \-\-ca.
 
3711
 
 
3712
When two OpenVPN peers connect, each presents its local certificate to the
 
3713
other.  Each peer will then check that its partner peer presented a
 
3714
certificate which was signed by the master root certificate as specified in
 
3715
.B \-\-ca.
 
3716
 
 
3717
If that check on both peers succeeds, then the TLS negotiation
 
3718
will succeed, both OpenVPN
 
3719
peers will exchange temporary session keys, and the tunnel will begin
 
3720
passing data.
 
3721
 
 
3722
The OpenVPN distribution contains a set of scripts for
 
3723
managing RSA certificates & keys,
 
3724
located in the
 
3725
.I easy-rsa
 
3726
subdirectory.
 
3727
 
 
3728
The easy-rsa package is also rendered in web form here:
 
3729
.I http://openvpn.net/easyrsa.html
 
3730
.\"*********************************************************
 
3731
.TP
 
3732
.B \-\-tls-server
 
3733
Enable TLS and assume server role during TLS handshake.  Note that
 
3734
OpenVPN is designed as a peer-to-peer application.  The designation
 
3735
of client or server is only for the purpose of negotiating the TLS
 
3736
control channel.
 
3737
.\"*********************************************************
 
3738
.TP
 
3739
.B \-\-tls-client
 
3740
Enable TLS and assume client role during TLS handshake.
 
3741
.\"*********************************************************
 
3742
.TP
 
3743
.B \-\-ca file
 
3744
Certificate authority (CA) file in .pem format, also referred to as the
 
3745
.I root
 
3746
certificate.  This file can have multiple
 
3747
certificates in .pem format, concatenated together.  You can construct your own
 
3748
certificate authority certificate and private key by using a command such as:
 
3749
 
 
3750
.B openssl req -nodes -new -x509 -keyout ca.key -out ca.crt
 
3751
 
 
3752
Then edit your openssl.cnf file and edit the
 
3753
.B certificate
 
3754
variable to point to your new root certificate
 
3755
.B ca.crt.
 
3756
 
 
3757
For testing purposes only, the OpenVPN distribution includes a sample
 
3758
CA certificate (ca.crt).
 
3759
Of course you should never use
 
3760
the test certificates and test keys distributed with OpenVPN in a
 
3761
production environment, since by virtue of the fact that
 
3762
they are distributed with OpenVPN, they are totally insecure.
 
3763
.\"*********************************************************
 
3764
.TP
 
3765
.B \-\-dh file
 
3766
File containing Diffie Hellman parameters
 
3767
in .pem format (required for
 
3768
.B \-\-tls-server
 
3769
only). Use
 
3770
 
 
3771
.B openssl dhparam -out dh1024.pem 1024
 
3772
 
 
3773
to generate your own, or use the existing dh1024.pem file
 
3774
included with the OpenVPN distribution.  Diffie Hellman parameters
 
3775
may be considered public.
 
3776
.\"*********************************************************
 
3777
.TP
 
3778
.B \-\-cert file
 
3779
Local peer's signed certificate in .pem format \-\- must be signed
 
3780
by a certificate authority whose certificate is in
 
3781
.B \-\-ca file.
 
3782
Each peer in an OpenVPN link running in TLS mode should have its own
 
3783
certificate and private key file.  In addition, each certificate should
 
3784
have been signed by the key of a certificate
 
3785
authority whose public key resides in the
 
3786
.B \-\-ca
 
3787
certificate authority file.
 
3788
You can easily make your own certificate authority (see above) or pay money
 
3789
to use a commercial service such as thawte.com (in which case you will be
 
3790
helping to finance the world's second space tourist :).
 
3791
To generate a certificate,
 
3792
you can use a command such as:
 
3793
 
 
3794
.B openssl req -nodes -new -keyout mycert.key -out mycert.csr
 
3795
 
 
3796
If your certificate authority private key lives on another machine, copy
 
3797
the certificate signing request (mycert.csr) to this other machine (this can
 
3798
be done over an insecure channel such as email).  Now sign the certificate
 
3799
with a command such as:
 
3800
 
 
3801
.B openssl ca -out mycert.crt -in mycert.csr
 
3802
 
 
3803
Now copy the certificate (mycert.crt)
 
3804
back to the peer which initially generated the .csr file (this
 
3805
can be over a public medium).
 
3806
Note that the
 
3807
.B openssl ca
 
3808
command reads the location of the certificate authority key from its
 
3809
configuration file such as
 
3810
.B /usr/share/ssl/openssl.cnf
 
3811
\-\- note also
 
3812
that for certificate authority functions, you must set up the files
 
3813
.B index.txt
 
3814
(may be empty) and
 
3815
.B serial
 
3816
(initialize to
 
3817
.B 
 
3818
01
 
3819
).
 
3820
.\"*********************************************************
 
3821
.TP
 
3822
.B \-\-key file
 
3823
Local peer's private key in .pem format.  Use the private key which was generated
 
3824
when you built your peer's certificate (see
 
3825
.B -cert file
 
3826
above).
 
3827
.\"*********************************************************
 
3828
.TP
 
3829
.B \-\-pkcs12 file
 
3830
Specify a PKCS #12 file containing local private key,
 
3831
local certificate, and root CA certificate.
 
3832
This option can be used instead of
 
3833
.B \-\-ca, \-\-cert,
 
3834
and
 
3835
.B \-\-key.
 
3836
.\"*********************************************************
 
3837
.TP
 
3838
.B \-\-pkcs11-cert-private [0|1]...
 
3839
Set if access to certificate object should be performed after login.
 
3840
Every provider has its own setting.
 
3841
.\"*********************************************************
 
3842
.TP
 
3843
.B \-\-pkcs11-id name
 
3844
Specify the serialized certificate id to be used. The id can be gotten
 
3845
by the standalone
 
3846
.B \-\-show-pkcs11-ids
 
3847
option.
 
3848
.\"*********************************************************
 
3849
.TP
 
3850
.B \-\-pkcs11-id-management
 
3851
Acquire PKCS#11 id from management interface. In this case a NEED-STR 'pkcs11-id-request'
 
3852
real-time message will be triggered, application may use pkcs11-id-count command to
 
3853
retrieve available number of certificates, and pkcs11-id-get command to retrieve certificate
 
3854
id and certificate body.
 
3855
.\"*********************************************************
 
3856
.TP
 
3857
.B \-\-pkcs11-pin-cache seconds
 
3858
Specify how many seconds the PIN can be cached, the default is until the token is removed.
 
3859
.\"*********************************************************
 
3860
.TP
 
3861
.B \-\-pkcs11-protected-authentication [0|1]...
 
3862
Use PKCS#11 protected authentication path, useful for biometric and external
 
3863
keypad devices.
 
3864
Every provider has its own setting.
 
3865
.\"*********************************************************
 
3866
.TP
 
3867
.B \-\-pkcs11-providers provider...
 
3868
Specify a RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki) providers
 
3869
to load.
 
3870
This option can be used instead of
 
3871
.B \-\-cert, \-\-key,
 
3872
and
 
3873
.B \-\-pkcs12.
 
3874
.\"*********************************************************
 
3875
.TP
 
3876
.B \-\-pkcs11-private-mode mode...
 
3877
Specify which method to use in order to perform private key operations.
 
3878
A different mode can be specified for each provider.
 
3879
Mode is encoded as hex number, and can be a mask one of the following:
 
3880
 
 
3881
.B 0
 
3882
(default) -- Try to determind automatically.
 
3883
.br
 
3884
.B 1
 
3885
-- Use sign.
 
3886
.br
 
3887
.B 2
 
3888
-- Use sign recover.
 
3889
.br
 
3890
.B 4
 
3891
-- Use decrypt.
 
3892
.br
 
3893
.B 8
 
3894
-- Use unwrap.
 
3895
.br
 
3896
.\"*********************************************************
 
3897
.TP
 
3898
.B \-\-cryptoapicert select-string
 
3899
Load the certificate and private key from the
 
3900
Windows Certificate System Store (Windows Only).
 
3901
 
 
3902
Use this option instead of
 
3903
.B \-\-cert
 
3904
and
 
3905
.B \-\-key.
 
3906
 
 
3907
This makes
 
3908
it possible to use any smart card, supported by Windows, but also any
 
3909
kind of certificate, residing in the Cert Store, where you have access to
 
3910
the private key.  This option has been tested with a couple of different
 
3911
smart cards (GemSAFE, Cryptoflex, and Swedish Post Office eID) on the
 
3912
client side, and also an imported PKCS12 software certificate on the
 
3913
server side.
 
3914
 
 
3915
To select a certificate, based on a substring search in the
 
3916
certificate's subject:
 
3917
 
 
3918
.B cryptoapicert
 
3919
"SUBJ:Peter Runestig"
 
3920
 
 
3921
To select a certificate, based on certificate's thumbprint:
 
3922
 
 
3923
.B cryptoapicert
 
3924
"THUMB:f6 49 24 41 01 b4 ..."
 
3925
 
 
3926
The thumbprint hex string can easily be copy-and-pasted from the Windows
 
3927
Certificate Store GUI.
 
3928
 
 
3929
.\"*********************************************************
 
3930
.TP
 
3931
.B \-\-key-method m
 
3932
Use data channel key negotiation method
 
3933
.B m.
 
3934
The key method must match on both sides of the connection.
 
3935
 
 
3936
After OpenVPN negotiates a TLS session, a new set of keys
 
3937
for protecting the tunnel data channel is generated and
 
3938
exchanged over the TLS session.
 
3939
 
 
3940
In method 1 (the default for OpenVPN 1.x), both sides generate
 
3941
random encrypt and HMAC-send keys which are forwarded to
 
3942
the other host over the TLS channel.
 
3943
 
 
3944
In method 2, (the default for OpenVPN 2.0)
 
3945
the client generates a random key.  Both client
 
3946
and server also generate some random seed material.  All key source
 
3947
material is exchanged over the TLS channel. The actual
 
3948
keys are generated using the TLS PRF function, taking source
 
3949
entropy from both client and server.  Method 2 is designed to
 
3950
closely parallel the key generation process used by TLS 1.0.
 
3951
 
 
3952
Note that in TLS mode, two separate levels 
 
3953
of keying occur:
 
3954
 
 
3955
(1) The TLS connection is initially negotiated, with both sides
 
3956
of the connection producing certificates and verifying the certificate
 
3957
(or other authentication info provided) of
 
3958
the other side.  The
 
3959
.B \-\-key-method
 
3960
parameter has no effect on this process.
 
3961
 
 
3962
(2) After the TLS connection is established, the tunnel session keys are
 
3963
separately negotiated over the existing secure TLS channel.  Here,
 
3964
.B \-\-key-method
 
3965
determines the derivation of the tunnel session keys.
 
3966
.\"*********************************************************
 
3967
.TP
 
3968
.B \-\-tls-cipher l
 
3969
A list
 
3970
.B l
 
3971
of allowable TLS ciphers delimited by a colon (":").
 
3972
If you require a high level of security,
 
3973
you may want to set this parameter manually, to prevent a
 
3974
version rollback attack where a man-in-the-middle attacker tries
 
3975
to force two peers to negotiate to the lowest level
 
3976
of security they both support.
 
3977
Use
 
3978
.B \-\-show-tls
 
3979
to see a list of supported TLS ciphers.
 
3980
.\"*********************************************************
 
3981
.TP
 
3982
.B \-\-tls-timeout n
 
3983
Packet retransmit timeout on TLS control channel
 
3984
if no acknowledgment from remote within
 
3985
.B n
 
3986
seconds (default=2).  When OpenVPN sends a control
 
3987
packet to its peer, it will expect to receive an
 
3988
acknowledgement within
 
3989
.B n
 
3990
seconds or it will retransmit the packet, subject
 
3991
to a TCP-like exponential backoff algorithm.  This parameter
 
3992
only applies to control channel packets.  Data channel
 
3993
packets (which carry encrypted tunnel data) are never
 
3994
acknowledged, sequenced, or retransmitted by OpenVPN because
 
3995
the higher level network protocols running on top of the tunnel
 
3996
such as TCP expect this role to be left to them.
 
3997
.\"*********************************************************
 
3998
.TP
 
3999
.B \-\-reneg-bytes n
 
4000
Renegotiate data channel key after
 
4001
.B n
 
4002
bytes sent or received (disabled by default).
 
4003
OpenVPN allows the lifetime of a key
 
4004
to be expressed as a number of bytes encrypted/decrypted, a number of packets, or
 
4005
a number of seconds.  A key renegotiation will be forced
 
4006
if any of these three criteria are met by either peer.
 
4007
.\"*********************************************************
 
4008
.TP
 
4009
.B \-\-reneg-pkts n
 
4010
Renegotiate data channel key after
 
4011
.B n
 
4012
packets sent and received (disabled by default).
 
4013
.\"*********************************************************
 
4014
.TP
 
4015
.B \-\-reneg-sec n
 
4016
Renegotiate data channel key after
 
4017
.B n
 
4018
seconds (default=3600).
 
4019
 
 
4020
When using dual-factor authentication, note that this default value may
 
4021
cause the end user to be challenged to reauthorize once per hour.
 
4022
 
 
4023
Also, keep in mind that this option can be used on both the client and server,
 
4024
and whichever uses the lower value will be the one to trigger the renegotiation.
 
4025
A common mistake is to set
 
4026
.B \-\-reneg-sec
 
4027
to a higher value on either the client or server, while the other side of the connection
 
4028
is still using the default value of 3600 seconds, meaning that the renegotiation will
 
4029
still occur once per 3600 seconds.  The solution is to increase \-\-reneg-sec on both the
 
4030
client and server, or set it to 0 on one side of the connection (to disable), and to
 
4031
your chosen value on the other side.
 
4032
.\"*********************************************************
 
4033
.TP
 
4034
.B \-\-hand-window n
 
4035
Handshake Window \-\- the TLS-based key exchange must finalize within
 
4036
.B n
 
4037
seconds
 
4038
of handshake initiation by any peer (default = 60 seconds).
 
4039
If the handshake fails
 
4040
we will attempt to reset our connection with our peer and try again.
 
4041
Even in the event of handshake failure we will still use
 
4042
our expiring key for up to
 
4043
.B \-\-tran-window
 
4044
seconds to maintain continuity of transmission of tunnel
 
4045
data.
 
4046
.\"*********************************************************
 
4047
.TP
 
4048
.B \-\-tran-window n
 
4049
Transition window \-\- our old key can live this many seconds
 
4050
after a new a key renegotiation begins (default = 3600 seconds).
 
4051
This feature allows for a graceful transition from old to new
 
4052
key, and removes the key renegotiation sequence from the critical
 
4053
path of tunnel data forwarding.
 
4054
.\"*********************************************************
 
4055
.TP
 
4056
.B \-\-single-session
 
4057
After initially connecting to a remote peer, disallow any new connections.
 
4058
Using this
 
4059
option means that a remote peer cannot connect, disconnect, and then
 
4060
reconnect.
 
4061
 
 
4062
If the daemon is reset by a signal or
 
4063
.B \-\-ping-restart,
 
4064
it will allow one new connection.
 
4065
 
 
4066
.B \-\-single-session
 
4067
can be used with
 
4068
.B \-\-ping-exit
 
4069
or
 
4070
.B \-\-inactive
 
4071
to create a single dynamic session that will exit when finished.
 
4072
.\"*********************************************************
 
4073
.TP
 
4074
.B \-\-tls-exit
 
4075
Exit on TLS negotiation failure.
 
4076
.\"*********************************************************
 
4077
.TP
 
4078
.B \-\-tls-auth file [direction]
 
4079
Add an additional layer of HMAC authentication on top of the TLS
 
4080
control channel to protect against DoS attacks.
 
4081
 
 
4082
In a nutshell,
 
4083
.B \-\-tls-auth
 
4084
enables a kind of "HMAC firewall" on OpenVPN's TCP/UDP port,
 
4085
where TLS control channel packets
 
4086
bearing an incorrect HMAC signature can be dropped immediately without
 
4087
response.
 
4088
 
 
4089
.B file
 
4090
(required) is a key file which can be in one of two formats:
 
4091
 
 
4092
.B (1)
 
4093
An OpenVPN static key file generated by
 
4094
.B \-\-genkey
 
4095
(required if
 
4096
.B direction
 
4097
parameter is used).
 
4098
 
 
4099
.B (2)
 
4100
A freeform passphrase file.  In this case the HMAC key will
 
4101
be derived by taking a secure hash of this file, similar to
 
4102
the
 
4103
.BR md5sum (1)
 
4104
or
 
4105
.BR sha1sum (1)
 
4106
commands.
 
4107
 
 
4108
OpenVPN will first try format (1), and if the file fails to parse as
 
4109
a static key file, format (2) will be used.
 
4110
 
 
4111
See the
 
4112
.B \-\-secret
 
4113
option for more information on the optional
 
4114
.B direction
 
4115
parameter.
 
4116
 
 
4117
.B \-\-tls-auth
 
4118
is recommended when you are running OpenVPN in a mode where
 
4119
it is listening for packets from any IP address, such as when
 
4120
.B \-\-remote
 
4121
is not specified, or
 
4122
.B \-\-remote
 
4123
is specified with
 
4124
.B \-\-float.
 
4125
 
 
4126
The rationale for
 
4127
this feature is as follows.  TLS requires a multi-packet exchange
 
4128
before it is able to authenticate a peer.  During this time
 
4129
before authentication, OpenVPN is allocating resources (memory
 
4130
and CPU) to this potential peer.  The potential peer is also
 
4131
exposing many parts of OpenVPN and the OpenSSL library to the packets
 
4132
it is sending.  Most successful network attacks today seek
 
4133
to either exploit bugs in programs (such as buffer overflow attacks) or
 
4134
force a program to consume so many resources that it becomes unusable.
 
4135
Of course the first line of defense is always to produce clean,
 
4136
well-audited code.  OpenVPN has been written with buffer overflow
 
4137
attack prevention as a top priority.
 
4138
But as history has shown, many of the most widely used
 
4139
network applications have, from time to time,
 
4140
fallen to buffer overflow attacks.
 
4141
 
 
4142
So as a second line of defense, OpenVPN offers
 
4143
this special layer of authentication on top of the TLS control channel so that
 
4144
every packet on the control channel is authenticated by an
 
4145
HMAC signature and a unique ID for replay protection.
 
4146
This signature will also help protect against DoS (Denial of Service) attacks.
 
4147
An important rule of thumb in reducing vulnerability to DoS attacks is to
 
4148
minimize the amount of resources a potential, but as yet unauthenticated,
 
4149
client is able to consume.
 
4150
 
 
4151
.B \-\-tls-auth
 
4152
does this by signing every TLS control channel packet with an HMAC signature,
 
4153
including packets which are sent before the TLS level has had a chance
 
4154
to authenticate the peer.
 
4155
The result is that packets without
 
4156
the correct signature can be dropped immediately upon reception,
 
4157
before they have a chance to consume additional system resources
 
4158
such as by initiating a TLS handshake.
 
4159
.B \-\-tls-auth
 
4160
can be strengthened by adding the
 
4161
.B \-\-replay-persist
 
4162
option which will keep OpenVPN's replay protection state
 
4163
in a file so that it is not lost across restarts.
 
4164
 
 
4165
It should be emphasized that this feature is optional and that the
 
4166
passphrase/key file used with
 
4167
.B \-\-tls-auth
 
4168
gives a peer nothing more than the power to initiate a TLS
 
4169
handshake.  It is not used to encrypt or authenticate any tunnel data.
 
4170
.\"*********************************************************
 
4171
.TP
 
4172
.B \-\-askpass [file]
 
4173
Get certificate password from console or
 
4174
.B file
 
4175
before we daemonize.
 
4176
 
 
4177
For the extremely
 
4178
security conscious, it is possible to protect your private key with
 
4179
a password.  Of course this means that every time the OpenVPN
 
4180
daemon is started you must be there to type the password.  The
 
4181
.B \-\-askpass
 
4182
option allows you to start OpenVPN from the command line.  It will
 
4183
query you for a password before it daemonizes.  To protect a private
 
4184
key with a password you should omit the
 
4185
.B -nodes
 
4186
option when you use the
 
4187
.B openssl
 
4188
command line tool to manage certificates and private keys.
 
4189
 
 
4190
If
 
4191
.B file
 
4192
is specified, read the password from the first line of
 
4193
.B file.
 
4194
Keep in mind that storing your password in a file
 
4195
to a certain extent invalidates the extra security provided by
 
4196
using an encrypted key (Note: OpenVPN
 
4197
will only read passwords from a file if it has been built
 
4198
with the \-\-enable-password-save configure option, or on Windows
 
4199
by defining ENABLE_PASSWORD_SAVE in config-win32.h).
 
4200
.\"*********************************************************
 
4201
.TP
 
4202
.B \-\-auth-nocache
 
4203
Don't cache
 
4204
.B \-\-askpass
 
4205
or
 
4206
.B \-\-auth-user-pass
 
4207
username/passwords in virtual memory.
 
4208
 
 
4209
If specified, this directive will cause OpenVPN to immediately
 
4210
forget username/password inputs after they are used.  As a result,
 
4211
when OpenVPN needs a username/password, it will prompt for input
 
4212
from stdin, which may be multiple times during the duration of an
 
4213
OpenVPN session.
 
4214
 
 
4215
This directive does not affect the
 
4216
.B \-\-http-proxy
 
4217
username/password.  It is always cached.
 
4218
.\"*********************************************************
 
4219
.TP
 
4220
.B \-\-tls-verify cmd
 
4221
Execute shell command
 
4222
.B cmd
 
4223
to verify the X509 name of a
 
4224
pending TLS connection that has otherwise passed all other
 
4225
tests of certification (except for revocation via
 
4226
.B \-\-crl-verify
 
4227
directive; the revocation test occurs after the
 
4228
.B \-\-tls-verify
 
4229
test).
 
4230
 
 
4231
.B cmd
 
4232
should return 0 to allow the TLS handshake to proceed, or 1 to fail.
 
4233
.B cmd
 
4234
is executed as
 
4235
 
 
4236
.B cmd certificate_depth X509_NAME_oneline
 
4237
 
 
4238
This feature is useful if the peer you want to trust has a certificate
 
4239
which was signed by a certificate authority who also signed many
 
4240
other certificates, where you don't necessarily want to trust all of them,
 
4241
but rather be selective about which
 
4242
peer certificate you will accept.  This feature allows you to write a script
 
4243
which will test the X509 name on a certificate and decide whether or
 
4244
not it should be accepted.  For a simple perl script which will test
 
4245
the common name field on the certificate, see the file
 
4246
.B verify-cn
 
4247
in the OpenVPN distribution.
 
4248
 
 
4249
See the "Environmental Variables" section below for
 
4250
additional parameters passed as environmental variables.
 
4251
 
 
4252
Note that
 
4253
.B cmd
 
4254
can be a shell command with multiple arguments, in which
 
4255
case all OpenVPN-generated arguments will be appended
 
4256
to
 
4257
.B cmd
 
4258
to build a command line which will be passed to the script.
 
4259
.\"*********************************************************
 
4260
.TP
 
4261
.B \-\-tls-remote name
 
4262
Accept connections only from a host with X509 name
 
4263
or common name equal to
 
4264
.B name.
 
4265
The remote host must also pass all other tests
 
4266
of verification.
 
4267
 
 
4268
Name can also be a common name prefix, for example if you
 
4269
want a client to only accept connections to "Server-1",
 
4270
"Server-2", etc., you can simply use
 
4271
.B \-\-tls-remote Server
 
4272
 
 
4273
Using a common name prefix is a useful alternative to managing
 
4274
a CRL (Certificate Revocation List) on the client, since it allows the client
 
4275
to refuse all certificates except for those associated
 
4276
with designated servers.
 
4277
 
 
4278
.B \-\-tls-remote
 
4279
is a useful replacement for the
 
4280
.B \-\-tls-verify
 
4281
option to verify the remote host, because
 
4282
.B \-\-tls-remote
 
4283
works in a
 
4284
.B \-\-chroot
 
4285
environment too.
 
4286
.\"*********************************************************
 
4287
.TP
 
4288
.B \-\-ns-cert-type client|server
 
4289
Require that peer certificate was signed with an explicit
 
4290
.B nsCertType
 
4291
designation of "client" or "server".
 
4292
 
 
4293
This is a useful security option for clients, to ensure that
 
4294
the host they connect with is a designated server.
 
4295
 
 
4296
See the easy-rsa/build-key-server script for an example
 
4297
of how to generate a certificate with the
 
4298
.B nsCertType
 
4299
field set to "server".
 
4300
 
 
4301
If the server certificate's nsCertType field is set
 
4302
to "server", then the clients can verify this with
 
4303
.B \-\-ns-cert-type server.
 
4304
 
 
4305
This is an important security precaution to protect against
 
4306
a man-in-the-middle attack where an authorized client
 
4307
attempts to connect to another client by impersonating the server.
 
4308
The attack is easily prevented by having clients verify
 
4309
the server certificate using any one of
 
4310
.B \-\-ns-cert-type, \-\-tls-remote,
 
4311
or
 
4312
.B \-\-tls-verify.
 
4313
.\"*********************************************************
 
4314
.TP
 
4315
.B \-\-remote-cert-ku v...
 
4316
Require that peer certificate was signed with an explicit
 
4317
.B key usage.
 
4318
 
 
4319
This is a useful security option for clients, to ensure that
 
4320
the host they connect to is a designated server.
 
4321
 
 
4322
The key usage should be encoded in hex, more than one key
 
4323
usage can be specified.
 
4324
.\"*********************************************************
 
4325
.TP
 
4326
.B \-\-remote-cert-eku oid
 
4327
Require that peer certificate was signed with an explicit
 
4328
.B extended key usage.
 
4329
 
 
4330
This is a useful security option for clients, to ensure that
 
4331
the host they connect to is a designated server.
 
4332
 
 
4333
The extended key usage should be encoded in oid notation, or
 
4334
OpenSSL symbolic representation.
 
4335
.\"*********************************************************
 
4336
.TP
 
4337
.B \-\-remote-cert-tls client|server
 
4338
Require that peer certificate was signed with an explicit
 
4339
.B key usage
 
4340
and
 
4341
.B extended key usage
 
4342
based on RFC3280 TLS rules.
 
4343
 
 
4344
This is a useful security option for clients, to ensure that
 
4345
the host they connect to is a designated server.
 
4346
 
 
4347
The
 
4348
.B \-\-remote-cert-tls client
 
4349
option is equivalent to
 
4350
.B
 
4351
\-\-remote-cert-ku 80 08 88 \-\-remote-cert-eku "TLS Web Client Authentication"
 
4352
 
 
4353
The key usage is digitalSignature and/or keyAgreement.
 
4354
 
 
4355
The
 
4356
.B \-\-remote-cert-tls server
 
4357
option is equivalent to
 
4358
.B
 
4359
\-\-remote-cert-ku a0 88 \-\-remote-cert-eku "TLS Web Server Authentication"
 
4360
 
 
4361
The key usage is digitalSignature and ( keyEncipherment or keyAgreement ).
 
4362
 
 
4363
This is an important security precaution to protect against
 
4364
a man-in-the-middle attack where an authorized client
 
4365
attempts to connect to another client by impersonating the server.
 
4366
The attack is easily prevented by having clients verify
 
4367
the server certificate using any one of
 
4368
.B \-\-remote-cert-tls, \-\-tls-remote,
 
4369
or
 
4370
.B \-\-tls-verify.
 
4371
.\"*********************************************************
 
4372
.TP
 
4373
.B \-\-crl-verify crl
 
4374
Check peer certificate against the file
 
4375
.B crl
 
4376
in PEM format.
 
4377
 
 
4378
A CRL (certificate revocation list) is used when a particular key is
 
4379
compromised but when the overall PKI is still intact.
 
4380
 
 
4381
Suppose you had a PKI consisting of a CA, root certificate, and a number of
 
4382
client certificates.  Suppose a laptop computer containing a client key and
 
4383
certificate was stolen.  By adding the stolen certificate to the CRL file,
 
4384
you could reject any connection which attempts to use it, while preserving the
 
4385
overall integrity of the PKI.
 
4386
 
 
4387
The only time when it would be necessary to rebuild the entire PKI from scratch would be
 
4388
if the root certificate key itself was compromised.
 
4389
.\"*********************************************************
 
4390
.SS SSL Library information:
 
4391
.\"*********************************************************
 
4392
.TP
 
4393
.B \-\-show-ciphers
 
4394
(Standalone)
 
4395
Show all cipher algorithms to use with the
 
4396
.B \-\-cipher
 
4397
option.
 
4398
.\"*********************************************************
 
4399
.TP
 
4400
.B \-\-show-digests
 
4401
(Standalone)
 
4402
Show all message digest algorithms to use with the
 
4403
.B \-\-auth
 
4404
option.
 
4405
.\"*********************************************************
 
4406
.TP
 
4407
.B \-\-show-tls
 
4408
(Standalone)
 
4409
Show all TLS ciphers (TLS used only as a control channel).  The TLS
 
4410
ciphers will be sorted from highest preference (most secure) to
 
4411
lowest.
 
4412
.\"*********************************************************
 
4413
.TP
 
4414
.B \-\-show-engines
 
4415
(Standalone)
 
4416
Show currently available hardware-based crypto acceleration
 
4417
engines supported by the OpenSSL library.
 
4418
.\"*********************************************************
 
4419
.SS Generate a random key:
 
4420
Used only for non-TLS static key encryption mode.
 
4421
.\"*********************************************************
 
4422
.TP
 
4423
.B \-\-genkey
 
4424
(Standalone)
 
4425
Generate a random key to be used as a shared secret,
 
4426
for use with the
 
4427
.B \-\-secret
 
4428
option.  This file must be shared with the
 
4429
peer over a pre-existing secure channel such as
 
4430
.BR scp (1)
 
4431
.
 
4432
.\"*********************************************************
 
4433
.TP
 
4434
.B \-\-secret file
 
4435
Write key to
 
4436
.B file.
 
4437
.\"*********************************************************
 
4438
.SS TUN/TAP persistent tunnel config mode:
 
4439
Available with linux 2.4.7+.  These options comprise a standalone mode
 
4440
of OpenVPN which can be used to create and delete persistent tunnels.
 
4441
.\"*********************************************************
 
4442
.TP
 
4443
.B \-\-mktun
 
4444
(Standalone)
 
4445
Create a persistent tunnel on platforms which support them such
 
4446
as Linux.  Normally TUN/TAP tunnels exist only for
 
4447
the period of time that an application has them open.  This option
 
4448
takes advantage of the TUN/TAP driver's ability to build persistent
 
4449
tunnels that live through multiple instantiations of OpenVPN and die
 
4450
only when they are deleted or the machine is rebooted.
 
4451
 
 
4452
One of the advantages of persistent tunnels is that they eliminate the
 
4453
need for separate
 
4454
.B \-\-up
 
4455
and
 
4456
.B \-\-down
 
4457
scripts to run the appropriate
 
4458
.BR ifconfig (8)
 
4459
and
 
4460
.BR route (8)
 
4461
commands.  These commands can be placed in the the same shell script
 
4462
which starts or terminates an OpenVPN session.
 
4463
 
 
4464
Another advantage is that open connections through the TUN/TAP-based tunnel
 
4465
will not be reset if the OpenVPN peer restarts.  This can be useful to
 
4466
provide uninterrupted connectivity through the tunnel in the event of a DHCP
 
4467
reset of the peer's public IP address (see the
 
4468
.B \-\-ipchange
 
4469
option above).
 
4470
 
 
4471
One disadvantage of persistent tunnels is that it is harder to automatically
 
4472
configure their MTU value (see
 
4473
.B \-\-link-mtu
 
4474
and
 
4475
.B \-\-tun-mtu
 
4476
above).
 
4477
 
 
4478
On some platforms such as Windows, TAP-Win32 tunnels are persistent by
 
4479
default.
 
4480
.\"*********************************************************
 
4481
.TP
 
4482
.B \-\-rmtun
 
4483
(Standalone)
 
4484
Remove a persistent tunnel.
 
4485
.\"*********************************************************
 
4486
.TP
 
4487
.B \-\-dev tunX | tapX
 
4488
TUN/TAP device
 
4489
.\"*********************************************************
 
4490
.TP
 
4491
.B \-\-user user
 
4492
Optional user to be owner of this tunnel.
 
4493
.\"*********************************************************
 
4494
.TP
 
4495
.B \-\-group group
 
4496
Optional group to be owner of this tunnel.
 
4497
.\"*********************************************************
 
4498
.SS Windows-Specific Options:
 
4499
.\"*********************************************************
 
4500
.TP
 
4501
.B \-\-win-sys path|'env'
 
4502
Set the Windows system directory pathname to use when looking for system
 
4503
executables such as
 
4504
.B route.exe
 
4505
and
 
4506
.B netsh.exe.
 
4507
By default, if this directive is
 
4508
not specified, the pathname will be set to "C:\\WINDOWS"
 
4509
 
 
4510
The special string
 
4511
.B 'env'
 
4512
indicates that the pathname should be read from the
 
4513
.B SystemRoot
 
4514
environmental variable.
 
4515
.\"*********************************************************
 
4516
.TP
 
4517
.B \-\-ip-win32 method
 
4518
When using
 
4519
.B \-\-ifconfig
 
4520
on Windows, set the TAP-Win32 adapter
 
4521
IP address and netmask using
 
4522
.B method.
 
4523
Don't use this option unless you are also using
 
4524
.B \-\-ifconfig.
 
4525
 
 
4526
.B manual --
 
4527
Don't set the IP address or netmask automatically.
 
4528
Instead output a message
 
4529
to the console telling the user to configure the
 
4530
adapter manually and indicating the IP/netmask which
 
4531
OpenVPN expects the adapter to be set to.
 
4532
 
 
4533
.B dynamic [offset] [lease-time] --
 
4534
Automatically set the IP address and netmask by replying to
 
4535
DHCP query messages generated by the kernel.  This mode is
 
4536
probably the "cleanest" solution
 
4537
for setting the TCP/IP properties since it uses the well-known
 
4538
DHCP protocol.  There are, however, two prerequisites for using
 
4539
this mode: (1) The TCP/IP properties for the TAP-Win32
 
4540
adapter must be set to "Obtain an IP address automatically," and
 
4541
(2) OpenVPN needs to claim an IP address in the subnet for use
 
4542
as the virtual DHCP server address.  By default in
 
4543
.B \-\-dev tap
 
4544
mode, OpenVPN will
 
4545
take the normally unused first address in the subnet.  For example,
 
4546
if your subnet is 192.168.4.0 netmask 255.255.255.0, then
 
4547
OpenVPN will take the IP address 192.168.4.0 to use as the
 
4548
virtual DHCP server address.  In
 
4549
.B \-\-dev tun
 
4550
mode, OpenVPN will cause the DHCP server to masquerade as if it were
 
4551
coming from the remote endpoint.  The optional offset parameter is
 
4552
an integer which is > -256 and < 256 and which defaults to 0.
 
4553
If offset is positive, the DHCP server will masquerade as the IP
 
4554
address at network address + offset.
 
4555
If offset is negative, the DHCP server will masquerade as the IP
 
4556
address at broadcast address + offset.  The Windows
 
4557
.B ipconfig /all
 
4558
command can be used to show what Windows thinks the DHCP server
 
4559
address is.  OpenVPN will "claim" this address, so make sure to
 
4560
use a free address.  Having said that, different OpenVPN instantiations,
 
4561
including different ends of the same connection, can share the same
 
4562
virtual DHCP server address.  The
 
4563
.B lease-time
 
4564
parameter controls the lease time of the DHCP assignment given to
 
4565
the TAP-Win32 adapter, and is denoted in seconds.
 
4566
Normally a very long lease time is preferred
 
4567
because it prevents routes involving the TAP-Win32 adapter from
 
4568
being lost when the system goes to sleep.  The default
 
4569
lease time is one year.
 
4570
 
 
4571
.B netsh \-\-
 
4572
Automatically set the IP address and netmask using
 
4573
the Windows command-line "netsh"
 
4574
command.  This method appears to work correctly on
 
4575
Windows XP but not Windows 2000.
 
4576
 
 
4577
.B ipapi \-\-
 
4578
Automatically set the IP address and netmask using the
 
4579
Windows IP Helper API.  This approach
 
4580
does not have ideal semantics, though testing has indicated
 
4581
that it works okay in practice.  If you use this option,
 
4582
it is best to leave the TCP/IP properties for the TAP-Win32
 
4583
adapter in their default state, i.e. "Obtain an IP address
 
4584
automatically."
 
4585
 
 
4586
.B adaptive \-\-
 
4587
(Default) Try
 
4588
.B dynamic
 
4589
method initially and fail over to
 
4590
.B netsh
 
4591
if the DHCP negotiation with the TAP-Win32 adapter does
 
4592
not succeed in 20 seconds.  Such failures have been known
 
4593
to occur when certain third-party firewall packages installed
 
4594
on the client machine block the DHCP negotiation used by
 
4595
the TAP-Win32 adapter.
 
4596
Note that if the
 
4597
.B netsh
 
4598
failover occurs, the TAP-Win32 adapter
 
4599
TCP/IP properties will be reset from DHCP to static, and this
 
4600
will cause future OpenVPN startups using the
 
4601
.B adaptive
 
4602
mode to use
 
4603
.B netsh
 
4604
immediately, rather than trying
 
4605
.B dynamic
 
4606
first.  To "unstick" the
 
4607
.B adaptive
 
4608
mode from using
 
4609
.B netsh,
 
4610
run OpenVPN at least once using the
 
4611
.B dynamic
 
4612
mode to restore the TAP-Win32 adapter TCP/IP properties
 
4613
to a DHCP configuration.
 
4614
.\"*********************************************************
 
4615
.TP
 
4616
.B \-\-route-method m
 
4617
Which method
 
4618
.B m
 
4619
to use for adding routes on Windows?
 
4620
 
 
4621
.B adaptive
 
4622
(default) \-\- Try IP helper API first.  If that fails, fall
 
4623
back to the route.exe shell command.
 
4624
.br
 
4625
.B ipapi
 
4626
\-\- Use IP helper API.
 
4627
.br
 
4628
.B exe
 
4629
\-\- Call the route.exe shell command.
 
4630
.\"*********************************************************
 
4631
.TP
 
4632
.B \-\-dhcp-option type [parm]
 
4633
Set extended TAP-Win32 TCP/IP properties, must
 
4634
be used with
 
4635
.B \-\-ip-win32 dynamic
 
4636
or
 
4637
.B \-\-ip-win32 adaptive.
 
4638
This option can be used to set additional TCP/IP properties
 
4639
on the TAP-Win32 adapter, and is particularly useful for
 
4640
configuring an OpenVPN client to access a Samba server
 
4641
across the VPN.
 
4642
 
 
4643
.B DOMAIN name \-\-
 
4644
Set Connection-specific DNS Suffix.
 
4645
 
 
4646
.B DNS addr \-\-
 
4647
Set primary domain name server address.  Repeat
 
4648
this option to set secondary DNS server addresses.
 
4649
 
 
4650
.B WINS addr \-\-
 
4651
Set primary WINS server address (NetBIOS over TCP/IP Name Server).
 
4652
Repeat this option to set secondary WINS server addresses.
 
4653
 
 
4654
.B NBDD addr \-\-
 
4655
Set primary NBDD server address (NetBIOS over TCP/IP Datagram Distribution Server)
 
4656
Repeat this option
 
4657
to set secondary NBDD server addresses.
 
4658
 
 
4659
.B NTP addr \-\-
 
4660
Set primary NTP server address (Network Time Protocol).
 
4661
Repeat this option
 
4662
to set secondary NTP server addresses.
 
4663
 
 
4664
.B NBT type \-\-
 
4665
Set NetBIOS over TCP/IP Node type.  Possible options:
 
4666
.B 1
 
4667
= b-node (broadcasts),
 
4668
.B 2
 
4669
= p-node (point-to-point
 
4670
name queries to a WINS server),
 
4671
.B 4
 
4672
= m-node (broadcast
 
4673
then query name server), and
 
4674
.B 8
 
4675
= h-node (query name server, then broadcast).
 
4676
 
 
4677
.B NBS scope-id \-\-
 
4678
Set NetBIOS over TCP/IP Scope. A NetBIOS Scope ID provides an extended
 
4679
naming service for the NetBIOS over TCP/IP (Known as NBT) module. The
 
4680
primary purpose of a NetBIOS scope ID is to isolate NetBIOS traffic on
 
4681
a single network to only those nodes with the same NetBIOS scope ID.
 
4682
The NetBIOS scope ID is a character string that is appended to the NetBIOS
 
4683
name. The NetBIOS scope ID on two hosts must match, or the two hosts
 
4684
will not be able to communicate. The NetBIOS Scope ID also allows
 
4685
computers to use the same computer name, as they have different
 
4686
scope IDs. The Scope ID becomes a part of the NetBIOS name, making the name unique.
 
4687
(This description of NetBIOS scopes courtesy of NeonSurge@abyss.com)
 
4688
 
 
4689
.B DISABLE-NBT \-\-
 
4690
Disable Netbios-over-TCP/IP.
 
4691
 
 
4692
Note that if
 
4693
.B \-\-dhcp-option
 
4694
is pushed via
 
4695
.B \-\-push
 
4696
to a non-windows client, the option will be saved in the client's
 
4697
environment before the up script is called, under
 
4698
the name "foreign_option_{n}".
 
4699
.\"*********************************************************
 
4700
.TP
 
4701
.B \-\-tap-sleep n
 
4702
Cause OpenVPN to sleep for
 
4703
.B n
 
4704
seconds immediately after the TAP-Win32 adapter state
 
4705
is set to "connected".
 
4706
 
 
4707
This option is intended to be used to troubleshoot problems
 
4708
with the
 
4709
.B \-\-ifconfig
 
4710
and
 
4711
.B \-\-ip-win32
 
4712
options, and is used to give
 
4713
the TAP-Win32 adapter time to come up before
 
4714
Windows IP Helper API operations are applied to it.
 
4715
.\"*********************************************************
 
4716
.TP
 
4717
.B \-\-show-net-up
 
4718
Output OpenVPN's view of the system routing table and network
 
4719
adapter list to the syslog or log file after the TUN/TAP adapter
 
4720
has been brought up and any routes have been added.
 
4721
.\"*********************************************************
 
4722
.TP
 
4723
.B \-\-dhcp-renew
 
4724
Ask Windows to renew the TAP adapter lease on startup.
 
4725
This option is normally unnecessary, as Windows automatically
 
4726
triggers a DHCP renegotiation on the TAP adapter when it
 
4727
comes up, however if you set the TAP-Win32 adapter
 
4728
Media Status property to "Always Connected", you may need this
 
4729
flag.
 
4730
.\"*********************************************************
 
4731
.TP
 
4732
.B \-\-dhcp-release
 
4733
Ask Windows to release the TAP adapter lease on shutdown.
 
4734
This option has the same caveats as
 
4735
.B \-\-dhcp-renew
 
4736
above.
 
4737
.\"*********************************************************
 
4738
.TP
 
4739
.B \-\-pause-exit
 
4740
Put up a "press any key to continue" message on the console prior
 
4741
to OpenVPN program exit.  This option is automatically used by the
 
4742
Windows explorer when OpenVPN is run on a configuration
 
4743
file using the right-click explorer menu.
 
4744
.\"*********************************************************
 
4745
.TP
 
4746
.B \-\-service exit-event [0|1]
 
4747
Should be used when OpenVPN is being automatically executed by another
 
4748
program in such
 
4749
a context that no interaction with the user via display or keyboard
 
4750
is possible.  In general, end-users should never need to explicitly
 
4751
use this option, as it is automatically added by the OpenVPN service wrapper
 
4752
when a given OpenVPN configuration is being run as a service.
 
4753
 
 
4754
.B exit-event
 
4755
is the name of a Windows global event object, and OpenVPN will continuously
 
4756
monitor the state of this event object and exit when it becomes signaled.
 
4757
 
 
4758
The second parameter indicates the initial state of
 
4759
.B exit-event
 
4760
and normally defaults to 0.
 
4761
 
 
4762
Multiple OpenVPN processes can be simultaneously executed with the same
 
4763
.B exit-event
 
4764
parameter.  In any case, the controlling process can signal
 
4765
.B exit-event,
 
4766
causing all such OpenVPN processes to exit.
 
4767
 
 
4768
When executing an OpenVPN process using the
 
4769
.B \-\-service
 
4770
directive, OpenVPN will probably not have a console
 
4771
window to output status/error
 
4772
messages, therefore it is useful to use
 
4773
.B \-\-log
 
4774
or
 
4775
.B \-\-log-append
 
4776
to write these messages to a file.
 
4777
.\"*********************************************************
 
4778
.TP
 
4779
.B \-\-show-adapters
 
4780
(Standalone)
 
4781
Show available TAP-Win32 adapters which can be selected using the
 
4782
.B \-\-dev-node
 
4783
option.  On non-Windows systems, the
 
4784
.BR ifconfig (8)
 
4785
command provides similar functionality.
 
4786
.\"*********************************************************
 
4787
.TP
 
4788
.B \-\-allow-nonadmin [TAP-adapter]
 
4789
(Standalone)
 
4790
Set
 
4791
.B TAP-adapter
 
4792
to allow access from non-administrative accounts.  If
 
4793
.B TAP-adapter
 
4794
is omitted, all TAP adapters on the system will be configured to allow
 
4795
non-admin access.
 
4796
The non-admin access setting will only persist for the length of time that
 
4797
the TAP-Win32 device object and driver remain loaded, and will need
 
4798
to be re-enabled after a reboot, or if the driver is unloaded
 
4799
and reloaded.
 
4800
This directive can only be used by an administrator.
 
4801
.\"*********************************************************
 
4802
.TP
 
4803
.B \-\-show-valid-subnets
 
4804
(Standalone)
 
4805
Show valid subnets for
 
4806
.B \-\-dev tun
 
4807
emulation.  Since the TAP-Win32 driver
 
4808
exports an ethernet interface to Windows, and since TUN devices are
 
4809
point-to-point in nature, it is necessary for the TAP-Win32 driver
 
4810
to impose certain constraints on TUN endpoint address selection.
 
4811
 
 
4812
Namely, the point-to-point endpoints used in TUN device emulation
 
4813
must be the middle two addresses of a /30 subnet (netmask 255.255.255.252).
 
4814
.\"*********************************************************
 
4815
.TP
 
4816
.B \-\-show-net
 
4817
(Standalone)
 
4818
Show OpenVPN's view of the system routing table and network
 
4819
adapter list.
 
4820
.\"*********************************************************
 
4821
.SS PKCS#11 Standalone Options:
 
4822
.\"*********************************************************
 
4823
.TP
 
4824
.B \-\-show-pkcs11-ids provider [cert_private]
 
4825
(Standalone)
 
4826
Show PKCS#11 token object list. Specify cert_private as 1
 
4827
if certificates are stored as private objects.
 
4828
 
 
4829
.B \-\-verb
 
4830
option can be used BEFORE this option to produce debugging information.
 
4831
.\"*********************************************************
 
4832
.SH SCRIPTING AND ENVIRONMENTAL VARIABLES
 
4833
OpenVPN exports a series
 
4834
of environmental variables for use by user-defined scripts.
 
4835
.\"*********************************************************
 
4836
.SS Script Order of Execution
 
4837
.\"*********************************************************
 
4838
.TP
 
4839
.B \-\-up
 
4840
Executed after TCP/UDP socket bind and TUN/TAP open.
 
4841
.\"*********************************************************
 
4842
.TP
 
4843
.B \-\-tls-verify
 
4844
Executed when we have a still untrusted remote peer.
 
4845
.\"*********************************************************
 
4846
.TP
 
4847
.B \-\-ipchange
 
4848
Executed after connection authentication, or remote IP address change.
 
4849
.\"*********************************************************
 
4850
.TP
 
4851
.B \-\-client-connect
 
4852
Executed in
 
4853
.B \-\-mode server
 
4854
mode immediately after client authentication.
 
4855
.\"*********************************************************
 
4856
.TP
 
4857
.B \-\-route-up
 
4858
Executed after connection authentication, either
 
4859
immediately after, or some number of seconds after
 
4860
as defined by the
 
4861
.B \-\-route-delay
 
4862
option.
 
4863
.\"*********************************************************
 
4864
.TP
 
4865
.B \-\-client-disconnect
 
4866
Executed in
 
4867
.B \-\-mode server
 
4868
mode on client instance shutdown.
 
4869
.\"*********************************************************
 
4870
.TP
 
4871
.B \-\-down
 
4872
Executed after TCP/UDP and TUN/TAP close.
 
4873
.\"*********************************************************
 
4874
.TP
 
4875
.B \-\-learn-address
 
4876
Executed in
 
4877
.B \-\-mode server
 
4878
mode whenever an IPv4 address/route or MAC address is added to OpenVPN's
 
4879
internal routing table.
 
4880
.\"*********************************************************
 
4881
.TP
 
4882
.B \-\-auth-user-pass-verify
 
4883
Executed in
 
4884
.B \-\-mode server
 
4885
mode on new client connections, when the client is
 
4886
still untrusted.
 
4887
.\"*********************************************************
 
4888
.SS String Types and Remapping
 
4889
In certain cases, OpenVPN will perform remapping of characters
 
4890
in strings.  Essentially, any characters outside the set of
 
4891
permitted characters for each string type will be converted
 
4892
to underbar ('_').
 
4893
 
 
4894
.B Q:
 
4895
Why is string remapping necessary?
 
4896
 
 
4897
.B A:
 
4898
It's an important security feature to prevent the malicious coding of
 
4899
strings from untrusted sources to be passed as parameters to scripts,
 
4900
saved in the environment, used as a common name, translated to a filename,
 
4901
etc.
 
4902
 
 
4903
.B Q:
 
4904
Can string remapping be disabled?
 
4905
 
 
4906
.B A:
 
4907
Yes, by using the
 
4908
.B \-\-no-name-remapping
 
4909
option, however this should be considered an advanced option.
 
4910
 
 
4911
Here is a brief rundown of OpenVPN's current string types and the 
 
4912
permitted character class for each string:
 
4913
 
 
4914
.B X509 Names:
 
4915
Alphanumeric, underbar ('_'), dash ('-'), dot ('.'), at 
 
4916
('@'), colon (':'), slash ('/'), and equal ('=').  Alphanumeric is defined 
 
4917
as a character which will cause the C library isalnum() function to return 
 
4918
true.
 
4919
 
 
4920
.B Common Names:
 
4921
Alphanumeric, underbar ('_'), dash ('-'), dot ('.'), and at                
 
4922
('@').
 
4923
 
 
4924
.B \-\-auth-user-pass username:
 
4925
Same as Common Name, with one exception: starting with OpenVPN 2.0.1,
 
4926
the username is passed to the OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY plugin in its raw form,
 
4927
without string remapping.
 
4928
 
 
4929
.B \-\-auth-user-pass password:
 
4930
Any "printable" character except CR or LF.  
 
4931
Printable is defined to be a character which will cause the C library 
 
4932
isprint() function to return true.
 
4933
 
 
4934
.B \-\-client-config-dir filename as derived from common name or username:
 
4935
Alphanumeric, underbar ('_'), dash ('-'), and dot ('.') except for "." or 
 
4936
".." as standalone strings.  As of 2.0.1-rc6, the at ('@') character has
 
4937
been added as well for compatibility with the common name character class.
 
4938
 
 
4939
.B Environmental variable names:
 
4940
Alphanumeric or underbar ('_').
 
4941
 
 
4942
.B Environmental variable values:
 
4943
Any printable character.
 
4944
 
 
4945
For all cases, characters in a string which are not members of the legal 
 
4946
character class for that string type will be remapped to underbar ('_').
 
4947
.\"*********************************************************
 
4948
.SS Environmental Variables
 
4949
Once set, a variable is persisted
 
4950
indefinitely until it is reset by a new value or a restart,
 
4951
 
 
4952
As of OpenVPN 2.0-beta12, in server mode, environmental
 
4953
variables set by OpenVPN
 
4954
are scoped according to the client objects
 
4955
they are
 
4956
associated with, so there should not be any issues with
 
4957
scripts having access to stale, previously set variables
 
4958
which refer to different client instances.
 
4959
.\"*********************************************************
 
4960
.TP
 
4961
.B bytes_received
 
4962
Total number of bytes received from client during VPN session.
 
4963
Set prior to execution of the
 
4964
.B \-\-client-disconnect
 
4965
script.
 
4966
.\"*********************************************************
 
4967
.TP
 
4968
.B bytes_sent
 
4969
Total number of bytes sent to client during VPN session.
 
4970
Set prior to execution of the
 
4971
.B \-\-client-disconnect
 
4972
script.
 
4973
.\"*********************************************************
 
4974
.TP
 
4975
.B common_name
 
4976
The X509 common name of an authenticated client.
 
4977
Set prior to execution of
 
4978
.B \-\-client-connect, \-\-client-disconnect,
 
4979
and
 
4980
.B \-\-auth-user-pass-verify
 
4981
scripts.
 
4982
.\"*********************************************************
 
4983
.TP
 
4984
.B config
 
4985
Name of first
 
4986
.B \-\-config
 
4987
file.
 
4988
Set on program initiation and reset on SIGHUP.
 
4989
.\"*********************************************************
 
4990
.TP
 
4991
.B daemon
 
4992
Set to "1" if the
 
4993
.B \-\-daemon
 
4994
directive is specified, or "0" otherwise.
 
4995
Set on program initiation and reset on SIGHUP.
 
4996
.\"*********************************************************
 
4997
.TP
 
4998
.B daemon_log_redirect
 
4999
Set to "1" if the
 
5000
.B \-\-log
 
5001
or
 
5002
.B \-\-log-append
 
5003
directives are specified, or "0" otherwise.
 
5004
Set on program initiation and reset on SIGHUP.
 
5005
.\"*********************************************************
 
5006
.TP
 
5007
.B dev
 
5008
The actual name of the TUN/TAP device, including
 
5009
a unit number if it exists.
 
5010
Set prior to
 
5011
.B \-\-up
 
5012
or
 
5013
.B \-\-down
 
5014
script execution.
 
5015
.\"*********************************************************
 
5016
.TP
 
5017
.B foreign_option_{n}
 
5018
An option pushed via
 
5019
.B \-\-push
 
5020
to a client which does not natively support it,
 
5021
such as
 
5022
.B \-\-dhcp-option
 
5023
on a non-Windows system, will be recorded to this
 
5024
environmental variable sequence prior to
 
5025
.B \-\-up
 
5026
script execution.
 
5027
.\"*********************************************************
 
5028
.TP
 
5029
.B ifconfig_broadcast
 
5030
The broadcast address for the virtual
 
5031
ethernet segment which is derived from the
 
5032
.B \-\-ifconfig
 
5033
option when
 
5034
.B \-\-dev tap
 
5035
is used.
 
5036
Set prior to OpenVPN calling the
 
5037
.I ifconfig
 
5038
or
 
5039
.I netsh
 
5040
(windows version of ifconfig) commands which
 
5041
normally occurs prior to
 
5042
.B \-\-up
 
5043
script execution.
 
5044
.\"*********************************************************
 
5045
.TP
 
5046
.B ifconfig_local
 
5047
The local VPN endpoint IP address specified in the
 
5048
.B \-\-ifconfig
 
5049
option (first parameter).
 
5050
Set prior to OpenVPN calling the
 
5051
.I ifconfig
 
5052
or
 
5053
.I netsh
 
5054
(windows version of ifconfig) commands which
 
5055
normally occurs prior to
 
5056
.B \-\-up
 
5057
script execution.
 
5058
.\"*********************************************************
 
5059
.TP
 
5060
.B ifconfig_remote
 
5061
The remote VPN endpoint IP address specified in the
 
5062
.B \-\-ifconfig
 
5063
option (second parameter) when
 
5064
.B \-\-dev tun
 
5065
is used.
 
5066
Set prior to OpenVPN calling the
 
5067
.I ifconfig
 
5068
or
 
5069
.I netsh
 
5070
(windows version of ifconfig) commands which
 
5071
normally occurs prior to
 
5072
.B \-\-up
 
5073
script execution.
 
5074
.\"*********************************************************
 
5075
.TP
 
5076
.B ifconfig_netmask
 
5077
The subnet mask of the virtual ethernet segment
 
5078
that is specified as the second parameter to
 
5079
.B \-\-ifconfig
 
5080
when
 
5081
.B \-\-dev tap
 
5082
is being used.
 
5083
Set prior to OpenVPN calling the
 
5084
.I ifconfig
 
5085
or
 
5086
.I netsh
 
5087
(windows version of ifconfig) commands which
 
5088
normally occurs prior to
 
5089
.B \-\-up
 
5090
script execution.
 
5091
.\"*********************************************************
 
5092
.TP
 
5093
.B ifconfig_pool_local_ip
 
5094
The local
 
5095
virtual IP address for the TUN/TAP tunnel taken from an
 
5096
.B \-\-ifconfig-push
 
5097
directive if specified, or otherwise from
 
5098
the ifconfig pool (controlled by the
 
5099
.B \-\-ifconfig-pool
 
5100
config file directive).
 
5101
Only set for
 
5102
.B \-\-dev tun
 
5103
tunnels.
 
5104
This option is set on the server prior to execution
 
5105
of the
 
5106
.B \-\-client-connect
 
5107
and
 
5108
.B \-\-client-disconnect
 
5109
scripts.
 
5110
.\"*********************************************************
 
5111
.TP
 
5112
.B ifconfig_pool_netmask
 
5113
The
 
5114
virtual IP netmask for the TUN/TAP tunnel taken from an
 
5115
.B \-\-ifconfig-push
 
5116
directive if specified, or otherwise from
 
5117
the ifconfig pool (controlled by the
 
5118
.B \-\-ifconfig-pool
 
5119
config file directive).
 
5120
Only set for
 
5121
.B \-\-dev tap
 
5122
tunnels.
 
5123
This option is set on the server prior to execution
 
5124
of the
 
5125
.B \-\-client-connect
 
5126
and
 
5127
.B \-\-client-disconnect
 
5128
scripts.
 
5129
.\"*********************************************************
 
5130
.TP
 
5131
.B ifconfig_pool_remote_ip
 
5132
The remote
 
5133
virtual IP address for the TUN/TAP tunnel taken from an
 
5134
.B \-\-ifconfig-push
 
5135
directive if specified, or otherwise from
 
5136
the ifconfig pool (controlled by the
 
5137
.B \-\-ifconfig-pool
 
5138
config file directive).
 
5139
This option is set on the server prior to execution
 
5140
of the
 
5141
.B \-\-client-connect
 
5142
and
 
5143
.B \-\-client-disconnect
 
5144
scripts.
 
5145
.\"*********************************************************
 
5146
.TP
 
5147
.B link_mtu
 
5148
The maximum packet size (not including the IP header)
 
5149
of tunnel data in UDP tunnel transport mode.
 
5150
Set prior to
 
5151
.B \-\-up
 
5152
or
 
5153
.B \-\-down
 
5154
script execution.
 
5155
.\"*********************************************************
 
5156
.TP
 
5157
.B local
 
5158
The
 
5159
.B \-\-local
 
5160
parameter.
 
5161
Set on program initiation and reset on SIGHUP.
 
5162
.\"*********************************************************
 
5163
.TP
 
5164
.B local_port
 
5165
The local port number, specified by
 
5166
.B \-\-port
 
5167
or
 
5168
.B \-\-lport.
 
5169
Set on program initiation and reset on SIGHUP.
 
5170
.\"*********************************************************
 
5171
.TP
 
5172
.B password
 
5173
The password provided by a connecting client.
 
5174
Set prior to
 
5175
.B \-\-auth-user-pass-verify
 
5176
script execution only when the
 
5177
.B via-env
 
5178
modifier is specified, and deleted from the environment
 
5179
after the script returns.
 
5180
.\"*********************************************************
 
5181
.TP
 
5182
.B proto
 
5183
The
 
5184
.B \-\-proto
 
5185
parameter.
 
5186
Set on program initiation and reset on SIGHUP.
 
5187
.\"*********************************************************
 
5188
.TP
 
5189
.B remote_{n}
 
5190
The
 
5191
.B \-\-remote
 
5192
parameter.
 
5193
Set on program initiation and reset on SIGHUP.
 
5194
.\"*********************************************************
 
5195
.TP
 
5196
.B remote_port_{n}
 
5197
The remote port number, specified by
 
5198
.B \-\-port
 
5199
or
 
5200
.B \-\-rport.
 
5201
Set on program initiation and reset on SIGHUP.
 
5202
.\"*********************************************************
 
5203
.TP
 
5204
.B route_net_gateway
 
5205
The pre-existing default IP gateway in the system routing
 
5206
table.
 
5207
Set prior to
 
5208
.B \-\-up
 
5209
script execution.
 
5210
.\"*********************************************************
 
5211
.TP
 
5212
.B route_vpn_gateway
 
5213
The default gateway used by
 
5214
.B \-\-route
 
5215
options, as specified in either the
 
5216
.B \-\-route-gateway
 
5217
option or the second parameter to
 
5218
.B \-\-ifconfig
 
5219
when
 
5220
.B \-\-dev tun
 
5221
is specified.
 
5222
Set prior to
 
5223
.B \-\-up
 
5224
script execution.
 
5225
.\"*********************************************************
 
5226
.TP
 
5227
.B route_{parm}_{n}
 
5228
A set of variables which define each route to be added, and
 
5229
are set prior to
 
5230
.B \-\-up
 
5231
script execution.
 
5232
 
 
5233
.B parm
 
5234
will be one of "network", "netmask", "gateway", or "metric".
 
5235
 
 
5236
.B n
 
5237
is the OpenVPN route number, starting from 1.
 
5238
 
 
5239
If the network or gateway are resolvable DNS names,
 
5240
their IP address translations will be recorded rather
 
5241
than their names as denoted on the command line
 
5242
or configuration file.
 
5243
.\"*********************************************************
 
5244
.TP
 
5245
.B script_context
 
5246
Set to "init" or "restart" prior to up/down script execution.
 
5247
For more information, see
 
5248
documentation for
 
5249
.B \-\-up.
 
5250
.\"*********************************************************
 
5251
.TP
 
5252
.B script_type
 
5253
One of
 
5254
.B up, down, ipchange, route-up, tls-verify, auth-user-pass-verify,
 
5255
.B client-connect, client-disconnect, 
 
5256
or
 
5257
.B learn-address.
 
5258
Set prior to execution of any script.
 
5259
.\"*********************************************************
 
5260
.TP
 
5261
.B signal
 
5262
The reason for exit or restart.  Can be one of
 
5263
.B sigusr1, sighup, sigterm, sigint, inactive
 
5264
(controlled by
 
5265
.B \-\-inactive
 
5266
option),
 
5267
.B ping-exit
 
5268
(controlled by
 
5269
.B \-\-ping-exit
 
5270
option),
 
5271
.B ping-restart
 
5272
(controlled by
 
5273
.B \-\-ping-restart
 
5274
option),
 
5275
.B connection-reset
 
5276
(triggered on TCP connection reset),
 
5277
.B error,
 
5278
or
 
5279
.B unknown
 
5280
(unknown signal).  This variable is set just prior to down script execution.
 
5281
.\"*********************************************************
 
5282
.TP
 
5283
.B time_ascii
 
5284
Client connection timestamp, formatted as a human-readable
 
5285
time string.
 
5286
Set prior to execution of the
 
5287
.B \-\-client-connect
 
5288
script.
 
5289
.\"*********************************************************
 
5290
.TP
 
5291
.B time_duration
 
5292
The duration (in seconds) of the client session which is now
 
5293
disconnecting.
 
5294
Set prior to execution of the
 
5295
.B \-\-client-disconnect
 
5296
script.
 
5297
.\"*********************************************************
 
5298
.TP
 
5299
.B time_unix
 
5300
Client connection timestamp, formatted as a unix integer
 
5301
date/time value.
 
5302
Set prior to execution of the
 
5303
.B \-\-client-connect
 
5304
script.
 
5305
.\"*********************************************************
 
5306
.TP
 
5307
.B tls_id_{n}
 
5308
A series of certificate fields from the remote peer,
 
5309
where
 
5310
.B n
 
5311
is the verification level.  Only set for TLS connections.  Set prior
 
5312
to execution of
 
5313
.B \-\-tls-verify
 
5314
script.
 
5315
.\"*********************************************************
 
5316
.TP
 
5317
.B tls_serial_{n}
 
5318
The serial number of the certificate from the remote peer,
 
5319
where
 
5320
.B n
 
5321
is the verification level.  Only set for TLS connections.  Set prior
 
5322
to execution of
 
5323
.B \-\-tls-verify
 
5324
script.
 
5325
.\"*********************************************************
 
5326
.TP
 
5327
.B tun_mtu
 
5328
The MTU of the TUN/TAP device.
 
5329
Set prior to
 
5330
.B \-\-up
 
5331
or
 
5332
.B \-\-down
 
5333
script execution.
 
5334
.\"*********************************************************
 
5335
.TP
 
5336
.B trusted_ip
 
5337
Actual IP address of connecting client or peer which has been authenticated.
 
5338
Set prior to execution of
 
5339
.B \-\-ipchange, \-\-client-connect,
 
5340
and
 
5341
.B \-\-client-disconnect
 
5342
scripts.
 
5343
.\"*********************************************************
 
5344
.TP
 
5345
.B trusted_port
 
5346
Actual port number of connecting client or peer which has been authenticated.
 
5347
Set prior to execution of
 
5348
.B \-\-ipchange, \-\-client-connect,
 
5349
and
 
5350
.B \-\-client-disconnect
 
5351
scripts.
 
5352
.\"*********************************************************
 
5353
.TP
 
5354
.B untrusted_ip
 
5355
Actual IP address of connecting client or peer which has not been authenticated
 
5356
yet.  Sometimes used to
 
5357
.B nmap
 
5358
the connecting host in a
 
5359
.B \-\-tls-verify
 
5360
script to ensure it is firewalled properly.
 
5361
Set prior to execution of
 
5362
.B \-\-tls-verify
 
5363
and
 
5364
.B \-\-auth-user-pass-verify
 
5365
scripts.
 
5366
.\"*********************************************************
 
5367
.TP
 
5368
.B untrusted_port
 
5369
Actual port number of connecting client or peer which has not been authenticated
 
5370
yet.
 
5371
Set prior to execution of
 
5372
.B \-\-tls-verify
 
5373
and
 
5374
.B \-\-auth-user-pass-verify
 
5375
scripts.
 
5376
.\"*********************************************************
 
5377
.TP
 
5378
.B username
 
5379
The username provided by a connecting client.
 
5380
Set prior to
 
5381
.B \-\-auth-user-pass-verify
 
5382
script execution only when the
 
5383
.B via-env
 
5384
modifier is specified.
 
5385
.\"*********************************************************
 
5386
.TP
 
5387
.B X509_{n}_{subject_field}
 
5388
An X509 subject field from the remote peer certificate,
 
5389
where
 
5390
.B n
 
5391
is the verification level.  Only set for TLS connections.  Set prior
 
5392
to execution of
 
5393
.B \-\-tls-verify
 
5394
script.  This variable is similar to
 
5395
.B tls_id_{n}
 
5396
except the component X509 subject fields are broken out, and
 
5397
no string remapping occurs on these field values (except for remapping
 
5398
of control characters to "_").
 
5399
For example, the following variables would be set on the
 
5400
OpenVPN server using the sample client certificate
 
5401
in sample-keys (client.crt).
 
5402
Note that the verification level is 0 for the client certificate
 
5403
and 1 for the CA certificate.
 
5404
 
 
5405
.nf
 
5406
.ft 3
 
5407
.in +4
 
5408
X509_0_emailAddress=me@myhost.mydomain
 
5409
X509_0_CN=Test-Client
 
5410
X509_0_O=OpenVPN-TEST
 
5411
X509_0_ST=NA
 
5412
X509_0_C=KG
 
5413
X509_1_emailAddress=me@myhost.mydomain
 
5414
X509_1_O=OpenVPN-TEST
 
5415
X509_1_L=BISHKEK
 
5416
X509_1_ST=NA
 
5417
X509_1_C=KG
 
5418
.in -4
 
5419
.ft
 
5420
.fi
 
5421
.\"*********************************************************
 
5422
.SH SIGNALS
 
5423
.TP
 
5424
.B SIGHUP
 
5425
Cause OpenVPN to close all TUN/TAP and
 
5426
network connections,
 
5427
restart, re-read the configuration file (if any),
 
5428
and reopen TUN/TAP and network connections.
 
5429
.\"*********************************************************
 
5430
.TP
 
5431
.B SIGUSR1
 
5432
Like 
 
5433
.B SIGHUP,
 
5434
except don't re-read configuration file, and possibly don't close and reopen TUN/TAP
 
5435
device, re-read key files, preserve local IP address/port, or preserve most recently authenticated
 
5436
remote IP address/port based on
 
5437
.B \-\-persist-tun, \-\-persist-key, \-\-persist-local-ip,
 
5438
and
 
5439
.B \-\-persist-remote-ip
 
5440
options respectively (see above).
 
5441
 
 
5442
This signal may also be internally generated by a timeout condition, governed
 
5443
by the
 
5444
.B \-\-ping-restart
 
5445
option.
 
5446
 
 
5447
This signal, when combined with
 
5448
.B \-\-persist-remote-ip,
 
5449
may be
 
5450
sent when the underlying parameters of the host's network interface change
 
5451
such as when the host is a DHCP client and is assigned a new IP address.
 
5452
See
 
5453
.B \-\-ipchange
 
5454
above for more information.
 
5455
.\"*********************************************************
 
5456
.TP
 
5457
.B SIGUSR2
 
5458
Causes OpenVPN to display its current statistics (to the syslog
 
5459
file if
 
5460
.B \-\-daemon
 
5461
is used, or stdout otherwise).
 
5462
.\"*********************************************************
 
5463
.TP
 
5464
.B SIGINT, SIGTERM
 
5465
Causes OpenVPN to exit gracefully.
 
5466
.\"*********************************************************
 
5467
.SH TUN/TAP DRIVER SETUP
 
5468
If you are running Linux 2.4.7 or higher, you probably have the TUN/TAP driver
 
5469
already installed.  If so, there are still a few things you need to do:
 
5470
 
 
5471
Make device:
 
5472
.B mknod /dev/net/tun c 10 200
 
5473
 
 
5474
Load driver:
 
5475
.B modprobe tun
 
5476
 
 
5477
If you have Linux 2.2 or earlier, you should obtain version 1.1 of the
 
5478
TUN/TAP driver from
 
5479
.I http://vtun.sourceforge.net/tun/
 
5480
and follow the installation instructions.
 
5481
.\"*********************************************************
 
5482
.SH EXAMPLES
 
5483
Prior to running these examples, you should have OpenVPN installed on two
 
5484
machines with network connectivity between them.  If you have not
 
5485
yet installed OpenVPN, consult the INSTALL file included in the OpenVPN
 
5486
distribution.
 
5487
.\"*********************************************************
 
5488
.SS TUN/TAP Setup:
 
5489
If you are using Linux 2.4 or higher,
 
5490
make the tun device node and load the tun module:
 
5491
.IP
 
5492
.B mknod /dev/net/tun c 10 200
 
5493
.LP
 
5494
.IP
 
5495
.B modprobe tun
 
5496
.LP
 
5497
If you installed from RPM, the
 
5498
.B mknod
 
5499
step may be omitted, because the RPM install does that for you.
 
5500
 
 
5501
If you have Linux 2.2, you should obtain version 1.1 of the
 
5502
TUN/TAP driver from
 
5503
.I http://vtun.sourceforge.net/tun/
 
5504
and follow the installation instructions.
 
5505
 
 
5506
For other platforms, consult the INSTALL file at
 
5507
.I http://openvpn.net/install.html
 
5508
for more information.
 
5509
.\"*********************************************************
 
5510
.SS Firewall Setup:
 
5511
If firewalls exist between
 
5512
the two machines, they should be set to forward UDP port 1194
 
5513
in both directions.  If you do not have control over the firewalls
 
5514
between the two machines, you may still be able to use OpenVPN by adding
 
5515
.B \-\-ping 15
 
5516
to each of the
 
5517
.B openvpn
 
5518
commands used below in the examples (this will cause each peer to send out
 
5519
a UDP ping to its remote peer once every 15 seconds which will cause many
 
5520
stateful firewalls to forward packets in both directions
 
5521
without an explicit firewall rule).
 
5522
 
 
5523
If you are using a Linux iptables-based firewall, you may need to enter
 
5524
the following command to allow incoming packets on the TUN device:
 
5525
.IP
 
5526
.B iptables -A INPUT -i tun+ -j ACCEPT
 
5527
.LP
 
5528
See the firewalls section below for more information on configuring firewalls
 
5529
for use with OpenVPN.
 
5530
.\"*********************************************************
 
5531
.SS VPN Address Setup:
 
5532
For purposes
 
5533
of our example, our two machines will be called
 
5534
.B may.kg
 
5535
and
 
5536
.B june.kg.
 
5537
If you are constructing a VPN over the internet, then replace
 
5538
.B may.kg
 
5539
and
 
5540
.B june.kg
 
5541
with the internet hostname or IP address that each machine will use
 
5542
to contact the other over the internet.
 
5543
 
 
5544
Now we will choose the tunnel endpoints.  Tunnel endpoints are
 
5545
private IP addresses that only have meaning in the context of
 
5546
the VPN.  Each machine will use the tunnel endpoint of the other
 
5547
machine to access it over the VPN.  In our example,
 
5548
the tunnel endpoint for may.kg
 
5549
will be 10.4.0.1 and for june.kg, 10.4.0.2.
 
5550
 
 
5551
Once the VPN is established, you have essentially
 
5552
created a secure alternate path between the two hosts
 
5553
which is addressed by using the tunnel endpoints.  You can
 
5554
control which network
 
5555
traffic passes between the hosts 
 
5556
(a) over the VPN or (b) independently of the VPN, by choosing whether to use
 
5557
(a) the VPN endpoint address or (b) the public internet address,
 
5558
to access the remote host. For example if you are on may.kg and you wish to connect to june.kg
 
5559
via
 
5560
.B ssh
 
5561
without using the VPN (since
 
5562
.B ssh
 
5563
has its own built-in security) you would use the command
 
5564
.B ssh june.kg.
 
5565
However in the same scenario, you could also use the command
 
5566
.B telnet 10.4.0.2
 
5567
to create a telnet session with june.kg over the VPN, that would
 
5568
use the VPN to secure the session rather than
 
5569
.B ssh.
 
5570
 
 
5571
You can use any address you wish for the
 
5572
tunnel endpoints
 
5573
but make sure that they are private addresses
 
5574
(such as those that begin with 10 or 192.168) and that they are
 
5575
not part of any existing subnet on the networks of
 
5576
either peer, unless you are bridging.  If you use an address that is part of
 
5577
your local subnet for either of the tunnel endpoints,
 
5578
you will get a weird feedback loop.
 
5579
.\"*********************************************************
 
5580
.SS Example 1: A simple tunnel without security
 
5581
.LP
 
5582
On may:
 
5583
.IP
 
5584
.B openvpn \-\-remote june.kg \-\-dev tun1 \-\-ifconfig 10.4.0.1 10.4.0.2 \-\-verb 9
 
5585
.LP
 
5586
On june:
 
5587
.IP
 
5588
.B openvpn \-\-remote may.kg \-\-dev tun1 \-\-ifconfig 10.4.0.2 10.4.0.1 \-\-verb 9
 
5589
.LP
 
5590
Now verify the tunnel is working by pinging across the tunnel.
 
5591
.LP
 
5592
On may:
 
5593
.IP
 
5594
.B ping 10.4.0.2
 
5595
.LP
 
5596
On june:
 
5597
.IP
 
5598
.B ping 10.4.0.1
 
5599
.LP
 
5600
The
 
5601
.B \-\-verb 9
 
5602
option will produce verbose output, similar to the
 
5603
.BR tcpdump (8)
 
5604
program.  Omit the
 
5605
.B \-\-verb 9
 
5606
option to have OpenVPN run quietly.
 
5607
.\"*********************************************************
 
5608
.SS Example 2: A tunnel with static-key security (i.e. using a pre-shared secret)
 
5609
First build a static key on may.
 
5610
.IP
 
5611
.B openvpn \-\-genkey \-\-secret key
 
5612
.LP
 
5613
This command will build a random key file called
 
5614
.B key
 
5615
(in ascii format).
 
5616
Now copy
 
5617
.B key
 
5618
to june over a secure medium such as by
 
5619
using the
 
5620
.BR scp (1)
 
5621
program.
 
5622
.LP
 
5623
On may:
 
5624
.IP
 
5625
.B openvpn \-\-remote june.kg \-\-dev tun1 \-\-ifconfig 10.4.0.1 10.4.0.2 \-\-verb 5 \-\-secret key
 
5626
.LP
 
5627
On june:
 
5628
.IP
 
5629
.B openvpn \-\-remote may.kg \-\-dev tun1 \-\-ifconfig 10.4.0.2 10.4.0.1 \-\-verb 5 \-\-secret key
 
5630
.LP
 
5631
Now verify the tunnel is working by pinging across the tunnel.
 
5632
.LP
 
5633
On may:
 
5634
.IP
 
5635
.B ping 10.4.0.2
 
5636
.LP
 
5637
On june:
 
5638
.IP
 
5639
.B ping 10.4.0.1
 
5640
.\"*********************************************************
 
5641
.SS Example 3: A tunnel with full TLS-based security
 
5642
For this test, we will designate
 
5643
.B may
 
5644
as the TLS client and
 
5645
.B june
 
5646
as the TLS server.
 
5647
.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.
 
5648
 
 
5649
First, build a separate certificate/key pair
 
5650
for both may and june (see above where
 
5651
.B \-\-cert
 
5652
is discussed for more info).  Then construct
 
5653
Diffie Hellman parameters (see above where
 
5654
.B \-\-dh
 
5655
is discussed for more info).  You can also use the
 
5656
included test files client.crt, client.key,
 
5657
server.crt, server.key and ca.crt.
 
5658
The .crt files are certificates/public-keys, the .key
 
5659
files are private keys, and ca.crt is a certification
 
5660
authority who has signed both
 
5661
client.crt and server.crt.  For Diffie Hellman
 
5662
parameters you can use the included file dh1024.pem.
 
5663
.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.
 
5664
.LP
 
5665
On may:
 
5666
.IP
 
5667
.B openvpn \-\-remote june.kg \-\-dev tun1 \-\-ifconfig 10.4.0.1 10.4.0.2 \-\-tls-client \-\-ca ca.crt \-\-cert client.crt \-\-key client.key \-\-reneg-sec 60 \-\-verb 5
 
5668
.LP
 
5669
On june:
 
5670
.IP
 
5671
.B openvpn \-\-remote may.kg \-\-dev tun1 \-\-ifconfig 10.4.0.2 10.4.0.1 \-\-tls-server \-\-dh dh1024.pem \-\-ca ca.crt \-\-cert server.crt \-\-key server.key \-\-reneg-sec 60 \-\-verb 5
 
5672
.LP
 
5673
Now verify the tunnel is working by pinging across the tunnel.
 
5674
.LP
 
5675
On may:
 
5676
.IP
 
5677
.B ping 10.4.0.2
 
5678
.LP
 
5679
On june:
 
5680
.IP
 
5681
.B ping 10.4.0.1
 
5682
.LP
 
5683
Notice the
 
5684
.B \-\-reneg-sec 60
 
5685
option we used above.  That tells OpenVPN to renegotiate
 
5686
the data channel keys every minute.
 
5687
Since we used
 
5688
.B \-\-verb 5
 
5689
above, you will see status information on each new key negotiation.
 
5690
 
 
5691
For production operations, a key renegotiation interval of 60 seconds
 
5692
is probably too frequent.  Omit the
 
5693
.B \-\-reneg-sec 60
 
5694
option to use OpenVPN's default key renegotiation interval of one hour.
 
5695
.\"*********************************************************
 
5696
.SS Routing:
 
5697
Assuming you can ping across the tunnel,
 
5698
the next step is to route a real subnet over
 
5699
the secure tunnel.  Suppose that may and june have two network
 
5700
interfaces each, one connected
 
5701
to the internet, and the other to a private
 
5702
network.  Our goal is to securely connect
 
5703
both private networks.  We will assume that may's private subnet
 
5704
is 10.0.0.0/24 and june's is 10.0.1.0/24.
 
5705
.LP
 
5706
First, ensure that IP forwarding is enabled on both peers.
 
5707
On Linux, enable routing:
 
5708
.IP
 
5709
.B echo 1 > /proc/sys/net/ipv4/ip_forward
 
5710
.LP
 
5711
and enable TUN packet forwarding through the firewall:
 
5712
.IP
 
5713
.B iptables -A FORWARD -i tun+ -j ACCEPT
 
5714
.LP
 
5715
On may:
 
5716
.IP
 
5717
.B route add -net 10.0.1.0 netmask 255.255.255.0 gw 10.4.0.2
 
5718
.LP
 
5719
On june:
 
5720
.IP
 
5721
.B route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.4.0.1
 
5722
.LP
 
5723
Now any machine on the 10.0.0.0/24 subnet can
 
5724
access any machine on the 10.0.1.0/24 subnet
 
5725
over the secure tunnel (or vice versa).
 
5726
 
 
5727
In a production environment, you could put the route command(s)
 
5728
in a shell script and execute with the
 
5729
.B \-\-up
 
5730
option.
 
5731
.\"*********************************************************
 
5732
.SH FIREWALLS
 
5733
OpenVPN's usage of a single UDP port makes it fairly firewall-friendly.
 
5734
You should add an entry to your firewall rules to allow incoming OpenVPN
 
5735
packets.  On Linux 2.4+:
 
5736
.IP
 
5737
.B iptables -A INPUT -p udp -s 1.2.3.4 \-\-dport 1194 -j ACCEPT
 
5738
.LP
 
5739
This will allow incoming packets on UDP port 1194 (OpenVPN's default UDP port)
 
5740
from an OpenVPN peer at 1.2.3.4.
 
5741
 
 
5742
If you are using HMAC-based packet authentication (the default in any of
 
5743
OpenVPN's secure modes), having the firewall filter on source
 
5744
address can be considered optional, since HMAC packet authentication
 
5745
is a much more secure method of verifying the authenticity of
 
5746
a packet source.  In that case:
 
5747
.IP
 
5748
.B iptables -A INPUT -p udp \-\-dport 1194 -j ACCEPT
 
5749
.LP
 
5750
would be adequate and would not render the host inflexible with
 
5751
respect to its peer having a dynamic IP address.
 
5752
 
 
5753
OpenVPN also works well on stateful firewalls.  In some cases, you may
 
5754
not need to add any static rules to the firewall list if you are
 
5755
using a stateful firewall that knows how to track UDP connections.
 
5756
If you specify
 
5757
.B \-\-ping n,
 
5758
OpenVPN will be guaranteed
 
5759
to send a packet to its peer at least once every
 
5760
.B n
 
5761
seconds.  If
 
5762
.B n
 
5763
is less than the stateful firewall connection timeout, you can
 
5764
maintain an OpenVPN connection indefinitely without explicit
 
5765
firewall rules.
 
5766
 
 
5767
You should also add firewall rules to allow incoming IP traffic on
 
5768
TUN or TAP devices such as:
 
5769
.IP
 
5770
.B iptables -A INPUT -i tun+ -j ACCEPT
 
5771
.LP
 
5772
to allow input packets from tun devices,
 
5773
.IP
 
5774
.B iptables -A FORWARD -i tun+ -j ACCEPT
 
5775
.LP
 
5776
to allow input packets from tun devices to be forwarded to
 
5777
other hosts on the local network,
 
5778
.IP
 
5779
.B iptables -A INPUT -i tap+ -j ACCEPT
 
5780
.LP
 
5781
to allow input packets from tap devices, and
 
5782
.IP
 
5783
.B iptables -A FORWARD -i tap+ -j ACCEPT
 
5784
.LP
 
5785
to allow input packets from tap devices to be forwarded to
 
5786
other hosts on the local network.
 
5787
 
 
5788
These rules are secure if you use packet authentication,
 
5789
since no incoming packets will arrive on a TUN or TAP
 
5790
virtual device
 
5791
unless they first pass an HMAC authentication test.
 
5792
.\"*********************************************************
 
5793
.SH FAQ
 
5794
.I http://openvpn.net/faq.html
 
5795
.\"*********************************************************
 
5796
.SH HOWTO
 
5797
For a more comprehensive guide to setting up OpenVPN
 
5798
in a production setting, see the OpenVPN HOWTO at
 
5799
.I http://openvpn.net/howto.html
 
5800
.\"*********************************************************
 
5801
.SH PROTOCOL
 
5802
For a description of OpenVPN's underlying protocol,
 
5803
see 
 
5804
.I http://openvpn.net/security.html
 
5805
.\"*********************************************************
 
5806
.SH WEB
 
5807
OpenVPN's web site is at
 
5808
.I http://openvpn.net/
 
5809
 
 
5810
Go here to download the latest version of OpenVPN, subscribe
 
5811
to the mailing lists, read the mailing list
 
5812
archives, or browse the SVN repository.
 
5813
.\"*********************************************************
 
5814
.SH BUGS
 
5815
Report all bugs to the OpenVPN team <info@openvpn.net>.
 
5816
.\"*********************************************************
 
5817
.SH "SEE ALSO"
 
5818
.BR dhcpcd (8),
 
5819
.BR ifconfig (8),
 
5820
.BR openssl (1),
 
5821
.BR route (8),
 
5822
.BR scp (1)
 
5823
.BR ssh (1)
 
5824
.\"*********************************************************
 
5825
.SH NOTES 
 
5826
.LP
 
5827
This product includes software developed by the
 
5828
OpenSSL Project (
 
5829
.I http://www.openssl.org/
 
5830
)
 
5831
 
 
5832
For more information on the TLS protocol, see
 
5833
.I http://www.ietf.org/rfc/rfc2246.txt
 
5834
 
 
5835
For more information on the LZO real-time compression library see
 
5836
.I http://www.oberhumer.com/opensource/lzo/
 
5837
.\"*********************************************************
 
5838
.SH COPYRIGHT
 
5839
Copyright (C) 2002-2009 OpenVPN Technologies, Inc. This program is free software;
 
5840
you can redistribute it and/or modify
 
5841
it under the terms of the GNU General Public License version 2
 
5842
as published by the Free Software Foundation.
 
5843
.\"*********************************************************
 
5844
.SH AUTHORS
 
5845
James Yonan <jim@yonan.net>