← Pablo Murad

Plumbing for runv.club

A batch of small plumbing for runv.club: a calendar built from one text file, new tricks for runvbot, an IRC network of its own with a daily channel page, and almost the whole club reachable over Tor and I2P.

The runv.club calendar. On the left, a small purple calendar window titled cal: November 2026 with a pixel-art devil above it and coloured dots under the days. On the right, a Coming up list with The BBS opens on 12 March and runv day, the club's birthday, on 14 April; a Today box for Tuesday, November 24 with two launches, the Tor address getting IRC, gopher, gemini, finger and git over SSH, and the I2P address getting gopher, gemini and finger; and an Earlier this month list.
Contents

Most of what keeps runv.club going is plumbing: small programs that wait for a file to change, a line in a config that opens one more door, a timer that runs once a day. This is about a batch of that plumbing, and about the club growing a few new doors.

A calendar kept in one text file #

The club has a calendar now, at cal.runv.club. It's a fork of simple-calendar, a small static calendar I wrote a while ago, and the whole thing comes out of a single text file, one event per line:

13-11-2026 launch: runv.club on Tor [done]
24-11-2026 launch: The I2P address gets gopher, gemini and finger [done]
12-03-2027 launch: The BBS opens
14-04-2024 launch: 🎉 runv day, the club's birthday (2)

A date, a type, a sentence. [done] marks what already happened, and the (2) on runv day makes it come back every year with a counter. The types get colours: blue for maintenance, green for launches, lilac for changes.

The fork, at git.runv.club/runv/simple-calendar, learned a few things along the way: a dark theme that looks like cal in a terminal window, a page for what already happened with the newest first, the next three events at the top of the front page, and a box of its own for today, when today has something on.

Nobody runs the build by hand. A systemd path unit watches the folder, and saving is enough. It watches the folder and not the file because editors often save by writing a new file and swapping it in, and watching the file alone misses some of those saves:

# runv-cal.path
[Path]
PathChanged=/path/to/calendar/
Unit=runv-cal.service

[Install]
WantedBy=multi-user.target

The matching service rebuilds the site, the iCalendar file and the feed. People can subscribe on their phones and never visit the page at all.

runvbot learns to fetch things #

runvbot lives in #runv and already did the small things: weather, polls, the radio, a message kept for someone until they're back. It learned a few more:

  • !img cat brings a gif or a sticker for any word, from GIPHY.
  • !wiki lighthouse reads the start of the Wikipedia article (!wiki pt farol for another language), using the opensearch API to find the title and the REST summary to get the text.
  • !search looks for videos and songs on nine sites, and !video 2 or !audio 2 brings number two back as a file, with a link that lasts a day.

The bot itself runs sandboxed, with a DynamicUser and almost nothing it can write. It doesn't download anything. It drops a small JSON request in a spool directory and goes back to chatting:

{"pick": 2, "mode": "audio", "nick": "someone", "account": "someone", "to": "#runv"}

A path unit notices the file and starts the worker, under its own user, with its own memory and CPU limits. When the worker is done it writes a reply in another directory, and the bot, which checks every couple of seconds, says it in the channel. The bot and the worker never share a permission. All they share is those two directories.

Every file has to fit in 200 MB, whatever its length. So the worker works out a bitrate from the duration before calling ffmpeg, and the picture shrinks as the bitrate goes down:

budget = MAX_MB * 8_000_000 * 0.92 / duration # bits per second for everything
a = 96 if budget > 600_000 else 64 # audio, kbps
v = int(min(2_400_000, budget - a * 1000) / 1000) # video, kbps
steps = ((1400, 720), (800, 480), (450, 360), (0, 240))
height = next((h for rate, h in steps if v >= rate), 240)
# no more bits than the size of the picture can use
ceiling = {240: 600, 360: 1000, 480: 1600, 720: 2400}
v = min(v, ceiling[height])

A song or a short clip comes out at 720p. A two-hour film comes out at 360p or 240p and still fits. The ceiling at the end keeps short clips from getting absurd bitrates, and if a file still comes out too big, the worker tries again with 80% of the budget, then 60%.

An IRC network of its own #

The club moved to its own network, irc.runv.club, running Ergo. Two neighbours came along soon after: noctem.cafe, a small OpenBSD box, and Noctem 9, a 9front server you reach with drawterm. Their people chat in #runv now.

I wanted a page like the one tilde.chat has, with the channels and how many people are in each, at runv.club/irc. It doesn't need to be live. Once a day a timer runs a short script that connects, asks the server for LUSERS and LIST, writes a static page and leaves.

