Guard server setup behind an initialized PKI
- Profiler: server_files_missing/require_* helpers; 409 for /server/configure, start/restart and POST /profiles when the PKI is not initialized or server files (honouring fqdn_server) are missing; stop stays allowed; DELETE /system/pki returns 409 while OpenVPN runs; GET /system/init/status adds pki_ready, server_ready, missing. - UI: shared usePkiStatus; VPN menu item locked until the PKI is ready, route guard for /config/vpn, Start/Restart and New Client disabled with hints, lock notice on the VPN page. - Test: one pytest (test_pki_guard.py). - Docs: plan and summary in DOCS/Changes, API reference, README, Index. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dcc3d7f2d5
commit
56dae90ff5
19 files changed
+342
-22
No files matched your search
@@ -6,7 +6,7 @@ from schemas import (
|
||||
ConfigResponse, SystemSettings, PKISetting,
|
||||
SystemSettingsUpdate, PKISettingUpdate
|
||||
)
|
||||
from services import config, pki
|
||||
from services import config, pki, process
|
||||
|
||||
router = APIRouter(dependencies=[Depends(verify_token)])
|
||||
|
||||
@@ -52,5 +52,8 @@ def get_init_status(db: Session = Depends(get_db)):
|
||||
def clear_system_pki(db: Session = Depends(get_db)):
|
||||
if pki.is_init_running():
|
||||
raise HTTPException(status_code=409, detail="PKI initialization is running")
|
||||
# Do not pull the keys from under a running server
|
||||
if process.get_process_stats()["status"] == "running":
|
||||
raise HTTPException(status_code=409, detail="Stop OpenVPN first")
|
||||
msg = pki.clear_pki(db)
|
||||
return {"message": msg}
|
||||
Reference in new issue
Block a user