diff options
Diffstat (limited to 'protocols/luci-proto-vpnc/luasrc/model')
-rw-r--r-- | protocols/luci-proto-vpnc/luasrc/model/cbi/admin_network/proto_vpnc.lua | 82 | ||||
-rw-r--r-- | protocols/luci-proto-vpnc/luasrc/model/network/proto_vpnc.lua | 46 |
2 files changed, 128 insertions, 0 deletions
diff --git a/protocols/luci-proto-vpnc/luasrc/model/cbi/admin_network/proto_vpnc.lua b/protocols/luci-proto-vpnc/luasrc/model/cbi/admin_network/proto_vpnc.lua new file mode 100644 index 0000000000..e450470eb3 --- /dev/null +++ b/protocols/luci-proto-vpnc/luasrc/model/cbi/admin_network/proto_vpnc.lua @@ -0,0 +1,82 @@ +-- Copyright 2015 Daniel Dickinson <openwrt@daniel.thecshore.com> +-- Licensed to the public under the Apache License 2.0. + +local map, section, net = ... + +local server, username, password, hexpassword +local authgroup, interface, passgroup, hexpassgroup +local domain, vendor, natt_mode, dh_group +local pfs, enable_single_des, enable_no_enc +local mtu, local_addr, local_port, dpd_idle +local auth_mode, target_network + +local ifc = net:get_interface():name() + +server = section:taboption("general", Value, "server", translate("VPN Server")) +server.datatype = "host(0)" + +port = section:taboption("general", Value, "local_addr", translate("VPN Local address")) +port.placeholder = "0.0.0.0" +port.datatype = "ipaddr" + +port = section:taboption("general", Value, "local_port", translate("VPN Local port")) +port.placeholder = "500" +port.datatype = "port" + +ifname = section:taboption("general", Value, "interface", translate("Output Interface")) +ifname.template = "cbi/network_netlist" + +mtu = section.taboption("general", Value, "mtu", translate("MTU")) +mtu.datatype = "uinteger" + +section:taboption("general", Value, "authgroup", translate("AuthGroup")) + +username = section:taboption("general", Value, "username", translate("Username")) +password = section:taboption("general", Value, "password", translate("Password")) +hexpassword = section:taboption("general", Value, "hexpassword", translate("Obfuscated Password")) +password.password = true +hexpassword.password = true +authroup = section:taboption("general", Value, "authgroup", translate("Auth Group")) +passgroup = section:taboption("general", Value, "passgroup", translate("Group Password")) +hexpassgroup = section:taboption("general", Value, "hexpassgroup", translate("Obfuscated Group Password")) +password.passgroup = true +hexpassword.passgroup= true + +domain = section:taboption("general", Value, "domain", translate("NT Domain")) +vendor = section:taboption("general", Value, "vendor", translate("Vendor")) +dh_group = section:taboption("general", ListValue, "dh_group", translate("IKE DH Group")) +dh_group:value("dh2") +dh_group:value("dh1") +dh_group:value("dh5") + +pfs = section:taboption("general", ListValue, "pfs", translate("Perfect Forward Secrecy")) +dh_group:value("server") +dh_group:value("nopfs") +dh_group:value("dh1") +dh_group:value("dh2") +dh_group:value("dh5") + +natt_mode = section:taboption("general", ListValue, "natt_mode", translate("NAT-T Mode") +natt_mode:value("natt", translate("RFC3947 NAT-T mode")) +natt_mode:value("none", translate("No NAT-T")) +natt_mode:value("force-natt", translate("Force use of NAT-T") +natt_mode:value("cisco-udp", translate("Cisco UDP encapsulation") + +enable_no_enc = section:taboption("general", Flag, "enable_no_enc", + translate("Disable Encryption"), + translate("If checked, encryption is disabled")) +enable_no_enc.default = enable_no_enc.disabled + +enable_single_des = section:taboption("general", Flag, "enable_single_des", + translate("Enable Single DES"), + translate("If checked, 1DES is enaled")) +enable_no_enc.default = enable_single_des.disabled + +dpd_idle = section.taboption("general", Value, "dpd_idle", translate("DPD Idle Timeout")) +dpd_idle.datatype = "uinteger" +dpd.placeholder = "600" + +ifname = section:taboption("general", Value, "target_network", translate("Target network")) +port.placeholder = "0.0.0.0/0" +port.datatype = "network" + diff --git a/protocols/luci-proto-vpnc/luasrc/model/network/proto_vpnc.lua b/protocols/luci-proto-vpnc/luasrc/model/network/proto_vpnc.lua new file mode 100644 index 0000000000..f4cae0bd2a --- /dev/null +++ b/protocols/luci-proto-vpnc/luasrc/model/network/proto_vpnc.lua @@ -0,0 +1,46 @@ +-- Copyright 2015 Daniel Dickinson <openwrt@daniel.thecshore.com> +-- Licensed to the public under the Apache License 2.0. + +local netmod = luci.model.network +local interface = luci.model.network.interface +local proto = netmod:register_protocol("vpnc") + +function proto.get_i18n(self) + return luci.i18n.translate("VPNC (CISCO 3000 (and others) VPN)") +end + +function proto.ifname(self) + return "vpn-" .. self.sid +end + +function proto.get_interface(self) + return interface(self:ifname(), self) +end + +function proto.opkg_package(self) + return "vpnc" +end + +function proto.is_installed(self) + return nixio.fs.access("/lib/netifd/proto/vpnc.sh") +end + +function proto.is_floating(self) + return true +end + +function proto.is_virtual(self) + return true +end + +function proto.get_interfaces(self) + return nil +end + +function proto.contains_interface(self, ifc) + return (netmod:ifnameof(ifc) == self:ifname()) + +end + +netmod:register_pattern_virtual("^vpn-%w") + |