Blame


1 3e4749f7 2020-10-02 op
2 3e4749f7 2020-10-02 op # NAME
3 3e4749f7 2020-10-02 op
4 3e4749f7 2020-10-02 op **gmid** - dead simple gemini server
5 3e4749f7 2020-10-02 op
6 3e4749f7 2020-10-02 op # SYNOPSIS
7 3e4749f7 2020-10-02 op
8 3e4749f7 2020-10-02 op **gmid**
9 3e4749f7 2020-10-02 op \[**-h**]
10 3e4749f7 2020-10-02 op \[**-c** *cert.pem*]
11 3e4749f7 2020-10-02 op \[**-d** *docs*]
12 3e4749f7 2020-10-02 op \[**-k** *key.pem*]
13 3e4749f7 2020-10-02 op
14 3e4749f7 2020-10-02 op # DESCRIPTION
15 3e4749f7 2020-10-02 op
16 3e4749f7 2020-10-02 op **gmid**
17 3e4749f7 2020-10-02 op is a very simple and minimal gemini server.
18 3e4749f7 2020-10-02 op It only supports serving static content, and strive to be as simple as
19 3e4749f7 2020-10-02 op possible.
20 3e4749f7 2020-10-02 op
21 3e4749f7 2020-10-02 op **gmid**
22 3e4749f7 2020-10-02 op will strip any sequence of
23 3e4749f7 2020-10-02 op *../*
24 3e4749f7 2020-10-02 op or trailing
25 3e4749f7 2020-10-02 op *..*
26 3e4749f7 2020-10-02 op in the requests made by clients, so it's impossible to serve content
27 3e4749f7 2020-10-02 op outside the
28 3e4749f7 2020-10-02 op *docs*
29 3e4749f7 2020-10-02 op directory by mistake.
30 3e4749f7 2020-10-02 op Furthermore, on OpenBSD,
31 3e4749f7 2020-10-02 op pledge(3)
32 3e4749f7 2020-10-02 op and
33 3e4749f7 2020-10-02 op unveil(3)
34 3e4749f7 2020-10-02 op are used to ensure that
35 3e4749f7 2020-10-02 op **gmid**
36 3e4749f7 2020-10-02 op dosen't do anything else than read files from the given directory and
37 3e4749f7 2020-10-02 op accept network connections.
38 3e4749f7 2020-10-02 op
39 3e4749f7 2020-10-02 op It should be noted that
40 3e4749f7 2020-10-02 op **gmid**
41 3e4749f7 2020-10-02 op is very simple in its implementation, and so it may not be appropriate
42 3e4749f7 2020-10-02 op for serving site with lots of users.
43 3e4749f7 2020-10-02 op After all, the code is single threaded and use a single process.
44 3e4749f7 2020-10-02 op
45 3e4749f7 2020-10-02 op The options are as follows:
46 3e4749f7 2020-10-02 op
47 3e4749f7 2020-10-02 op **-c** *cert.pem*
48 3e4749f7 2020-10-02 op
49 3e4749f7 2020-10-02 op > The certificate to use, by default is
50 3e4749f7 2020-10-02 op > *cert.pem*
51 3e4749f7 2020-10-02 op
52 3e4749f7 2020-10-02 op **-d** *docs*
53 3e4749f7 2020-10-02 op
54 3e4749f7 2020-10-02 op > The root directory to serve.
55 3e4749f7 2020-10-02 op > **gmid**
56 3e4749f7 2020-10-02 op > won't serve any file that is outside that directory.
57 3e4749f7 2020-10-02 op
58 3e4749f7 2020-10-02 op **-h**
59 3e4749f7 2020-10-02 op
60 3e4749f7 2020-10-02 op > Print the usage and exit
61 3e4749f7 2020-10-02 op
62 3e4749f7 2020-10-02 op **-k** *key.pem*
63 3e4749f7 2020-10-02 op
64 3e4749f7 2020-10-02 op > The key for the certificate, by default is
65 3e4749f7 2020-10-02 op > *key.pem*
66 3e4749f7 2020-10-02 op
67 3e4749f7 2020-10-02 op # EXAMPLES
68 3e4749f7 2020-10-02 op
69 3e4749f7 2020-10-02 op To quickly getting started
70 3e4749f7 2020-10-02 op
71 3e4749f7 2020-10-02 op $ # generate a cert and a key
72 3e4749f7 2020-10-02 op $ openssl req -x509 -newkey rsa:4096 -keyout key.pem \
73 3e4749f7 2020-10-02 op -out cert.pem -days 365 -nodes
74 3e4749f7 2020-10-02 op $ mkdir docs
75 3e4749f7 2020-10-02 op $ cat <<EOF > docs/index.gmi
76 3e4749f7 2020-10-02 op # Hello world
77 3e4749f7 2020-10-02 op test paragraph...
78 3e4749f7 2020-10-02 op EOF
79 3e4749f7 2020-10-02 op $ gmid -c cert.pem -k key.pem -d docs
80 3e4749f7 2020-10-02 op
81 3e4749f7 2020-10-02 op now you can visit gemini://localhost/ with your preferred gemini client.
82 3e4749f7 2020-10-02 op
83 3e4749f7 2020-10-02 op # CAVEATS
84 3e4749f7 2020-10-02 op
85 3e4749f7 2020-10-02 op * it doesn't support virtual host: the host part of the request URL is
86 3e4749f7 2020-10-02 op completely ignored.
87 3e4749f7 2020-10-02 op
88 3e4749f7 2020-10-02 op * it doesn't fork in the background or anything like that.
89 3e4749f7 2020-10-02 op
90 3e4749f7 2020-10-02 op OpenBSD 6.8 - October 2, 2020