🍉 Sync 2026-10-06 20:57:57

This commit is contained in:
github-actions[bot] committed 2026-10-06 20:57:57 +08:00
1 parent d42f800eec
commit 6a9b13947b
23 files changed
+991 -507

No files matched your search

@@ -1,3 +1,5 @@
local sys = require "luci.sys"
m = Map("luci-app-ipsec-server", translate("IPSec VPN Server"))
m.template = "ipsec-server/ipsec-server_status"
@@ -7,53 +9,64 @@ s.anonymous = true
o = s:option(DummyValue, "ipsec-server_status", translate("Current Condition"))
o.rawhtml = true
o.cfgvalue = function(t, n)
return '<span class="ipsec-server-status is-loading" role="status" aria-live="polite">' .. translate("Checking...") .. '</span>'
return '<font class="ipsec-server_status"></font>'
end
enabled = s:option(Flag, "enabled", translate("Enable"))
enabled.description = translate("Enable IPsec access for IKEv2 PSK, IKEv1 XAuth PSK, and IKEv2 EAP clients.")
enabled.default = 0
enabled.rmempty = false
o = s:option(Flag, "enabled", translate("Enable"))
o.default = 0
o.rmempty = false
clientip = s:option(Value, "clientip", translate("VPN Client IP"))
clientip.description = translate("VPN client address pool in CIDR notation, such as: 10.0.10.0/24")
clientip.datatype = "ip4addr"
clientip.optional = false
clientip.rmempty = false
clientip.placeholder = "10.0.10.0/24"
type = s:option(ListValue, "type", translate("Type"))
type:value("IKEv2", "IKEv2/IPSec PSK")
type:value("IKEv1", "IPSec Xauth PSK")
type.default = "IKEv2"
serverip = s:option(Value, "serverip", translate("VPN Server IP"))
serverip.description = translate("VPN server address and subnet in CIDR notation, such as: 10.0.0.1/24")
serverip.datatype = "ip4addr"
serverip.optional = false
serverip.rmempty = false
serverip.placeholder = "10.0.0.1/24"
o = s:option(Value, "clientip", translate("VPN Client IP"))
o.description = translate("VPN Client reserved started IP addresses with the same subnet mask, such as: 192.168.100.10/24")
o.datatype = "ip4addr"
o.optional = false
o:depends("type", "IKEv2")
o:depends("type", "IKEv1")
domain = s:option(Value, "domain", translate("VPN Domain"))
domain.description = translate("Domain name used for IKEv2 certificate and Remote ID, such as: ns.miaogongzi.cc")
domain.datatype = "host"
domain.optional = false
domain.rmempty = false
domain.placeholder = "ns.miaogongzi.cc"
domain.default = "ns.miaogongzi.cc"
certs_name = s:option(Value, "certs_name", translate("Certificate File Name"))
certs_name.description = translate("Server certificate file name under /etc/ipsec.d/certs/, such as: server.pem")
certs_name.optional = false
certs_name.rmempty = false
certs_name.placeholder = "server.pem"
certs_name.default = "server.pem"
private_key = s:option(Value, "private_key", translate("Private Key File Name"))
private_key.description = translate("Server private key file name under /etc/ipsec.d/private/, such as: server_key.pem")
private_key.optional = false
private_key.rmempty = false
private_key.placeholder = "server_key.pem"
private_key.default = "server_key.pem"
secret = s:option(Value, "secret", translate("Secret Pre-Shared Key"))
secret.description = translate("Used by IKEv2 PSK and IKEv1 XAuth PSK clients.")
secret = s:option(Value, "secret", translate("Preshared Key"))
secret.default = "ipsec"
secret.password = true
secret.rmempty = false
secret:depends("type", "IKEv1")
if sys.call("command -v xl2tpd > /dev/null") == 0 then
type:value("L2TP", "L2TP/IPSec PSK")
secret:depends("type", "L2TP")
o = s:option(DummyValue, "l2tp_status", "L2TP " .. translate("Current Condition"))
o.rawhtml = true
o.cfgvalue = function(t, n)
return '<font class="l2tp_status"></font>'
end
o:depends("type", "L2TP")
o = s:option(Value, "l2tp_localip", "L2TP " .. translate("Server IP"))
o.description = translate("VPN Server IP address, such as: 192.168.101.1")
o.datatype = "ip4addr"
o.default = "192.168.101.1"
o.placeholder = o.default
o:depends("type", "L2TP")
o = s:option(Value, "l2tp_remoteip", "L2TP " .. translate("Client IP"))
o.description = translate("VPN Client IP address range, such as: 192.168.101.10-20")
o.default = "192.168.101.10-20"
o.placeholder = o.default
o:depends("type", "L2TP")
--[[
if sys.call("ls -L /usr/lib/ipsec/libipsec* 2>/dev/null >/dev/null") == 0 then
o = s:option(DummyValue, "_o", " ")
o.rawhtml = true
o.cfgvalue = function(t, n)
return string.format('<a style="color: red">%s</a>', translate("L2TP/IPSec is not compatible with kernel-libipsec, which will disable this module."))
end
o:depends("type", "L2TP")
end
]]--
end
return m