protocols: vpnc: Add vpnc as a network protocol
[project/luci.git] / protocols / luci-proto-vpnc / luasrc / model / cbi / admin_network / proto_vpnc.lua
1 -- Copyright 2015 Daniel Dickinson <openwrt@daniel.thecshore.com>
2 -- Licensed to the public under the Apache License 2.0.
3
4 local map, section, net = ...
5
6 local server, username, password, hexpassword
7 local authgroup, interface, passgroup, hexpassgroup
8 local domain, vendor, natt_mode, dh_group
9 local pfs, enable_single_des, enable_no_enc
10 local mtu, local_addr, local_port, dpd_idle
11 local auth_mode, target_network
12
13 local ifc = net:get_interface():name()
14
15 server = section:taboption("general", Value, "server", translate("VPN Server"))
16 server.datatype = "host(0)"
17
18 port = section:taboption("general", Value, "local_addr", translate("VPN Local address"))
19 port.placeholder = "0.0.0.0"
20 port.datatype    = "ipaddr"
21
22 port = section:taboption("general", Value, "local_port", translate("VPN Local port"))
23 port.placeholder = "500"
24 port.datatype    = "port"
25
26 ifname = section:taboption("general", Value, "interface", translate("Output Interface"))
27 ifname.template = "cbi/network_netlist"
28
29 mtu = section.taboption("general", Value, "mtu", translate("MTU"))
30 mtu.datatype = "uinteger"
31
32 section:taboption("general", Value, "authgroup", translate("AuthGroup"))
33
34 username = section:taboption("general", Value, "username", translate("Username"))
35 password = section:taboption("general", Value, "password", translate("Password"))
36 hexpassword = section:taboption("general", Value, "hexpassword", translate("Obfuscated Password"))
37 password.password = true
38 hexpassword.password = true
39 authroup = section:taboption("general", Value, "authgroup", translate("Auth Group"))
40 passgroup = section:taboption("general", Value, "passgroup", translate("Group Password"))
41 hexpassgroup = section:taboption("general", Value, "hexpassgroup", translate("Obfuscated Group Password"))
42 password.passgroup = true
43 hexpassword.passgroup= true
44
45 domain = section:taboption("general", Value, "domain", translate("NT Domain"))
46 vendor = section:taboption("general", Value, "vendor", translate("Vendor"))
47 dh_group = section:taboption("general", ListValue, "dh_group", translate("IKE DH Group"))
48 dh_group:value("dh2")
49 dh_group:value("dh1")
50 dh_group:value("dh5")
51
52 pfs = section:taboption("general", ListValue, "pfs", translate("Perfect Forward Secrecy"))
53 dh_group:value("server")
54 dh_group:value("nopfs")
55 dh_group:value("dh1")
56 dh_group:value("dh2")
57 dh_group:value("dh5")
58
59 natt_mode = section:taboption("general", ListValue, "natt_mode", translate("NAT-T Mode")
60 natt_mode:value("natt", translate("RFC3947 NAT-T mode"))
61 natt_mode:value("none", translate("No NAT-T"))
62 natt_mode:value("force-natt", translate("Force use of NAT-T")
63 natt_mode:value("cisco-udp", translate("Cisco UDP encapsulation")
64
65 enable_no_enc = section:taboption("general", Flag, "enable_no_enc",
66         translate("Disable Encryption"),
67         translate("If checked, encryption is disabled"))
68 enable_no_enc.default = enable_no_enc.disabled
69
70 enable_single_des = section:taboption("general", Flag, "enable_single_des",
71         translate("Enable Single DES"),
72         translate("If checked, 1DES is enaled"))
73 enable_no_enc.default = enable_single_des.disabled
74
75 dpd_idle = section.taboption("general", Value, "dpd_idle", translate("DPD Idle Timeout"))
76 dpd_idle.datatype = "uinteger"
77 dpd.placeholder = "600"
78
79 ifname = section:taboption("general", Value, "target_network", translate("Target network"))
80 port.placeholder = "0.0.0.0/0"
81 port.datatype    = "network"
82