← All projects Project

LARES: Customer-Specific Access Portal

25 Haziran 2026

Flask WireGuard

For LARES, I built a web page that gives customers access specific to them.

What it does

The page lets LARES customers/devices self-register onto the WireGuard network. Registration requests are forwarded to the CERES broker service behind the scenes; the login and registration endpoints are protected with rate limiting against abuse.

Field integration

A local copy of the WELCO backend runs on a Raspberry Pi 4 panel to test LoRaWAN + DALI panel integration under real field conditions; the panel reaches the central infrastructure securely over WireGuard.

A minimal illustration

A tiny Flask example capturing the rate-limiting idea behind the registration endpoint, unrelated to the real code:

from flask import Flask, request, jsonify
from collections import defaultdict
import time

app = Flask(__name__)
attempts = defaultdict(list)

def rate_limited(ip, limit=5, window=60):
    now = time.time()
    attempts[ip] = [t for t in attempts[ip] if now - t < window]
    attempts[ip].append(now)
    return len(attempts[ip]) > limit

@app.route("/register", methods=["POST"])
def register():
    ip = request.remote_addr
    if rate_limited(ip):
        return jsonify(error="too many requests"), 429
    return jsonify(status="ok")