mirror of
https://git.hexahost.dev/smueller/HexaHost-Frontend.git
synced 2026-06-02 07:48:43 +00:00
chore(release): obfuscate and hash production assets [skip ci]
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* HexaDNS - SSL Certificate Check API
|
||||
*
|
||||
* Prüft SSL-Zertifikat-Informationen einer Domain
|
||||
*
|
||||
* Verwendung: GET /api/ssl-check.php?domain=example.com
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
require_once __DIR__ . '/../includes/api-helpers.php';
|
||||
|
||||
@@ -43,9 +43,9 @@ echo json_encode([
|
||||
'ssl' => $sslData
|
||||
], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
||||
|
||||
/**
|
||||
* Prüft SSL-Zertifikat einer Domain
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function checkSslCertificate(string $domain): array {
|
||||
$result = [
|
||||
'success' => false,
|
||||
@@ -55,7 +55,7 @@ function checkSslCertificate(string $domain): array {
|
||||
'certificate' => null
|
||||
];
|
||||
|
||||
// Stream Context für SSL
|
||||
|
||||
$context = stream_context_create([
|
||||
'ssl' => [
|
||||
'capture_peer_cert' => true,
|
||||
@@ -64,18 +64,18 @@ function checkSslCertificate(string $domain): array {
|
||||
]
|
||||
]);
|
||||
|
||||
// Verbindung herstellen
|
||||
|
||||
$socket = @stream_socket_client(
|
||||
"ssl://{$domain}:443",
|
||||
$errno,
|
||||
$errstr,
|
||||
10, // Timeout
|
||||
10,
|
||||
STREAM_CLIENT_CONNECT,
|
||||
$context
|
||||
);
|
||||
|
||||
if (!$socket) {
|
||||
// Versuche ohne SSL (um zu prüfen ob Server erreichbar)
|
||||
|
||||
$httpSocket = @fsockopen($domain, 80, $errno, $errstr, 5);
|
||||
if ($httpSocket) {
|
||||
fclose($httpSocket);
|
||||
@@ -89,7 +89,7 @@ function checkSslCertificate(string $domain): array {
|
||||
$result['has_ssl'] = true;
|
||||
$result['success'] = true;
|
||||
|
||||
// Zertifikat extrahieren
|
||||
|
||||
$params = stream_context_get_params($socket);
|
||||
$cert = $params['options']['ssl']['peer_certificate'] ?? null;
|
||||
|
||||
@@ -105,10 +105,10 @@ function checkSslCertificate(string $domain): array {
|
||||
$isNotYetValid = $now < $validFrom;
|
||||
$result['is_valid'] = !$isExpired && !$isNotYetValid;
|
||||
|
||||
// Tage bis Ablauf
|
||||
|
||||
$daysUntilExpiry = floor(($validTo - $now) / 86400);
|
||||
|
||||
// Subject Alternative Names (SANs)
|
||||
|
||||
$sans = [];
|
||||
if (isset($certInfo['extensions']['subjectAltName'])) {
|
||||
$sanStr = $certInfo['extensions']['subjectAltName'];
|
||||
@@ -116,7 +116,7 @@ function checkSslCertificate(string $domain): array {
|
||||
$sans = $matches[1] ?? [];
|
||||
}
|
||||
|
||||
// Issuer aufbereiten
|
||||
|
||||
$issuer = [];
|
||||
if (isset($certInfo['issuer'])) {
|
||||
if (isset($certInfo['issuer']['O'])) $issuer['organization'] = $certInfo['issuer']['O'];
|
||||
@@ -124,7 +124,7 @@ function checkSslCertificate(string $domain): array {
|
||||
if (isset($certInfo['issuer']['C'])) $issuer['country'] = $certInfo['issuer']['C'];
|
||||
}
|
||||
|
||||
// Subject aufbereiten
|
||||
|
||||
$subject = [];
|
||||
if (isset($certInfo['subject'])) {
|
||||
if (isset($certInfo['subject']['CN'])) $subject['common_name'] = $certInfo['subject']['CN'];
|
||||
@@ -144,7 +144,7 @@ function checkSslCertificate(string $domain): array {
|
||||
'version' => $certInfo['version'] ?? null,
|
||||
];
|
||||
|
||||
// Warnung wenn bald ablaufend
|
||||
|
||||
if ($daysUntilExpiry <= 30 && $daysUntilExpiry > 0) {
|
||||
$result['warning'] = "Zertifikat läuft in {$daysUntilExpiry} Tagen ab!";
|
||||
} elseif ($isExpired) {
|
||||
|
||||
Reference in New Issue
Block a user