DECserver-style terminal server for Linux: native LAT, telnet, Local> command line
  • Go 92.7%
  • JavaScript 4.4%
  • CSS 1.7%
  • HTML 1.2%
Find a file
Hans Hübner 2a658dfe8d
All checks were successful
packages / packages (push) Successful in 2m49s
image / build (push) Successful in 7m26s
LAT ignores unicast frames addressed to other stations
A lattice on a bridge saw circuit Starts between other nodes and refused
them with reason 2, which aborted those circuits (%LAT-F-PROTERR on VMS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 07:57:23 +01:00
.forgejo/workflows Sessions to IBM hosts through a sandboxed 3270 emulator 2026-10-06 20:57:17 +02:00
cmd Sessions to IBM hosts through a sandboxed 3270 emulator 2026-10-06 20:57:17 +02:00
dist Sessions to IBM hosts through a sandboxed 3270 emulator 2026-10-06 20:57:17 +02:00
docs Port names by kind with their source; LAT login service 2026-10-06 07:15:49 +02:00
internal LAT ignores unicast frames addressed to other stations 2026-10-27 07:57:23 +01:00
.gitignore Packages for Debian and RPM distributions 2026-10-06 13:17:53 +02:00
go.mod PING and TRACEROUTE 2026-10-06 08:36:16 +02:00
go.sum PING and TRACEROUTE 2026-10-06 08:36:16 +02:00
lattice.example.yml Sessions to IBM hosts through a sandboxed 3270 emulator 2026-10-06 20:57:17 +02:00
README.md Sessions to IBM hosts through a sandboxed 3270 emulator 2026-10-06 20:57:17 +02:00

lattice

A DECserver-style terminal server for Linux. It offers the serial ports of the machine it runs on (built-in UARTs and USB CDC/serial adapters) to users and hosts, speaking LAT natively over raw Ethernet and telnet over TCP, with a Local> command line that behaves like a DEC terminal server's.

Running

go build ./cmd/latticed
sudo ./latticed -c lattice.yml

lattice.example.yml documents the configuration. latticed needs CAP_NET_RAW for LAT and access to the serial devices.

With server.web.listen set, latticed serves a web interface: live status of ports, users and sessions, the network's LAT services and the machine's IP configuration, configuration editing and the log. Users log in with a Unix account in server.web.group (sudo by default). Password checks, configuration changes and SET PRIVILEGED logins go through a root helper (latticed login-helper) that systemd starts per connection on a socket only latticed can reach; dist/rpi/files has the units.

Packages

CI builds .deb and .rpm packages for amd64, arm64, armhf (every Raspberry Pi), i386 and riscv64 and publishes them on code.netzhansa.com. They install latticed with its systemd units, the latticed account and a configuration that offers telnet on port 23; the web interface is commented out in /etc/lattice/lattice.yml.

Debian, Ubuntu, Raspberry Pi OS:

sudo curl -o /etc/apt/keyrings/lattice.asc \
    https://code.netzhansa.com/api/packages/hanshuebner/debian/repository.key
echo "deb [signed-by=/etc/apt/keyrings/lattice.asc] https://code.netzhansa.com/api/packages/hanshuebner/debian stable main" |
    sudo tee /etc/apt/sources.list.d/lattice.list
sudo apt update && sudo apt install lattice

Fedora and other RPM distributions:

sudo dnf config-manager addrepo \
    --from-repofile=https://code.netzhansa.com/api/packages/hanshuebner/rpm.repo
sudo dnf install lattice

dist/pkg/build.sh VERSION DIR builds the packages locally; it needs Go and nfpm.

IBM hosts

A service with a tn3270 host (see lattice.example.yml) takes users to an IBM host: CONNECT from the Local> prompt, a port dedicated to the service, or a LAT session from another node runs the 3270 emulator c3270 for the user's terminal. With server.tn3270.command on, TN3270 host reaches any host. HELP 3270 lists the keys.

c3270 runs in a helper (latticed tn3270-helper) that systemd starts per session on a socket only latticed can reach, as an unprivileged user of its own in a sandbox that executes nothing but latticed, c3270 and shared libraries. Its profile, built into latticed, binds only 3270 keys and drops c3270's prompt, so users have no way out of the session. The packages recommend c3270; the Raspberry Pi image installs it once the Pi is on a network. dist/terminfo/vk100-color.ti, which the packages install, gives VK100 terminals the host's colors.

User socket

With server.user_socket set, latticed listens on that Unix socket for programs that bring their users to the Local> prompt, such as a web terminal. The client sends a request as one line of JSON:

{"request": "services"}

is answered with the known LAT services as a JSON array of name, description and available. A login request

{"name": "web.hans", "source": "192.0.2.9", "terminal": "vt100",
 "type": "ANSI", "width": 80, "height": 24, "connect": "VAX1"}

(every field optional) turns the connection into the user's terminal. name is the port name that SHOW USERS shows and LAT hosts see, source where the user is, terminal and type the terminfo name and the SET PORT TYPE of the terminal, and connect a service the user is connected to right away. In the user's input the byte 0xFF introduces a command, as in telnet: 0xFF 0xF3 is a BREAK, 0xFF 0xFF a 0xFF byte.

LAT only

server.tcpip: false gives users LAT alone: TELNET, PING and TRACEROUTE are not commands, SHOW SERVER leaves out the machine's network configuration, and the configuration may not set a telnet listener or reverse telnet ports.

Raspberry Pi image

dist/rpi/build-image.sh turns the current Raspberry Pi OS Lite image into one with lattice installed. CI builds both architectures on every push to main and publishes them as the release latest:

  • lattice-rpi-arm64.img.xz for the Pi 3, 4, 5 and Zero 2 W,
  • lattice-rpi-armhf.img.xz for every Pi, including 1, 2 and Zero.

Raspberry Pi Imager's settings (user, Wi-Fi, SSH, host name) work as with Raspberry Pi OS. Without them the Pi is called lattice, takes its address on Ethernet by DHCP and has the user lattice without a password. latticed runs on Ethernet, adds USB serial adapters as they are plugged in, takes telnet on port 23, and serves the web interface on port 80. The Pi's own serial port is left to the console.

Status

  • internal/lineedit — the command line editor: starts with no assumptions about the terminal, switches to ANSI or VT52 control on the first cursor key sequence, Emacs and VMS key bindings, history, incremental search, completion, horizontal scrolling, hardcopy mode.
  • internal/portstate — per-port settings users change from the command line, persisted across logouts.
  • cmd/ledemo — runs the editor on the controlling terminal.
  • cmd/latticed and internal/server — the daemon: the Local> command line on local ports and for telnet and LAT users (CONNECT, TELNET, RESUME, FORWARDS/BACKWARDS, DISCONNECT, SHOW SERVICES/NODES/PORT/SESSIONS/USERS/ SERVER, SET PORT EDITING/TYPE, LOGOUT), BREAK to local mode, remote ports offered as LAT services and reverse telnet ports, and LAT services carried to telnet hosts, which hear the session's configured terminal, its speed and environment variables naming its node and port.
  • internal/serial, internal/telnet, internal/config — serial lines with BREAK, both ends of telnet, the configuration file.
  • internal/lat — LAT: service announcements, virtual circuits and sessions in both roles, over raw Ethernet on Linux.
  • cmd/latscan, cmd/latc, cmd/latserve — LAT test tools: list services, connect to a service, offer an echo service.
  • docs/lat-protocol.md — the LAT protocol as the terminal server implements it, with the points still to be verified against a capture.
  • docs/ds200/ — transcripts of a real DECserver 200's user interface, the reference for the command line.

LAT interoperability

Peer Role of peer Result
VAX/VMS 5.5-2H4 (VAX 4000-105A) slave (we connect, log in as GUEST) works
VAX/VMS 5.5-2H4, SET HOST/LAT master (VMS connects to our service) works
DECserver 200 V3.1, port service slave works
DECserver 200 V3.1, CONNECT from a port master works

The testdata captures of these sessions are kept with the LAT package.

Development

go test ./...
go run ./cmd/ledemo