1 207dc0f9 2021-01-02 op .\" Copyright (c) 2021, 2022 Omar Polo <op@omarpolo.com>
3 3e4749f7 2020-10-02 op .\" Permission to use, copy, modify, and distribute this software for any
4 3e4749f7 2020-10-02 op .\" purpose with or without fee is hereby granted, provided that the above
5 3e4749f7 2020-10-02 op .\" copyright notice and this permission notice appear in all copies.
7 3e4749f7 2020-10-02 op .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 3e4749f7 2020-10-02 op .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 3e4749f7 2020-10-02 op .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 3e4749f7 2020-10-02 op .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 3e4749f7 2020-10-02 op .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 3e4749f7 2020-10-02 op .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 3e4749f7 2020-10-02 op .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 1595c277 2022-04-07 op .Dd $Mdocdate: April 7 2022$
19 714685c1 2021-01-30 op .Nd simple and secure Gemini server
24 15902770 2021-01-15 op .Op Fl c Ar config
25 8b743dda 2021-06-29 op .Op Fl D Ar macro Ns = Ns Ar value
26 8e8b2e25 2021-04-28 op .Op Fl P Ar pidfile
31 14cee926 2022-01-04 op .Op Fl d Ar certs-dir
32 f28d96d3 2021-01-25 op .Op Fl H Ar hostname
33 721e2325 2020-11-18 op .Op Fl p Ar port
36 3e4749f7 2020-10-02 op .Sh DESCRIPTION
38 8ff40039 2021-05-24 op is a simple and minimal gemini server that can serve static files,
39 d29a2ee2 2022-09-06 op talk to FastCGI applications and act as a gemini reverse proxy.
40 eb699783 2021-01-18 op It can run without a configuration file with a limited set of features
44 3007f565 2021-02-04 op rereads the configuration file when it receives
47 eb699783 2021-01-18 op The options are as follows:
48 f28d96d3 2021-01-25 op .Bl -tag -width 14m
49 14cee926 2022-01-04 op .It Fl c Ar config
50 f28d96d3 2021-01-25 op Specify the configuration file.
51 8b743dda 2021-06-29 op .It Fl D Ar macro Ns = Ns Ar value
56 8b743dda 2021-06-29 op on the command line.
57 8b743dda 2021-06-29 op Overrides the definition of
59 8b743dda 2021-06-29 op in the config file if present.
61 46af8c6c 2021-01-27 op Stays and logs on the foreground.
63 eb699783 2021-01-18 op Check that the configuration is valid, but don't start the server.
64 f0a01fc7 2021-10-09 op If specified two or more time, dump the configuration in addition to
66 14cee926 2022-01-04 op .It Fl P Ar pidfile
67 301e039d 2021-07-29 op Write daemon's pid to the given location.
69 2b520ad5 2021-07-09 op will also act as lock: if another process is holding a lock on that
72 2b520ad5 2021-07-09 op will refuse to start.
75 eb699783 2021-01-18 op If no configuration file is given,
78 ebf3373d 2021-12-02 op .Dq config-less mode
79 ebf3373d 2021-12-02 op .Pq i.e. runs in the foreground to serve a directory from the shell
80 ebf3373d 2021-12-02 op and looks for the following options
81 f28d96d3 2021-01-25 op .Bl -tag -width 14m
84 14cee926 2022-01-04 op .It Fl d Ar certs-path
85 f28d96d3 2021-01-25 op Directory where certificates for the config-less mode are stored.
86 301e039d 2021-07-29 op By default it is
87 f28d96d3 2021-01-25 op .Pa $XDG_DATA_HOME/gmid ,
89 f28d96d3 2021-01-25 op .Pa ~/.local/share/gmid .
90 71cf3975 2021-01-25 op .It Fl H Ar hostname
96 f28d96d3 2021-01-25 op Certificates for the given
98 f28d96d3 2021-01-25 op are searched inside the
100 f28d96d3 2021-01-25 op directory given with the
103 714685c1 2021-01-30 op They have the form
104 f28d96d3 2021-01-25 op .Pa hostname.cert.pem
106 f28d96d3 2021-01-25 op .Pa hostname.key.pem .
107 301e039d 2021-07-29 op If a certificate or a key doesn't exist for a given hostname, they
108 301e039d 2021-07-29 op will be generated automatically.
109 ba65dcc8 2021-06-29 op .It Fl h , Fl -help
110 fab952e1 2020-10-03 op Print the usage and exit.
111 721e2325 2020-11-18 op .It Fl p Ar port
112 eb699783 2021-01-18 op The port to listen on, by default 1965.
113 ba65dcc8 2021-06-29 op .It Fl V , Fl -version
114 ba65dcc8 2021-06-29 op Print the version and exit.
116 3abf91b0 2021-02-07 op Verbose mode.
119 3abf91b0 2021-02-07 op options increase the verbosity.
121 f28d96d3 2021-01-25 op The root directory to serve.
122 f28d96d3 2021-01-25 op By default the current working directory is assumed.
125 e58a447a 2021-07-29 op Messages and requests are logged by
129 e58a447a 2021-07-29 op facility or printed on
132 e58a447a 2021-07-29 op Requests are logged with the
135 e58a447a 2021-07-29 op Each request log entry has the following fields, separated by
138 e58a447a 2021-07-29 op .Bl -bullet -compact
140 e58a447a 2021-07-29 op Client IP address and the source port number, separated by a colon
147 e58a447a 2021-07-29 op Response status
149 e58a447a 2021-07-29 op Response meta
152 f28d96d3 2021-01-25 op Serve the current directory
153 6980aad6 2020-10-02 op .Bd -literal -offset indent
159 5eb842cd 2022-04-08 op as a deamon a configuration file and a X.509 certificate must be provided.
160 5eb842cd 2022-04-08 op A self-signed certificate, which are commonly used in the Geminispace,
161 5eb842cd 2022-04-08 op can be generated using for e.g.\&
162 5eb842cd 2022-04-08 op .Xr openssl 1 :
163 e308526c 2021-07-29 op .Bd -literal -offset indent
164 5eb842cd 2022-04-08 op # openssl req \-x509 \-newkey rsa:4096 \-nodes \e
165 5eb842cd 2022-04-08 op \-keyout /etc/ssl/private/example.com.key \e
166 5eb842cd 2022-04-08 op \-out /etc/ssl/example.com.pem \e
167 5eb842cd 2022-04-08 op \-days 365 \-subj "/CN=example.com"
168 e308526c 2021-07-29 op # chmod 600 /etc/ssl/example.com.crt
169 e308526c 2021-07-29 op # chmod 600 /etc/ssl/private/example.com.key
174 5eb842cd 2022-04-08 op can be started with
175 eb699783 2021-01-18 op .Bd -literal -offset indent
176 5eb842cd 2022-04-08 op # gmid -c /etc/gmid.conf
179 1595c277 2022-04-07 op .Xr gmid.conf 5
180 ef04b551 2021-01-09 op .Sh ACKNOWLEDGEMENTS
183 eb699783 2021-01-18 op .Dq Flexible and Economical
184 eb699783 2021-01-18 op UTF-8 decoder written by
185 f28d96d3 2021-01-25 op .An Bjoern Hoehrmann .
190 714685c1 2021-01-30 op program was written by
191 714685c1 2021-01-30 op .An Omar Polo Aq Mt op@omarpolo.com .
195 2b520ad5 2021-07-09 op All the root directories are opened during the daemon startup; if a
196 2b520ad5 2021-07-09 op root directory is deleted and then re-created,
198 eb699783 2021-01-18 op won't be able to serve files inside that directory until a restart.
199 2b520ad5 2021-07-09 op This restriction only applies to the root directories and not their
202 714685c1 2021-01-30 op a %2F sequence is indistinguishable from a literal slash: this is not
203 714685c1 2021-01-30 op RFC3986-compliant.
205 714685c1 2021-01-30 op a %00 sequence is treated as invalid character and thus rejected.