summaryrefslogtreecommitdiff
path: root/README.gmi
blob: 3f0ce666cdd06180c93ff2e729c6f20cce1a7c45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# sr-71, a small web server

```ASCII art of an SR-71 Blackbird
                                 ,
                                dMb,
                              ,dMMMMb,          ,,
                           ,dMMMMMMMMMb, eeee8888"
                        ,mMMm!!!!XXXXMMMMM"""
                      ,d!!XXMMXX88888888W"
                     `MX88dMM8888WWWMMMMMMb,
                         '""MMMMMMMMMMMMMMMMb
                           MMMMMMMMMMMMMMMMMMb,
                          dMMMMMMMMMMMMMMMMMMMMb,,
              _,dMMMMMMMMMMXXXX!!!!!!!!!!!!!!XXXXXMP
         _,dMMXX!!!!!!!!!!!!!!!!!!XXXXX888888888WWC
     _,dMMX!!!MMMM!!!!!!!!XXXXXX888888888888WWMMMMMb,
    dMMX!!!!!MMM!XXXXXX88888888888888888WWMMMMMMMMMMMb
   dMMXXXXXX8MMMM88888888888888888WWWMMMMMMMMMMMMMMMMMb    ,d8
   MMMMWW888888MMMMM8888888WWMMMMMMMMMMMMMMMMMMMMMMMMMMM,d88P'
    YMMMMMWW888888WWMMMMMMMMMMP"""'    `"YMMMMMMMMMMMXMMMMMP
       `""YMMMMMMMMMMMMMP""'            mMMMm!XXXXX8888888e,
                                      ,d!!XXMM888888888888WW
                                     "MX88dMM888888WWWMMMMMMb
                                          """``'"YMMMMMMMYMMM
                                                     `"YMMMMM
                                                        `"YMP
```

The last airplane designed without the use of electronic calculators, the SR-71 was developed from concept to first flight in just over 2 years. It flew higher and faster than any jet of its time holding the speed record to this day, and pioneered low-observability (stealth) characteristics.

This sr-71 project is a small web server, able to host your pages on the gemini, gopher, spartan, nex, and finger protocols.

## Getting it

sr-71 is a single-package go project, so using the go toolchain installing is as simple as:

```shell command to install sr-71
go install tildegit.org/tjp/sr-71@latest
```

Currently binaries are not made available for download, so the go command is a requirement.

## Running it

sr-71 requires a configuration file, the path of which is provided as the only command-line argument.

```shell command to start an sr-71 server
sr-71 /path/to/sr71.conf
```

## Highlights

sr-71 isn't just a multi-protocol static file server. It also features:
* virtualhosting on protocols which support it
* SNI support when virtualhosting with TLS
* CGI
* extensions to the gophermap format borrowed from gophernicus
* automatic generation of atom resources from subscribable gemini pages
* privilege dropping
* client TLS certificate authentication
* support for titan (the gemini "write" companion protocol) with separately-configurable auth
* git repository viewers with overridable templates
* user-specific paths for shared hosting environments

## Configuration File

The format of the config file is designed to be straightforward, and human-readable and -writable.

Here's a simple configuration that would get you off the ground:

```example of an sr-71 config file
systemuser nobody

gemini {
	host myhostname.com, gemini.myhostname.com
	servertls key /path/to/tls/keyfile cert /path/to/tls/certfile

	static /var/gemini at / with dirdefault index.gmi, dirlist
}

gopher {
	host myhostname.com

	static /var/gopher at / with dirdefault gophermap, dirlist, extendedgophermap
}

spartan {
	host myhostname.com

	static /var/spartan at / with dirdefault index.gmi, dirlist
}

finger {
	static ~/.finger
}
```

With the above configuration, sr-71 will:
* drop privileges to the "nobody" user
* respond to any gemini requests to the domains myhostname.com or gemini.myhostname.com by reading files out of /var/gemini
* for gemini directory requests, it will first look for an index.gmi file, then fall back to listing the directory's contents in gemtext
* serve gopher by reading out of /var/gopher
* for gopher directory requests, it will look for a file called "gophermap", then fall back to listing the contents as gopher menu
* for any gopher files, it will apply the "extended gophermap" parsing (see REFERENCE.gmi)
* serve spartan by reading files from /var/spartan (perhaps imagine this being a symlink to /var/gemini)
* serve spartan directory requests by looking for index.gmi and falling back to a directory listing
* serve finger requests by reading a ".finger" file in the requested user's home directory

=> ./REFERENCE.gmi More information is in the reference documentation