Commit Graph

141 Commits

Author SHA1 Message Date
Omar Polo 8aba5d8b21 remove dead code 2024-03-12 14:10:36 +00:00
Omar Polo f862d389ff turn log styles into strings from yacc point of view
having styles as reserved keywords means that variables / macros can't
be called `common', `condensed', etc...  which is not great and not
obvious either.

Instead, let's keep the log styles as strings and match on them.  This
also allows to have a slightly better error message in case of a typo.

See: https://codeberg.org/op/gmid/issues/1
2024-01-30 09:30:50 +00:00
Omar Polo 574f71f7a3 remove stray space 2024-01-30 09:28:54 +00:00
Omar Polo ddb089c157 rework the grammar so that ; is accepted after variables and options
See Codeberg issue #1.
2024-01-26 16:54:58 +00:00
Omar Polo d8df67565c fix missing listen on warning
printed the wrong value for the hostname
2024-01-11 13:18:15 +00:00
Omar Polo 7bbf17a857 plug a leak
all other rules are freeing the value of `listen_addr'
2023-08-25 12:19:49 +00:00
Omar Polo c2c051f28e fix automatic guessing of `listen on'
default_host needs to be NULL for getaddrinfo(3) to listen on
everything.
2023-08-25 12:19:00 +00:00
Omar Polo 03d671e2aa implement fastcgi strip number 2023-08-08 17:35:11 +00:00
Omar Polo 9abba172b6 add `log syslog facility' to use a different syslog(3) facility
Was requested ages ago by Karl Jeacle, now that there is some better
support for configuring the logging there's no excuse to add this.
It helps with filtering from syslog.d / syslog.conf.
2023-08-07 09:34:19 +00:00
Omar Polo 3a93c90445 sort logopt 2023-08-07 09:08:23 +00:00
Omar Polo 46bcc4ea95 add log syslog off; don't turn syslog off when log access is specified 2023-07-26 08:10:12 +00:00
Omar Polo 82947e8be7 typo 2023-07-25 20:18:44 +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 226f13ece0 add ability to log to files with log access <path> 2023-07-24 08:50:49 +00:00
Omar Polo 3d56cb5336 fix a reduce/reduce conflict
location -> error and locopt -> fastcgi -> error both end up with
a optnl that can be reduced to the empty string.
2023-07-23 19:11:09 +00:00
Omar Polo 6a8387e5f5 add `fastcgi off' to forceful skip fastcgi for a route 2023-07-23 19:04:37 +00:00
Omar Polo a1ba9650a9 revamp fastcgi configuration: make it per-location
this revamps the syntax in the configuration to better match httpd(8)
(and in general be less weird) and to allow per-location fastcgi
configurations.

the bare `param' is now deprecated, but for compatibility it acts
like `fastcgi param' would do now.  Same story for `fastcgi <pathÂ>'.
2023-07-23 18:45:05 +00:00
Omar Polo 0995ecdb87 plug memleak 2023-07-23 17:43:27 +00:00
Omar Polo 911156fb95 make `listen on' defaults on port 1965 2023-06-29 15:01:16 +00:00
Omar Polo eac9287d29 copyright years++ 2023-06-24 10:07:17 +00:00
Omar Polo a7a998ac9b fix `listen on *' 2023-06-23 21:59:11 +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 55b74a9691 remove the new_*() declarations that were moved to utils.c 2023-06-23 21:03:24 +00:00
Omar Polo fc2d207c79 use host->domain to report errors, $2 is free'd 2023-06-23 16:23:59 +00:00
Omar Polo 8af9da9843 fix the build with some yacc implementations 2023-06-13 11:00:07 +00:00
Omar Polo 5af19830c3 move print_conf and make it take the config as argument 2023-06-09 17:29:52 +00:00
Omar Polo 792f302ace use fatal/fatalx instead of err/errx in daemon code 2023-06-09 17:27:41 +00:00
Omar Polo 68368f4c29 parse_conf: don't die on error, return -1
this avoids having the daemon dieing on SIGHUP with a bad config
file.
2023-06-09 17:24:37 +00:00
Omar Polo af1dab1870 don't have the config being a global 2023-06-09 17:18:04 +00:00
Omar Polo e45334e6ae move hosts into the config struct 2023-06-09 16:54:04 +00:00
Omar Polo 5d22294a59 move fastcgi from global var to the config struct
while here also make them a list rather than a fixed-size array.
2023-06-09 10:42:36 +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 1c6967b33a keep cert/key/ocsp path as strings and don't send them via imsg 2023-06-08 19:34:49 +00:00
Omar Polo fc9cc497e0 move some new_* functions from parse.y to utils.c 2023-06-08 15:59:53 +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 2dd5994ae1 use fatal() in code used in the daemon 2023-06-06 11:52:43 +00:00
Omar Polo eae52ad493 switch to the more usual log.c 2023-06-06 11:46:40 +00:00
Omar Polo 3a8c76eab2 rename PROC_MAX to PREFORK_MAX 2023-06-06 08:34:31 +00:00
Omar Polo df5058c919 provide a more usual fatal
fatal usually appends the error string.  Add 'fatalx' that doesn't.
Fix callers and move the prototypes to log.h
2023-06-05 17:07:52 +00:00
Omar Polo 1e0b974519 send capsicum/landlock/seccomp hack to Valhalla 2023-05-08 10:27:32 +00:00
Omar Polo e92efb0d8e don't crash when specifying fcgi UNIX sockets to connect to 2022-11-27 10:05:56 +00:00
Omar Polo 7b00c8900b remove the last tentacles of the hidden `span' fcgi feature 2022-10-05 15:30:22 +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 4ceb570910 remove stale comment 2022-10-05 10:53:43 +00:00
Omar Polo 9715efe6f3 retire fcgi' prog field
spawning programs was a hidden feature used only for testing.  It's
gross and when got removed, I forgot to remove the field as well.
2022-10-05 10:41:54 +00:00
Omar Polo edc5ca667d properly initialize the TAILQs at vhost creation 2022-09-10 10:12:37 +00:00
Omar Polo 2025e96d97 drop cgi vestiges from the struct host
The `env' list is no longer used since CGI scripts were removed
2022-09-10 09:48:30 +00:00
Omar Polo cd5826b8ba retire the deprecated `mime' and `map' config options 2022-09-10 09:43:57 +00:00
Omar Polo aa9543b9fd make the mime types fixed-sized too 2022-09-10 09:40:05 +00:00
Omar Polo 7277bb7dc2 make config fields `chroot' and `user' fixed-size 2022-09-10 09:21:09 +00:00