修复安全组规则方向校验与旧工单切换错对象
This commit is contained in:
1 parent
bcb47f102c
commit
4bc84717ff
3 files changed
+323
-4
No files matched your search
@@ -579,7 +579,7 @@ var Te = {
|
||||
let Q = ref(!1),
|
||||
$ = ref(``),
|
||||
Lt = ref(!1);
|
||||
// 每行按方向、协议、端口、IP 和可选描述解析;空行忽略,不足四列明确报格式错误。
|
||||
// 先把自由文本收敛为方向、协议的封闭枚举;任一行无效就拒绝整批,不能猜成入站规则。
|
||||
function Rt(e) {
|
||||
let t = [];
|
||||
for (let n of e.split(`
|
||||
@@ -589,9 +589,15 @@ var Te = {
|
||||
let r = e.split(/\s+/);
|
||||
if (r.length < 4) throw Error(`格式不正确:${e}`);
|
||||
let [ee, i, te = ``, a = ``, ...o] = r;
|
||||
let direction = ee.toLowerCase(),
|
||||
protocol = i.toLowerCase();
|
||||
if (!["in", "out"].includes(direction))
|
||||
throw Error(`规则方向必须为 in 或 out:${ee}`);
|
||||
if (!["tcp", "udp", "icmp", "all"].includes(protocol))
|
||||
throw Error(`规则协议必须为 tcp、udp、icmp 或 all:${i}`);
|
||||
t.push({
|
||||
direction: ee === `out` ? `out` : `in`,
|
||||
protocol: (i || `tcp`).toLowerCase(),
|
||||
direction,
|
||||
protocol,
|
||||
port: te,
|
||||
ip: a,
|
||||
description: o.join(` `) || void 0,
|
||||
|
||||
Reference in new issue
Block a user