1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Licensed to the public under the Apache License 2.0.
5 require("luci.model.uci")
17 -- initialisation and daemon options
20 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 },
21 translate("Set output verbosity") },
25 translate("Disable Paging") },
29 translate("Disable options consistency check") },
33 -- translate("Set UID to user") },
37 -- translate("Set GID to group") },
41 translate("Change to directory before initialization") },
45 translate("Chroot to directory after initialization") },
49 -- translate("Daemonize after initialization") },
53 -- translate("Output to syslog and do not daemonize") },
57 translate("TOS passthrough (applies to IPv4 only)") },
60 -- "nowait Instance-Name",
61 -- translate("Run as an inetd or xinetd server") },
64 "/var/log/openvpn.log",
65 translate("Write log to file") },
68 "/var/log/openvpn.log",
69 translate("Append log to file") },
71 "suppress_timestamps",
73 translate("Don't log timestamps") },
76 -- "/var/run/openvpn.pid",
77 -- translate("Write process ID to file") },
81 translate("Change process priority") },
85 translate("Optimize TUN/TAP/UDP writes") },
88 "some params echoed to log",
89 translate("Echo parameters to log") },
92 { "SIGHUP", "SIGTERM" },
93 translate("Remap SIGUSR1 signals") },
96 "/var/run/openvpn.status 5",
97 translate("Write status to file every n seconds") },
101 translate("Status file format version") }, -- status
105 translate("Limit repeated log messages") },
109 translate("Shell cmd to execute after tun device open") },
113 translate("Delay tun/tap open and up script execution") },
116 "/usr/bin/ovpn-down",
117 translate("Shell cmd to run after tun device close") },
121 translate("Call down cmd/script before TUN/TAP close") },
125 translate("Run up/down scripts for all restarts") },
128 "/usr/bin/ovpn-routeup",
129 translate("Execute shell cmd after routes are added") },
132 "/usr/bin/ovpn-ipchange",
133 translate("Execute shell command on remote ip change"),
137 { "VAR1 value1", "VAR2 value2" },
138 translate("Pass environment variables to script") },
141 "/usr/bin/ovpn-tlsverify",
142 translate("Shell command to verify X509 name") },
145 "/usr/bin/ovpn-clientconnect",
146 translate("Run script cmd on client connection") },
150 translate("Run script cmd on client disconnection") },
153 "/usr/bin/ovpn-learnaddress",
154 translate("Executed in server mode whenever an IPv4 address/route or MAC address is added to OpenVPN's internal routing table") },
156 "auth_user_pass_verify",
157 "/usr/bin/ovpn-userpass via-env",
158 translate("Executed in server mode on new client connections, when the client is still untrusted") },
162 translate("Policy level over usage of external programs and scripts") },
170 translate("Major mode") },
174 translate("Local host name or ip address") },
178 translate("TCP/UDP port # for both local and remote") },
182 translate("TCP/UDP port # for local (default=1194)") },
186 translate("TCP/UDP port # for remote (default=1194)") },
190 translate("Allow remote to change its IP or port") },
194 translate("Do not bind to local address and port") },
198 translate("tun/tap device") },
202 translate("Type of used device") },
206 translate("Use tun/tap device node") },
209 "10.200.200.3 10.200.200.1",
210 translate("Set tun/tap adapter parameters") },
214 translate("Don't actually execute ifconfig") },
218 translate("Don't warn on ifconfig inconsistencies") },
221 "10.123.0.0 255.255.0.0",
222 translate("Add route after establishing connection") },
226 translate("Specify a default gateway for routes") },
230 translate("Delay n seconds after connection") },
234 translate("Don't add routes automatically") },
238 translate("Don't pull routes automatically") },
241 { "yes", "maybe", "no" },
242 translate("Enable Path MTU discovery") },
246 translate("Empirically measure MTU") },
250 translate("Set TCP/UDP MTU") },
254 translate("Set tun/tap device MTU") },
258 translate("Set tun/tap device overhead") },
262 translate("Enable internal datagram fragmentation"),
267 translate("Set upper bound on TCP MSS"),
272 translate("Set the TCP/UDP send buffer size") },
276 translate("Set the TCP/UDP receive buffer size") },
280 translate("Set tun/tap TX queue length") },
284 translate("Shaping for peer bandwidth") },
288 translate("tun/tap inactivity timeout") },
292 translate("Helper directive to simplify the expression of --ping and --ping-restart in server mode configurations") },
296 translate("Ping remote every n seconds over TCP/UDP port") },
300 translate("Remote ping timeout") },
304 translate("Restart after remote ping timeout") },
308 translate("Only process ping timeouts if routes exist") },
312 translate("Keep tun/tap device open on restart") },
316 translate("Don't re-read key on restart") },
320 translate("Keep local IP address on restart") },
324 translate("Keep remote IP address on restart") },
325 -- management channel
328 "127.0.0.1 31194 /etc/openvpn/mngmt-pwds",
329 translate("Enable management interface on <em>IP</em> <em>port</em>") },
332 "management_query_passwords",
334 translate("Query management channel for private key") },
339 translate("Start OpenVPN in a hibernating state") },
342 "management_log_cache",
344 translate("Number of lines for log file history") },
347 { "net30", "p2p", "subnet" },
348 translate("'net30', 'p2p', or 'subnet'"),
355 "10.200.200.0 255.255.255.0",
356 translate("Configure server mode"),
357 { client="0" }, { client="" } },
360 "10.200.200.1 255.255.255.0 10.200.200.200 10.200.200.250",
361 translate("Configure server bridge"),
362 { client="0" }, { client="" } },
365 { "redirect-gateway" },
366 translate("Push options to peer"),
367 { client="0" }, { client="" } },
371 translate("Don't inherit global push options"),
372 { client="0" }, { client="" } },
376 translate("Client is disabled"),
377 { client="0" }, { client="" } },
380 "10.200.200.100 10.200.200.150 255.255.255.0",
381 translate("Set aside a pool of subnets"),
382 { client="0" }, { client="" } },
384 "ifconfig_pool_persist",
385 "/etc/openvpn/ipp.txt 600",
386 translate("Persist/unpersist ifconfig-pool"),
387 { client="0" }, { client="" } },
390 "10.200.200.1 255.255.255.255",
391 translate("Push an ifconfig option to remote"),
392 { client="0" }, { client="" } },
395 "10.200.200.0 255.255.255.0",
396 translate("Route subnet to client"),
397 { client="0" }, { client="" } },
401 translate("Allow client-to-client traffic"),
402 { client="0" }, { client="" } },
406 translate("Allow multiple clients with same certificate"),
407 { client="0" }, { client="" } },
411 translate("Directory for custom client config files"),
412 { client="0" }, { client="" } },
416 translate("Refuse connection if no custom client config"),
417 { client="0" }, { client="" } },
421 translate("Temporary directory for client-connect return file"),
422 { client="0" }, { client="" } },
426 translate("Set size of real and virtual address hash tables"),
427 { client="0" }, { client="" } },
431 translate("Number of allocated broadcast buffers"),
432 { client="0" }, { client="" } },
436 translate("Maximum number of queued TCP output packets"),
437 { client="0" }, { client="" } },
441 translate("Allowed maximum of connected clients"),
442 { client="0" }, { client="" } },
444 "max_routes_per_client",
446 translate("Allowed maximum of internal"),
447 { client="0" }, { client="" } },
451 translate("Allowed maximum of new connections"),
452 { client="0" }, { client="" } },
454 "username_as_common_name",
456 translate("Use username as common name"),
457 { client="0" }, { client="" } },
461 translate("Configure client mode") },
465 translate("Accept options pushed from server"),
469 "/etc/openvpn/userpass.txt",
470 translate("Authenticate using username/password"),
474 { "none", "nointeract", "interact" },
475 translate("Handling of authentication failures"),
478 "explicit_exit_notify",
480 translate("Send notification to peer on disconnect"),
485 translate("Remote host name or ip address"),
490 translate("Randomly choose remote server"),
494 { "udp", "tcp-client", "tcp-server" },
495 translate("Use protocol"),
500 translate("Connection retry interval"),
501 { proto="tcp-client" }, { client="1" } },
504 "192.168.1.100 8080",
505 translate("Connect to remote host through an HTTP proxy"),
510 translate("Retry indefinitely on HTTP proxy errors"),
513 "http_proxy_timeout",
515 translate("Proxy timeout in seconds"),
519 { "VERSION 1.0", "AGENT OpenVPN/2.0.9" },
520 translate("Set extended HTTP proxy options"),
524 "192.168.1.200 1080",
525 translate("Connect through Socks5 proxy"),
527 -- client && socks_proxy
531 translate("Retry indefinitely on Socks proxy errors"),
536 translate("If hostname resolve fails, retry"),
540 { "", "local", "def1", "local def1" },
541 translate("Automatically redirect default route"),
548 "/etc/openvpn/secret.key",
549 translate("Enable Static Key encryption mode (non-TLS)") },
554 translate("HMAC authentication for packets") },
559 translate("Encryption cipher for packets") },
564 translate("Size of cipher key") },
569 translate("Enable OpenSSL hardware crypto engines") },
573 translate("Replay protection sliding window size") },
575 "mute_replay_warnings",
577 translate("Silence the output of replay warnings") },
580 "/var/run/openvpn-replay-state",
581 translate("Persist replay-protection state") },
585 translate("Enable TLS and assume server role"),
586 { tls_client="" }, { tls_client="0" } },
590 translate("Enable TLS and assume client role"),
591 { tls_server="" }, { tls_server="0" } },
594 "/etc/easy-rsa/keys/ca.crt",
595 translate("Certificate authority") },
598 "/etc/easy-rsa/keys/dh1024.pem",
599 translate("Diffie Hellman parameters") },
602 "/etc/easy-rsa/keys/some-client.crt",
603 translate("Local certificate") },
606 "/etc/easy-rsa/keys/some-client.key",
607 translate("Local private key") },
610 "/etc/easy-rsa/keys/some-client.pk12",
611 translate("PKCS#12 file containing keys") },
615 translate("Enable TLS and assume client role") },
618 "DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:AES256-SHA:EDH-RSA-DES-CBC3-SHA:EDH-DSS-DES-CBC3-SHA:DES-CBC3-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA:AES128-SHA:RC4-SHA:RC4-MD5:EDH-RSA-DES-CBC-SHA:EDH-DSS-DES-CBC-SHA:DES-CBC-SHA:EXP-EDH-RSA-DES-CBC-SHA:EXP-EDH-DSS-DES-CBC-SHA:EXP-DES-CBC-SHA:EXP-RC2-CBC-MD5:EXP-RC4-MD5",
619 translate("TLS cipher") },
623 translate("Retransmit timeout on TLS control channel") },
627 translate("Renegotiate data chan. key after bytes") },
631 translate("Renegotiate data chan. key after packets") },
635 translate("Renegotiate data chan. key after seconds") },
639 translate("Timeframe for key exchange") },
643 translate("Key transition window") },
647 translate("Allow only one session") },
651 translate("Exit on TLS negotiation failure") },
654 "/etc/openvpn/tlsauth.key",
655 translate("Additional authentication over TLS") },
658 "/etc/openvpn/tlscrypt.key",
659 translate("Encrypt and authenticate all control channel packets with the key") },
663 -- translate("Get PEM password from controlling tty before we daemonize") },
667 translate("Don't cache --askpass or --auth-user-pass passwords") },
671 translate("Only accept connections from given X509 name") },
674 { "client", "server" },
675 translate("Require explicit designation on certificate") },
678 { "client", "server" },
679 translate("Require explicit key usage on certificate") },
682 "/etc/easy-rsa/keys/crl.pem",
683 translate("Check peer certificate against a CRL") },
687 translate("The lowest supported TLS version") },
691 translate("The highest supported TLS version") },
695 translate("The key direction for 'tls-auth' and 'secret' options") },
703 local m = Map("openvpn")
704 local p = m:section( SimpleSection )
706 p.template = "openvpn/pageswitch"
709 p.category = arg[2] or "Service"
711 for _, c in ipairs(knownParams) do
713 if c[1] == p.category then params = c[2] end
720 NamedSection, arg[1], "openvpn",
721 translate("%s" % arg[2])
724 s.title = translate("%s" % arg[2])
729 for _, option in ipairs(params) do
731 option[1], option[2],
735 if option[1] == DummyValue then
738 if option[1] == DynamicList then
739 function o.cfgvalue(...)
740 local val = AbstractValue.cfgvalue(...)
741 return ( val and type(val) ~= "table" ) and { val } or val
747 if type(option[3]) == "table" then
748 if o.optional then o:value("", "-- remove --") end
749 for _, v in ipairs(option[3]) do
753 o.default = tostring(option[3][1])
755 o.default = tostring(option[3])
760 if type(option[i]) == "table" then