a small web server
Go to file
tjp b36a7be80f split up documentation into README and REFERENCE 2023-12-29 12:19:28 -07:00
.gitignore first .gitignore 2023-09-08 14:54:58 -06:00
LICENSE.txt Initial commit. 2023-09-08 14:54:53 -06:00
README.gmi split up documentation into README and REFERENCE 2023-12-29 12:19:28 -07:00
README.md split up documentation into README and REFERENCE 2023-12-29 12:19:28 -07:00
REFERENCE.gmi split up documentation into README and REFERENCE 2023-12-29 12:19:28 -07:00
REFERENCE.md split up documentation into README and REFERENCE 2023-12-29 12:19:28 -07:00
auth.go config file refactor 2023-10-09 08:47:37 -06:00
example.conf move 'auth' to a modifier 2023-10-31 11:15:08 -06:00
finger.go support server TLS in gopher and finger 2023-10-10 16:53:51 -06:00
gemini.go minor optimization for git routes 2023-11-14 21:48:48 -07:00
go.mod bump dependencies 2023-11-14 21:54:41 -07:00
go.sum bump dependencies 2023-11-14 21:54:41 -07:00
gopher.go minor optimization for git routes 2023-11-14 21:48:48 -07:00
logging.go fixes and adjusting to a sliderule bump 2023-11-14 15:47:13 -07:00
main.go config file refactor 2023-10-09 08:47:37 -06:00
nex.go add support for syw git views on nex 2023-11-14 21:50:15 -07:00
parse.go add support for syw git views on nex 2023-11-14 21:50:15 -07:00
privdrop.go config file refactor 2023-10-09 08:47:37 -06:00
routes.go initial support for nex protocol 2023-11-14 18:58:06 -07:00
servers.go initial support for nex protocol 2023-11-14 18:58:06 -07:00
spartan.go minor optimization for git routes 2023-11-14 21:48:48 -07:00
types.go move 'auth' to a modifier 2023-10-31 11:15:08 -06:00
userpath.go config file refactor 2023-10-09 08:47:37 -06:00

README.md

sr-71, a small web server

                                 ,
                                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:

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.

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:

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

=> More information is in the reference documentation