Skip to content

Installation

minired needs root: it creates network namespaces, veth pairs and Open vSwitch bridges. Use it in a lab VM (one per student), never on your work machine.

Requirements

Linux (tested on Ubuntu 24.04) with:

  • the Mininet fork (mendezgarabetti/mininet, 2.3.1b4+edu.1), Open vSwitch, tcpdump, tshark and ethtool;
  • for the services and routing exercises: apt install frr dnsmasq-base nftables busybox curl (there is no need to enable those services on the system: minired starts its own instances inside each device);
  • Python 3.11 or later and, to build the interface, Node.js 18 or later.

Install and run

git clone https://github.com/fosshlab/minired && cd minired
python3 -m venv --system-site-packages ~/.venvs/minired   # to see the system mininet package
~/.venvs/minired/bin/pip install -e '.[pruebas]'
(cd gui && npm ci && npm run build)
sudo ~/.venvs/minired/bin/python -m minired gui

The last command prints an address http://127.0.0.1:8787/#token=…. Open it in full in the browser of the same machine, or from your computer through an SSH tunnel:

ssh -L 8787:127.0.0.1:8787 user@vm

The interface opens in the browser's language (Spanish, English or Portuguese) and can be changed from the top bar. The terminal messages of minired gui follow LANG.

Security

  • By default the server listens only on 127.0.0.1. The only exception is hosted mode (below), meant to sit behind an HTTPS proxy.
  • Each start generates a random token, required by the API and the WebSockets, together with the Origin. The Host is validated (against DNS rebinding), there is no CORS and the page uses a strict CSP.
  • Each device's terminal is a root shell inside its namespace.

Hosted mode

To serve a disposable lab VM behind an HTTPS reverse proxy (one VM per student and session), minired gui accepts:

Option Purpose
--escuchar IP IPv4 address to listen on (default 127.0.0.1). Outside loopback it prints a warning.
--host NAME Additional accepted Host header value (repeatable), e.g. the name served by the proxy.
--origen-extra URL Additional accepted origin (repeatable), e.g. https://lab.example.org.
--token-env VAR Takes the token from that environment variable (at least 32 characters A-Z a-z 0-9 - _), does not print it and removes it from the environment before starting.
--vence EPOCH End of the session (seconds since 1970). When reached the network is stopped; requests that change anything get 410 and the interface shows the remaining time and a notice.
sudo MINIRED_TOKEN="$TOKEN" minired gui --escuchar 10.0.0.5 --puerto 8787 \
  --host lab.example.org --origen-extra https://lab.example.org \
  --token-env MINIRED_TOKEN --vence 1767225600

The proxy must pass Host and Origin through unchanged and support WebSocket. X-Forwarded-* headers are ignored. The other protections (token, Host, Origin, CSP) stay the same, and the port must be reachable only from the proxy (firewall or private network).

Tests

~/.venvs/minired/bin/python -m pytest                 # without root (root tests are skipped)
(cd gui && npm test)                                  # interface logic
sudo ~/.venvs/minired/bin/python -m pytest -m root    # in the VM: Mininet, OVS, tcpdump, FRR, dnsmasq, nft