GNC: A Gemini Server for inetd
GNC is a pure-Fortran implementation of a simple Gemini server for UNIX-like systems. The server requires the inetd super-server (or compatible system like xinetd) to work. GNC will handle all the TLS nonsense, and, if given a root directory to work with, should provide some mild security that only files in that directory will be served (no promises, though!).
GNC requires almost nothing:
- A modern Fortran compiler (GNU Fortran > 7)
- The file command (for computing MIME types)
- inetd or equivalent (Debian calls it inetutils-inetd)
There is a makefile provided to compile it (makefile.gnu) and a Simply Fortran project if you're rad.
These directions will focus on just getting everything running on plain, old BSD-esque inetd. Users can probably extrapolate for other systems.
You'll first need to set up the Gemini protocol in the file /etc/services:
gemini 1965/tcp # Gemini...
Next, you can add a nice line to inetd.conf:
gemini stream tcp nowait root /path/to/gnc gnc -pub /path/to/certs/cer
t.pem -priv /path/to/certs/key.pem -root /path/to/files/to/serve -l /path/to/logfile
Note that if you don't provide a logfile (the "-l" option), GNC will write to /tmp/gnc.log all the time.
The inetd.conf line above implies using root as the user for GNC which is super- unecessary. Users should probably set up a sensible user instead.
The "-root" option isn't mandatory. If you don't provide it, though, GNC will just serve your entire filesystem, so maybe you should provide it...
After that, it should just work.
Paths ending in a slash will actually attempt to open a file "index.gmi" without letting the end user know. You might want one of those in your root directory from which you're serving.
GNC is Copyright (c) 2020 Jeffrey Armstrong email@example.com, and the software is licensed under the JSON license. See LICENSE.txt for more details.