Files
itflow/agent/modals/certificate/certificate_add.php
johnnyq e4c8130ebe Certificates: Check now connects to the host and saves what it serves - issuer, issued and expiry dates, names covered, SHA-256 fingerprint and the PEM - with the result (OK, name mismatch, untrusted, expired or unreachable) and when it ran, and a check that reaches nothing keeps the certificate on file; New/Edit form split into tabs (Certificate, Paste or by hand, Notes) with a Check button that shows what the host serves before saving, the host tidied from a pasted web address, the name defaulting to the host, the domain picked from the host and limited to the client's own, and a PEM paste or issuer and expiry by hand for hosts ITFlow can't reach; new certificate quick look with the check result and what to do about it, names covered, fingerprint copy, PEM copy and .crt download, domain, services, notes and history; certificates list rebuilt with All/Starred/Expiring soon/Expired/Problems/Not checked pills, host and names covered, domain link, issuer filter, last check column, whitelisted sort, ?open= and bulk check/star/archive/restore/delete; short-lived (ACME) certificates only count as expiring soon inside 20 days and skip the 45-day alert; domain and service quick looks link certificates to their quick look (with New certificate from a domain), global search finds certificates by name, host, names covered or fingerprint, client overview gets a Certificate problems box and renewals open the certificate, dashboard links to Expiring soon, client portal shows expiry badges, export adds last check, names covered, fingerprint and more, documentation PDF adds host and last check; certificate refresher now checks hosts daily in a time-boxed batch, writes history and notifies when an OK certificate turns bad; nightly alerts skip archived certificates and open the certificate; API create uses the same form rules and checks the host; demo data adds firewall, remote access and RADIUS certificates with real check results. Fixes the delete audit log using an undefined name, the archive flash type, certificates linking to another client's domain, services linking to another client's certificates, PEM parsing assuming an issuer organisation, and the API create using an undefined variable. DB 2.8.4
2026-10-15 01:07:32 -04:00

59 lines
2.1 KiB
PHP

<?php
/*
* New certificate - for the client it was opened from, or pick the client
* here. Give the host it is served on and it is checked as it is saved: the
* certificate it serves, its issuer, dates and names, and whether it is OK.
* For a host ITFlow can't reach, paste the certificate or type the issuer
* and expiry. Opened from a domain (?domain_id=) it starts on that domain.
*/
require_once '../../../includes/modal_header.php';
enforceUserPermission('module_support', 2);
$client_id = intval($_GET['client_id'] ?? 0);
$certificate_domain_id = 0;
$certificate_domain = '';
// From a domain - its client, the domain, and the domain as the host
$from_domain = domainRow($_GET['domain_id'] ?? 0);
if ($from_domain) {
$client_id = intval($from_domain['domain_client_id']);
$certificate_domain_id = intval($from_domain['domain_id']);
$certificate_domain = escapeHtml($from_domain['domain_name']);
}
if ($client_id) {
enforceClientAccess();
}
$certificate_form_mode = 'add';
$certificate_id = 0;
$certificate_name = $certificate_description = $certificate_issued_by = $certificate_expire = $certificate_public_key = $certificate_notes = '';
$certificate_favorite = 0;
ob_start();
?>
<div class="modal-header bg-dark">
<h5 class="modal-title"><i class="fa fa-fw fa-lock me-2"></i>New Certificate</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<?php if ($client_id) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<div class="modal-body">
<?php require 'certificate_form.php'; ?>
</div>
<div class="modal-footer">
<button type="submit" name="add_certificate" class="btn btn-primary text-bold"><i class="fa fa-check me-2"></i>Create</button>
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
</div>
</form>
<?php
require_once '../../../includes/modal_footer.php';