Commit Graph

149 Commits

Author SHA1 Message Date
Omar Polo 42235e3fc2 add a test for the config dumping 2024-04-04 13:07:09 +00:00
Omar Polo bb5a25d287 rename the @common_opt macro back to @common
now common is no longer a reserved keyword
2024-01-30 09:31:09 +00:00
Omar Polo 3524375abe add a test that uses @-style macros
See Codeberg issue #1.
2024-01-26 15:34:46 +00:00
Omar Polo 80745f0411 regress: change naming scheme for certs, add GENCERT_FLAGS knob
Call the certificates .pem and the keys .key; use contrib/gencert
to generate the certificates and provide a GENCERT_FLAGS knob so
that regress can be run with EC keys (GENCERT_FLAGS=-e).  Still no
automatic way of testing with both RSA and EC keys.
2023-08-29 09:30:28 +00:00
Omar Polo f9ab77a898 bundle libtls
gmid (like all other daemons that want to do privsep crypto) has a
very close relationship with libtls and need to stay in sync with
it.

OpenBSD' libtls was recently changed to use OpenSSL' EC_KEY_METHOD
instead of the older ECDSA_METHOD, on the gmid side we have to do
the same otherwise failures happens at runtime.  In a similar manner,
privsep crypto is silently broken in the current libretls (next
version should fix it.)

The proper solution would be to complete the signer APIs so that
applications don't need to dive into the library' internals, but
that's a mid-term goal, for the immediate bundling the 'little'
libtls is the lesser evil.

The configure script has gained a new (undocumented for the time
being) flag `--with-libtls=bundled|system' to control which libtls
to use.  It defaults to `bundled' except for OpenBSD where it uses
the `system' one.  Note that OpenBSD versions before 7.3 (inclusive)
ought to use --with-libtls=bundled too since they still do ECDSA_METHOD.
2023-08-23 17:38:49 +00:00
Omar Polo 56054fe197 use the legacy style in the tests for now 2023-08-03 22:37:05 +00:00
Omar Polo f736c9579c fix test after log style condensed change 2023-08-03 22:35:49 +00:00
Omar Polo 98827de5ab use `log syslog off' in regress to avoid spamming syslog 2023-07-26 08:11:39 +00:00
Omar Polo a84492b75f ge->gemexp forgotten in previous 2023-07-25 20:27:31 +00:00
Omar Polo 471a5250e3 rename ge -> gemexp in regress too 2023-07-25 20:26:26 +00:00
Omar Polo abd261d25b allow to change the logging style; introduce some new ones
add `log style <style>'; The old default is called `legacy' now, a
new default format is added called `condensed', and `common' and
`combined' to mimick Apache httpd and nginx (respectively) are also
added.
2023-07-25 20:07:26 +00:00
Omar Polo 60b4efa1e2 add a test for the file logging 2023-07-24 08:51:35 +00:00
Omar Polo 60f4107da6 add a test with fastcgi, locations and forceful disabling 2023-07-23 19:04:53 +00:00
Omar Polo fdd67729b4 adjust syntax in fastcgi test; add another test for the old syntax 2023-07-23 18:45:43 +00:00
Omar Polo 2247b66842 improve fcgi test: send more than one chunk of data 2023-07-01 18:38:22 +00:00
Omar Polo 57ee9057af add some ideas 2023-07-01 14:11:21 +00:00
Omar Polo 5a34572282 use REGRESS_HOST to specify the host to listen to; use in CI
some CI envs don't like `listen on localhost' but tolerate INADDR_ANY
or IN6ADDR_ANY_INIT.
2023-06-23 22:00:21 +00:00
Omar Polo 509d0509a5 implement `listen on'
Listening by default on all the addresses is so bad I don't know
why I haven't changed this before.  Anyway.

Add a `listen on $hostname port $port' syntax to the config file
and deprecate the old "port" and "ipv6" global setting.  Still try
to honour them when no "listen on" directive is used for backward
compatibily, but this will go away in the next next version hopefully.

At the moment the `listen on' in server context don't filter the
host, i.e. one can still reach a host from a address not specified
in the corresponding `liste on', this will be added later.
2023-06-23 21:03:29 +00:00
Omar Polo 1959cda3d8 more avoiding of void pointer arithmetics
This time with a temporary variable to avoid not to trigger
-Wpointer-sign, sigh.
2023-06-13 17:36:42 +00:00
Omar Polo 1610f9541d rework the configure script
now it resembles less oconfigure and more the configure scripts I'm
using in my recent projects.  I'd argue it's more easy to use it.
2023-06-13 16:36:10 +00:00
Omar Polo 611dffe816 remove regress/sha
we can use cmp to tell if two files are different, which also has
the benefit of being available everywhere and reporting the byte
offset of the first difference.  Reduces the test dependencies on
some systems.
2023-06-13 10:59:50 +00:00
Omar Polo 94893746ae use the default prefork in tests 2023-06-12 21:28:28 +00:00
Omar Polo af1dab1870 don't have the config being a global 2023-06-09 17:18:04 +00:00
Omar Polo d273c0648d ignore and clean fcgi.sock 2023-06-09 10:51:24 +00:00
Omar Polo fe7cdaa479 fcgi-test: be less verbose 2023-06-09 10:47:20 +00:00
Omar Polo 9adeb26579 re-establish fastcgi test 2023-06-09 10:46:50 +00:00
Omar Polo cd1ede6dd3 rework fcgi-test so that it binds a local socket
still not re-enabled.
2023-06-09 10:39:05 +00:00
Omar Polo deadd9e131 readd proxy certs and `require client ca' support
Was temporarly disabled during the transition to real privsep.
While here, fix a memory leak when using `require client ca'.

Also, avoid leaking info about the parent address space layout to
server processes by not sending pointer values.
2023-06-09 09:28:26 +00:00
Omar Polo 797c4609a9 make ge work again 2023-06-08 16:22:03 +00:00
Omar Polo c26f2460e4 rework the daemon to do fork+exec
It uses the 'common' proc.c from various OpenBSD-daemons.

gmid grew organically bit by bit and it was also the first place where I
tried to implement privsep.  It wasn't done very well, in fact the
parent process (that retains root privileges) just fork()s a generation
of servers, all sharing *exactly* the same address space.  No good!

Now, we fork() and re-exec() ourselves, so that each process has a fresh
address space.

Some features (require client ca for example) are temporarly disabled,
will be fixed in subsequent commits.  The "ge" program is also
temporarly disabled as it needs tweaks to do privsep too.
2023-06-08 13:59:31 +00:00
Omar Polo 99f1fbb0c7 regress: use -P with an absolute path 2023-06-08 13:56:09 +00:00
Omar Polo 3a8c76eab2 rename PROC_MAX to PREFORK_MAX 2023-06-06 08:34:31 +00:00
Omar Polo 0ac785a6fa revert aae8f6bf2b
it's just not worth it to inflict this breaking change to the users.
2023-06-05 20:35:12 +00:00
Omar Polo a4180f1d0b disable test_unknown_host temporarly
breaks on some distro and needs further investigations; it's not that
interesting fortunately.
2022-10-31 22:53:16 +00:00
Omar Polo 4b93be289b rework `make dist' 2022-10-31 22:53:16 +00:00
Omar Polo 534afd0ddc make the various strings in the config fixed-length
will help in future restructuring to have fixed-size objects.
2022-10-05 15:10:44 +00:00
Omar Polo 7bb80ca90d don't count twice the failing tests on gmid crash 2022-09-10 10:12:50 +00:00
Omar Polo aae8f6bf2b change the flags to be consistent with other OpenBSD daemons
-d is `debug' (run in the foreground)
 -f to load the configuration file

adjust regress and contrib accordingly
2022-09-08 21:34:29 +00:00
Omar Polo a5fb2593a9 adjust regress to use `ge' for the old configless test 2022-09-08 20:45:12 +00:00
Omar Polo d29a2ee224 get rid of the CGI support
I really want to get rid of the `executor' process hack for CGI scripts
and its escalation to allow fastcgi and proxying to work on non-OpenBSD.

This drops the CGI support and the `executor' process entirely and is
the first step towards gmid 2.0.  It also allows to have more secure
defaults.

On non-OpenBSD systems this means that the sandbox will be deactivated
as soon as fastcgi or proxying are used: you can't open sockets under
FreeBSD' capsicum(4) and I don't want to go thru the pain of making it
work under linux' seccomp/landlock.  Patches are always welcome however.

For folks using CGI scripts (hey, I'm one of you!) not all hope is lost:
fcgiwrap or OpenBSD' slowcgi(8) are ways to run CGI scripts as they were
FastCGI applications.

fixes for the documentation and to the non-OpenBSD sandboxes will
follow.
2022-09-06 16:11:09 +00:00
Omar Polo 5df699d1ab count ran/failed tests number 2022-08-29 16:44:07 +00:00
Omar Polo d45d5306e3 fix test_auto_index 2022-07-04 14:33:45 +00:00
Omar Polo 96e3c01314 refactor the makefile / configure
steal more (good) stuff from mandoc-portable :)
2022-07-04 13:44:38 +00:00
Omar Polo a555e0d67b copyright years 2022-07-04 09:48:39 +00:00
Omar Polo 617ae38546 add some more regress for the encodings 2022-07-04 09:36:55 +00:00
Omar Polo 475205fa0f check for the expected page in test_auto_index
not just the number of lines, check the full page!
2022-07-04 09:36:31 +00:00
Omar Polo 5e41063f1b bugfix: allow @ and : in paths
gmid would disallow the '@' and ':' characters in paths (unless
percent-encoded.)  Issue reported by freezr.
2022-07-04 08:15:39 +00:00
Omar Polo 93cab6dc78 document the implicit mapping for text/gemini
and remove the explicit mapping from the documentation and test files.
2022-04-08 15:36:59 +00:00
Omar Polo fde8750859 fix test_include_mime after `types' change 2022-04-08 13:52:48 +00:00
Omar Polo 9448a01fdb use the types block instead of `map' in the tests too 2022-04-07 16:21:56 +00:00