Blame


1 f224a3fe 2021-08-24 xhr twind
2 f224a3fe 2021-08-24 xhr =====
3 f224a3fe 2021-08-24 xhr
4 f224a3fe 2021-08-24 xhr twind is a simple daemon serving static files over the gemini protocol. It is
5 f224a3fe 2021-08-24 xhr intended to have as few knobs as possible and has no support for a
6 97aee1f8 2021-08-24 xhr configuration file. twind is named after the latin word for gemini - twins.
7 f224a3fe 2021-08-24 xhr
8 97aee1f8 2021-08-24 xhr twind is known to run on OpenBSD, FreeBSD and Linux and currently supports
9 97aee1f8 2021-08-24 xhr
10 97aee1f8 2021-08-24 xhr * Serving static gemini files
11 97aee1f8 2021-08-24 xhr * Virtual hosts
12 97aee1f8 2021-08-24 xhr * MIME handling
13 97aee1f8 2021-08-24 xhr * IPv4 and IPv6 support
14 97aee1f8 2021-08-24 xhr
15 97aee1f8 2021-08-24 xhr It doesn't support CGI handling and probably never will. There are more
16 97aee1f8 2021-08-24 xhr advanced gemini servers out there if you look for fancy stuff.
17 97aee1f8 2021-08-24 xhr
18 f224a3fe 2021-08-24 xhr Installation
19 f224a3fe 2021-08-24 xhr ------------
20 f224a3fe 2021-08-24 xhr
21 f224a3fe 2021-08-24 xhr twind is written in plain C and you need to have the following software
22 f224a3fe 2021-08-24 xhr installed:
23 f224a3fe 2021-08-24 xhr
24 97aee1f8 2021-08-24 xhr * A C compiler (tested with clang >= 11 and GCC >= 9)
25 f224a3fe 2021-08-24 xhr * LibreSSL or OpenSSL
26 f224a3fe 2021-08-24 xhr * POSIX compatible libc with pthreads support
27 f224a3fe 2021-08-24 xhr * make (both BSD and GNU make will work)
28 f224a3fe 2021-08-24 xhr
29 f224a3fe 2021-08-24 xhr twind needs a dedicated user called '_twind' and directory to run. The
30 f224a3fe 2021-08-24 xhr Makefile contains a command to create the user. Note that you shall not change
31 c67880d6 2021-08-24 xhr the user's name and the directory twind needs! By default, the user ID for
32 c67880d6 2021-08-24 xhr _twind is set to 4000. If you need another user ID, change the UID variable
33 c67880d6 2021-08-24 xhr in the Makefile.
34 f224a3fe 2021-08-24 xhr
35 f224a3fe 2021-08-24 xhr $ make
36 f224a3fe 2021-08-24 xhr # make install
37 f224a3fe 2021-08-24 xhr # make user
38 f224a3fe 2021-08-24 xhr
39 f224a3fe 2021-08-24 xhr TLS certificates
40 f224a3fe 2021-08-24 xhr ----------------
41 f224a3fe 2021-08-24 xhr
42 f224a3fe 2021-08-24 xhr twind expects to find a X509 certificate and a corresponding private key
43 f224a3fe 2021-08-24 xhr under the following locations (which cannot be changed):
44 f224a3fe 2021-08-24 xhr
45 f224a3fe 2021-08-24 xhr * /etc/twind/twind.cert.pem
46 f224a3fe 2021-08-24 xhr * /etc/twind/twind.key.pem
47 f224a3fe 2021-08-24 xhr
48 f224a3fe 2021-08-24 xhr Either copy your existing keys to these locations or generate a new key and
49 c67880d6 2021-08-24 xhr certificate by using the Makefile. Note that the command overwrites any existing
50 f224a3fe 2021-08-24 xhr key without warning! To generate both key and certificate use the following
51 f224a3fe 2021-08-24 xhr command and provide the hostname via the HN variable. If you don't provide the
52 f224a3fe 2021-08-24 xhr hostname the command will fail!
53 f224a3fe 2021-08-24 xhr
54 f224a3fe 2021-08-24 xhr # make setuptls HN=example.com
55 f224a3fe 2021-08-24 xhr
56 f224a3fe 2021-08-24 xhr Usage
57 f224a3fe 2021-08-24 xhr -----
58 f224a3fe 2021-08-24 xhr
59 f224a3fe 2021-08-24 xhr twind has support for virtual hosts. If your gemini server is called
60 f224a3fe 2021-08-24 xhr example.com you have to create a dedicated sub directory under /var/twind:
61 f224a3fe 2021-08-24 xhr
62 f224a3fe 2021-08-24 xhr # cd /var/twind
63 f224a3fe 2021-08-24 xhr # mkdir example.com
64 f224a3fe 2021-08-24 xhr # <copy files into the example.com directory>
65 f224a3fe 2021-08-24 xhr
66 f224a3fe 2021-08-24 xhr In case your server is also reachable via gemini.example.com and you want to
67 f224a3fe 2021-08-24 xhr serve the same content as on example.com you can create a symlink. In case you
68 f224a3fe 2021-08-24 xhr want to serve different content, you have to create a dedicated sub directory.
69 f224a3fe 2021-08-24 xhr
70 f224a3fe 2021-08-24 xhr twind needs root permissions to start and will drop its privileges as soon as
71 f224a3fe 2021-08-24 xhr possible. It will also chroot to /var/twind.
72 f224a3fe 2021-08-24 xhr
73 f224a3fe 2021-08-24 xhr # twind
74 f224a3fe 2021-08-24 xhr
75 f224a3fe 2021-08-24 xhr For debugging purposes, you can start twind with -df option so that debugging
76 f224a3fe 2021-08-24 xhr and running in the foreground is enabled.
77 60333239 2021-08-24 xhr
78 60333239 2021-08-24 xhr Contact
79 60333239 2021-08-24 xhr -------
80 60333239 2021-08-24 xhr
81 60333239 2021-08-24 xhr Please send feedback, patches by email to git()xosc.org. Send git formatted
82 60333239 2021-08-24 xhr patches, see https://git-send-email.io/ for more information.