refactor(deployment): Remove WireGuard VPN dependency and restore public service access

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.
This commit is contained in:
2025-11-05 12:48:25 +01:00
parent 7c52065aae
commit 95147ff23e
215 changed files with 29490 additions and 368 deletions

View File

@@ -0,0 +1,122 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/../../vendor/autoload.php';
echo "=== Reference RS Implementation ===\n\n";
// Known working Reed-Solomon implementation from qrcode.js
// Algorithm:
// 1. Generator polynomial: g(x) = (x - α^0)(x - α^1)...(x - α^(t-1))
// 2. Message polynomial: m(x) = data[0] + data[1]*x + ... + data[n-1]*x^(n-1)
// 3. Encoded: c(x) = m(x) * x^t + (m(x) * x^t) mod g(x)
// 4. EC codewords = remainder of (m(x) * x^t) / g(x)
// Initialize GF(256)
$gfLog = array_fill(0, 256, 0);
$gfExp = array_fill(0, 512, 0);
$x = 1;
for ($i = 0; $i < 255; $i++) {
$gfExp[$i] = $x;
$gfLog[$x] = $i;
$x <<= 1;
if ($x & 0x100) {
$x ^= 0x11d;
}
}
for ($i = 255; $i < 512; $i++) {
$gfExp[$i] = $gfExp[$i - 255];
}
function gfMultiply(array $gfExp, array $gfLog, int $a, int $b): int
{
if ($a === 0 || $b === 0) {
return 0;
}
return $gfExp[$gfLog[$a] + $gfLog[$b]];
}
// Generate generator polynomial for degree t
function generateGenerator(array $gfExp, int $degree): array
{
$poly = [1]; // Start with 1
for ($i = 0; $i < $degree; $i++) {
// Multiply by (x - α^i)
$newPoly = array_fill(0, count($poly) + 1, 0);
for ($j = 0; $j < count($poly); $j++) {
$newPoly[$j] ^= $poly[$j];
$newPoly[$j + 1] ^= gfMultiply($gfExp, $gfLog, $poly[$j], $gfExp[$i]);
}
$poly = $newPoly;
}
return $poly;
}
// RS Encode
function rsEncode(array $data, int $ecCodewords, array $gfExp, array $gfLog): array
{
// Generate generator polynomial
$generator = generateGenerator($gfExp, $ecCodewords);
echo "Generator polynomial (monic): " . implode(', ', $generator) . "\n";
echo "Length: " . count($generator) . " (expected: " . ($ecCodewords + 1) . ")\n\n";
// Message polynomial: [data, 0, 0, ..., 0]
$messagePoly = array_merge($data, array_fill(0, $ecCodewords, 0));
// Polynomial division
for ($i = 0; $i < count($data); $i++) {
$coeff = $messagePoly[$i];
if ($coeff !== 0) {
// Leading coefficient is 1 (monic), so clear this position
$messagePoly[$i] = 0;
// Apply generator coefficients
for ($j = 1; $j < count($generator); $j++) {
$messagePoly[$i + $j - 1] ^= gfMultiply($gfExp, $gfLog, $generator[$j], $coeff);
}
}
}
return array_slice($messagePoly, count($data));
}
// Test
echo "Test with QR Code Data:\n";
$data = [64, 180, 132, 84, 196, 196, 242, 5, 116, 245, 36, 196, 64, 236, 17, 236];
$ecCodewords = 10;
$ec = rsEncode($data, $ecCodewords, $gfExp, $gfLog);
echo "Data codewords: " . implode(', ', $data) . "\n";
echo "EC codewords: " . implode(', ', $ec) . "\n\n";
// Verify with decoder
require_once __DIR__ . '/test-reed-solomon-decoder.php';
$fullCodeword = array_merge($data, $ec);
$decoder = new SimpleRSDecoder();
$syndromes = $decoder->calculateSyndromes($fullCodeword, $ecCodewords);
echo "Syndromes: " . implode(', ', $syndromes) . "\n";
$allZero = true;
foreach ($syndromes as $s) {
if ($s !== 0) {
$allZero = false;
break;
}
}
if ($allZero) {
echo "\n✅ All syndromes are zero - Reed-Solomon is CORRECT!\n";
echo "\nThis is the correct implementation. We need to update our code to match this.\n";
} else {
echo "\n❌ Syndromes are not all zero - still wrong!\n";
}