A Windows 2000 server in your browser: QEMU and Guacamole

A retro-OS lab you can reach from any browser — safely.

A Windows 2000 server in your browser: QEMU and Guacamole

Part of FlameNet is a retro lab. It holds period operating systems in virtual machines that you can reach from anywhere without installing a remote desktop client. The machines run on QEMU. Apache Guacamole puts them in a browser tab.

Right now the lab runs Windows 2000 and Windows XP. This post covers how the pieces fit, how I deploy Guacamole, and how I keep a 25-year-old operating system from becoming anyone’s problem.

The layout

Each retro OS runs as a QEMU guest. The guests sit on an isolated bridge network, away from anything that matters. A systemd unit per guest brings it up on boot, so a reboot of the host puts the lab back without me.

Guacamole sits in front. It is a clientless remote desktop gateway. On the back end it speaks RDP or VNC to the guests. On the front end it speaks HTML5 to your browser. You install nothing, it works on a phone, and it tunnels through the same reverse proxy as every other service on the box.

That last point matters. The lab does not need its own public listener. One proxy, one certificate setup, one place to look.

Two containers

Guacamole ships as two images, according to the Guacamole Manual 1.6.0:

  • guacamole/guacd is the protocol daemon. It listens on port 4822.
  • guacamole/guacamole is the web application, running on Tomcat 9.

Start guacd on a private network and publish no ports for it. Nothing outside that network has a reason to talk to it:

docker run --network=some-network --name some-guacd -d guacamole/guacd

Then start the web application on the same network and point it at guacd:

docker run --network=some-network --name some-guacamole \
  -e GUACD_HOSTNAME=some-guacd \
  -d -p 8080:8080 guacamole/guacamole

The interface answers at http://HOST:8080/guacamole/. GUACAMOLE_HOME defaults to /etc/guacamole inside the container.

Sign-in needs a database

The web image will not start without an authentication backend. The manual lists MySQL, PostgreSQL and LDAP, set through environment variables. I use a database backend, MySQL or PostgreSQL, so users and their connections live in tables. The manual has the variable names for each backend and the schema scripts to load. Follow it for the exact settings.

The practical effect is that every person who signs in has an account, and each account sees only the connections it was given. A guest is never open to anyone who finds the URL.

Behind a reverse proxy

Two variables matter when a proxy sits in front:

  • REMOTE_IP_VALVE_ENABLED=true tells Tomcat to trust the proxy’s forwarded headers. The other proxy variables are ignored unless it is set.
  • WEBAPP_CONTEXT=ROOT serves Guacamole at the root path instead of /guacamole/.

With the second one set, a hostname such as lab.example.com can point straight at the login page.

Defining a connection

A connection to a guest is a short list of fields. For an RDP guest:

  • protocol: rdp
  • hostname: 192.0.2.50
  • port: 3389

For a VNC guest the protocol is vnc, and the port is 5900 plus the display number. I use RDP where a guest offers it and VNC where it does not. QEMU can expose a guest’s display over VNC, so even a machine with no remote desktop server of its own can sit behind Guacamole. Bind that VNC listener to the loopback address or to the bridge, never to a public interface.

Why the lab is isolated

A 25-year-old operating system has no business on the open internet. Unpatched remote flaws are the reason, and nothing in a retro lab changes that. So the lab sits on its own network segment, with tight egress rules.

The idea is simple. A guest can answer Guacamole. It cannot start a conversation with anything else. Here is the shape of the rules on a Linux host, with the guest network written as 192.0.2.0/24:

# guests may reach the gateway, nothing else
iptables -A FORWARD -s 192.0.2.0/24 -d 192.0.2.1 -j ACCEPT
iptables -A FORWARD -s 192.0.2.0/24 -j DROP

Adjust the chain and addresses to your own bridge. A gateway address of 192.0.2.1 is only an example.

Do not forget IPv6. Rules written with iptables do not touch IPv6 traffic. If the host has IPv6 on that bridge, write matching ip6tables rules or turn IPv6 off for the segment, and check which one you did.

A safe test of the egress rules

From a shell inside a guest, run:

ping 192.0.2.1
nslookup example.com

The first should answer if the gateway rule allows it. The second should time out, because the guest has no route to a resolver. If nslookup returns an address, the egress rules have a hole.

You can poke around a pristine Windows 2000 desktop. It just can’t poke back.

Using it

Open the login page, sign in, and click the connection. A Windows 2000 desktop appears in the tab, mouse and keyboard included. On a phone the same page works with touch.

That is the part I like most. A machine from 2000 is one link away, and the link needs nothing installed on the other end.

Subscribe to Just another Geek

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe