Blob


1 .\" Copyright (c) 2021, 2022 Omar Polo <op@omarpolo.com>
2 .\"
3 .\" Permission to use, copy, modify, and distribute this software for any
4 .\" purpose with or without fee is hereby granted, provided that the above
5 .\" copyright notice and this permission notice appear in all copies.
6 .\"
7 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 .Dd September 8, 2022
15 .Dt GMID 8
16 .Os
17 .Sh NAME
18 .Nm gmid
19 .Nd simple and secure Gemini server
20 .Sh SYNOPSIS
21 .Nm
22 .Bk -words
23 .Op Fl fhnVv
24 .Op Fl c Ar config
25 .Op Fl D Ar macro Ns = Ns Ar value
26 .Op Fl P Ar pidfile
27 .Ek
28 .Sh DESCRIPTION
29 .Nm
30 is a simple and minimal gemini server that can serve static files,
31 talk to FastCGI applications and act as a gemini reverse proxy.
32 It can run without a configuration file with a limited set of features
33 available.
34 .Pp
35 .Nm
36 rereads the configuration file when it receives
37 .Dv SIGHUP .
38 .Pp
39 The options are as follows:
40 .Bl -tag -width 14m
41 .It Fl c Ar config
42 Specifies the configuration file.
43 The default is
44 .Pa /etc/gmid.conf .
45 .It Fl D Ar macro Ns = Ns Ar value
46 Define
47 .Ar macro
48 to be set to
49 .Ar value
50 on the command line.
51 Overrides the definition of
52 .Ar macro
53 in the config file if present.
54 .It Fl f
55 Stays and logs on the foreground.
56 .It Fl h , Fl -help
57 Print the usage and exit.
58 .It Fl n
59 Check that the configuration is valid, but don't start the server.
60 If specified two or more time, dump the configuration in addition to
61 verify it.
62 .It Fl P Ar pidfile
63 Write daemon's pid to the given location.
64 .Ar pidfile
65 will also act as lock: if another process is holding a lock on that
66 file,
67 .Nm
68 will refuse to start.
69 .It Fl V , Fl -version
70 Print the version and exit.
71 .It Fl v
72 Verbose mode.
73 Multiple
74 .Fl v
75 options increase the verbosity.
76 .El
77 .Sh LOGGING
78 Messages and requests are logged by
79 .Xr syslog 3
80 using the
81 .Dv DAEMON
82 facility or printed on
83 .Em stderr .
84 .Pp
85 Requests are logged with the
86 .Dv NOTICE
87 severity.
88 Each request log entry has the following fields, separated by
89 whitespace:
90 .Pp
91 .Bl -bullet -compact
92 .It
93 Client IP address and the source port number, separated by a colon
94 .It
95 .Sy GET
96 keyword
97 .It
98 Request URL
99 .It
100 Response status
101 .It
102 Response meta
103 .El
104 .Sh EXAMPLES
105 To run
106 .Nm
107 a configuration file and a X.509 certificate must be provided.
108 A self-signed certificate, which are commonly used in the Geminispace,
109 can be generated using for e.g.\&
110 .Xr openssl 1 :
111 .Bd -literal -offset indent
112 # openssl req \-x509 \-newkey rsa:4096 \-nodes \e
113 \-keyout /etc/ssl/private/example.com.key \e
114 \-out /etc/ssl/example.com.pem \e
115 \-days 365 \-subj "/CN=example.com"
116 # chmod 600 /etc/ssl/example.com.crt
117 # chmod 600 /etc/ssl/private/example.com.key
118 .Ed
119 .Pp
120 Then
121 .Nm
122 can be started with
123 .Bd -literal -offset indent
124 # gmid -c /etc/gmid.conf
125 .Ed
126 .Sh SEE ALSO
127 .Xr gmid.conf 5
128 .Sh ACKNOWLEDGEMENTS
129 .Nm
130 uses the
131 .Dq Flexible and Economical
132 UTF-8 decoder written by
133 .An Bjoern Hoehrmann .
134 .Sh AUTHORS
135 .An -nosplit
136 The
137 .Nm
138 program was written by
139 .An Omar Polo Aq Mt op@omarpolo.com .
140 .Sh CAVEATS
141 .Bl -bullet
142 .It
143 All the root directories are opened during the daemon startup; if a
144 root directory is deleted and then re-created,
145 .Nm
146 won't be able to serve files inside that directory until a restart.
147 This restriction only applies to the root directories and not their
148 content.
149 .It
150 a %2F sequence is indistinguishable from a literal slash: this is not
151 RFC3986-compliant.
152 .It
153 a %00 sequence is treated as invalid character and thus rejected.
154 .El