v1 - zumindest der adminpanel ist erreichbar

Dieser Commit ist enthalten in:
2025-06-07 12:07:57 +02:00
Commit 9d742fa274
1275 geänderte Dateien mit 1311 neuen und 0 gelöschten Zeilen

8
.claude/settings.local.json Normale Datei
Datei anzeigen

@@ -0,0 +1,8 @@
{
"permissions": {
"allow": [
"Bash(ls:*)"
],
"deny": []
}
}

41
v2/.env Normale Datei
Datei anzeigen

@@ -0,0 +1,41 @@
# PostgreSQL-Datenbank
POSTGRES_DB=meinedatenbank
POSTGRES_USER=adminuser
POSTGRES_PASSWORD=supergeheimespasswort
# Admin-Panel Zugangsdaten
ADMIN1_USERNAME=rac00n
ADMIN1_PASSWORD=1248163264
ADMIN2_USERNAME=w@rh@mm3r
ADMIN2_PASSWORD=Warhammer123!
# Lizenzserver API Key für Authentifizierung
# Domains (können von der App ausgewertet werden, z.B. für Links oder CORS)
API_DOMAIN=api-software-undso.z5m7q9dk3ah2v1plx6ju.com
ADMIN_PANEL_DOMAIN=admin-panel-undso.z5m7q9dk3ah2v1plx6ju.com
# ===================== OPTIONALE VARIABLEN =====================
# JWT für API-Auth
# JWT_SECRET=geheimer_token_schlüssel
# E-Mail Konfiguration (z.B. bei Ablaufwarnungen)
# MAIL_SERVER=smtp.meinedomain.de
# MAIL_PORT=587
# MAIL_USERNAME=deinemail
# MAIL_PASSWORD=geheim
# MAIL_FROM=no-reply@meinedomain.de
# Logging
# LOG_LEVEL=info
# Erlaubte CORS-Domains (für Web-Frontend)
# ALLOWED_ORIGINS=https://admin.meinedomain.de
# ===================== VERSION =====================
# Serverseitig gepflegte aktuelle Software-Version
# Diese wird vom Lizenzserver genutzt, um die Kundenversion zu vergleichen
LATEST_CLIENT_VERSION=1.0.0

62
v2/docker-compose.yaml Normale Datei
Datei anzeigen

@@ -0,0 +1,62 @@
version: "3.9"
services:
postgres:
image: postgres:14
container_name: db
restart: always
env_file: .env
environment:
POSTGRES_HOST: postgres
volumes:
# Persistente Speicherung der Datenbank auf dem Windows-Host
- C:/Users/Administrator/Documents/GitHub/v2-Docker/v2_postgreSQL:/var/lib/postgresql/data
# Init-Skript für Tabellen
- ../v2_adminpanel/init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- internal_net
deploy:
resources:
limits:
cpus: '2'
memory: 4g
license-server:
build:
context: ../v2_lizenzserver
container_name: license-server
restart: always
ports:
- "8443:8443"
env_file: .env
depends_on:
- postgres
networks:
- internal_net
deploy:
resources:
limits:
cpus: '2'
memory: 4g
admin-panel:
build:
context: ../v2_adminpanel
container_name: admin-panel
restart: always
ports:
- "443:443" # Admin-Panel über HTTPS erreichbar
env_file: .env
depends_on:
- postgres
networks:
- internal_net
deploy:
resources:
limits:
cpus: '2'
memory: 4g
networks:
internal_net:
driver: bridge

12
v2_adminpanel/Dockerfile Normale Datei
Datei anzeigen

@@ -0,0 +1,12 @@
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 443
CMD ["python", "app.py"]

99
v2_adminpanel/app.py Normale Datei
Datei anzeigen

