保存最小权限初始化防火墙策略与依赖加固检查点
This commit is contained in:
1 parent
c98c6050c5
commit
7d374dc10d
19 files changed
+255
-20
No files matched your search
@@ -814,6 +814,10 @@ export function useSetupWizard(props, emit) {
|
||||
}
|
||||
completed.value = true;
|
||||
resultMessage.value = isBootstrap ? `初始化配置已保存,正在切换至 ${result.management_url}。请稍候;IP 自签名证书或测试证书需要人工核对。` : result.message || "初始化配置已保存。";
|
||||
if (isBootstrap && Array.isArray(result.warnings)) {
|
||||
const warnings = result.warnings.filter((message) => typeof message === "string" && message.trim());
|
||||
if (warnings.length) resultMessage.value += ` 注意:${warnings.join(";")}`;
|
||||
}
|
||||
emit("initialized", result);
|
||||
} catch (err) {
|
||||
error.value = err.message || "保存初始化配置失败";
|
||||
|
||||
@@ -82,6 +82,9 @@ const {
|
||||
<span>
|
||||
请先完成 DNS API 在线验证。提交初始化时将申请管理页面证书;只有证书校验和配置保存成功后才会完成初始化。
|
||||
</span>
|
||||
<span v-if="isBootstrap">
|
||||
Linux 服务由管理员预先配置防火墙和云安全组。请确认正式管理端口已按需放行;反向代理模式仅允许代理访问内部端口。初始化完成不代表外部网络已验证可达。
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -98,6 +98,20 @@ test("首次向导提交中和完成后禁止重复提交", async (t) => {
|
||||
assert.equal(state.submitting.value, false);
|
||||
});
|
||||
|
||||
test("首次向导成功后显示外部防火墙提示且不输出畸形警告", async (t) => {
|
||||
const { state, emitted } = await setup(t, () => Response.json({
|
||||
completed: true,
|
||||
management_url: "https://203.0.113.20:8443/",
|
||||
warnings: ["防火墙由管理员管理,端口 8443 未检查或修改。", null, {}, ""],
|
||||
}));
|
||||
state.currentStep.value = 4;
|
||||
await state.handleSubmit();
|
||||
assert.equal(state.completed.value, true);
|
||||
assert.equal(emitted.length, 1);
|
||||
assert.match(state.resultMessage.value, /端口 8443 未检查或修改/);
|
||||
assert.doesNotMatch(state.resultMessage.value, /null|\[object Object\]/);
|
||||
});
|
||||
|
||||
test("首次向导提交失败清除已领取令牌,重新验证后允许重试", async (t) => {
|
||||
let attempts = 0;
|
||||
const { state, submitted, emitted } = await setup(t, () => ++attempts === 1
|
||||
|
||||
Reference in new issue
Block a user