The IRC page on runv.club. It reads: There are 25 people across 3 channels on irc.runv.club right now, counted once a day, last on Nov 24 at 11:34 UTC. Below, a table lists the channels with their user counts and topics: #runv with 24, #help with 2 and #bots with 1.

Parsing the channel list is one regular expression on each 322 reply:

# :server 322 me #runv 21 :[+nt] the club's channel
chan, users, topic = re.match(r"(\S+) (\d+) :?(.*)$", rest).groups()

The script takes itself out of the count, since it shows up in the channels it looks at.

The whole club over Tor #

runv.club already had an onion address for the website. Now almost everything else goes through the same address, runv7hg2p4poebepvhbbstt3dcs3dqapbtq4ko4bsw5jkcepvkwmkhad.onion:

serviceport
the website80
gopher70
gemini1965
finger79
IRC6667
git over ssh2222
Source
| service      | port |
|--------------+------|
| the website  |   80 |
| gopher       |   70 |
| gemini       | 1965 |
| finger       |   79 |
| IRC          | 6667 |
| git over ssh | 2222 |

On the Tor side, each door is one HiddenServicePort line in torrc, which ties a port on the onion address to a service listening on the machine. One more line turns on Tor's proof-of-work defence, which asks clients for a small puzzle only when the service is under a flood:

HiddenServicePoWDefensesEnabled 1

Adding a port only needs a reload, so nobody gets dropped.

Finger and git went straight to the services that already existed. Gopher and gemini didn't, because both write their own address into what they serve. Gophernicus puts the host name in every menu line, so over Tor the first page would load and every click after it would lead back to the clear address. Molly Brown, the gemini server, goes further and refuses any request for a host other than its own, with status 53. The fix was a small copy of each, listening only on the machine, that knows the onion address. The gopher copy is socket-activated and runs only while someone is reading:

# a gopher copy that knows the onion name
[Service]
ExecStart=/usr/sbin/gophernicus -h ONION.onion -p 70
StandardInput=socket
ProtectSystem=strict
ProtectHome=yes

The gemini copy has a certificate of its own for the onion name, made once and kept for twenty years, because gemini clients pin a certificate the first time they see it. Molly Brown can't be told to listen only on localhost, so systemd does the job: IPAddressAllow=localhost and IPAddressDeny=any in a drop-in.

IRC over Tor, announced in Note IX, uses Ergo's own support for it. A listener marked with tor: true gets its own rules. With require-sasl: true, only registered nicks come in this way. Tor is the door spammers like best, and a login keeps them out without bothering anyone else. Everyone who arrives over Tor shows up as tor-network.onion, and Tor connections have limits of their own, apart from the regular ports, so a flood through Tor can't eat into what everyone else gets.

The shell's own SSH stayed off the onion. Through Tor every connection reaches sshd from 127.0.0.1, so the protections in front of sshd can't tell one visitor from another, and a flood could fill its queue for people coming in the normal way. Git doesn't have that problem: it has its own SSH server, inside Forgejo, on port 2222. Cloning over Tor is one block of ~/.ssh/config:

Host runv-git-onion
    HostName runv7hg2p4poebepvhbbstt3dcs3dqapbtq4ko4bsw5jkcepvkwmkhad.onion
    Port 2222
    User git
    ProxyCommand nc -X 5 -x 127.0.0.1:9050 %h %p

And a little more of it on I2P #

The club's I2P address, jzux6h32o3tzndepnqlwwvhaoq7occkjzc2fzhozearlrj5nezuq.b32.i2p, used to carry only the website. It now has gopher, gemini and finger too, through the same kind of small copies. In i2pd, server tunnels that share a key file share a destination, and inport says which port each one answers on. One address, no extra tunnels on the network:

[club]
type = http
keys = club.dat

[club-gopher]
type = server
inport = 70
keys = club.dat

i2pd taught me one thing on the way. A reload picks up new tunnels and leaves gopher and the rest alone, but the HTTP tunnels stop answering until the next restart. So for i2pd it's a restart, every time, and a few minutes of republishing.

Testing from outside #

Every door got tested the way a stranger would use it: a throwaway Tor client and a throwaway i2pd, each started in a scratch directory, used once and deleted. A gopher menu has to give out the right address, a gemini capsule has to answer 20 for its own name and 53 for any other, finger has to answer, and git has to clone. It's slower than checking from the server itself, but it shows what other people see.

The docs and the wiki on runv.club have the details for anyone who wants to come in through one of these doors: the Tor page and the I2P page.