@@ -0,0 +1,99 @@
import os
import psycopg2
from flask import Flask, render_template, request, redirect, session, url_for
from flask_session import Session
from functools import wraps
from dotenv import load_dotenv
load_dotenv()
app = Flask(__name__)
app.config['SECRET_KEY'] = os.urandom(24)
app.config['SESSION_TYPE'] = 'filesystem'
Session(app)
# Login decorator
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if 'logged_in' not in session:
return redirect(url_for('login'))
return f(*args, **kwargs)
return decorated_function
# DB-Verbindung
def get_connection():
return psycopg2.connect(
host=os.getenv("POSTGRES_HOST", "postgres"),
port=os.getenv("POSTGRES_PORT", "5432"),
dbname=os.getenv("POSTGRES_DB"),
user=os.getenv("POSTGRES_USER"),
password=os.getenv("POSTGRES_PASSWORD")
)
@app.route("/login", methods=["GET", "POST"])
def login():
if request.method == "POST":
username = request.form.get("username")
password = request.form.get("password")
# Check gegen beide Admin-Accounts aus .env
admin1_user = os.getenv("ADMIN1_USERNAME")
admin1_pass = os.getenv("ADMIN1_PASSWORD")
admin2_user = os.getenv("ADMIN2_USERNAME")
admin2_pass = os.getenv("ADMIN2_PASSWORD")
if ((username == admin1_user and password == admin1_pass) or
(username == admin2_user and password == admin2_pass)):
session['logged_in'] = True
session['username'] = username
return redirect(url_for('dashboard'))
else:
return render_template("login.html", error="Ungültige Anmeldedaten")
return render_template("login.html")
@app.route("/logout")
def logout():
session.pop('logged_in', None)
session.pop('username', None)
return redirect(url_for('login'))
@app.route("/", methods=["GET", "POST"])
@login_required
def dashboard():
if request.method == "POST":
name = request.form["customer_name"]
email = request.form["email"]
license_key = request.form["license_key"]
license_type = request.form["license_type"]
valid_from = request.form["valid_from"]
valid_until = request.form["valid_until"]
conn = get_connection()
cur = conn.cursor()
# Kunde einfügen (falls nicht vorhanden)
cur.execute("""
INSERT INTO customers (name, email, created_at)
VALUES (%s, %s, NOW())
RETURNING id
""", (name, email))
customer_id = cur.fetchone()[0]
# Lizenz hinzufügen
cur.execute("""
INSERT INTO licenses (license_key, customer_id, license_type, valid_from, valid_until, is_active)
VALUES (%s, %s, %s, %s, %s, TRUE)
""", (license_key, customer_id, license_type, valid_from, valid_until))
conn.commit()
cur.close()
conn.close()
return redirect("/")
return render_template("index.html", username=session.get('username'))
if __name__ == "__main__":
app.run(host="0.0.0.0", port=443, ssl_context='adhoc')

16
v2_adminpanel/init.sql Normale Datei
Datei anzeigen

