Commit Graph

1359 Commits

Author SHA1 Message Date
Omar Polo 7980a5d2a8 gg: print the response header for non-2x replies to standard error 2023-10-18 17:13:51 +00:00
Omar Polo c7bcd4a8a9 gg: exit with the gemini response code
0 is still used for 2X replies, and "external" failures (e.g.
network, tls, ...) are still using exit code 1.  Gemini non-2x
replies now get their response code reported as-is as status code.
2023-10-15 15:06:34 +00:00
Omar Polo 4db22ea654 pass LDFLAGS before LIBS 2023-10-14 18:53:37 +00:00
Omar Polo 6e4ba8184d copyright# 2023-10-14 18:52:12 +00:00
Omar Polo 60ff0ebcb5 gemexp doesn't have -v; remove from getopt and usage() 2023-08-29 10:44:08 +00:00
Omar Polo 23e92df733 extend/sync .gitignore 2023-08-29 09:39:28 +00:00
Omar Polo 1218bca611 add -e to gencert usage() string 2023-08-29 09:36:36 +00:00
Omar Polo 96515efd27 tweak gemexp logs
gemexp is meant for local testing so I'm not too worried about
changing its log format if it makes sense to do so.
2023-08-29 09:35:07 +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 eaca1ed4db sync changelog 2023-08-29 09:26:55 +00:00
Omar Polo a6d07f09e0 gemexp: save certs to $XDG_DATA_HOME/gemexp, not /gmid 2023-08-29 09:26:14 +00:00
Omar Polo f31289a8ac gemexp: change the naming scheme for the certificates
Using what the manpage advertised.  The regress adaptations will
follow.  The directory will also change (and the key type too.)
2023-08-29 09:24:14 +00:00
Omar Polo b894573ad9 fix typo; the size computation is done using len, not ret 2023-08-29 09:18:55 +00:00
Omar Polo c440a0ded9 log ip address and port when tls_handshake fails
These connection are not otherwise logged and it could be helpful
to track down the bad ip.
2023-08-28 21:42:58 +00:00
Omar Polo 6be41efe33 tweak log_request() comment
gg -> gemexp and better wording.
2023-08-28 21:39:59 +00:00
Omar Polo a6c8b8051e don't let crypto_dispatch_server handle IMSG_CRYPTO_ECDSA_SIGN
in this codepath.  otherwise we end up with a mismatch where we
expect a request but were sent a response.
2023-08-28 21:38:09 +00:00
Omar Polo 3cba037a11 pre-increment reqid
otherwise we send the request id N and expect to receive N+1
2023-08-28 21:37:27 +00:00
Omar Polo 6c86d810fc typo; was filling the wrong iov_len... 2023-08-28 21:36:58 +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 3cb7e8d7ac ignore some errors from socket(2)
There's no much we can do if we resolv an IPv6 address but its
support is disabled in the current kernel, so ignore and go ahead.
Spotted while testing gmid i n a FreeBSD jail without IPv6.
2023-08-25 09:40:09 +00:00
Omar Polo 39204b7e48 we're in public alpha right now! 2023-08-24 23:21:56 +00:00
Omar Polo ee42fb87e2 remove configure.local{,.example}
unused, un-updated and ignored for quite some time now.
2023-08-23 20:47:17 +00:00
Omar Polo 4f97572edc tweak readme 2023-08-23 20:34:06 +00:00
Omar Polo ae32f1aa8e don't leave HAVE_GETENTROPY undefined 2023-08-23 20:31:02 +00:00
Omar Polo 618b1d4dce resurrect openlog() + tzset() in the logger
They're not needed on OpenBSD nor in other systems... except under
sandbox.  These were added for capsicum() if I remember correctly,
but also with landlock it's better to initialize these things
earlier.
2023-08-23 20:30:39 +00:00
Omar Polo 4d9d3093d4 resurrect landlock support
this time targetting ABI level 3; partially based on how claudio@
handled it in rpki-client.  Fun how this bit of code has come full
circle (gmid inspired what I wrote for got, which inspired what was
written for rpki-client, which has come back.)
2023-08-23 20:18:59 +00:00
Omar Polo cedef5b09c fix build of regress 2023-08-23 19:46:53 +00:00
Omar Polo 01d3961d6f adding forgotten file 2023-08-23 19:39:27 +00:00
Omar Polo 74c6900c91 fix previous; check for getentropy only when arc4random is missing
on macos we have the situation where we have arc4random available
but no getentropy().
2023-08-23 19:22:22 +00:00
Omar Polo 21b4a5163c comment out seed_from_prngd
it's not used (we define OPENSSL_PRNG_ONLY) and fails the build
with -Werror.  Keep the function commented instead of deleting it
just in case we need to undefine OPENSSL_PRNG_ONLY in the future.
2023-08-23 19:13:46 +00:00
Omar Polo 258131b1b6 typo 2023-08-23 17:44:35 +00:00
Omar Polo 8f8d721301 enable privsep crypto on all systems
now that we have a bundled libtls we can actually do this.  Retain
the knob to disable it "just in case".
2023-08-23 17:39: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 9019e55e7e sync DISTFILES 2023-08-22 19:58:29 +00:00
Omar Polo 7ea8725593 sync have/* files 2023-08-22 19:43:47 +00:00
Omar Polo 9cd81f93d7 sync changelog 2023-08-22 19:24:45 +00:00
Omar Polo e872053b20 send all the params as per RFC3875 (CGI) and sync documentation 2023-08-18 12:40:10 +00:00
Omar Polo f5dc7eddd7 fix INSTALL handling
Set a sane default for INSTALL, allow it to be changed either as
environment variable or configure argument, and propagate it correctly
to the generated config.mk.

Issue reported by xavi, thanks!
2023-08-13 09:53:12 +00:00
Omar Polo 81634643db fix comment (ge -> gemexp) 2023-08-11 16:18:37 +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 cf2784df75 remove useless logging 2023-08-09 19:13:48 +00:00
Omar Polo 390d312b22 don't call client_close() from fcgi/proxy bev handlers
We might end up calling client_close() from start_reply(), but that
will free the fcgi/proxy bufferevent while they're still used on the
stack.

Instead, start_reply() only sets REQUEST_DONE and exits, returning the
error eventually, so callers know when to stop.
2023-08-09 19:13:13 +00:00
Omar Polo 01481c255a update changelog 2023-08-08 18:08:37 +00:00
Omar Polo a1e159c917 fix PATH_INFO / SCRIPT_NAME splitting 2023-08-08 18:07:54 +00:00
Omar Polo 03d671e2aa implement fastcgi strip number 2023-08-08 17:35:11 +00:00
Omar Polo 4f7492c36e lower debug log priority 2023-08-08 17:33:43 +00:00
Omar Polo b27dc2b0a3 draft the PATH_INFO and SCRIPT_NAME handling
The idea is to require SCRIPT_NAME to be defined and strip it from
the beginning of the path to get PATH_INFO.  Soon(tm) a `fastcgi
request strip' option will be added too.  Maybe even `fastcgi script
name "path"` that sets SCRIPT_NAME automatically.
2023-08-08 16:06:17 +00:00