1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Licensed to the public under the Apache License 2.0.
5 require("luci.model.uci")
10 -- Widget, Name, Default(s), Description
13 { ListValue, "verb", { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }, translate("Set output verbosity") },
14 { Value, "nice",0, translate("Change process priority") },
15 { Value,"port",1194, translate("TCP/UDP port # for both local and remote") },
16 { ListValue,"dev_type",{ "tun", "tap" }, translate("Type of used device") },
17 { Flag,"tun_ipv6",0, translate("Make tun device IPv6 capable") },
19 { Value,"ifconfig","10.200.200.3 10.200.200.1", translate("Set tun/tap adapter parameters") },
20 { Value,"server","10.200.200.0 255.255.255.0", translate("Configure server mode") },
21 { Value,"server_bridge","192.168.1.1 255.255.255.0 192.168.1.128 192.168.1.254", translate("Configure server bridge") },
22 { Flag,"nobind",0, translate("Do not bind to local address and port") },
24 { ListValue,"comp_lzo",{"yes","no","adaptive"}, translate("Use fast LZO compression") },
25 { Value,"keepalive","10 60", translate("Helper directive to simplify the expression of --ping and --ping-restart in server mode configurations") },
27 { ListValue,"proto",{ "udp", "tcp-client", "tcp-server" }, translate("Use protocol") },
29 { Flag,"client",0, translate("Configure client mode") },
30 { Flag,"client_to_client",0, translate("Allow client-to-client traffic") },
31 { DynamicList,"remote","vpnserver.example.org", translate("Remote host name or ip address") },
33 { FileUpload,"secret","/etc/openvpn/secret.key", translate("Enable Static Key encryption mode (non-TLS)") },
34 { Value,"key_direction","1", translate("The key direction for 'tls-auth' and 'secret' options") },
35 { FileUpload,"pkcs12","/etc/easy-rsa/keys/some-client.pk12", translate("PKCS#12 file containing keys") },
36 { FileUpload,"ca","/etc/easy-rsa/keys/ca.crt", translate("Certificate authority") },
37 { FileUpload,"dh","/etc/easy-rsa/keys/dh1024.pem", translate("Diffie Hellman parameters") },
38 { FileUpload,"cert","/etc/easy-rsa/keys/some-client.crt", translate("Local certificate") },
39 { FileUpload,"key","/etc/easy-rsa/keys/some-client.key", translate("Local private key") },
43 local m = Map("openvpn")
44 local p = m:section( SimpleSection )
46 p.template = "openvpn/pageswitch"
51 local s = m:section( NamedSection, arg[1], "openvpn" )
53 for _, option in ipairs(basicParams) do
61 if option[1] == DummyValue then
64 if option[1] == DynamicList then
65 function o.cfgvalue(...)
66 local val = AbstractValue.cfgvalue(...)
67 return ( val and type(val) ~= "table" ) and { val } or val
71 if type(option[3]) == "table" then
72 if o.optional then o:value("", "-- remove --") end
73 for _, v in ipairs(option[3]) do
77 o.default = tostring(option[3][1])
79 o.default = tostring(option[3])
84 if type(option[i]) == "table" then