移除前端私钥录入与命令展示入口
收紧服务器管理页面安全边界,移除私钥导航、私钥录入、私钥命令和相关展示,保留后端兼容能力。
This commit is contained in:
parent
2df78496a6
commit
519f815786
@ -6,7 +6,6 @@ import SettingsModal from "./SettingsModal.vue";
|
||||
import DomainModal from "./DomainModal.vue";
|
||||
import ServerModal from "./ServerModal.vue";
|
||||
import RuntimeOverview from "./RuntimeOverview.vue";
|
||||
import SSHKeyModal from "./SSHKeyModal.vue";
|
||||
import DashboardNavigation from "./DashboardNavigation.vue";
|
||||
import { useDashboardNavigation } from "./DashboardNavigation.js";
|
||||
import { useDashboard } from "./Dashboard.js";
|
||||
@ -18,7 +17,6 @@ const {
|
||||
currentUser,
|
||||
domains,
|
||||
servers,
|
||||
sshKeys,
|
||||
certificates,
|
||||
tasks,
|
||||
auditLogs,
|
||||
@ -46,9 +44,6 @@ const {
|
||||
serverEditingId,
|
||||
serverSaving,
|
||||
serverFormError,
|
||||
showSSHKeyForm,
|
||||
sshKeySaving,
|
||||
sshKeyFormError,
|
||||
certificateTypeLabels,
|
||||
domainStatusLabels,
|
||||
taskStatusLabels,
|
||||
@ -60,24 +55,10 @@ const {
|
||||
dnsProviders,
|
||||
environmentLabels,
|
||||
webServerLabels,
|
||||
serverSSHKey,
|
||||
serverSSHKeyStatusLabel,
|
||||
serverSSHKeyStatusClass,
|
||||
serverSSHCommand,
|
||||
serverSSHKeyHint,
|
||||
isEditing,
|
||||
formTitle,
|
||||
form,
|
||||
serverForm,
|
||||
sshKeyForm,
|
||||
sshKeyPlatform,
|
||||
sshKeyPassphraseVisible,
|
||||
sshKeyCommandUsername,
|
||||
sshKeyCommandHost,
|
||||
sshKeyFileName,
|
||||
sshKeyPath,
|
||||
sshKeyPrivatePath,
|
||||
sshKeyPublicPath,
|
||||
showSettings,
|
||||
showCertificateImport,
|
||||
importDomain,
|
||||
@ -100,8 +81,6 @@ const {
|
||||
handleDNSProviderChange,
|
||||
clearDNSCredentials,
|
||||
testDNS,
|
||||
sshKeyCommands,
|
||||
sshPublicKeyCommands,
|
||||
defaultCertificatePath,
|
||||
defaultCertificateChainPath,
|
||||
defaultPrivateKeyPath,
|
||||
@ -111,12 +90,6 @@ const {
|
||||
openServerCreate,
|
||||
openServerEdit,
|
||||
closeServerForm,
|
||||
openSSHKeyCreate,
|
||||
closeSSHKeyForm,
|
||||
importSSHKeyFile,
|
||||
copySSHKeyCommand,
|
||||
saveSSHKey,
|
||||
deleteSSHKey,
|
||||
saveServer,
|
||||
deleteServer,
|
||||
saveDomain,
|
||||
@ -162,14 +135,6 @@ const { activeSection, activeLabel, sections, selectSection } = useDashboardNavi
|
||||
<button v-if="activeSection === 'activity' && canRunRenewal" class="secondary-button" type="button" @click="runRenewalNow">
|
||||
立即检查续期
|
||||
</button>
|
||||
<button
|
||||
class="secondary-button"
|
||||
type="button"
|
||||
@click="openSSHKeyCreate"
|
||||
v-if="activeSection === 'keys'"
|
||||
>
|
||||
添加 SSH 私钥
|
||||
</button>
|
||||
<button
|
||||
class="secondary-button"
|
||||
type="button"
|
||||
@ -626,7 +591,6 @@ const { activeSection, activeLabel, sections, selectSection } = useDashboardNavi
|
||||
|
||||
<ServerModal v-if="showServerForm" :state="dashboard" />
|
||||
|
||||
<SSHKeyModal v-if="showSSHKeyForm" :state="dashboard" />
|
||||
|
||||
<DeploymentResult
|
||||
v-if="deploymentResult"
|
||||
|
||||
@ -6,7 +6,6 @@ export const dashboardSections = [
|
||||
{ id: "projects", label: "项目与成员", group: "证书与部署", hint: "查看有权访问的项目并管理项目成员角色" },
|
||||
{ id: "domains", label: "域名配置", group: "证书与部署", hint: "管理域名、申请证书和执行部署" },
|
||||
{ id: "servers", label: "部署服务器", group: "证书与部署", hint: "配置部署目标及 SSH 认证方式" },
|
||||
{ id: "keys", label: "SSH 私钥", group: "证书与部署", hint: "管理加密保存的 SSH 私钥" },
|
||||
{ id: "dns-accounts", label: "DNS 账户管理", group: "证书与部署", hint: "查看已配置的 DNS 账号及归属用户,凭据标识脱敏显示" },
|
||||
{ id: "users", label: "用户管理", group: "系统管理", hint: "管理登录账号、角色与使用状态" },
|
||||
];
|
||||
|
||||
@ -46,10 +46,6 @@ defineEmits(["select", "settings"]);
|
||||
<rect x="3" y="14" width="18" height="7" rx="2" />
|
||||
<path d="M7 6.5h.01M7 17.5h.01M12 6.5h5M12 17.5h5" />
|
||||
</g>
|
||||
<g v-else-if="section.id === 'keys'">
|
||||
<circle cx="8" cy="8" r="5" />
|
||||
<path d="m12 12 9 9m-6-6 3-3m0 6 3-3" />
|
||||
</g>
|
||||
<g v-else-if="section.id === 'dns-accounts'">
|
||||
<rect x="3" y="4" width="18" height="16" rx="3" />
|
||||
<circle cx="9" cy="10" r="2" />
|
||||
|
||||
@ -7,25 +7,6 @@ const {
|
||||
closeServerForm,
|
||||
serverEditingId,
|
||||
serverForm,
|
||||
sshKeys,
|
||||
openSSHKeyCreate,
|
||||
closeSSHKeyForm,
|
||||
showEmbeddedSSHKeyGuide,
|
||||
sshKeySaving,
|
||||
sshKeyFormError,
|
||||
sshKeyPlatform,
|
||||
sshKeyFileName,
|
||||
sshKeyPrivatePath,
|
||||
sshKeyPublicPath,
|
||||
sshKeyCommandUsername,
|
||||
sshKeyCommandHost,
|
||||
sshKeyCommands,
|
||||
sshPublicKeyCommands,
|
||||
sshKeyForm,
|
||||
importSSHKeyFile,
|
||||
sshKeyPassphraseVisible,
|
||||
copySSHKeyCommand,
|
||||
saveSSHKey,
|
||||
defaultCertificatePath,
|
||||
defaultCertificateChainPath,
|
||||
defaultPrivateKeyPath,
|
||||
@ -114,14 +95,7 @@ const {
|
||||
<span>SSH 用户</span>
|
||||
<input v-model="serverForm.username" required type="text" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>认证方式</span>
|
||||
<select v-model="serverForm.auth_method">
|
||||
<option value="password">SSH 密码</option>
|
||||
<option value="private_key">SSH 私钥</option>
|
||||
</select>
|
||||
</label>
|
||||
<label v-if="serverForm.auth_method === 'password'" class="field server-form-field-wide">
|
||||
<label class="field server-form-field-wide">
|
||||
<span>SSH 密码</span>
|
||||
<input
|
||||
v-model="serverForm.password"
|
||||
@ -131,31 +105,6 @@ const {
|
||||
placeholder="编辑时留空表示保留原密码"
|
||||
/>
|
||||
</label>
|
||||
<label v-else class="field server-form-field-wide">
|
||||
<span class="field-label-row">
|
||||
<span>SSH 私钥</span>
|
||||
<button
|
||||
class="inline-button"
|
||||
type="button"
|
||||
@click="openSSHKeyCreate({ embedded: true })"
|
||||
>
|
||||
新建或导入
|
||||
</button>
|
||||
</span>
|
||||
<select v-model="serverForm.private_key_ref" required>
|
||||
<option value="">请选择已加密保存的私钥</option>
|
||||
<option
|
||||
v-for="key in sshKeys"
|
||||
:key="key.id"
|
||||
:value="key.reference"
|
||||
>
|
||||
{{ key.name }} · {{ key.algorithm }}
|
||||
</option>
|
||||
</select>
|
||||
<HelpTip v-if="sshKeys.length === 0">
|
||||
还没有私钥?点击“新建或导入”,按照引导生成、粘贴或读取私钥文件。
|
||||
</HelpTip>
|
||||
</label>
|
||||
<label class="field server-form-field-wide">
|
||||
<span>
|
||||
SSH 主机 SHA256 指纹
|
||||
@ -171,144 +120,6 @@ const {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="showEmbeddedSSHKeyGuide" class="server-form-section server-ssh-key-guide">
|
||||
<div class="server-form-section-heading">
|
||||
<div>
|
||||
<p class="eyebrow">当前服务器</p>
|
||||
<h3>准备 SSH 私钥</h3>
|
||||
</div>
|
||||
<div class="server-form-heading-actions">
|
||||
<HelpTip>
|
||||
按顺序执行命令后读取本机私钥,保存后会自动选中到当前服务器配置。
|
||||
</HelpTip>
|
||||
<button class="inline-button" type="button" @click="closeSSHKeyForm">
|
||||
收起引导
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ssh-key-steps">
|
||||
<article>
|
||||
<b>1</b>
|
||||
<strong>本机生成密钥</strong>
|
||||
</article>
|
||||
<article>
|
||||
<b>2</b>
|
||||
<strong>把公钥放到当前服务器</strong>
|
||||
</article>
|
||||
<article>
|
||||
<b>3</b>
|
||||
<strong>读取私钥并保存</strong>
|
||||
</article>
|
||||
</div>
|
||||
<div class="ssh-key-platforms" role="tablist" aria-label="密钥生成平台">
|
||||
<button
|
||||
class="platform-tab"
|
||||
:class="{ active: sshKeyPlatform === 'windows' }"
|
||||
type="button"
|
||||
role="tab"
|
||||
:aria-selected="sshKeyPlatform === 'windows'"
|
||||
@click="sshKeyPlatform = 'windows'"
|
||||
>
|
||||
Windows
|
||||
</button>
|
||||
<button
|
||||
class="platform-tab"
|
||||
:class="{ active: sshKeyPlatform === 'linux' }"
|
||||
type="button"
|
||||
role="tab"
|
||||
:aria-selected="sshKeyPlatform === 'linux'"
|
||||
@click="sshKeyPlatform = 'linux'"
|
||||
>
|
||||
Linux / macOS
|
||||
</button>
|
||||
</div>
|
||||
<div class="ssh-key-path-line">
|
||||
<span>本次密钥文件名</span>
|
||||
<code>{{ sshKeyFileName }}</code>
|
||||
<span class="guide-badge">每次随机生成</span>
|
||||
</div>
|
||||
<div class="ssh-key-path-summary">
|
||||
<div>
|
||||
<span>本地私钥位置</span>
|
||||
<code>{{ sshKeyPrivatePath }}</code>
|
||||
</div>
|
||||
<div>
|
||||
<span>本地公钥位置</span>
|
||||
<code>{{ sshKeyPublicPath }}</code>
|
||||
</div>
|
||||
<div>
|
||||
<span>远程登录目标</span>
|
||||
<code>{{ sshKeyCommandUsername }}@{{ sshKeyCommandHost }}</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ssh-command-card">
|
||||
<div class="ssh-command-heading">
|
||||
<span>生成命令</span>
|
||||
<button
|
||||
class="inline-button"
|
||||
type="button"
|
||||
@click="copySSHKeyCommand(sshKeyCommands[sshKeyPlatform], '密钥生成命令已复制')"
|
||||
>
|
||||
复制命令
|
||||
</button>
|
||||
</div>
|
||||
<code>{{ sshKeyCommands[sshKeyPlatform] }}</code>
|
||||
</div>
|
||||
<div class="ssh-command-card">
|
||||
<div class="ssh-command-heading">
|
||||
<span>安装公钥命令</span>
|
||||
<button
|
||||
class="inline-button"
|
||||
type="button"
|
||||
@click="copySSHKeyCommand(sshPublicKeyCommands[sshKeyPlatform], '公钥安装命令已复制')"
|
||||
>
|
||||
复制命令
|
||||
</button>
|
||||
</div>
|
||||
<code>{{ sshPublicKeyCommands[sshKeyPlatform] }}</code>
|
||||
</div>
|
||||
<div class="server-ssh-key-fields">
|
||||
<label class="field">
|
||||
<span>私钥名称</span>
|
||||
<input v-model="sshKeyForm.name" required type="text" maxlength="128" autocomplete="off" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>读取本机私钥文件</span>
|
||||
<input type="file" @change="importSSHKeyFile" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>私钥内容</span>
|
||||
<textarea
|
||||
v-model="sshKeyForm.private_key"
|
||||
rows="4"
|
||||
spellcheck="false"
|
||||
placeholder="-----BEGIN OPENSSH PRIVATE KEY-----"
|
||||
></textarea>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label-row">
|
||||
<span>私钥口令</span>
|
||||
<button class="inline-button" type="button" @click="sshKeyPassphraseVisible = !sshKeyPassphraseVisible">
|
||||
{{ sshKeyPassphraseVisible ? "隐藏口令" : "显示口令" }}
|
||||
</button>
|
||||
</span>
|
||||
<input
|
||||
v-model="sshKeyForm.passphrase"
|
||||
:type="sshKeyPassphraseVisible ? 'text' : 'password'"
|
||||
maxlength="4096"
|
||||
autocomplete="new-password"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<p v-if="sshKeyFormError" class="form-error">{{ sshKeyFormError }}</p>
|
||||
<div class="server-ssh-key-actions">
|
||||
<HelpTip>私钥会加密保存,服务器配置中只保存安全引用。</HelpTip>
|
||||
<button class="primary-button" type="button" :disabled="sshKeySaving" @click="saveSSHKey">
|
||||
{{ sshKeySaving ? "加密保存中……" : "加密保存并用于当前服务器" }}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="server-form-section">
|
||||
<div class="server-form-section-heading">
|
||||
<div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user