---
title: 安全性
description: 使用雙因素驗證與 IP 允許清單保護管理主控台、管理管理員角色，並設定客戶登入：passkeys、Google 與 GitHub、驗證碼及封鎖的電子郵件網域。
url: https://nexcmp.com/zh-tw/docs/administration/security/
applies_to: NexCMP 1.6.1
updated: 2026-11-02
---

# 安全性 {#security}

> **後台位置：** System › Admin › Console security (`/account`)、Admin users (`/users`)；System › Settings › Customer logins (`/settings/login`)。

## 管理者控制台 {#admin-console}

### 雙因素驗證 (TOTP) {#two-factor-authentication-totp}

主控台可從網際網路存取，因此請啟用 TOTP。

1. 開啟 **System › Admin › Console security**。
2. 在 **Two-factor authentication (TOTP)** 下點擊 **Start setup**。
3. 使用 Google Authenticator、Authy、1Password 或 Bitwarden 掃描 QR 碼，然後輸入 6 位數代碼。

### 允許的主控台 IP 範圍 {#allowed-console-ip-ranges}

在 **Allowed console IP ranges** 下每行輸入一個 IP 或 CIDR（IPv4 或 IPv6）。**空白表示允許任何來源。** 若超出範圍，登入與管理 API 都將遭到封鎖。

::: warning 請勿將自己鎖在門外
頁面會顯示您目前的 IP，並要求新的清單必須包含它。請使用 **+ Add my IP**。若您仍遭到鎖定，請使用來自伺服器的 [emergency access](https://nexcmp.com/zh-tw/docs/getting-started/cli-reference/#emergency-access)。
:::

### 變更密碼 {#change-password}

填寫 **Current password**、**New password** 與 **Confirm new password**。請使用長且獨特的密碼（12 個字元以上；安裝精靈強制要求第一位管理員使用 12 個字元）。

### 管理員帳號與角色 {#administrator-accounts-and-roles}

開啟 **System › Admin › Admin users** 並使用 **+ Create account**。

| 角色 | 存取權限 |
|---|---|
| `admin` | 完整存取管理 API |
| `staff` | 全系統唯讀 |
| `user` | 單一客戶資源的唯讀檢視 |

根帳號是在 [setup wizard](https://nexcmp.com/zh-tw/docs/getting-started/setup-wizard/) 中建立的帳號。列動作：**Edit**、**Reset PW**、**Key**、**Delete**。密碼以帶鹽雜湊儲存；變更或鎖定帳號會立即終止其工作階段。

## 客戶登入 {#customer-sign-in}

開啟 **System › Settings › Customer logins**。

| 設定 | 功能 |
|---|---|
| **Google sign-in** | 啟用後輸入OAuth用戶端ID與密碼。將頁面上顯示的**Callback URL**複製到*Google Cloud Console › APIs & Services › Credentials › OAuth client ID › Authorized redirect URIs*中。請使用**Test configuration**。 |
| **GitHub login** | 同上，使用*GitHub › Settings › Developer settings › OAuth Apps › Authorization callback URL* |
| **Passkey** | 指紋、PIN碼或硬體金鑰登入；預設開啟。Passkeys會繫結至網域；每個經銷商網域皆獨立運作。品牌重塑後，請在*Legacy passkey Domain*中輸入舊網域，以便客戶獲得實用提示 |
| **新增登入方式時重新驗證** | 新增passkey或連結Google/GitHub之前再次要求輸入密碼（預設關閉） |
| **Captcha** | 註冊時使用Cloudflare Turnstile或Google reCAPTCHA：啟用、選擇提供商、輸入網站金鑰與密鑰 |
| **Block e-mail domains** | 每行一個網域（最多2000個）。註冊時若符合位址將遭到拒絕，並顯示`email_domain_blocked` |

![顯示Google登入及其callback URL的客戶登入頁面](https://nexcmp.com/zh-tw/docs/images/administration/security-01-customer-logins.webp)

### 內建原則 {#built-in-policies}

| 政策 | 值 |
|---|---|
| 客戶密碼 | 至少10個字元，包含字母與數字 |
| 客戶工作階段 | 30天；「以客戶身分登入」的工作階段持續1小時 |
| 電子郵件驗證 | 當銷售設定中開啟*require e-mail verified*時，於建立虛擬機器前必填 |
| 防盜刷 | 帳戶餘額低於最低加值金額時，僅能建立有限數量的虛擬機器 |

## 伺服器強化 {#server-hardening}

- 設定與TLS完成後，連接埠3000將會關閉；請參閱[Installation](https://nexcmp.com/zh-tw/docs/getting-started/installation/#the-panel-port-3000)。
- 服務以無特權的`nexcmp`使用者身分執行，並具備受限制的systemd沙箱。
- API金鑰、付款憑證與SMTP密碼皆以加密方式儲存；主金鑰位於`/var/lib/nexcmp/secrets`中 — 請保護好[backups](https://nexcmp.com/zh-tw/docs/getting-started/backup-and-restore/)。
- 安裝前會透過SHA-256與Ed25519簽章驗證版本。


