mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 17:44:41 +00:00
System: Trust: Certificates - work in progress for https://github.com/opnsense/core/issues/7248
* handle externally managed certificates (manual action)
This commit is contained in:
parent
35b866f922
commit
4211e54d04
@ -135,6 +135,11 @@ class CertController extends ApiMutableModelControllerBase
|
||||
$error = $data['error'] ?? '';
|
||||
}
|
||||
break;
|
||||
case 'manual':
|
||||
if (!empty((string)$node->crt_payload)) {
|
||||
$node->crt = base64_encode((string)$node->crt_payload);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ($error !== false) {
|
||||
throw new UserException($error, "Certificate error");
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
<import>Import an existing Certificate</import>
|
||||
<import_csr>Import certificate (signed by CA)</import_csr>
|
||||
<reissue>Reissue and replace certificate (does not restart services)</reissue>
|
||||
<manual>Manual</manual>
|
||||
</OptionValues>
|
||||
</action>
|
||||
<key_type type="OptionField" volatile="true">
|
||||
|
||||
@ -126,8 +126,10 @@ class CertificatesField extends ArrayField
|
||||
$node->prv_payload = !empty((string)$node->prv) ? (string)base64_decode($node->prv) : '';
|
||||
if (!empty((string)$node->csr_payload)) {
|
||||
$node->action = 'import_csr';
|
||||
} elseif (!empty((string)$node->crt_payload)) {
|
||||
} elseif (!empty((string)$node->crt_payload) && !empty((string)$node->prv_payload)) {
|
||||
$node->action = 'reissue';
|
||||
} elseif (!empty((string)$node->crt_payload)) {
|
||||
$node->action = 'manual';
|
||||
}
|
||||
}
|
||||
return parent::actionPostLoadingEvent();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user