Erweiterte Features (1/2): Trusted-Proxy-IP, Bandbreitenlimits, 2FA
- Schema: updater/migrations/0002 + database.sql (users.totp_*, voucher_templates qos_*, neue Tabelle api_keys) - Trusted-Proxy-IP: Auth::clientIp() wertet X-Forwarded-For nur hinter konfiguriertem trusted_proxy aus (korrektes Rate-Limit/Audit hinter Proxy) - Bandbreiten-/Datenlimits: UniFiController::createVoucher akzeptiert QoS (down/up kbit/s, Datenkontingent MB); Voucher-Profile speichern Limits, Voucher-Formular reicht sie via Template-Quick-Select durch - 2FA (TOTP, RFC 6238): includes/Totp.php (gegen RFC-Testvektoren verifiziert), zweistufiger Login, admin/security.php zum Aktivieren/Deaktivieren mit QR, Nav-Link + i18n
This commit is contained in:
parent
51485810b4
commit
eec28f77b8
12 changed files with 458 additions and 16 deletions
27
updater/migrations/0002_extended_features.sql
Normal file
27
updater/migrations/0002_extended_features.sql
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
-- Updater-Migration: Schema fuer erweiterte Funktionen
|
||||
-- * 2FA (TOTP) fuer lokale Accounts
|
||||
-- * Bandbreiten-/Datenlimits in Voucher-Profilen
|
||||
-- * REST-API-Schluessel
|
||||
-- Idempotent gehalten; "duplicate column"/"already exists" werden vom
|
||||
-- MigrationRunner ignoriert.
|
||||
|
||||
ALTER TABLE `users` ADD COLUMN `totp_secret` VARCHAR(64) NULL;
|
||||
ALTER TABLE `users` ADD COLUMN `totp_enabled` TINYINT(1) NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `voucher_templates` ADD COLUMN `qos_rate_max_down` INT NULL;
|
||||
ALTER TABLE `voucher_templates` ADD COLUMN `qos_rate_max_up` INT NULL;
|
||||
ALTER TABLE `voucher_templates` ADD COLUMN `qos_usage_quota` INT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `api_keys` (
|
||||
`id` INT PRIMARY KEY AUTO_INCREMENT,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`key_prefix` VARCHAR(16) NOT NULL,
|
||||
`key_hash` VARCHAR(255) NOT NULL,
|
||||
`created_by` INT,
|
||||
`last_used_at` TIMESTAMP NULL,
|
||||
`is_active` TINYINT(1) NOT NULL DEFAULT 1,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL,
|
||||
INDEX `idx_prefix` (`key_prefix`),
|
||||
INDEX `idx_active` (`is_active`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
Loading…
Add table
Add a link
Reference in a new issue