aboutsummaryrefslogtreecommitdiff
path: root/gmid.c
AgeCommit message (Collapse)Author
2024-08-03main_reload: save and restore preforkOmar Polo
We only honour the prefork at startup time.
2024-08-03fmtOmar Polo
2024-07-06remove debug logOmar Polo
2024-06-14propagate prefork valueOmar Polo
otherwise the child processes still believet the prefork value is 3 and can end up reading/writing out of bounds when setting up the sockets. Actually, server processes shouldn't create pipes to other servers, but this is left for a follow-up diff. Issue reported by la ninpre, thank you!
2024-06-12typo in bounds check, sigh...Omar Polo
2024-06-09check and error on strlcpy truncationOmar Polo
2024-06-08change the approach for strnvisOmar Polo
instead of making things more obscure via gmid_strnvis(), let's just check for strnvis with -Werror so we can swap the OS broken implementation with the bundled OpenBSD one.
2024-06-06attempt to deal with the portability fiasco of strnvis(3)Omar Polo
2024-04-04fix config dumping (-nn) handlingOmar Polo
with the privsep rework the config dumping was unadvertitely broken, it prints the content of the key itself.
2024-03-03fix `log access path' with chrootOmar Polo
We should open the log file inside the chroot; missed in 4acf495f41d2c26136e99072293ca8b9bff91dc0. See https://github.com/omar-polo/gmid/issues/24
2024-01-21convert remaining code to the imsg gettersOmar Polo
Now gmid doesn't touch anymore the internals of the imsg structs.
2024-01-11configure: add --sysconfdir / $SYSCONFDIR handlingOmar Polo
so that we don't have to hardcode /etc in gmid.c. Helps on systems like FreeBSD where the non-base programs are expected to look for their config in /usr/local/etc.
2024-01-09fix configtest with chrootOmar Polo
The configtest checks try to open the root directories too, operation that can fail when they're expected to be inside a chroot.
2023-10-18copyright++Omar Polo
2023-08-28tweak log_request() commentOmar Polo
gg -> gemexp and better wording.
2023-08-07use the subject' common name as the user field in logOmar Polo
2023-08-07remove debugging leftoverOmar Polo
2023-08-07try hard at loading the configuration during conftest (-n)Omar Polo
Attempt to do also a few more steps that were previously done only at runtime. This can help verifying that the keypairs are matching for example, but also that there are no typos in the path to the root directories. Was requested some time ago by Marian Mizik, thanks for the feature request!
2023-08-07add `log syslog facility' to use a different syslog(3) facilityOmar Polo
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-03actually use the specified log styleOmar Polo
2023-08-01change the 'condensed' style to include the size of the request tooOmar Polo
will be used in the future to log how much byte a titan request uploaded.
2023-07-26add log syslog off; don't turn syslog off when log access is specifiedOmar Polo
2023-07-26rename IMSG_LOG_TYPE to ACCESSOmar Polo
2023-07-25allow to change the logging style; introduce some new onesOmar Polo
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-24still respect `log' when in debug modeOmar Polo
2023-07-24open the log files inside the chrootOmar Polo
2023-07-24reopen log files upon SIGUSR2Omar Polo
2023-07-24add ability to log to files with log access <path>Omar Polo
2023-07-01change log_request to take the code and meta unpackedOmar Polo
don't know what i was smoking when I wrote log_request() like that...
2023-06-26call getnameinfo() only once per requestOmar Polo
2023-06-24default chroot to user' home if unsetOmar Polo
2023-06-23implement `listen on'Omar Polo
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-23rename client->addr to raddr (remote address) and keep original lengthOmar Polo
2023-06-23typo; use the `l' variable not `len'Omar Polo
2023-06-11add a privsep crypto engineOmar Polo
Incorporate the OpenSMTPD' privsep crypto engine. The idea behind it is to never load the certificate' private keys in a networked process, instead they are loaded in a separate process (the `crypto' one) which signs payloads on the behalf of the server processes. This way, we greatly reduce the risk of leaking the certificate' private key should the server process be compromised. This currently compiles only on LibreSSL (portable fix is in the way).
2023-06-09parse the config file only onceOmar Polo
Don't have all the processes read gmid.conf. The parent needs to do that, and the will send the config to the children (already happening.) The other processes were reading the config anyway to figure out the user and the chroot (if enabled); make the parent pass additional flag to propagate that info. We dissociate a bit from the "usual" proc.c but it's a change worth having.
2023-06-09move print_conf and make it take the config as argumentOmar Polo
2023-06-09use fatal/fatalx instead of err/errx in daemon codeOmar Polo
2023-06-09parse_conf: don't die on error, return -1Omar Polo
this avoids having the daemon dieing on SIGHUP with a bad config file.
2023-06-09don't have the config being a globalOmar Polo
2023-06-09move hosts into the config structOmar Polo
2023-06-09move fastcgi from global var to the config structOmar Polo
while here also make them a list rather than a fixed-size array.
2023-06-08remove foreground / verbose from configOmar Polo
set them as global vars; rename foreground -> debug
2023-06-08remove forgotten include of logger.hOmar Polo
2023-06-08move log_request to gmid.cOmar Polo
so that ge can provide its own log_request without requiring a separate logger process.
2023-06-08move make_socket to config.c and make it privateOmar Polo
2023-06-08rework the daemon to do fork+execOmar Polo
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-08absolutify the path to the pid fileOmar Polo
2023-06-06switch to the more usual log.cOmar Polo
2023-06-06rename log.[ch] to logger.[ch]Omar Polo