Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / openvpn / doc / management-notes.txt
blobef39b8553913d13fc4af4a05d146b958da331126
1 OpenVPN Management Interface Notes
2 ----------------------------------
4 The OpenVPN Management interface allows OpenVPN to
5 be administratively controlled from an external program via
6 a TCP or unix domain socket.
8 The interface has been specifically designed for developers
9 who would like to programmatically or remotely control
10 an OpenVPN daemon, and can be used when OpenVPN is running
11 as a client or server.
13 The management interface is implemented using a client/server TCP
14 connection or unix domain socket where OpenVPN will listen on a
15 provided IP address and port for incoming management client connections.
17 The management protocol is currently cleartext without an explicit
18 security layer.  For this reason, it is recommended that the
19 management interface either listen on a unix domain socket,
20 localhost (127.0.0.1), or on the local VPN address.  It's possible
21 to remotely connect to the management interface over the VPN itself,
22 though some capabilities will be limited in this mode, such as the
23 ability to provide private key passwords.
25 The management interface is enabled in the OpenVPN
26 configuration file using the following directive:
28 --management
30 See the man page for documentation on this and related
31 directives.
33 Once OpenVPN has started with the management layer enabled,
34 you can telnet to the management port (make sure to use
35 a telnet client which understands "raw" mode).
37 Once connected to the management port, you can use
38 the "help" command to list all commands.
40 COMMAND -- bytecount
41 --------------------
43 The bytecount command is used to request real-time notification
44 of OpenVPN bandwidth usage.
46 Command syntax:
48   bytecount n (where n > 0) -- set up automatic notification of
49                                bandwidth usage once every n seconds
50   bytecount 0 -- turn off bytecount notifications
52 If OpenVPN is running as a client, the bytecount notification
53 will look like this:
55   >BYTECOUNT:{BYTES_IN},{BYTES_OUT}
57 BYTES_IN is the number of bytes that have been received from
58 the server and BYTES_OUT is the number of bytes that have been
59 sent to the server.
61 If OpenVPN is running as a server, the bytecount notification
62 will look like this:
64   >BYTECOUNT_CLI:{CID},{BYTES_IN},{BYTES_OUT}
66 CID is the Client ID, BYTES_IN is the number of bytes that have
67 been received from the client and BYTES_OUT is the number of
68 bytes that have been sent to the client.
70 Note that when the bytecount command is used on the server, every
71 connected client will report its bandwidth numbers once every n
72 seconds.
74 When the client disconnects, the final bandwidth numbers will be
75 placed in the 'bytes_received' and 'bytes_sent' environmental variables
76 as included in the >CLIENT:DISCONNECT notification.
78 COMMAND -- echo
79 ---------------
81 The echo capability is used to allow GUI-specific
82 parameters to be either embedded in the OpenVPN config file
83 or pushed to an OpenVPN client from a server.
85 Command examples:
87   echo on      -- turn on real-time notification of echo messages
88   echo all     -- print the current echo history list
89   echo off     -- turn off real-time notification of echo messages
90   echo on all  -- atomically enable real-time notification,
91                   plus show any messages in history buffer
93 For example, suppose you are developing a OpenVPN GUI and
94 you want to give the OpenVPN server the ability to ask
95 the GUI to forget any saved passwords.
97 In the OpenVPN server config file, add:
99   push "echo forget-passwords"
101 When the OpenVPN client receives its pulled list of directives
102 from the server, the "echo forget-passwords" directive will
103 be in the list, and it will cause the management interface
104 to save the "forget-passwords" string in its list of echo
105 parameters.
107 The management client can use "echo all" to output the full
108 list of echoed parameters, "echo on" to turn on real-time
109 notification of echoed parameters via the ">ECHO:" prefix,
110 or "echo off" to turn off real-time notification.
112 When the GUI connects to the OpenVPN management socket, it
113 can issue an "echo all" command, which would produce output
114 like this:
116   1101519562,forget-passwords
117   END
119 Essentially the echo command allowed us to pass parameters from
120 the OpenVPN server to the OpenVPN client, and then to the
121 management client (such as a GUI).  The large integer is the
122 unix date/time when the echo parameter was received.
124 If the management client had issued the command "echo on",
125 it would have enabled real-time notifications of echo
126 parameters.  In this case, our "forget-passwords" message
127 would be output like this:
129   >ECHO:1101519562,forget-passwords
131 Like the log command, the echo command can atomically show
132 history while simultaneously activating real-time updates:
134   echo on all
136 The size of the echo buffer is currently hardcoded to 100
137 messages.
139 COMMAND -- exit, quit
140 ---------------------
142 Close the managment session, and resume listening on the
143 management port for connections from other clients. Currently,
144 the OpenVPN daemon can at most support a single management client
145 any one time.
147 COMMAND -- help
148 ---------------
150 Print a summary of commands.
152 COMMAND -- hold
153 ---------------
155 The hold command can be used to manipulate the hold flag,
156 or release OpenVPN from a hold state.
158 If the hold flag is set on initial startup or
159 restart, OpenVPN will hibernate prior to initializing
160 the tunnel until the management interface receives
161 a "hold release" command.
163 The --management-hold directive of OpenVPN can be used
164 to start OpenVPN with the hold flag set.
166 The hold flag setting is persistent and will not
167 be reset by restarts.
169 OpenVPN will indicate that it is in a hold state by
170 sending a real-time notification to the management
171 client:
173   >HOLD:Waiting for hold release
175 Command examples:
177   hold         -- show current hold flag, 0=off, 1=on.
178   hold on      -- turn on hold flag so that future restarts
179                   will hold.
180   hold off     -- turn off hold flag so that future restarts will
181                   not hold.
182   hold release -- leave hold state and start OpenVPN, but
183                   do not alter the current hold flag setting.
185 COMMAND -- kill
186 ---------------
188 In server mode, kill a particlar client instance.
190 Command examples:
192   kill Test-Client -- kill the client instance having a
193                       common name of "Test-Client".
194   kill 1.2.3.4:4000 -- kill the client instance having a
195                        source address and port of 1.2.3.4:4000
197 Use the "status" command to see which clients are connected.
199 COMMAND -- log
200 --------------
202 Show the OpenVPN log file.  Only the most recent n lines
203 of the log file are cached by the management interface, where
204 n is controlled by the OpenVPN --management-log-cache directive.
206 Command examples:
208   log on     -- Enable real-time output of log messages.
209   log all    -- Show currently cached log file history.
210   log on all -- Atomically show all currently cached log file
211                 history then enable real-time notification of
212                 new log file messages.
213   log off    -- Turn off real-time notification of log messages.
214   log 20     -- Show the most recent 20 lines of log file history.
216 Real-time notification format:
218 Real-time log messages begin with the ">LOG:" prefix followed
219 by the following comma-separated fields:
221   (a) unix integer date/time,
222   (b) zero or more message flags in a single string:
223       I -- informational
224       F -- fatal error
225       N -- non-fatal error
226       W -- warning
227       D -- debug, and
228   (c) message text.
230 COMMAND -- mute
231 ---------------
233 Change the OpenVPN --mute parameter.  The mute parameter is
234 used to silence repeating messages of the same message
235 category.
237 Command examples:
239   mute 40 -- change the mute parameter to 40
240   mute    -- show the current mute setting
242 COMMAND -- net
243 --------------
245 (Windows Only) Produce output equivalent to the OpenVPN
246 --show-net directive.  The output includes OpenVPN's view
247 of the system network adapter list and routing table based
248 on information returned by the Windows IP helper API.
250 COMMAND -- pid
251 --------------
253 Shows the process ID of the current OpenVPN process.
255 COMMAND -- password and username
256 --------------------------------
258   The password command is used to pass passwords to OpenVPN.
260   If OpenVPN is run with the --management-query-passwords
261   directive, it will query the management interface for RSA
262   private key passwords and the --auth-user-pass
263   username/password.
265   When OpenVPN needs a password from the management interface,
266   it will produce a real-time ">PASSWORD:" message.
268   Example 1:
270     >PASSWORD:Need 'Private Key' password
272   OpenVPN is indicating that it needs a password of type
273   "Private Key".
275   The management client should respond to this query as follows:
277     password "Private Key" foo
279   Example 2:
281     >PASSWORD:Need 'Auth' username/password
283   OpenVPN needs a --auth-user-pass password.  The management
284   client should respond:
286     username "Auth" foo
287     password "Auth" bar
289   The username/password itself can be in quotes, and special
290   characters such as double quote or backslash must be escaped,
291   for example,
293     password "Private Key" "foo\"bar"
295   The escaping rules are the same as for the config file.
296   See the "Command Parsing" section below for more info.
298   The PASSWORD real-time message type can also be used to
299   indicate password or other types of authentication failure:
301   Example 3: The private key password is incorrect and OpenVPN
302   is exiting:
304     >PASSWORD:Verification Failed: 'Private Key'
306   Example 4: The --auth-user-pass username/password failed,
307   and OpenVPN is exiting:
309     >PASSWORD:Verification Failed: 'Auth'
311   Example 5: The --auth-user-pass username/password failed,
312   and the server provided a custom client-reason-text string
313   using the client-deny server-side management interface command.
315     >PASSWORD:Verification Failed: 'custom server-generated string'
317 COMMAND -- forget-passwords
318 ---------------------------
320 The forget-passwords command will cause the daemon to forget passwords
321 entered during the session.
323 Command example:
325   forget-passwords -- forget passwords entered so far.
327 COMMAND -- signal
328 -----------------
330 The signal command will send a signal to the OpenVPN daemon.
331 The signal can be one of SIGHUP, SIGTERM, SIGUSR1, or SIGUSR2.
333 Command example:
335   signal SIGUSR1 -- send a SIGUSR1 signal to daemon
337 COMMAND -- state
338 ----------------
340 Show the current OpenVPN state, show state history, or
341 enable real-time notification of state changes.
343 These are the OpenVPN states:
345 CONNECTING    -- OpenVPN's initial state.
346 WAIT          -- (Client only) Waiting for initial response
347                  from server.
348 AUTH          -- (Client only) Authenticating with server.
349 GET_CONFIG    -- (Client only) Downloading configuration options
350                  from server.
351 ASSIGN_IP     -- Assigning IP address to virtual network
352                  interface.
353 ADD_ROUTES    -- Adding routes to system.
354 CONNECTED     -- Initialization Sequence Completed.
355 RECONNECTING  -- A restart has occurred.
356 EXITING       -- A graceful exit is in progress.
358 Command examples:
360   state        -- Print current OpenVPN state.
361   state on     -- Enable real-time notification of state changes.
362   state off    -- Disable real-time notification of state changes.
363   state all    -- Print current state history.
364   state 3      -- Print the 3 most recent state transitions.
365   state on all -- Atomically show state history while at the
366                   same time enable real-time state notification
367                   of future state transitions.
369 The output format consists of 4 comma-separated parameters: 
370   (a) the integer unix date/time,
371   (b) the state name,
372   (c) optional descriptive string (used mostly on RECONNECTING
373       and EXITING to show the reason for the disconnect),
374   (d) optional TUN/TAP local IP address (shown for ASSIGN_IP
375       and CONNECTED), and
376   (e) optional address of remote server (OpenVPN 2.1 or higher).
378 Real-time state notifications will have a ">STATE:" prefix
379 prepended to them.
381 COMMAND -- status
382 -----------------
384 Show current daemon status information, in the same format as
385 that produced by the OpenVPN --status directive.
387 Command examples:
389 status   -- Show status information using the default status
390             format version.
392 status 3 -- Show status information using the format of
393             --status-version 3.
395 COMMAND -- username
396 -------------------
398 See the "password" section above.
400 COMMAND -- verb
401 ---------------
403 Change the OpenVPN --verb parameter.  The verb parameter
404 controls the output verbosity, and may range from 0 (no output)
405 to 15 (maximum output).  See the OpenVPN man page for additional
406 info on verbosity levels.
408 Command examples:
410   verb 4  -- change the verb parameter to 4
411   mute    -- show the current verb setting
413 COMMAND -- version
414 ------------------
416 Show the current OpenVPN and Management Interface versions.
419 COMMAND -- auth-retry
420 ---------------------
422 Set the --auth-retry setting to control how OpenVPN responds to
423 username/password authentication errors.  See the manual page
424 for more info.
426 Command examples:
428   auth-retry interact -- Don't exit when bad username/passwords are entered.
429                          Query for new input and retry.
431 COMMAND -- needok  (OpenVPN 2.1 or higher)
432 ------------------------------------------
434 Confirm a ">NEED-OK" real-time notification, normally used by
435 OpenVPN to block while waiting for a specific user action.
437 Example:
439   OpenVPN needs the user to insert a cryptographic token,
440   so it sends a real-time notification:
442     >NEED-OK:Need 'token-insertion-request' confirmation MSG:Please insert your cryptographic token
444   The management client, if it is a GUI, can flash a dialog
445   box containing the text after the "MSG:" marker to the user.
446   When the user acknowledges the dialog box,
447   the management client can issue this command:
449      needok token-insertion-request ok
450   or
451      needok token-insertion-request cancel
453 COMMAND -- needstr  (OpenVPN 2.1 or higher)
454 -------------------------------------------
456 Confirm a ">NEED-STR" real-time notification, normally used by
457 OpenVPN to block while waiting for a specific user input.
459 Example:
461   OpenVPN needs the user to specify some input, so it sends a
462   real-time notification:
464     >NEED-STR:Need 'name' input MSG:Please specify your name
466   The management client, if it is a GUI, can flash a dialog
467   box containing the text after the "MSG:" marker to the user.
468   When the user acknowledges the dialog box,
469   the management client can issue this command:
471      needstr name "John"
473 COMMAND -- pkcs11-id-count  (OpenVPN 2.1 or higher)
474 ---------------------------------------------------
476 Retrieve available number of certificates.
478 Example:
480      pkcs11-id-count
481      >PKCS11ID-COUNT:5
483 COMMAND -- pkcs11-id-get  (OpenVPN 2.1 or higher)
484 -------------------------------------------------
486 Retrieve certificate by index, the ID string should be provided
487 as PKCS#11 identity, the blob is BASE64 encoded certificate.
489 Example:
491      pkcs11-id-get 1
492      PKCS11ID-ENTRY:'1', ID:'<snip>', BLOB:'<snip>'
494 COMMAND -- client-auth  (OpenVPN 2.1 or higher)
495 -----------------------------------------------
497 Authorize a ">CLIENT:CONNECT" or ">CLIENT:REAUTH" request and specify
498 "client-connect" configuration directives in a subsequent text block.
500 The OpenVPN server should have been started with the
501 --management-client-auth directive so that it will ask the management
502 interface to approve client connections.
505   client-auth {CID} {KID}
506   line_1
507   line_2
508   ...
509   line_n
510   END
512 CID,KID -- client ID and Key ID.  See documentation for ">CLIENT:"
513 notification for more info.
515 line_1 to line_n -- client-connect configuration text block, as would be
516 returned by a --client-connect script.  The text block may be null, with
517 "END" immediately following the "client-auth" line (using a null text
518 block is equivalent to using the client-auth-nt command).
520 A client-connect configuration text block contains OpenVPN directives
521 that will be applied to the client instance object representing a newly
522 connected client.
524 COMMAND -- client-auth-nt  (OpenVPN 2.1 or higher)
525 --------------------------------------------------
527 Authorize a ">CLIENT:CONNECT" or ">CLIENT:REAUTH" request without specifying
528 client-connect configuration text.
530 The OpenVPN server should have been started with the
531 --management-client-auth directive so that it will ask the management
532 interface to approve client connections.
534   client-auth-nt {CID} {KID}
536 CID,KID -- client ID and Key ID.  See documentation for ">CLIENT:"
537 notification for more info.
539 COMMAND -- client-deny  (OpenVPN 2.1 or higher)
540 -----------------------------------------------
542 Deny a ">CLIENT:CONNECT" or ">CLIENT:REAUTH" request.
544   client-deny {CID} {KID} "reason-text" ["client-reason-text"]
546 CID,KID -- client ID and Key ID.  See documentation for ">CLIENT:"
547 notification for more info.
549 reason-text: a human-readable message explaining why the authentication
550 request was denied.  This message will be output to the OpenVPN log
551 file or syslog.
553 client-reason-text: a message that will be sent to the client as
554 part of the AUTH_FAILED message.
556 Note that client-deny denies a specific Key ID (pertaining to a
557 TLS renegotiation).  A client-deny command issued in response to
558 an initial TLS key negotiation (notified by ">CLIENT:CONNECT") will
559 terminate the client session after returning "AUTH-FAILED" to the client.
560 On the other hand, a client-deny command issued in response to
561 a TLS renegotiation (">CLIENT:REAUTH") will invalidate the renegotiated
562 key, however the TLS session associated with the currently active
563 key will continue to live for up to --tran-window seconds before
564 expiration.
566 To immediately kill a client session, use "client-kill".
568 COMMAND -- client-kill  (OpenVPN 2.1 or higher)
569 -----------------------------------------------
571 Immediately kill a client instance by CID.
573   client-kill {CID}
575 CID -- client ID.  See documentation for ">CLIENT:" notification for more
576 info.
578 COMMAND -- client-pf  (OpenVPN 2.1 or higher)
579 ---------------------------------------------
581 Push a packet filter file to a specific client.
583 The OpenVPN server should have been started with the
584 --management-client-pf directive so that it will require that
585 VPN tunnel packets sent or received by client instances must
586 conform to that client's packet filter configuration.
588   client-pf {CID}
589   line_1
590   line_2
591   ...
592   line_n
593   END
595 CID -- client ID.  See documentation for ">CLIENT:" notification for
596 more info.
598 line_1 to line_n -- the packet filter configuration file for this
599 client.
601 Packet filter file grammar:
603  [CLIENTS DROP|ACCEPT]
604  {+|-}common_name1
605  {+|-}common_name2
606  . . .
607  [SUBNETS DROP|ACCEPT]
608  {+|-}subnet1
609  {+|-}subnet2
610  . . .
611  [END]
613  Subnet: IP-ADDRESS | IP-ADDRESS/NUM_NETWORK_BITS | "unknown"
615  CLIENTS refers to the set of clients (by their common-name) which
616  this instance is allowed ('+') to connect to, or is excluded ('-')
617  from connecting to.  Note that in the case of client-to-client
618  connections, such communication must be allowed by the packet filter
619  configuration files of both clients AND the --client-to-client
620  directive must have been specified in the OpenVPN server config.
622  SUBNETS refers to IP addresses or IP address subnets which this
623  client instance may connect to ('+') or is excluded ('-') from
624  connecting to, and applies to IPv4 and ARP packets.  The special
625  "unknown" tag refers to packets of unknown type, i.e. a packet that
626  is not IPv4 or ARP.
628  DROP or ACCEPT defines default policy when there is no explicit match
629  for a common-name or subnet.  The [END] tag must exist.
631  Notes:
633  * The SUBNETS section currently only supports IPv4 addresses and
634    subnets.
636  * A given client or subnet rule applies to both incoming and
637    outgoing packets.
639  * The CLIENTS list is order-invariant.  Because the list is stored
640    as a hash-table, the order of the list does not affect its function.
642  * The SUBNETS table is scanned sequentially, and the first item to
643    match is chosen.  Therefore the SUBNETS table is NOT order-invariant.
645  * No client-to-client communication is allowed unless the
646    --client-to-client configuration directive is enabled AND
647    the CLIENTS list of BOTH clients allows the communication.
649 Example packet filter spec, as transmitted to the management interface:
651  client-pf 42
652  [CLIENTS ACCEPT]
653  -accounting
654  -enigma
655  [SUBNETS DROP]
656  -10.46.79.9
657  +10.0.0.0/8
658  [END]
659  END
661 The above example sets the packet filter policy for the client
662 identified by CID=42.  This client may connect to all other clients
663 except those having a common name of "accounting" or "enigma".
664 The client may only interact with external IP addresses in the
665 10.0.0.0/8 subnet, however access to 10.46.79.9 is specifically
666 excluded.
668 Another example packet filter spec, as transmitted to the
669 management interface:
671  client-pf 99
672  [CLIENTS DENY]
673  +public
674  [SUBNETS ACCEPT]
675  +10.10.0.1
676  -10.0.0.0/8
677  -unknown
678  [END]
679  END
681 The above example sets the packet filter policy for the client
682 identified by CID=99.  This client may not connect to any other
683 clients except those having a common name of "public".  It may
684 interact with any external IP address except those in the
685 10.0.0.0/8 netblock.  However interaction with one address in
686 the 10.0.0.0/8 netblock is allowed: 10.10.0.1.  Also, the client
687 may not interact with external IP addresses using an "unknown"
688 protocol (i.e. one that is not IPv4 or ARP).
690 COMMAND -- remote  (OpenVPN AS 2.1.5/OpenVPN 2.3 or higher)
691 --------------------------------------------
693 Provide remote host/port in response to a >REMOTE notification
694 (client only).  Requires that the --management-query-remote
695 directive is used.
697   remote ACTION [HOST PORT]
699 The "remote" command should only be given in response to a >REMOTE
700 notification.  For example, the following >REMOTE notification
701 indicates that the client config file would ordinarily connect
702 to vpn.example.com port 1194 (UDP):
704   >REMOTE:vpn.example.com,1194,udp
706 Now, suppose we want to override the host and port, connecting
707 instead to vpn.otherexample.com port 1234.  After receiving
708 the above notification, use this command:
710   remote MOD vpn.otherexample.com 1234
712 To accept the same host and port as the client would ordinarily
713 have connected to, use this command:
715   remote ACCEPT
717 To skip the current connection entry and advance to the next one,
718 use this command:
720   remote SKIP
722 COMMAND -- proxy  (OpenVPN 2.3 or higher)
723 --------------------------------------------
725 Provide proxy server host/port and flags in response to a >PROXY
726 notification (client only).  Requires that the --management-query-proxy
727 directive is used.
729   proxy TYPE HOST PORT ["nct"]
731 The "proxy" command must only be given in response to a >PROXY
732 notification.  Use the "nct" flag if you only want to allow
733 non-cleartext auth with the proxy server.  The following >PROXY
734 notification indicates that the client config file would ordinarily
735 connect to the first --remote configured, vpn.example.com using TCP:
737   >PROXY:1,TCP,vpn.example.com
739 Now, suppose we want to connect to the remote host using the proxy server
740 proxy.intranet port 8080 with secure authentication only, if required.
741 After receiving the above notification, use this command:
743   proxy HTTP proxy.intranet 8080 nct
745 You can also use the SOCKS keyword to pass a SOCKS server address, like:
747   proxy SOCKS fe00::1 1080
749 To accept connecting to the host and port directly, use this command:
751   proxy NONE
753 COMMAND -- rsa-sig (OpenVPN 2.3 or higher)
754 ------------------------------------------
755 Provides support for external storage of the private key. Requires the
756 --management-external-key option. This option can be used instead of "key"
757 in client mode, and allows the client to run without the need to load the
758 actual private key. When the SSL protocol needs to perform an RSA sign
759 operation, the data to be signed will be sent to the management interface
760 via a notification as follows:
762 >RSA_SIGN:[BASE64_DATA]
764 The management interface client should then sign BASE64_DATA
765 using the private key and return the SSL signature as follows:
767 rsa-sig
768 [BASE64_SIG_LINE]
774 Base64 encoded output of RSA_sign(NID_md5_sha1,... will provide a
775 correct signature.
777 This capability is intended to allow the use of arbitrary cryptographic
778 service providers with OpenVPN via the management interface.
781 OUTPUT FORMAT
782 -------------
784 (1) Command success/failure indicated by "SUCCESS: [text]" or
785     "ERROR: [text]".
787 (2) For commands which print multiple lines of output,
788     the last line will be "END".
790 (3) Real-time messages will be in the form ">[source]:[text]",
791     where source is "CLIENT", "ECHO", "FATAL", "HOLD", "INFO", "LOG",
792     "NEED-OK", "PASSWORD", or "STATE".
794 REAL-TIME MESSAGE FORMAT
795 ------------------------
797 The OpenVPN management interface produces two kinds of
798 output: (a) output from a command, or (b) asynchronous,
799 real-time output which can be generated at any time.
801 Real-time messages start with a '>' character in the first
802 column and are immediately followed by a type keyword
803 indicating the type of real-time message.  The following
804 types are currently defined:
806 BYTECOUNT -- Real-time bandwidth usage notification, as enabled
807              by "bytecount" command when OpenVPN is running as
808              a client.
810 BYTECOUNT_CLI -- Real-time bandwidth usage notification per-client,
811                  as enabled by "bytecount" command when OpenVPN is
812                  running as a server.
814 CLIENT   -- Notification of client connections and disconnections
815             on an OpenVPN server.  Enabled when OpenVPN is started
816             with the --management-client-auth option.  CLIENT
817             notifications may be multi-line.  See "The CLIENT
818             notification" section below for detailed info.
820 ECHO     -- Echo messages as controlled by the "echo" command.
822 FATAL    -- A fatal error which is output to the log file just
823             prior to OpenVPN exiting.
825 HOLD     -- Used to indicate that OpenVPN is in a holding state
826             and will not start until it receives a
827             "hold release" command.
829 INFO     -- Informational messages such as the welcome message.
831 LOG      -- Log message output as controlled by the "log" command.
833 NEED-OK  -- OpenVPN needs the end user to do something, such as
834             insert a cryptographic token.  The "needok" command can
835             be used to tell OpenVPN to continue.
837 NEED-STR -- OpenVPN needs information from end, such as
838             a certificate to use.  The "needstr" command can
839             be used to tell OpenVPN to continue.
841 PASSWORD -- Used to tell the management client that OpenVPN
842             needs a password, also to indicate password
843             verification failure.
845 STATE    -- Shows the current OpenVPN state, as controlled
846             by the "state" command.
848 The CLIENT notification
849 -----------------------
851 The ">CLIENT:" notification is enabled by the --management-client-auth
852 OpenVPN configuration directive that gives the management interface client
853 the responsibility to authenticate OpenVPN clients after their client
854 certificate has been verified.  CLIENT notifications may be multi-line, and
855 the sequentiality of a given CLIENT notification, its associated environmental
856 variables, and the terminating ">CLIENT:ENV,END" line are guaranteed to be
857 atomic.
859 CLIENT notification types:
861 (1) Notify new client connection ("CONNECT") or existing client TLS session
862     renegotiation ("REAUTH").  Information about the client is provided
863     by a list of environmental variables which are documented in the OpenVPN
864     man page.  The environmental variables passed are equivalent to those
865     that would be passed to an --auth-user-pass-verify script.
867     >CLIENT:CONNECT|REAUTH,{CID},{KID}
868     >CLIENT:ENV,name1=val1
869     >CLIENT:ENV,name2=val2
870     >CLIENT:ENV,...
871     >CLIENT:ENV,END
873 (2) Notify successful client authentication and session initiation.
874     Called after CONNECT.
876     >CLIENT:ESTABLISHED,{CID}
877     >CLIENT:ENV,name1=val1
878     >CLIENT:ENV,name2=val2
879     >CLIENT:ENV,...
880     >CLIENT:ENV,END
882 (3) Notify existing client disconnection.  The environmental variables passed
883     are equivalent to those that would be passed to a --client-disconnect
884     script.
886     >CLIENT:DISCONNECT,{CID}
887     >CLIENT:ENV,name1=val1
888     >CLIENT:ENV,name2=val2
889     >CLIENT:ENV,...
890     >CLIENT:ENV,END
892 (4) Notify that a particular virtual address or subnet
893     is now associated with a specific client.
895     >CLIENT:ADDRESS,{CID},{ADDR},{PRI}
897 Variables:
899 CID --  Client ID, numerical ID for each connecting client, sequence = 0,1,2,...
900 KID --  Key ID, numerical ID for the key associated with a given client TLS session,
901         sequence = 0,1,2,...
902 PRI --  Primary (1) or Secondary (0) VPN address/subnet.  All clients have at least
903         one primary IP address.  Secondary address/subnets are associated with
904         client-specific "iroute" directives.
905 ADDR -- IPv4 address/subnet in the form 1.2.3.4 or 1.2.3.0/255.255.255.0
907 In the unlikely scenario of an extremely long-running OpenVPN server,
908 CID and KID should be assumed to recycle to 0 after (2^32)-1, however this
909 recycling behavior is guaranteed to be collision-free.
911 Command Parsing
912 ---------------
914 The management interface uses the same command line lexical analyzer
915 as is used by the OpenVPN config file parser.
917 Whitespace is a parameter separator.
919 Double quotation or single quotation characters ("", '') can be used
920 to enclose parameters containing whitespace.
922 Backslash-based shell escaping is performed, using the following
923 mappings, when not in single quotations:
925 \\       Maps to a single backslash character (\).
926 \"       Pass a literal doublequote character ("), don't
927          interpret it as enclosing a parameter.
928 \[SPACE] Pass a literal space or tab character, don't
929          interpret it as a parameter delimiter.
931 Challenge/Response Protocol
932 ---------------------------
934 The OpenVPN Challenge/Response Protocol allows an OpenVPN server to
935 generate challenge questions that are shown to the user, and to see
936 the user's responses to those challenges.  Based on the responses, the
937 server can allow or deny access.
939 In this way, the OpenVPN Challenge/Response Protocol can be used
940 to implement multi-factor authentication.  Two different
941 variations on the challenge/response protocol are supported: the
942 "Dynamic" and "Static" protocols.
944 The basic idea of Challenge/Response is that the user must enter an
945 additional piece of information, in addition to the username and
946 password, to successfully authenticate.  Normally, this information
947 is used to prove that the user posesses a certain key-like device
948 such as cryptographic token or a particular mobile phone.
950 Dynamic protocol:
952 The OpenVPN dynamic challenge/response protocol works by returning
953 a specially formatted error message after initial successful
954 authentication.  This error message contains the challenge question,
955 and is formatted as such:
957   CRV1:<flags>:<state_id>:<username_base64>:<challenge_text>
959 flags: a series of optional, comma-separated flags:
960  E : echo the response when the user types it
961  R : a response is required
963 state_id: an opaque string that should be returned to the server
964  along with the response.
966 username_base64 : the username formatted as base64
968 challenge_text : the challenge text to be shown to the user
970 Example challenge:
972   CRV1:R,E:Om01u7Fh4LrGBS7uh0SWmzwabUiGiW6l:Y3Ix:Please enter token PIN
974 After showing the challenge_text and getting a response from the user
975 (if R flag is specified), the client should submit the following
976 auth creds back to the OpenVPN server:
978 Username: [username decoded from username_base64]
979 Password: CRV1::<state_id>::<response_text>
981 Where state_id is taken from the challenge request and response_text
982 is what the user entered in response to the challenge_text.
983 If the R flag is not present, response_text may be the empty
984 string.
986 Example response (suppose the user enters "8675309" for the token PIN):
988   Username: cr1 ("Y3Ix" base64 decoded)
989   Password: CRV1::Om01u7Fh4LrGBS7uh0SWmzwabUiGiW6l::8675309
991 Static protocol:
993 The static protocol differs from the dynamic protocol in that the
994 challenge question and response field is given to the user in the
995 initial username/password dialog, and the username, password, and
996 response are delivered back to the server in a single transaction.
998 The "static-challenge" directive is used to give the challenge text
999 to OpenVPN and indicate whether or not the response should be echoed.
1001 When the "static-challenge" directive is used, the management
1002 interface will respond as such when credentials are needed:
1004   >PASSWORD:Need 'Auth' username/password SC:<ECHO>,<TEXT>
1006   ECHO: "1" if response should be echoed, "0" to not echo
1007   TEXT: challenge text that should be shown to the user to
1008       facilitate their response
1010 For example:
1012   >PASSWORD:Need 'Auth' username/password SC:1,Please enter token PIN
1014 The above notification indicates that OpenVPN needs a --auth-user-pass
1015 password plus a response to a static challenge ("Please enter token PIN").
1016 The "1" after the "SC:" indicates that the response should be echoed.
1018 The management interface client in this case should add the static
1019 challenge text to the auth dialog followed by a field for the user to
1020 enter a response.  Then the client should pack the password and response
1021 together into an encoded password:
1023   username "Auth" foo
1024   password "Auth" "SCRV1:<BASE64_PASSWORD>:<BASE64_RESPONSE>"
1026 For example, if the user entered "bar" as the password and 8675309
1027 as the PIN, the following management interface commands should be
1028 issued:
1030   username "Auth" foo
1031   password "Auth" "SCRV1:Zm9v:ODY3NTMwOQ=="
1033 Client-side support for challenge/response protocol:
1035 Currently, the Access Server client and standalone OpenVPN
1036 client support both static and dynamic challenge/response
1037 protocols.  However, any OpenVPN client UI that drives OpenVPN
1038 via the management interface needs to add explicit support
1039 for the challenge/response protocol.