Blame


1 d3670d7f 2021-08-13 xhr twind
2 d3670d7f 2021-08-13 xhr =====
3 d3670d7f 2021-08-13 xhr
4 d3670d7f 2021-08-13 xhr twind is a simple daemon serving static files over the gemini protocol. It is
5 d3670d7f 2021-08-13 xhr intended to have as few knobs as possible and has no support for a
6 d3670d7f 2021-08-13 xhr configuration file.
7 d3670d7f 2021-08-13 xhr
8 d3670d7f 2021-08-13 xhr Installation
9 d3670d7f 2021-08-13 xhr ------------
10 d3670d7f 2021-08-13 xhr
11 d3670d7f 2021-08-13 xhr twind is written in plain C and you need to have the following software
12 d3670d7f 2021-08-13 xhr installed:
13 d3670d7f 2021-08-13 xhr
14 d3670d7f 2021-08-13 xhr * A C compiler (tested with clang and GCC)
15 d3670d7f 2021-08-13 xhr * LibreSSL or OpenSSL
16 d3670d7f 2021-08-13 xhr * POSIX compatible libc with pthreads support
17 d3670d7f 2021-08-13 xhr * make (both BSD and GNU make will work)
18 d3670d7f 2021-08-13 xhr
19 d3670d7f 2021-08-13 xhr twind needs a dedicated user called '_twind' and directory to run. The
20 d3670d7f 2021-08-13 xhr Makefile contains a command to create the user. Note that you shall not change
21 d3670d7f 2021-08-13 xhr the user's name and the directory twind needs!
22 d3670d7f 2021-08-13 xhr
23 d3670d7f 2021-08-13 xhr $ make
24 d3670d7f 2021-08-13 xhr # make install
25 d3670d7f 2021-08-13 xhr # make user
26 d3670d7f 2021-08-13 xhr
27 d3670d7f 2021-08-13 xhr TLS certificates
28 d3670d7f 2021-08-13 xhr ----------------
29 d3670d7f 2021-08-13 xhr
30 d3670d7f 2021-08-13 xhr twind expects to find a X509 certificate and a corresponding private key
31 d3670d7f 2021-08-13 xhr under the following locations (which cannot be changed):
32 d3670d7f 2021-08-13 xhr
33 d3670d7f 2021-08-13 xhr * /etc/twind/twind.cert.pem
34 d3670d7f 2021-08-13 xhr * /etc/twind/twind.key.pem
35 d3670d7f 2021-08-13 xhr
36 d3670d7f 2021-08-13 xhr Either copy your existing keys to these locations or generate a new key and
37 d3670d7f 2021-08-13 xhr certificate via the Makefile. Note that the command overwrites any existing
38 d3670d7f 2021-08-13 xhr key without warning! To generate both key and certificate use the following
39 d3670d7f 2021-08-13 xhr command and provide the hostname via the HN variable. If you don't provide the
40 d3670d7f 2021-08-13 xhr hostname the command will fail!
41 d3670d7f 2021-08-13 xhr
42 d3670d7f 2021-08-13 xhr # make setuptls HN=example.com
43 d3670d7f 2021-08-13 xhr
44 d3670d7f 2021-08-13 xhr Usage
45 d3670d7f 2021-08-13 xhr -----
46 d3670d7f 2021-08-13 xhr
47 d3670d7f 2021-08-13 xhr twind has support for virtual hosts. If your gemini server is called
48 d3670d7f 2021-08-13 xhr example.com you have to create a dedicated sub directory under /var/twind:
49 d3670d7f 2021-08-13 xhr
50 d3670d7f 2021-08-13 xhr # cd /var/twind
51 d3670d7f 2021-08-13 xhr # mkdir example.com
52 d3670d7f 2021-08-13 xhr # <copy files into the example.com directory>
53 d3670d7f 2021-08-13 xhr
54 d3670d7f 2021-08-13 xhr In case your server is also reachable via gemini.example.com and you want to
55 d3670d7f 2021-08-13 xhr serve the same content as on example.com you can create a symlink. In case you
56 d3670d7f 2021-08-13 xhr want to serve different content, you have to create a dedicated sub directory.
57 d3670d7f 2021-08-13 xhr
58 d3670d7f 2021-08-13 xhr twind needs root permissions to start and will drop its privileges as soon as
59 d3670d7f 2021-08-13 xhr possible. It will also chroot to /var/twind.
60 d3670d7f 2021-08-13 xhr
61 d3670d7f 2021-08-13 xhr # twind
62 d3670d7f 2021-08-13 xhr
63 d3670d7f 2021-08-13 xhr For debugging purposes, you can start twind with -df option so that debugging
64 d3670d7f 2021-08-13 xhr and running in the foreground is enabled.