2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
16 require("luci.model.uci")
21 -- Widget, Name, Default(s), Description
24 { ListValue, "verb", { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }, translate("Set output verbosity") },
25 { Value, "nice",0, translate("Change process priority") },
26 { Value,"port",1194, translate("TCP/UDP port # for both local and remote") },
27 { ListValue,"dev_type",{ "tun", "tap" }, translate("Type of used device") },
28 { Flag,"tun_ipv6",0, translate("Make tun device IPv6 capable") },
30 { Value,"ifconfig","10.200.200.3 10.200.200.1", translate("Set tun/tap adapter parameters") },
31 { Value,"server","10.200.200.0 255.255.255.0", translate("Configure server mode") },
32 { Value,"server_bridge","192.168.1.1 255.255.255.0 192.168.1.128 192.168.1.254", translate("Configure server bridge") },
33 { Flag,"nobind",0, translate("Do not bind to local address and port") },
35 { ListValue,"comp_lzo",{"yes","no","adaptive"}, translate("Use fast LZO compression") },
36 { Value,"keepalive","10 60", translate("Helper directive to simplify the expression of --ping and --ping-restart in server mode configurations") },
38 { ListValue,"proto",{ "udp", "tcp" }, translate("Use protocol") },
40 { Flag,"client",0, translate("Configure client mode") },
41 { Flag,"client_to_client",0, translate("Allow client-to-client traffic") },
42 { DynamicList,"remote","vpnserver.example.org", translate("Remote host name or ip address") },
44 { FileUpload,"secret","/etc/openvpn/secret.key 1", translate("Enable Static Key encryption mode (non-TLS)") },
45 { FileUpload,"pkcs12","/etc/easy-rsa/keys/some-client.pk12", translate("PKCS#12 file containing keys") },
46 { FileUpload,"ca","/etc/easy-rsa/keys/ca.crt", translate("Certificate authority") },
47 { FileUpload,"dh","/etc/easy-rsa/keys/dh1024.pem", translate("Diffie Hellman parameters") },
48 { FileUpload,"cert","/etc/easy-rsa/keys/some-client.crt", translate("Local certificate") },
49 { FileUpload,"key","/etc/easy-rsa/keys/some-client.key", translate("Local private key") },
53 local m = Map("openvpn")
54 local p = m:section( SimpleSection )
56 p.template = "openvpn/pageswitch"
61 local s = m:section( NamedSection, arg[1], "openvpn" )
63 for _, option in ipairs(basicParams) do
71 if option[1] == DummyValue then
74 if option[1] == DynamicList then
76 function o.cfgvalue(...)
77 local val = AbstractValue.cfgvalue(...)
78 return ( val and type(val) ~= "table" ) and { val } or val
82 if type(option[3]) == "table" then
83 if o.optional then o:value("", "-- remove --") end
84 for _, v in ipairs(option[3]) do
88 o.default = tostring(option[3][1])
90 o.default = tostring(option[3])
95 if type(option[i]) == "table" then