Audit logs stage 3: failed sign-ins say why and are logged against the account they were for - wrong password, no account with that email, disabled, archived or invited account, client archived, portal turned off, a wrong MFA or two-step code after the right password - with failed Microsoft 365 portal sign-ins logged too and marked Their account in the audit log; the IP lockout counts portal failures as well; the first sign-in from an IP address is badged New IP in the audit lists and quick look; new Admin > Sign-ins under Access with People and IP addresses views, search, date filter, sortable columns and paging; admins get a notification and an email on a run of failed sign-ins or turned-away API calls from one address or against one account, set in Settings > Security (10 to start, 5, 20, 50 or never), each in the audit log Security view and in Mail > Previews; API calls counted per key, day and endpoint, with a 30-day calls column and last IP on API Keys and a usage window, expired-key calls logged against the key, and usage deleted with the key and after the log retention; database 3.3.2 drops the unused auth_logs table and adds settings.config_login_alert_failures and api_key_usage; new functions/sign_in.php, admin/sign_ins.php and admin/modals/api/api_key_usage.php; the license template page no longer warns when view is missing

This commit is contained in:
johnnyq
2026-10-19 00:56:52 -04:00
parent f43d4a9127
commit a5a43e37ac
25 changed files with 1022 additions and 72 deletions

View File

@@ -1,6 +1,9 @@
<?php
require_once "includes/inc_all_admin.php";
// Read here rather than with every page's settings, so a page still opens before the update that adds it
$config_login_alert_failures = signInAlertLimit();
?>
<div class="card card-dark">
@@ -40,13 +43,25 @@ require_once "includes/inc_all_admin.php";
</div>
<div class="mb-3">
<label>Log retention <small class="text-secondary">(The amount of days before app/audit/auth logs are deleted during nightly cron)</small></label>
<label>Log retention <small class="text-secondary">(The amount of days before app and audit logs, and API key use, are deleted during nightly cron)</small></label>
<div class="input-group">
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
<input type="number" class="form-control" name="config_log_retention" placeholder="Enter days to retain" value="<?= intval($config_log_retention) ?>">
</div>
</div>
<div class="mb-3">
<label>Tell administrators about failed sign-ins <small class="text-secondary">(In <?= SIGN_IN_WINDOW_MINUTES ?> minutes, from one IP address or against one account - each admin gets a notification and an email. An address is turned away after <?= SIGN_IN_LOCKOUT ?>.)</small></label>
<div class="input-group">
<span class="input-group-text"><i class="fa fa-fw fa-bell"></i></span>
<select class="form-select" name="config_login_alert_failures">
<?php foreach (signInAlertOptions() as $failures => $label) { ?>
<option value="<?= $failures ?>" <?= intval($config_login_alert_failures) === $failures ? 'selected' : '' ?>><?= $label ?></option>
<?php } ?>
</select>
</div>
</div>
<h5 class="mt-4 mb-3"><i class="fas fa-fw fa-share-alt me-2"></i>Shared links</h5>
<div class="mb-3">