Blob


1 # gmid
3 > dead simple, zero configuration Gemini server
5 gmid is a simple and minimal Gemini server. It can run without
6 configuration, so it's well suited for local development, but at the
7 same time has a configuration file flexible enough to meet the
8 requirements of most capsules.
10 gmid was initially written to serve static files, but can also
11 optionally execute CGI scripts. It was also written with security in
12 mind: on FreeBSD and OpenBSD is sandboxed via `capsicum(4)`and
13 `pledge(2)`/`unveil(2)` respectively.
16 ## Features
18 - IRI support (RFC3987)
19 - dual stack: can serve over both IPv4 and IPv6
20 - CGI scripts
21 - (very) low memory footprint
22 - small codebase, easily hackable
23 - virtual hosts
24 - sandboxed by default on OpenBSD and FreeBSD
27 ## Drawbacks
29 - not suited for very busy hosts. If you receive an high number of
30 connection per-second you'd probably want to run multiple gmid
31 instances behind relayd/haproxy or a different server.
33 ## Building
35 gmid depends a POSIX libc and libtls. It can probably be linked
36 against libretls, but I've never tried.
38 See [INSTALL.gmi](INSTALL.gmi) for more info, but the build is as
39 simple as
41 make
43 The Makefile isn't able to produce a statically linked executable
44 (yet), so for that you have to execute by hand
46 make
47 cc -static *.o /usr/lib/lib{crypto,tls,ssl}.a -o gmid
48 strip gmid
50 to enjoy your ~2.3M statically-linked gmid.
53 ## Architecture/Security considerations
55 gmid is composed by two processes: a listener and an executor. The
56 listener process is the only one that needs internet access and is
57 sandboxed. When a CGI script needs to be executed, the executor
58 (outside of the sandbox) sets up a pipe and gives one end to the
59 listener, while the other is bound to the CGI script standard output.
60 This way, is still possible to execute CGI scripts without restriction
61 even if the presence of a sandbox.
63 On OpenBSD, the listener process runs with the `stdio recvfd rpath
64 inet` pledges and has `unveil(2)`ed only the directories that it
65 serves. Furthermore, the executor process has `stdio sendfd proc exec`
66 as pledges.
68 On FreeBSD, the listener process is sandboxed with `capsicum(4)`.
70 On linux, a seccomp filter is installed for the listener process.