Skip to content

Resurrecting the Qi/Ph nameserver from '93

License

Notifications You must be signed in to change notification settings

filipobecerra/ccso-nameserver

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CCSO Nameserver

Ph Demo

The CCSO nameserver was an early form of database search on the Internet. In its most common form, it was used as an electronic "Phone Book" to lookup information such as telephone numbers and email addresses. Today, this service has largely been replaced by LDAP. [1]

This repository contains a working version of the original CCSO nameserver (aka "Qi") developed by Steven Domer at University of Illinois in '93. I salvaged the source code off a long forgotten FTP server, stuck it into a CentOS Docker Container, and smashed it with a hammer until gcc cried uncle and compiled without errors.

The fruits of this labor can be seen here:

cso://mozz.us:105

There are less than a handful of CCSO servers still running on the open web. This is probably the first new nameserver to go live in over a decade! More information about CCSO, including a list of active domains, can be found at:

gopher://mozz.us:70/1/ccso (http proxy)

Table of Contents

Quickstart

git clone https://github.com/michael-lazar/ccso-nameserver.git && cd ccso-nameserver
./ccso build
./ccso initdb
./ccso qi

This will build the docker container, initialize a new CCSO database using the built-in seed data, and launch an interactive Qi command line prompt. The only dependency is Docker.

Using this Repository

Commands

I have included a bash script that contains aliases for my commonly used docker commands:

Command Description
./ccso build Build the CCSO docker image
./ccso initdb Setup the CCSO database files inside of a persistant docker volume
./ccso shell Launch a shell into the docker container
./ccso ph Launch the ph client
./ccso qi Run the qi server in local "hero" mode
./ccso daemon Run the qi server in silent daemon mode
./ccso install-service Install a systemd service that exposes the qi server

Running Qi as a Daemon

Qi was originally designed to run behind an inetd service. The qi binary itself has very straightforward behavior: Read one or more commands from stdin, write its response to stdout, and exit. Inetd handles running the actual TCP server and managing the incoming socket connections.

Inetd is not very popular anymore and has been largely supplanted by other services. For my implementation, I decided to use systemd sockets instead. Systemd binds to port 105 on the host machine, and everytime there's an incoming connection it launches an ephemeral docker container that executes the qi binary. The container runs for the duration of the connection and shuts down once the connection closes.

Here's what the systemd service looks like:

# /etc/systemd/system/ccso.socket
[Unit]
Description=CCSO Nameserver

[Socket]
ListenStream=105
Accept=yes

[Install]
WantedBy=sockets.target
# /etc/systemd/system/[email protected]
[Unit]
Description=CCSO Service
Requires=ccso.socket

[Service]
Type=simple
# Assumes the repository was cloned into /var/ccso/
ExecStart=/var/ccso/ccso daemon
StandardInput=socket
StandardError=journal

[Install]
WantedBy=multi-user.target

Customizing the Database

You can customize the fields in your CCSO database by editing the following files:

File Description
util/db/prod-new.cnf Defines all of the fields and indices that will be available to the nameserver
util/db/qi.input Defines seed data that will be added when the database is created
util/db/initdb Shell script used to construct the database files

See the CSO Nameserver FAQ for more information on how these files are structured.

You can re-initialize the database at any time with the following commands, but beware that it will overwrite any existing data saved in the CCSO server. Migrating data from an old format appears to be a painful process, and I have not yet attempted it.

./ccso build
./ccso initdb

Explore!

There are a ton of tools for qi and ph that are bundled with the source code but that I haven't documented here. A great place to start is by launching a shell into the docker container and poking around the /opt/nameserv/ directory.

CCSO Clients

CCSO's simple, plaintext ASCII protocol lends itself to work with a wide range of terminal clients. Some are more sophisticated than others.

Ph

Ph (stands for "Phonebook") was the original CCSO client that was developed alongside the Qi server by University of Illinois. The source code is bundled with Qi, and it gets built and installed inside of the docker image. I've included a shortcut command to launch Ph from the docker container. Use the -s flag to specify a server host.

Ph Demo

Lynx

Lynx (the curses web browser) supports CCSO links using the cso:// protocol. When you open a cso link, lynx will present you with a form that contains all of the fields that are indexed and searchable by the CCSO server. Pretty neat!

Example: $ lynx cso://mozz.us

Lynx Demo Lynx Demo 2

Lynx also recognizes gopher URLs with item type 2, and will parse everything after the ? as a CCSO query.

Example: $ lynx "gopher://mozz.us:105/2?name=adams clay"

Lynx Demo 3

Telnet

Good ol' Telnet. Is there anything it can't do?

Telnet Demo

Python

This repo also includes a python script for automating connections to CCSO servers. The script was borrowed from https://github.com/jcollie/ccso and has been ported to work with python 3.

Python Demo

Interesting Documents

A series of reference documents were published by the University of Illinois between 1988 and 1992. These cover everything from the motivations for creating the CCSO Nameserver, to a retrospective of what worked and what didn't. These are a great place to start if you're looking for some historical context:

An RFC memo was later published in 1998 that formally describes the CCSO protocol:

Man pages:

Other miscellaneous documentation:

About

Resurrecting the Qi/Ph nameserver from '93

cso://mozz.us:105

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 45.7%
  • Roff 31.8%
  • Shell 7.4%
  • Rich Text Format 5.1%
  • Makefile 3.1%
  • Perl 3.0%
  • Other 3.9%