diff --git a/Readme.md b/Readme.md index 86f54e5..9e655ae 100644 --- a/Readme.md +++ b/Readme.md @@ -184,16 +184,8 @@ cd Unifi-Voucher-Tool - **Site ID:** UniFi Site ID (meist `default`) - **Controller URL:** `https://unifi.example.com:11443` - **Benutzername / Passwort:** UniFi Admin-Zugangsdaten - - **Zertifikat des Controllers prüfen:** optional, siehe unten 3. **Verbindung testen** klicken, dann speichern -> **Zertifikatsprüfung:** UniFi-Geräte liefern ab Werk ein selbst signiertes -> Zertifikat, deshalb ist die Prüfung standardmäßig **aus** – sonst käme keine -> Verbindung zustande. Läuft der Controller unter seinem echten Namen mit einem -> gültigen Zertifikat (eigene CA oder Let's Encrypt), schalten Sie die Prüfung -> pro Site ein; die Verbindung ist dann gegen Man-in-the-Middle abgesichert. -> Für den Mailversand gibt es denselben Schalter unter **Einstellungen → SMTP**. - ### Voucher erstellen 1. Startseite öffnen (Login je nach Konfiguration optional) @@ -426,7 +418,6 @@ Das Tool ist auf einen sicheren Standardbetrieb ausgelegt: | **OAuth** | `state`-Validierung gegen Login-CSRF | | **Brute-Force** | Login-Rate-Limiting + Throttle der öffentlichen Voucher-Erstellung | | **Sessions** | HttpOnly, SameSite, strict mode + absolutes Timeout | -| **TLS zum Controller** | Zertifikatsprüfung pro Site einschaltbar (aus, solange der Controller self-signed ist) | | **Fehler** | `display_errors` aus, `log_errors` an (kein Info-Leak) | Mitgeliefert wird eine `.htaccess` im Projektstamm mit Sicherheits-Headern diff --git a/admin/backup.php b/admin/backup.php index 1291790..5908cf4 100644 --- a/admin/backup.php +++ b/admin/backup.php @@ -29,7 +29,7 @@ if (isset($_GET['export']) && isset($_GET['token']) && $auth->validateCsrfToken( 'note' => 'Site-Passwörter sind mit dem APP_KEY dieser Installation verschlüsselt.', ], 'settings' => $db->fetchAll("SELECT setting_key, setting_value FROM settings"), - 'sites' => $db->fetchAll("SELECT name, site_id, unifi_controller_url, unifi_username, unifi_password, ssl_verify, is_active, public_access FROM sites"), + 'sites' => $db->fetchAll("SELECT name, site_id, unifi_controller_url, unifi_username, unifi_password, is_active, public_access FROM sites"), 'voucher_templates' => $db->fetchAll("SELECT name, max_uses, expire_minutes, description, qos_rate_max_down, qos_rate_max_up, qos_usage_quota, is_active FROM voucher_templates"), // Display-Seiten samt Token: sonst zeigen aufgehängte QR-Codes nach // einem Restore ins Leere. Site und Profil werden über den Namen @@ -84,13 +84,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['import'])) { $exists = $db->fetchOne("SELECT id FROM sites WHERE name = ? AND site_id = ?", [$s['name'], $s['site_id']]); if ($exists) { $db->query( - "UPDATE sites SET unifi_controller_url=?, unifi_username=?, unifi_password=?, ssl_verify=?, is_active=?, public_access=? WHERE id=?", - [$s['unifi_controller_url'], $s['unifi_username'], $s['unifi_password'], (int)($s['ssl_verify'] ?? 0), (int)$s['is_active'], (int)$s['public_access'], $exists['id']] + "UPDATE sites SET unifi_controller_url=?, unifi_username=?, unifi_password=?, is_active=?, public_access=? WHERE id=?", + [$s['unifi_controller_url'], $s['unifi_username'], $s['unifi_password'], (int)$s['is_active'], (int)$s['public_access'], $exists['id']] ); } else { $db->query( - "INSERT INTO sites (name, site_id, unifi_controller_url, unifi_username, unifi_password, ssl_verify, is_active, public_access) VALUES (?,?,?,?,?,?,?,?)", - [$s['name'], $s['site_id'], $s['unifi_controller_url'], $s['unifi_username'], $s['unifi_password'], (int)($s['ssl_verify'] ?? 0), (int)$s['is_active'], (int)$s['public_access']] + "INSERT INTO sites (name, site_id, unifi_controller_url, unifi_username, unifi_password, is_active, public_access) VALUES (?,?,?,?,?,?,?)", + [$s['name'], $s['site_id'], $s['unifi_controller_url'], $s['unifi_username'], $s['unifi_password'], (int)$s['is_active'], (int)$s['public_access']] ); } $counts['sites']++; diff --git a/admin/import.php b/admin/import.php index 5ea2a66..d32b357 100644 --- a/admin/import.php +++ b/admin/import.php @@ -44,8 +44,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['do_import'])) { $controller = new UniFiController( $site['unifi_controller_url'], $site['unifi_username'], - Crypto::decrypt($site['unifi_password']), $site['site_id'], - $site['ssl_verify'] ?? 0 + Crypto::decrypt($site['unifi_password']), $site['site_id'] ); $created = 0; diff --git a/admin/index.php b/admin/index.php index c50e27f..4f3ee40 100644 --- a/admin/index.php +++ b/admin/index.php @@ -29,7 +29,7 @@ if (isset($_GET['ajax_stats'])) { if ($syncFirst) { foreach ($sites as $site) { try { - $ctrl = new UniFiController($site['unifi_controller_url'], $site['unifi_username'], Crypto::decrypt($site['unifi_password']), $site['site_id'], $site['ssl_verify'] ?? 0); + $ctrl = new UniFiController($site['unifi_controller_url'], $site['unifi_username'], Crypto::decrypt($site['unifi_password']), $site['site_id']); $ctrl->syncVouchersToDatabase($db, $site['id']); } catch (Exception $e) { $syncErrors[$site['id']] = $e->getMessage(); diff --git a/admin/settings.php b/admin/settings.php index 245ba6e..45f1fc0 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -111,7 +111,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save_settings'])) { $settings['smtp_password'] = trim($_POST['smtp_password']); } $settings['smtp_encryption'] = trim($_POST['smtp_encryption'] ?? 'tls'); - $settings['smtp_verify_ssl'] = isset($_POST['smtp_verify_ssl']) ? '1' : '0'; $settings['smtp_from_email'] = trim($_POST['smtp_from_email'] ?? ''); $settings['smtp_from_name'] = trim($_POST['smtp_from_name'] ?? ''); } @@ -209,7 +208,6 @@ $cs = [ 'smtp_username' => $db->getSetting('smtp_username', ''), 'smtp_password' => $db->getSetting('smtp_password', ''), 'smtp_encryption' => $db->getSetting('smtp_encryption', 'tls'), - 'smtp_verify_ssl' => $db->getSetting('smtp_verify_ssl', '0'), 'smtp_from_email' => $db->getSetting('smtp_from_email', ''), 'smtp_from_name' => $db->getSetting('smtp_from_name', ''), 'system_url' => $db->getSetting('system_url', $autoDetectedUrl), @@ -564,8 +562,6 @@ $adminBase = '';
-
>
-

diff --git a/admin/sites.php b/admin/sites.php index 82132c1..a45d0a9 100644 --- a/admin/sites.php +++ b/admin/sites.php @@ -32,16 +32,15 @@ if ($_SERVER['REQUEST_METHOD']==='POST' && isset($_POST['edit_site'])) { $username = trim($_POST['username']); $password = $_POST['password']; $publicAccess = isset($_POST['public_access']) ? 1 : 0; - $sslVerify = isset($_POST['ssl_verify']) ? 1 : 0; if (empty($name)||empty($siteIdStr)||empty($controllerUrl)||empty($username)) throw new Exception(__('error_fill_all')); if (!empty($password)) { - $test = UniFiController::testConnection($controllerUrl,$username,$password,$siteIdStr,$sslVerify); + $test = UniFiController::testConnection($controllerUrl,$username,$password,$siteIdStr); if ($test !== true) throw new Exception('Verbindung fehlgeschlagen: '.$test); - $db->execute("UPDATE sites SET name=?,site_id=?,unifi_controller_url=?,unifi_username=?,unifi_password=?,ssl_verify=?,public_access=? WHERE id=?", - [$name,$siteIdStr,$controllerUrl,$username,Crypto::encrypt($password),$sslVerify,$publicAccess,$siteId]); + $db->execute("UPDATE sites SET name=?,site_id=?,unifi_controller_url=?,unifi_username=?,unifi_password=?,public_access=? WHERE id=?", + [$name,$siteIdStr,$controllerUrl,$username,Crypto::encrypt($password),$publicAccess,$siteId]); } else { - $db->execute("UPDATE sites SET name=?,site_id=?,unifi_controller_url=?,unifi_username=?,ssl_verify=?,public_access=? WHERE id=?", - [$name,$siteIdStr,$controllerUrl,$username,$sslVerify,$publicAccess,$siteId]); + $db->execute("UPDATE sites SET name=?,site_id=?,unifi_controller_url=?,unifi_username=?,public_access=? WHERE id=?", + [$name,$siteIdStr,$controllerUrl,$username,$publicAccess,$siteId]); } $auth->writeAuditLog($_SESSION['user_id'],'site_edit','site',$siteId,"Site {$name} aktualisiert"); $success = __('sites_updated'); @@ -61,12 +60,11 @@ if ($_SERVER['REQUEST_METHOD']==='POST' && isset($_POST['add_site'])) { $username = trim($_POST['username']); $password = $_POST['password']; $publicAccess = isset($_POST['public_access']) ? 1 : 0; - $sslVerify = isset($_POST['ssl_verify']) ? 1 : 0; if (empty($name)||empty($siteId)||empty($controllerUrl)||empty($username)) throw new Exception(__('error_fill_all')); - $test = UniFiController::testConnection($controllerUrl,$username,$password,$siteId,$sslVerify); + $test = UniFiController::testConnection($controllerUrl,$username,$password,$siteId); if ($test !== true) throw new Exception('Verbindung fehlgeschlagen: '.$test); - $newId = $db->execute("INSERT INTO sites (name,site_id,unifi_controller_url,unifi_username,unifi_password,ssl_verify,public_access) VALUES (?,?,?,?,?,?,?)", - [$name,$siteId,$controllerUrl,$username,Crypto::encrypt($password),$sslVerify,$publicAccess]); + $newId = $db->execute("INSERT INTO sites (name,site_id,unifi_controller_url,unifi_username,unifi_password,public_access) VALUES (?,?,?,?,?,?)", + [$name,$siteId,$controllerUrl,$username,Crypto::encrypt($password),$publicAccess]); $auth->writeAuditLog($_SESSION['user_id'],'site_create','site',$newId,"Site {$name} erstellt"); $success = __('sites_added'); } catch (Exception $e) { $error = $e->getMessage(); } @@ -142,9 +140,6 @@ $currentPage = 'sites'; - - -
@@ -162,7 +157,7 @@ $currentPage = 'sites';
- @@ -219,11 +214,6 @@ $currentPage = 'sites';
-
- - -
-

-
- - -
-