@@ -0,0 +1,16 @@
CREATE TABLE IF NOT EXISTS customers (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
email TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS licenses (
id SERIAL PRIMARY KEY,
license_key TEXT UNIQUE NOT NULL,
customer_id INTEGER REFERENCES customers(id),
license_type TEXT NOT NULL,
valid_from DATE NOT NULL,
valid_until DATE NOT NULL,
is_active BOOLEAN DEFAULT TRUE
);

Datei anzeigen

@@ -0,0 +1,5 @@
flask
flask-session
psycopg2-binary
python-dotenv
pyopenssl

Datei anzeigen

@@ -0,0 +1,5 @@
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DB=meinedatenbank
POSTGRES_USER=adminuser
POSTGRES_PASSWORD=supergeheimespasswort

Datei anzeigen

@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Admin Panel – Lizenzverwaltung</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<nav class="navbar navbar-dark bg-dark">
<div class="container">
<span class="navbar-brand">🎛️ Lizenzverwaltung</span>
<div class="d-flex align-items-center">
<span class="text-white me-3">Angemeldet als: {{ username }}</span>
<a href="/logout" class="btn btn-outline-light btn-sm">Abmelden</a>
</div>
</div>
</nav>
<div class="container py-5">
<h2 class="mb-4">Neue Lizenz erstellen</h2>
<form method="post" action="/">
<div class="row g-3">
<div class="col-md-6">
<label for="customerName" class="form-label">Kundenname</label>
<input type="text" class="form-control" id="customerName" name="customer_name" required>
</div>
<div class="col-md-6">
<label for="email" class="form-label">E-Mail</label>
<input type="email" class="form-control" id="email" name="email">
</div>
<div class="col-md-4">
<label for="licenseKey" class="form-label">Lizenzschlüssel</label>
<input type="text" class="form-control" id="licenseKey" name="license_key" required>
</div>
<div class="col-md-4">
<label for="licenseType" class="form-label">Lizenztyp</label>
<select class="form-select" id="licenseType" name="license_type" required>
<option value="full">Vollversion</option>
<option value="test">Testversion</option>
</select>
</div>
<div class="col-md-2">
<label for="validFrom" class="form-label">Kaufdatum</label>
<input type="date" class="form-control" id="validFrom" name="valid_from" required>
</div>
<div class="col-md-2">
<label for="validUntil" class="form-label">Ablaufdatum</label>
<input type="date" class="form-control" id="validUntil" name="valid_until" required>
</div>
</div>
<div class="mt-4">
<button type="submit" class="btn btn-primary"> Lizenz erstellen</button>
</div>
</form>
</div>
</body>
</html>

Datei anzeigen

@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Login - Lizenzverwaltung</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<div class="container">
<div class="row min-vh-100 align-items-center justify-content-center">
<div class="col-md-4">
<div class="card shadow">
<div class="card-body p-5">
<h2 class="text-center mb-4">🔐 Admin Login</h2>
{% if error %}
<div class="alert alert-danger" role="alert">
{{ error }}
</div>
{% endif %}
<form method="post">
<div class="mb-3">
<label for="username" class="form-label">Benutzername</label>
<input type="text" class="form-control" id="username" name="username" required autofocus>
</div>
<div class="mb-3">
<label for="password" class="form-label">Passwort</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<button type="submit" class="btn btn-primary w-100">Anmelden</button>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

8
v2_lizenzserver/Dockerfile Normale Datei
Datei anzeigen

@@ -0,0 +1,8 @@
FROM python:3.11-slim
WORKDIR /app
# Placeholder für Lizenzserver
RUN echo "Lizenzserver noch nicht implementiert" > info.txt
CMD ["python", "-c", "print('Lizenzserver Container läuft, aber noch keine Implementierung vorhanden'); import time; time.sleep(86400)"]

1
v2_postgreSQL/PG_VERSION Normale Datei
Datei anzeigen

@@ -0,0 +1 @@
14

BIN
v2_postgreSQL/base/1/112 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/113 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1247 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1247_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1247_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1249 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1249_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1249_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1255 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1255_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1255_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1259 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1259_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/1259_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13598 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13598_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13598_vm Normale Datei

Binäre Datei nicht angezeigt.

0
v2_postgreSQL/base/1/13601 Normale Datei
Datei anzeigen

BIN
v2_postgreSQL/base/1/13602 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13603 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13603_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13603_vm Normale Datei

Binäre Datei nicht angezeigt.

0
v2_postgreSQL/base/1/13606 Normale Datei
Datei anzeigen

BIN
v2_postgreSQL/base/1/13607 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13608 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13608_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13608_vm Normale Datei

Binäre Datei nicht angezeigt.

0
v2_postgreSQL/base/1/13611 Normale Datei
Datei anzeigen

BIN
v2_postgreSQL/base/1/13612 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13613 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13613_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/13613_vm Normale Datei

Binäre Datei nicht angezeigt.

0
v2_postgreSQL/base/1/13616 Normale Datei
Datei anzeigen

BIN
v2_postgreSQL/base/1/13617 Normale Datei

Binäre Datei nicht angezeigt.

0
v2_postgreSQL/base/1/1417 Normale Datei
Datei anzeigen

0
v2_postgreSQL/base/1/1418 Normale Datei
Datei anzeigen

BIN
v2_postgreSQL/base/1/174 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/175 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2187 Normale Datei

Binäre Datei nicht angezeigt.

0
v2_postgreSQL/base/1/2224 Normale Datei
Datei anzeigen

BIN
v2_postgreSQL/base/1/2228 Normale Datei

Binäre Datei nicht angezeigt.

0
v2_postgreSQL/base/1/2328 Normale Datei
Datei anzeigen

0
v2_postgreSQL/base/1/2336 Normale Datei
Datei anzeigen

BIN
v2_postgreSQL/base/1/2337 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2579 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2600 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2600_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2600_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2601 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2601_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2601_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2602 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2602_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2602_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2603 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2603_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2603_vm Normale Datei

Binäre Datei nicht angezeigt.

0
v2_postgreSQL/base/1/2604 Normale Datei
Datei anzeigen

BIN
v2_postgreSQL/base/1/2605 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2605_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2605_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2606 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2606_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2606_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2607 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2607_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2607_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2608 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2608_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2608_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2609 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2609_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2609_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2610 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2610_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2610_vm Normale Datei

Binäre Datei nicht angezeigt.

0
v2_postgreSQL/base/1/2611 Normale Datei
Datei anzeigen

BIN
v2_postgreSQL/base/1/2612 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2612_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2612_vm Normale Datei

Binäre Datei nicht angezeigt.

0
v2_postgreSQL/base/1/2613 Normale Datei
Datei anzeigen

BIN
v2_postgreSQL/base/1/2615 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2615_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2615_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2616 Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2616_fsm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2616_vm Normale Datei

Binäre Datei nicht angezeigt.

BIN
v2_postgreSQL/base/1/2617 Normale Datei

Binäre Datei nicht angezeigt.

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen