Commit Graph

46 Commits

Author SHA1 Message Date
Alex Kotov 2068c3b02a Allow to disable directory listing
Signed-off-by: Solderpunk <solderpunk@posteo.net>
2023-08-20 14:30:51 +02:00
Solderpunk efde852c54 Refactor rate limiting to have soft and hard limits, block clients exceeding hard limits for one hour. 2023-03-18 16:40:23 +01:00
Solderpunk a6170a355d Make rate limiting configurable. 2023-03-17 19:52:39 +01:00
Solderpunk 81b4f1dcc0 Fix small variable name error. 2023-02-27 08:35:11 +01:00
Solderpunk eefb1bc3a6 Further simplifications of config parsing code. 2023-02-26 19:42:30 +01:00
Solderpunk eb85a6e94c Another big refactor, splitting the Config struct in two.
The split reflects that between variables which can and cannot be
overridden by .molly files, and this greatly simplifies the
processing of said files, getting rid of the need for lots of
ugly temporary variable thrashing.
2023-02-25 11:29:13 +01:00
Solderpunk d67f896b84 Add AllowTLS12 option to switch minimum TLS version between 1.2 and 1.3. 2023-02-23 19:31:16 +01:00
Solderpunk 212c9f79fb A rather extensive refactor.
Basically the function formerly known as do_main() in main.go has
been renamed launch() and moved into launch.go.  Now there are
main.go and main_unix.go files implementing minmial main()
functions which load a config and pass it to launch.  This allows
separating unix-specific security stuff (both the actual system
calls which won't compile on other platforms and the definition
of command line switches) out from the platform agnostic
implementation of the main server logic.  It also simplifies the
interaction of relative paths in config files with chrooting.

Docs still need updating...
2023-02-23 18:49:15 +01:00
Solderpunk 7a89b307a1 Just use the log package's default logger as the error log. 2023-02-19 15:04:34 +01:00
Solderpunk 182e58ffe3 Make unprivileged user configurable, thanks nervuri! (see issue #16) 2023-02-15 21:16:49 +01:00
Solderpunk c0c67f7ba6 Whoops, don't ignore error from filepath.Abs. 2023-02-15 21:15:14 +01:00
Solderpunk 8372142843 Add support for chroot()ing server early after startup, more work toward issue #16. 2023-02-15 21:10:22 +01:00
Solderpunk 5258b29c6b Big ol' gofmt. 2023-02-10 17:19:21 +01:00
Solderpunk b16fe0b8d4 Absolutise DocBase before trying to absolutise anything else relative to it. 2023-02-08 20:32:17 +01:00
Solderpunk 443bfd4bbd Change to error logging behaviour (stderr instead of stdout, by default). 2023-02-07 19:33:14 +01:00
Solderpunk 8541b6194b Resolve non-absolute values of CGIPaths relative to DocBase. Closes #24. 2023-02-05 16:54:07 +01:00
Solderpunk 8446885f56 Rename DirectoriesFirst option to DirectorySubdirsFirst and document in README. 2023-02-05 14:35:29 +01:00
Russ Magee 67d509a234 Sort directory listings with directories before files 2023-02-05 13:36:16 +01:00
Solderpunk a41898b012 Add DefaultEncoding option to config/.molly files. Closes #19. 2023-01-29 12:07:52 +01:00
Solderpunk f05bab2b73 Make test of request URL hostname against configured hostname case insensitive. Closes #29. 2023-01-28 19:22:31 +01:00
Solderpunk 16ed9e5cff Allow redirects to other hosts. Closes #26. 2023-01-28 19:16:11 +01:00
Solderpunk 2e510328ef Fix serious bug whereby config changes made in .molly files apply everywhere and persist until server restart! 2020-07-06 19:08:03 +02:00
Solderpunk 37e177fbe0 Move .molly file parsing function into config.go. 2020-07-01 23:05:49 +02:00
Solderpunk f4f14320df Expand CGI path globs once on startup, not for each request. 2020-07-01 16:18:49 +02:00
Solderpunk fd31094cb6 Allow .molly files to set certificate zones. 2020-06-30 20:39:26 +02:00
Solderpunk 702cc73a63 Add redirect members to Molly File struct. Should have been part of an earlier commit! 2020-06-30 20:38:46 +02:00
Solderpunk 4dbe52adf8 Permit .molly files to specify MIME overrides. 2020-06-30 17:01:19 +02:00
Solderpunk 18c056167f Make it possible to toggle handling of .molly files on and off via main config. 2020-06-29 17:17:43 +02:00
Solderpunk 77691d6983 Introduce error log. 2020-06-28 18:34:50 +02:00
Solderpunk 31161cf21c Permit multiple authorised certificates per zone. 2020-06-28 14:47:36 +02:00
Solderpunk a0dacf4bbd Basic implementation of certificate zones - only one authorised cert per zone. 2020-06-28 13:47:30 +02:00
Solderpunk 5377c2941f Allow overriding MIME types based on path regexes. 2020-06-28 00:12:32 +02:00
Solderpunk a07645dd2e Allow overriding directory listing options with .molly files. 2020-06-27 23:44:15 +02:00
Solderpunk 7066bad570 Use headings in .gmi files instead of filenames in directory listings. 2020-06-27 22:57:03 +02:00
Solderpunk 3f98a9edf1 Permit sorting of files in automatic directory listings by various factors. 2020-06-27 18:52:29 +02:00
Solderpunk b0b18971f4 Run gofmt on everything for the first time ever! 2020-06-10 21:31:13 +02:00
Solderpunk 3e80488f92 Add DefaultLang config variable to set text/gemini lang parameter. Overridable via .molly file. 2020-06-10 21:22:15 +02:00
Solderpunk cb1e0da7d5 Read .molly files from parent directories of served file, permitting overrides to text/gemini file extension. 2020-06-10 20:40:13 +02:00
Solderpunk b8034c1576 Make text/gemini extension configurable. 2020-06-08 21:47:33 +02:00
Solderpunk 4681d3f971 Support multiple CGI paths. 2020-06-08 21:46:39 +02:00
Solderpunk 301d3409f1 Support temporary and permanent redirects. 2020-06-08 19:59:16 +02:00
Solderpunk 11beddcfb1 Add rudimentary support for specifying redirects. 2020-06-06 13:36:10 +02:00
Solderpunk 920f06597f Stub implementation of SCGI. 2020-06-04 20:41:40 +02:00
Solderpunk db4ff190be Fix default port. 2020-03-24 22:05:26 +01:00
Solderpunk 8239e7fd3f Limit CGI processes to a particular path. 2020-01-12 13:39:38 +01:00
Solderpunk 0ddf8ca2ae Initial bare bones implementation. 2019-11-06 17:08:44 +02:00