Commit Graph

126 Commits

Author SHA1 Message Date
Omar Polo 7b2d743260 move pidfile & cgi to global vars 2021-05-01 12:17:42 +00:00
Omar Polo fdea6aa0bc allow ``root'' rule to be specified per-location block 2021-04-30 17:16:34 +00:00
Omar Polo cc8c2901ad added ``alias'' option to define hostname aliases for a server 2021-04-29 18:23:35 +00:00
Omar Polo 8e8b2e252c pidfile support with `-P pidfile' 2021-04-28 12:45:22 +00:00
Omar Polo 48b69cb2dc fix some logging
- we can't use log_* or fatal() before logger_init
- err -> errx if errno isn't involved
2021-04-28 12:43:17 +00:00
Omar Polo 9cc630aa63 added ``env'' option to define environment vars for CGI scripts 2021-04-28 12:43:17 +00:00
Omar Polo 419a423520 keep verbosity level after config reload 2021-04-28 12:42:36 +00:00
Omar Polo 1b333122a9 typo 2021-04-26 20:58:06 +00:00
Omar Polo 5d1474a561 typo in comment 2021-04-20 09:53:33 +00:00
Omar Polo 3841a36930 restore signal handlers before exec'ing CGI scripts 2021-04-20 09:53:03 +00:00
Omar Polo b8e64ccd44 list instead of fixed-size array for vhosts and locations
saves some bytes of memory and removes the limit on the maximum number
of vhosts and location blocks.
2021-03-31 16:32:18 +00:00
Omar Polo 7e1df73d7d fix mkdirs: create directories recursively 2021-03-31 13:56:58 +00:00
Omar Polo 8e09ee1d50 typo 2021-03-20 10:48:11 +00:00
Omar Polo b9c9123b8e fix signal handling so it works on linux too
it seems that linux calls the signal handlers even when we're waiting
on sigwait for that signal.  Work around that.
2021-03-20 10:43:23 +00:00
Omar Polo d632468df5 fix correct shutdown after SIG{INT,TERM} 2021-03-20 09:23:53 +00:00
Omar Polo 1d3eb470b0 quit every process cleanly when receiving SIGINT or SIGTERM 2021-03-20 08:51:17 +00:00
Omar Polo bc99d868bc refactoring: imsg everywhere
use imsg to handle ALL kinds of IPC in gmid.  This simplifies and shorten the
code, and  makes everything more uniform too.
2021-03-19 19:21:29 +00:00
Omar Polo dbe262a45d split usage string into two lines 2021-03-03 17:51:42 +00:00
Omar Polo 2c3e53dac6 give each server process its own socket for the executor
this fixes a bug introduced with the prefork mechanics: every server
process shared the same socket, and this would cause a race condition
when multiple server processes asked for a script cgi being executed.

This gives each server process its own socket to talk to the executor,
so the race cannot happen.
2021-03-03 17:22:01 +00:00
Omar Polo 376a540764
move log_init & vars to gmid.c, retain logger_main in log.c
this is to let the regression suite compile
2021-02-23 13:44:20 +01:00
Omar Polo d278a0c3c5
moving logging to its own process 2021-02-23 13:40:59 +01:00
Omar Polo 52418c8d82 fix various compilation errors
Include gmid.h as first header in every file, as it then includes
config.h (that defines _GNU_SOURCE for instance).

Fix also a warning about unsigned vs signed const char pointers in
openssl.
2021-02-12 12:47:20 +00:00
Omar Polo aa37287565 add newline after usage 2021-02-10 17:58:43 +00:00
Omar Polo df58efff26 fix seccomp for the new event loop
add/remove syscalls from the BPF filter and move sandbox() after
libevent initialisation
2021-02-08 12:46:46 +00:00
Omar Polo 3abf91b0b4 improve logs management 2021-02-07 15:30:28 +00:00
Omar Polo a709ddf5eb added prefork option 2021-02-07 12:05:32 +00:00
Omar Polo e3ddf39095 add the ``entrypoint'' option 2021-02-06 18:28:43 +00:00
Omar Polo 6abda252e9 added ``block return'' and ``strip'' options 2021-02-06 17:22:37 +00:00
Omar Polo 102d2e9cce missing argument for LOGI 2021-02-04 18:09:42 +00:00
Omar Polo 9543e3fbaf avoid race-condition
what if we receive a SIGHUP right after unblock_signal (or during the
whole block_signals...unblock_signals) but *before* the wait_sighup?
Yeah.
2021-02-04 18:09:30 +00:00
Omar Polo ca21e10043 reload configuration on SIGHUP 2021-02-04 13:23:15 +00:00
Omar Polo e824d03efa drop unnecessary check around close 2021-02-03 16:53:34 +00:00
Omar Polo 4e2e2ab1d3 refactor executor_main
now it's symmetrical to listener_main().
2021-02-03 16:37:53 +00:00
Omar Polo d672b8fba1 refactoring startup logic 2021-02-03 16:28:00 +00:00
Omar Polo 9edb828251 drop privileges after the fork 2021-02-03 14:13:32 +00:00
Omar Polo 3c680bddab configless: fixing the case of the implicit "."
I got bitten by the scope visibility rules.  After the end of the
block, the path variable is no longer valid, and in fact later
load_vhosts fails to open that (because the buffer gets invalidated)
2021-02-02 09:30:24 +00:00
Omar Polo bcf5d929e6 ensure absolute paths in config-less mode 2021-02-01 11:07:57 +00:00
Omar Polo 8503a1431d set cloexec status on the socketpair fds
the executor forks to spawn the cgi scripts, and they inherit the
socket for communication with the listener process.  Make that
impossible.
2021-01-31 11:07:12 +00:00
Omar Polo ef0f2ae88c remove unused function 2021-01-28 14:21:57 +00:00
Omar Polo 8904fa0e64 -v for verbose logging 2021-01-27 23:14:16 +00:00
Omar Polo 13ed2fb63f improve configuration parsing error 2021-01-27 16:45:45 +00:00
Omar Polo b736ca35f2 drop unused variable 2021-01-27 15:35:55 +00:00
Omar Polo 44ee1bac8b use starts_with in puny.c 2021-01-27 15:35:09 +00:00
Omar Polo 72bbed9136 make configless mode works again. also accept every host 2021-01-27 15:00:55 +00:00
Omar Polo 46af8c6cfe drop the daemon config in favour of the -f flag
Now it daemonize by default when running with a config, unless the -f
flag is given.
2021-01-27 12:04:37 +00:00
Omar Polo 3300cbe06a initial punycode support 2021-01-27 10:47:49 +00:00
Omar Polo 390a611893 sane defaults for the config-less mode 2021-01-27 10:43:55 +00:00
Omar Polo 8443bff77a rework the configless mode: change flags and generate certs 2021-01-25 14:08:31 +00:00
Omar Polo ae08ec7da5 chroot & drop privileges 2021-01-25 10:30:07 +00:00
Omar Polo 2030e31486 order 2021-01-25 09:45:09 +00:00