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
@@ -1,6 +1,15 @@
|
||||
<template>
|
||||
<div class="config-wrapper">
|
||||
<div class="config-card">
|
||||
<!-- PKI cleared while the page is open (e.g. in another tab) -->
|
||||
<div v-if="!pkiStatus.pki_ready" class="config-card">
|
||||
<div class="config-header">
|
||||
<h1>Server Infrastructure Configuration</h1>
|
||||
</div>
|
||||
<p><i class="fas fa-lock me-2"></i>The server cannot be configured until the PKI is initialized.</p>
|
||||
<router-link to="/config/pki">Go to PKI configuration</router-link>
|
||||
</div>
|
||||
|
||||
<div v-else class="config-card">
|
||||
<div class="config-header">
|
||||
<h1>Server Infrastructure Configuration</h1>
|
||||
</div>
|
||||
@@ -254,9 +263,11 @@
|
||||
import { ref, onMounted, reactive, watch } from 'vue';
|
||||
import { useApi } from '../composables/useApi';
|
||||
import { useToast } from '../composables/useToast';
|
||||
import { usePkiStatus } from '../composables/usePkiStatus';
|
||||
|
||||
const { profilesApiClient } = useApi();
|
||||
const toast = useToast();
|
||||
const { status: pkiStatus, refresh: refreshPkiStatus } = usePkiStatus();
|
||||
|
||||
// State
|
||||
const form = reactive({
|
||||
@@ -356,7 +367,7 @@ const handleSave = async () => {
|
||||
await profilesApiClient.put('/config/server', payload);
|
||||
showMessage('Server configuration saved!', 'success');
|
||||
} catch (err) {
|
||||
showMessage(`Error saving: ${err.message}`, 'error');
|
||||
showMessage(`Error saving: ${err.response?.data?.detail || err.message}`, 'error');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
action.value = '';
|
||||
@@ -371,7 +382,8 @@ const handleApply = async () => {
|
||||
const data = res.data;
|
||||
showMessage(data.message || 'Configuration applied!', 'success');
|
||||
} catch (err) {
|
||||
showMessage(`Error applying: ${err.message}`, 'error');
|
||||
showMessage(`Error applying: ${err.response?.data?.detail || err.message}`, 'error');
|
||||
refreshPkiStatus();
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
action.value = '';
|
||||
@@ -379,6 +391,7 @@ const handleApply = async () => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
refreshPkiStatus();
|
||||
loadConfig();
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user