feature: the VPN, the router, the name server and WebDAV are components switched on the System tab and installed on demand, Caddy from the Ubuntu archive is a dependency and serves every HTTP and HTTPS port, HTTPS is chosen at install, its certificate is of the Servers Issuing CA or self-signed by default, of ACME or of another CA, the issuing CAs are in one tab, a locked account is unlocked again, the name of a CA is fixed once the CA exists, and a run of setup is no longer cut short by a change.
Release / release (push) Failing after 8s
Release / release (push) Failing after 8s
This commit is contained in:
1 parent
a649331aa2
commit
a7bfabcb89
97 files changed
+4498
-1834
No files matched your search
@@ -3,7 +3,7 @@ import {
|
||||
Typography,
|
||||
} from '@mui/material'
|
||||
import { useState, type FormEvent } from 'react'
|
||||
import { PKI_KEYS, PKI_PUBLISH, type Pki, type PkiRootSource, type PkiSettings, type PkiTemplate } from './api.ts'
|
||||
import { PKI_KEYS, PKI_PUBLISH, type Pki, type PkiAuthority, type PkiRootSource, type PkiSettings, type PkiTemplate } from './api.ts'
|
||||
|
||||
/** The labels of the publishing endpoints. */
|
||||
export const PUBLISH_LABELS: Record<string, string> = {
|
||||
@@ -24,7 +24,7 @@ export const ROOT_SOURCE_LABELS: Record<PkiRootSource, string> = {
|
||||
export const NAME_PATTERN = /^[a-z][a-z0-9-]{0,30}$/
|
||||
|
||||
/** The names the issuing CAs of pki.issuing_cas cannot have. */
|
||||
export const RESERVED = ['root', 'upstream', 'p2s', 's2s']
|
||||
export const RESERVED = ['root', 'upstream', 'p2s', 's2s', 'servers']
|
||||
|
||||
/** The longest common name of a CA, in characters. */
|
||||
const CA_NAME_MAX = 64
|
||||
@@ -37,6 +37,11 @@ export const NEW_TEMPLATE: PkiTemplate = {
|
||||
key: 'rsa-3072', days: 365, key_usage: ['digital_signature'], extended_key_usage: [], subject: 'name', sans: [], policies: [],
|
||||
}
|
||||
|
||||
/** Whether an issuing CA has its certificate or its CSR, which fix its common name. */
|
||||
export function made(authority: PkiAuthority) {
|
||||
return authority.state === 'active' || authority.state === 'pending'
|
||||
}
|
||||
|
||||
/** A common name's problem, or ''. */
|
||||
export function nameProblem(value: string) {
|
||||
return value.trim() === '' || value.trim().length > CA_NAME_MAX ? `1 to ${CA_NAME_MAX} characters.` : ''
|
||||
@@ -59,10 +64,12 @@ export function daysProblem(value: number) {
|
||||
|
||||
/**
|
||||
* A dialog that edits the server's pki section but the general-purpose issuing CAs, the templates and the custom
|
||||
* extended key usages, which IssuingCaDialog, TemplateDialog and EkuDialog edit: the names, lifetimes and key type of
|
||||
* the CAs, the validity of the CRLs, where certificates and CRLs are published and, with a Simple CA root, the URL of
|
||||
* the service. The source of the root is shown and not edited, as it is fixed once the root exists. The server applies
|
||||
* the names, lifetimes and key type when it creates a CA. onSave sends the settings; the dialog closes when it
|
||||
* extended key usages, which IssuingCaDialog, TemplateDialog and EkuDialog edit: the names of the P2S and site-to-site
|
||||
* CAs, the lifetimes and key type of the CAs, the validity of the CRLs, where certificates and CRLs are published and,
|
||||
* with a Simple CA root, the URL of the service. The source of the root is shown and not edited, as it is fixed once
|
||||
* the root exists. The root and the Servers CA are made by the first setup, so their names are not shown; the P2S and
|
||||
* site-to-site CAs are made when the VPN and the router are switched on, and their names are fixed from then on. The
|
||||
* server applies the lifetimes and key type when it creates a CA. onSave sends the settings; the dialog closes when it
|
||||
* succeeds and shows the server's message when it fails.
|
||||
*/
|
||||
export default function PkiSettingsDialog(props: {
|
||||
@@ -75,8 +82,9 @@ export default function PkiSettingsDialog(props: {
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
|
||||
const change = (values: Partial<PkiSettings>) => setSettings({ ...settings, ...values })
|
||||
const fixed = (name: string) => props.pki.status.authorities.some((authority) => authority.name === name && made(authority))
|
||||
const blocked = [
|
||||
nameProblem(settings.root_name), nameProblem(settings.p2s_name), nameProblem(settings.s2s_name),
|
||||
nameProblem(settings.p2s_name), nameProblem(settings.s2s_name),
|
||||
daysProblem(settings.root_days), daysProblem(settings.ca_days), daysProblem(settings.crl_days), daysProblem(settings.root_crl_days),
|
||||
settings.root === 'simple-ca' ? urlProblem(settings.simple_ca_url) : '',
|
||||
].some((problem) => problem !== '')
|
||||
@@ -107,6 +115,7 @@ export default function PkiSettingsDialog(props: {
|
||||
{error && <Alert severity="error" sx={{ whiteSpace: 'pre-line' }}>{error}</Alert>}
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Names, lifetimes and the key type apply when the server creates a CA; URLs apply to the certificates signed afterwards.
|
||||
The P2S and site-to-site CAs are created when the VPN and the router are switched on.
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">CAs</Typography>
|
||||
<TextField label="Root CA source" value={ROOT_SOURCE_LABELS[settings.root]} disabled helperText="Fixed once the root exists." />
|
||||
@@ -120,16 +129,17 @@ export default function PkiSettingsDialog(props: {
|
||||
onChange={(event) => change({ simple_ca_url: event.target.value.trim() })}
|
||||
/>
|
||||
)}
|
||||
{(['root', 'p2s', 's2s'] as const).filter((name) => name !== 'root' || settings.root === 'local').map((name) => {
|
||||
const option = `${name}_name` as 'root_name' | 'p2s_name' | 's2s_name'
|
||||
{(['p2s', 's2s'] as const).map((name) => {
|
||||
const option = `${name}_name` as 'p2s_name' | 's2s_name'
|
||||
return (
|
||||
<TextField
|
||||
key={name}
|
||||
label={{ root: 'Root CA name', p2s: 'P2S CA name', s2s: 'Site-to-site CA name' }[name]}
|
||||
label={{ p2s: 'P2S CA name', s2s: 'Site-to-site CA name' }[name]}
|
||||
value={settings[option]}
|
||||
disabled={fixed(name)}
|
||||
autoComplete="off"
|
||||
error={nameProblem(settings[option]) !== ''}
|
||||
helperText={nameProblem(settings[option])}
|
||||
helperText={nameProblem(settings[option]) || (fixed(name) ? 'Fixed once the CA exists.' : '')}
|
||||
onChange={(event) => change({ [option]: event.target.value })}
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user