aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 409a40ace8f91507265128d244a42f2ddeb27840 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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!).

## Requirements

GNC requires almost nothing:

 * A modern Fortran compiler (GNU Fortran > 7)
 * OpenSSL
 * 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.

## Usage

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.

## License

GNC is Copyright (c) 2020 Jeffrey Armstrong <jeff@rainbow-100.com>, and the software
is licensed under the JSON license.  See LICENSE.txt for more details.