Date: 2024-10-22
Last update: 2024-02-22

Simple Gopher server setup on OpenBSD
-------------------------------------

# Install original Gopher client
$ doas pkg_add gopher

# Get god.pl - simple Gopher server for Perl and save it as "god.pl"
$ gopher gopher://morena.rip/9god.pl

# Move "god.pl" to /usr/local/libexec/ and make it executable.
$ doas mv god.pl /usr/local/libexec/
$ doas chown root:bin /usr/local/libexec/god.pl
$ doas chmod +x /usr/local/libexec/god.pl

# Copy example of inetd.conf to /etc/inetd.conf and adjust it for god
$ doas cp /etc/example/inetd.conf /etc/

# Add the last line to /etc/inetd.conf [ empty spaces are TAB ]
70  stream  tcp  nowait  nobody  /usr/local/libexec/god.pl  god.pl

# Create Gopher directory where your files will exist.
$ doas mkdir /var/gopher

All your files published by Gopher will be in that directory.

# Write a text file there and make your Gopher menu based on RFC 1436

$ doas vi /var/gopher/menu 
  0Gopher text  coolfile  morena.rip  70
  .

This will be default menu directory for your Gopher.
> 0 		- item type text file
> Gopher text	- visible name for your file [max 70 characters]
> coolfile	- location of your file with its real filename
> morena.rip	- domain name, hostname
> 70		- port for serving gopher
> .		- Ending with period on its own line

Each part is separated by TAB, not a space.

# Write something special to your first Gopher plain text article. 
$ doas vi /var/gopher/coolfile

Be hero, be saint, put the period at the end of your text file on its
own line as RFC says. Use only ASCII characters, keep your lines at
maximum of 70 characters.

# Enable and start inetd - super-server
$ doas rcctl enable inetd
$ doas rcctl start inetd

All is setup and running. Millions can now visit your Gopher server.

# Visit your great Gopher with original Gopher client
$ gopher gopher://morena.rip/

If in doubt, read RFC 1436 - The Internet Gopher Protocol standard.
$ gopher gopher://morena.rip/0bin/rfc1436

You can check how my menu directory looks like with netcat:
$ echo | nc morena.rip 70

You will get my raw "menu" file. This file is then interpreted by
gopher client the way you see it when you visit my Gopher server.

This is how morena's Great Gopher server runs. It's known as god mode!
If you did all above, congratulation giant, you already stand out!
You just created and started one of rare Gopher server fully compliant
with RFC 1436.

----------------------------------------------------------------------

Not born to fit in.