Konstantinos Antoniou.

← Projects

Backoffice

My own web console for reaching and running a two-site home lab from any browser, behind one Cloudflare domain, with its own sign-in, 2FA and audit trail.

The problem

Everything I run at home is private: the hypervisor, the routers, the NVR, the monitoring server, the secrets vault, the containers, the files. My normal way in is a ZeroTier VPN, and on my own devices that works well.

It stops working on a machine where I can’t use a VPN client, such as a work PC. There I can’t install software or join my network, but I may still need to look at a failed job, restart a container or open a terminal.

I built Backoffice for that. It puts all my private resources behind one Cloudflare-protected domain, so a browser is the only thing I need. It also replaces a pile of separate admin pages, each with its own address and login, with one console.

How I get in

  1. The browser opens one public domain.
  2. Cloudflare Access checks who I am before anything reaches my network.
  3. A Cloudflare Tunnel carries the request home. The tunnel connects outwards, so the console needs no open port on my router.
  4. A reverse proxy hands it to Backoffice, which has its own sign-in with 2FA.
  5. Backoffice talks to the private resource from inside the network. Admin web apps are served as paths of the same domain, and the proxy asks the console for permission before it forwards anything to them.

What it can do

  • See the lab: hosts with live status and usage, a topology map of both sites, Zabbix problems, Grafana and Cloudflare status, reports, and a page that collects whatever needs attention.
  • Operate it: Proxmox guests, Docker containers and stacks, systemd services, MikroTik routers and Wi-Fi, RabbitMQ, Vault and PostgreSQL.
  • Run the jobs: every scheduled script reports its result, so a backup that went silent shows up as stale instead of as nothing. Backup and restore are buttons.
  • Work remotely: an SSH terminal, a file manager, VS Code, virtual machine consoles, remote desktop and a browser that lives inside my network, all in a tab.
  • Do the daily things: a wiki, mail, Discord, office documents, printing and scanning, and an editor for the pages of this website.

These are screenshots of my own console. I blurred addresses and a few other private details.

Tools, one click away

A grid of tool tiles, most of them marked as opening through Backoffice

Tiles marked Backoffice open through the console. The others are shortcuts to outside services.

Need Tool, opened in the browser
Shell and files SSH terminal, file manager, VS Code (code-server)
Desktops and consoles RustDesk, Virt Manager, WinBox, Proxmox consoles
Inside web pages Firefox running in my network, shown in a tab
Admin interfaces Proxmox, Zabbix, RabbitMQ, Vault, Portainer, the NVR
Utilities IT Tools, printer and scanner, wiki, mail, Discord

A tour

Topology map of two sites with their routers, virtual machines, devices and cloud services

Both sites on one map, with live status on each box.

Host cards showing up or down status and CPU, RAM and disk usage

The host list, with a terminal, files and more on each card. The travel laptop was off at the time.

File manager showing the home folder of one host, with places, drives, tabs, search and upload

The file manager: a host’s filesystem over SFTP, with tabs, search and upload.

Proxmox datacenter view with the list of virtual machines, health and resource gauges

Proxmox: guests, health and resource use.

MikroTik page with the active internet line, a Wi-Fi client chart and a card for each router and access point

The network: which internet line is active, Wi-Fi clients per access point, and every router.

Four Docker environments with their container counts

Containers across four Docker hosts.

Dashboard of one Docker host with counts of stacks, containers, images, volumes and networks

One host at a glance.

Container table with state, stack, image, CPU, memory and quick actions

State, resource use and quick actions. The containers the console depends on are marked as protected.

Vault overview with seal state, backups and action buttons

Vault: state, snapshots, certificates and the actions I use most.

RabbitMQ queues with status, message counts and consumers

RabbitMQ: queues, consumers and dead letters.

Database page with connection, schema, size figures and a table list

PostgreSQL: tables, SQL, diagrams, backup and restore.

Wiki page with a page tree on the left and a table of contents on the right

The wiki that holds my operations documentation.

Monitoring page with host availability, problems by severity and a list of current problems

Monitoring: availability and current problems from Zabbix.

Discord channel list next to a Zabbix alert from a router, with a box to reply as the bot

Discord inside the console: alerts land in their channels, and I can answer from the same page.

The code

It is a Python application: FastAPI with server-rendered Jinja2 pages and plain JavaScript, no frontend framework. Terminals and remote desktops use xterm.js and noVNC over WebSockets. Data lives in PostgreSQL. It is about 40,000 lines of Python, roughly one module per feature. The repository is private, so this is the short map:

Area Modules What they do
Identity accounts, stepup, perms Accounts, sessions, 2FA and what each role may open
Reaching hosts sshrun, terminal, files One SSH channel for scripts, the terminal and files
Run history consumer, runs Reads script results from RabbitMQ into PostgreSQL
Live status integrations Overlays Proxmox and Zabbix data on the host list
Configuration config, labsettings Resolves secrets and settings at runtime
  • Run health: results are deduplicated, failures are tracked as streaks, and the next expected run comes from the script’s cron entry. The UI tells apart “the consumer is down” from “the script is silent”.
  • Failing in pieces: each outside system fails on its own and reports its error as data, so one dead API never blanks a page.
  • Lab data is data: everything that names my lab is imported from data files into the database, and a test renders the main pages without them to prove the code holds no lab-specific values.

Security

One door to everything is convenient, and it is also the thing most worth attacking. So there are several layers:

  • Two gates: Cloudflare Access first, then the console’s own accounts. The console trusts no identity header from a proxy.
  • Passwords and 2FA: passwords are hashed with scrypt, TOTP is mandatory for administrators and its secret is stored encrypted, and repeated failures lock the account for a while.
  • Sessions: a random token in an HttpOnly cookie, of which the server keeps only a hash.
  • Step-up: the riskiest actions, such as opening a terminal or a remote desktop, writing to Vault, changing the database or users, or restoring a backup, ask for a fresh 2FA code.
  • Request forgery: changes are accepted only from the console’s own pages, and each terminal or desktop opens with a short-lived, single-use ticket.
  • Least privilege: operators get only what is switched on for them, and a new route stays admin-only until I decide otherwise.
  • Hosts: SSH host keys are pinned, and an unknown key is refused. The backup and restore buttons run only allowlisted scripts.
  • Secrets: the app starts from three bootstrap values and reads the rest from Cloudflare Workers KV at runtime, so no secret lives in the repository or the image.
  • Container: the console runs as a non-root user, on a read-only filesystem, with all Linux capabilities dropped.
  • Audit trail: changes are recorded with who made them, when, from where and whether they worked.

Delivery

Tests run against a real PostgreSQL in the pipeline before anything is built. The pipeline assigns version numbers at deploy time and tags each shipped image, so a rollback is a retag.

How sign-in changed

Sign-in first came from an external identity provider in front of every admin page. I replaced it with native accounts and 2FA, so the console itself decides who may do what.

What I would change

The console runs on one of the hosts it monitors, so if that host fails, I lose the view just when I need it. I would add a small independent check, outside that host, that tells me when the console is unreachable.