Remove WireGuard integration from production deployment to simplify infrastructure: - Remove docker-compose-direct-access.yml (VPN-bound services) - Remove VPN-only middlewares from Grafana, Prometheus, Portainer - Remove WireGuard middleware definitions from Traefik - Remove WireGuard IPs (10.8.0.0/24) from Traefik forwarded headers All monitoring services now publicly accessible via subdomains: - grafana.michaelschiemer.de (with Grafana native auth) - prometheus.michaelschiemer.de (with Basic Auth) - portainer.michaelschiemer.de (with Portainer native auth) All services use Let's Encrypt SSL certificates via Traefik.
121 lines
4.0 KiB
PHP
121 lines
4.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Framework\QrCode\QrCodeGenerator;
|
|
use App\Framework\QrCode\ValueObjects\ErrorCorrectionLevel;
|
|
use App\Framework\QrCode\ValueObjects\QrCodeConfig;
|
|
use App\Framework\QrCode\ValueObjects\QrCodeVersion;
|
|
use App\Framework\QrCode\ValueObjects\EncodingMode;
|
|
|
|
echo "=== Full QR Code Validation ===\n\n";
|
|
|
|
$testData = 'https://localhost/';
|
|
echo "Test data: {$testData}\n";
|
|
echo "Data length: " . strlen($testData) . " bytes\n\n";
|
|
|
|
$config = QrCodeConfig::autoSize($testData, ErrorCorrectionLevel::M);
|
|
$matrix = QrCodeGenerator::generate($testData, $config);
|
|
|
|
$size = $matrix->getSize();
|
|
$version = $matrix->getVersion()->getVersionNumber();
|
|
|
|
echo "Generated QR Code:\n";
|
|
echo " Version: {$version}\n";
|
|
echo " Size: {$size}x{$size}\n";
|
|
echo " Error Correction: M\n";
|
|
echo " Encoding Mode: Byte\n\n";
|
|
|
|
// Check format information
|
|
echo "=== Format Information Check ===\n";
|
|
$formatCols = [0, 1, 2, 3, 4, 5, 7, 8, $size - 1, $size - 2, $size - 3, $size - 4, $size - 5, $size - 6, $size - 7];
|
|
$formatH = '';
|
|
foreach ($formatCols as $col) {
|
|
$formatH .= $matrix->getModuleAt(8, $col)->isDark() ? '1' : '0';
|
|
}
|
|
|
|
$formatRows = [$size - 1, $size - 2, $size - 3, $size - 4, $size - 5, $size - 6, $size - 7, 8, 7, 5, 4, 3, 2, 1, 0];
|
|
$formatV = '';
|
|
foreach ($formatRows as $row) {
|
|
$formatV .= $matrix->getModuleAt($row, 8)->isDark() ? '1' : '0';
|
|
}
|
|
|
|
echo "Horizontal format: {$formatH}\n";
|
|
echo "Vertical format: {$formatV}\n";
|
|
echo "Match: " . ($formatH === $formatV ? "✅ YES" : "❌ NO") . "\n\n";
|
|
|
|
// Decode format info
|
|
$xorMask = "101010000010010";
|
|
$unmasked = '';
|
|
for ($i = 0; $i < 15; $i++) {
|
|
$unmasked .= (int)$formatH[$i] ^ (int)$xorMask[$i];
|
|
}
|
|
|
|
$ecBits = substr($unmasked, 0, 2);
|
|
$maskBits = substr($unmasked, 2, 3);
|
|
$ecLevel = match($ecBits) {'01' => 'L', '00' => 'M', '11' => 'Q', '10' => 'H', default => 'UNKNOWN'};
|
|
$maskPattern = bindec($maskBits);
|
|
|
|
echo "Decoded format info:\n";
|
|
echo " EC Level: {$ecLevel}\n";
|
|
echo " Mask Pattern: {$maskPattern}\n\n";
|
|
|
|
// Check finder patterns
|
|
echo "=== Finder Pattern Check ===\n";
|
|
$topLeft = $matrix->getModuleAt(0, 0)->isDark() &&
|
|
$matrix->getModuleAt(6, 6)->isDark();
|
|
$topRight = $matrix->getModuleAt(0, $size - 7)->isDark() &&
|
|
$matrix->getModuleAt(6, $size - 1)->isDark();
|
|
$bottomLeft = $matrix->getModuleAt($size - 7, 0)->isDark() &&
|
|
$matrix->getModuleAt($size - 1, 6)->isDark();
|
|
|
|
echo "Top-left: " . ($topLeft ? "✅" : "❌") . "\n";
|
|
echo "Top-right: " . ($topRight ? "✅" : "❌") . "\n";
|
|
echo "Bottom-left: " . ($bottomLeft ? "✅" : "❌") . "\n\n";
|
|
|
|
// Check dark module
|
|
$darkModuleRow = 4 * $version + 9;
|
|
$darkModule = $matrix->getModuleAt($darkModuleRow, 8)->isDark();
|
|
echo "Dark module at ({$darkModuleRow}, 8): " . ($darkModule ? "✅ Dark" : "❌ Light") . "\n\n";
|
|
|
|
// Check timing patterns
|
|
echo "=== Timing Pattern Check ===\n";
|
|
$timingRow = '';
|
|
$timingCol = '';
|
|
for ($i = 8; $i < 13; $i++) {
|
|
$timingRow .= $matrix->getModuleAt(6, $i)->isDark() ? '1' : '0';
|
|
$timingCol .= $matrix->getModuleAt($i, 6)->isDark() ? '1' : '0';
|
|
}
|
|
echo "Row 6 timing: {$timingRow} (should alternate)\n";
|
|
echo "Col 6 timing: {$timingCol} (should alternate)\n\n";
|
|
|
|
// Generate SVG
|
|
$renderer = new \App\Framework\QrCode\QrCodeRenderer();
|
|
$svg = $renderer->renderSvg($matrix);
|
|
$svgFile = __DIR__ . '/qrcode-validation.svg';
|
|
file_put_contents($svgFile, $svg);
|
|
echo "SVG saved to: {$svgFile}\n\n";
|
|
|
|
echo "=== Summary ===\n";
|
|
$issues = [];
|
|
if ($formatH !== $formatV) $issues[] = "Format info mismatch";
|
|
if (!$topLeft || !$topRight || !$bottomLeft) $issues[] = "Finder pattern issues";
|
|
if (!$darkModule) $issues[] = "Dark module missing";
|
|
|
|
if (empty($issues)) {
|
|
echo "✅ All structural checks passed\n";
|
|
echo "⚠️ If QR code still doesn't scan, the issue may be:\n";
|
|
echo " 1. Data encoding/placement order\n";
|
|
echo " 2. Mask application\n";
|
|
echo " 3. Reed-Solomon error correction\n";
|
|
} else {
|
|
echo "❌ Issues found:\n";
|
|
foreach ($issues as $issue) {
|
|
echo " - {$issue}\n";
|
|
}
|
|
}
|
|
|
|
|