Commit Graph

35 Commits

Author SHA1 Message Date
Omar Polo 07d86a0beb tweak certificate generation log messages 2023-10-18 18:07:28 +00:00
Omar Polo adaae5163c rework gencert(); make gemexp generate EC certs
Taking inspiration from acme-client.
2023-10-18 17:47:29 +00:00
Omar Polo 07ad491025 getcwd(NULL) is an extension; don't rely on it
also, while here, add some error checking too
2023-08-11 10:40:58 +00:00
Omar Polo 95500a936a remove not so useful starts_with()
replace its only usage with strncmp().  it's likely faster too.
2023-08-11 10:38:34 +00:00
Omar Polo 8bb1b23633 remove a long, long unused function 2023-08-11 10:33:40 +00:00
Omar Polo d98ef73494 move strip_path to utils.c 2023-08-08 15:56:27 +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 eac9287d29 copyright years++ 2023-06-24 10:07:17 +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 2cef5cf42a load_ca: get a buffer instead of a fd
We dup(1) the ca fd and send it to various processes, so they fail
loading it.  Instead, use load_file to get a buffer with the file
content and pass that to load_ca which then loads via BIO.
2023-06-12 21:27:24 +00:00
Omar Polo b8d68fc8e4 fixes for -Wpointer-sign 2023-06-11 11:31:22 +00:00
Omar Polo 86693a33ab add a privsep crypto engine
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-11 11:03:59 +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 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 fc9cc497e0 move some new_* functions from parse.y to utils.c 2023-06-08 15:59:53 +00:00
Omar Polo e69e1151f6 drop now unused dispatch_imsg 2023-06-08 15:57:11 +00:00
Omar Polo eae52ad493 switch to the more usual log.c 2023-06-06 11:46:40 +00:00
Omar Polo 281a8852b3 rename log.[ch] to logger.[ch] 2023-06-06 08:50:54 +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 7b27af8388 log when the certificate was successfully generated 2022-04-12 17:40:58 +00:00
Omar Polo 4842c72d9f fmt 2021-10-18 10:05:55 +00:00
Omar Polo 1eb3631d10 certificate generation (bugfix and improvement)
don't add gmid as organisation when generating the certificate, and
set the version to 3, so it's compatible with java/android clients.

Found by Gnuserland, thanks!
2021-05-12 17:37:22 +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 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 5b6dc93c8a kill debug printf 2021-02-12 12:51:47 +00: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 4283d65fc1 don't allocate BIGNUM on the stack
on fedora 33 the BIGNUM type is opaque.  Allocate always to avoid headaches.
2021-02-10 14:25:39 +00:00
Omar Polo 02be96c6dd add `require client ca' rule to require certs signed by a CA 2021-02-09 22:30:04 +00:00
Omar Polo 3abf91b0b4 improve logs management 2021-02-07 15:30:28 +00:00
Omar Polo ca21e10043 reload configuration on SIGHUP 2021-02-04 13:23:15 +00:00
Omar Polo 9b8f5ed2c0 revert commit 346f28eeaa
keep mark_nonblock in utils.c, as otherwise the build for the regress
suite will fail (mark_nonblock needs fatal which is in gmid.c, and
we can't link gmid.o with the regress suite...)
2021-02-03 14:16:39 +00:00
Omar Polo 346f28eeaa move mark_nonblock to utils.c 2021-02-02 23:03:33 +00:00
Omar Polo bcf5d929e6 ensure absolute paths in config-less mode 2021-02-01 11:07:57 +00:00
Omar Polo d2b941f34b correct copyright date 2021-01-28 16:24:03 +00:00
Omar Polo 44ee1bac8b use starts_with in puny.c 2021-01-27 15:35:09 +00:00