# 审计 — 2026-06-12 新服务器接入自动化（生产部署）

## 范围（文件清单）

| 文件 | 说明 |
|------|------|
| `server/application/services/server_onboarding_service.py` | 调度入口 |
| `server/application/services/server_batch_service.py` | `_run_onboard` |
| `server/application/server_batch_common.py` | `detect_and_save_target_path` |
| `server/api/servers.py` | 创建/导入/IP 添加钩子 |
| `server/api/schemas.py` | `onboarding_job_id` |
| `frontend/src/composables/servers/useServerFormDialog.ts` | 任务注册 |
| `frontend/src/pages/ServersPage.vue` | IP 批量添加注册 |
| `frontend/src/types/api.ts` | 类型 |
| `frontend/src/utils/auditLabels.ts` | batch_server_onboard 标签 |
| `scripts/batch_detect_target_path.py` | 复用 detect_and_save_target_path |
| `tests/test_server_onboarding.py` | 单测 |

## Step 3 规则扫描

| H | 规则 | 结论 |
|---|------|------|
| H1 | sudoers 白名单 | PASS |
| H2 | 创建 API 不 5xx | PASS |
| H3 | 探测失败可推 wwwroot | PASS |

## Closure

| H | 判定 | 依据 |
|---|------|------|
| H1 | PASS | files_sudoers_service |
| H2 | PASS | server_onboarding_service |
| H3 | PASS | _run_onboard |

## DoD

- [x] pytest test_server_onboarding
- [x] changelog 2026-06-12-server-onboarding-automation.md
- [x] 7/7 门控

## 验证

```bash
pytest tests/test_server_onboarding.py -q
bash deploy/pre_deploy_check.sh
```
