Commit Graph

1213 Commits

Author SHA1 Message Date
Omar Polo
dcfdb969a2 don't list the exact pledge promises
It's easy to forgot to update the README after a code change (already
happened in the past) and they're easy to discover by reading
sandbox.c
2021-10-24 16:52:39 +00:00
Omar Polo
d65fa58c1b use gmid from the repo instead of the system installed one 2021-10-24 16:38:11 +00:00
Omar Polo
eaa02ac8c7 sync changelog 2021-10-24 16:34:34 +00:00
Omar Polo
a81dd6cda6 fix "double slash" in logs
gmid ended up printing two slashes between the hostname and the path
when logging the request IRI.
2021-10-24 16:34:30 +00:00
Omar Polo
93edd35305 master is now 1.8-dev 2021-10-23 10:46:35 +00:00
Omar Polo
4842c72d9f fmt 2021-10-18 10:05:55 +00:00
Omar Polo
f8bcc13822 typo 2021-10-15 09:19:17 +00:00
Omar Polo
e84ee6a729 update the site for 1.7.5 2021-10-15 09:12:54 +00:00
Omar Polo
818d6aeeb6 sync changelog 2021-10-15 08:28:35 +00:00
Omar Polo
7fa6717647 fmt 2021-10-15 08:03:11 +00:00
Stephen Gregoratto
ff05125eb8 Implement OCSP stapling support
Currently dogfooding this patch at gemini.sgregoratto.me. To test,
run the following command and look for the "OCSP response" header:

 openssl s_client -connect "gemini.sgregoratto.me:1965" -status
2021-10-15 09:58:23 +02:00
Omar Polo
387b976b99 c->req may be NULL now 2021-10-15 07:51:15 +00:00
Omar Polo
8044493865 move bufferevent initialization early in handle_handshake
the error path needs an initialized bufferevent too, otherwise it'll
crash when trying to write the response.

This moves the initialisation early, right after the tls_handshake.
Another option would be to initialise it in do_accept, but that may be
too early.
2021-10-15 07:46:30 +00:00
Omar Polo
33c4c3a5ba more small improvements for the quickstart 2021-10-13 20:52:19 +00:00
Omar Polo
2ae10bb4ee sync 2021-10-13 20:50:37 +00:00
Omar Polo
c62a411f4f don't die on ECONNABORTED
ECONNABORTED is returned if a connections gets aborted after being
queued before the accept(2).  I had some cases of

	accept: Software caused connection abort

on FreeBSD, this should avoid that.
2021-10-13 20:49:58 +00:00
Omar Polo
8af884dff4 fix navigation links 2021-10-11 17:59:15 +00:00
Omar Polo
7c6bf71dc8 fix navigation links in *.gmi pages 2021-10-11 15:49:34 +00:00
Omar Polo
fc4b58d450 tweak the quickstart guide 2021-10-11 15:46:41 +00:00
Omar Polo
c0f81ed39e mention renew-certs in contrib.{gmi,html} 2021-10-11 15:32:47 +00:00
Omar Polo
536026c565 add script to automatically renew self-signed certificates 2021-10-11 14:42:11 +00:00
Omar Polo
f0a01fc742 two -n to dump the parsed configuration
This adds a barebone dumping of the parsed configuration.  It is not
complete, but I'm interested in dumping the full path to `cert' and
`key' in order to write some scripts that can inspect the
configuration, extract the certificates and renew them when expired
automatically.

It's not easy to parse gmid configuration otherwise because the syntax
is flexible and users can use macros.  Instead, the idea is to run
gmid and let it dump the configuration once it's been parsed in a
static and predictable format.

Now is possible to parse gmid configuration with, say, awk or perl.
2021-10-09 21:40:55 +00:00
Omar Polo
5eb3fc905f don't work around a missing -Wno-unused-parameter
It's been there for a long time, and it's frankly annoying to pretend
to use parameters.  Most of the time, they're there to satisfy an
interface and nothings more.
2021-10-09 18:54:41 +00:00
Omar Polo
c6bcc919c6 don't wrap the paths inside a <code></code> 2021-10-09 17:19:25 +00:00
Omar Polo
c7b79c9eed fix navigation in contrib page 2021-10-09 17:13:35 +00:00
Omar Polo
1298e4307f split the cert generation example on multiple lines 2021-10-09 17:09:56 +00:00
Omar Polo
679d5d1a61 tweak the style for the manpage exported in HTML 2021-10-09 17:09:56 +00:00
Omar Polo
35340c9f1e typos 2021-10-09 16:54:33 +00:00
Omar Polo
540d05dedc typo 2021-10-09 16:31:43 +00:00
Omar Polo
0111ad5d26 add the Quickstart page 2021-10-09 16:30:36 +00:00
Omar Polo
a83ba84448 mention gencert in contrib.{gmi,html} 2021-10-09 14:16:28 +00:00
Omar Polo
d7e2e22c58 add gencert, a simple script to generate self-signed certs 2021-10-09 14:07:21 +00:00
Omar Polo
9bb2f62e24 tweak landlock comment 2021-10-08 15:55:48 +00:00
Omar Polo
807869c14e print the error too if we can't open a directory
It's not intuitive to print

	open ... for domain xyz

it doesn't convey that the open failed.

now it appends the error string, at least the user can understand that
something went wrong.

reported by cage on irc, thanks!
2021-10-07 17:19:45 +00:00
Omar Polo
492a274fd7 add compat for sys/tree.h 2021-10-07 11:36:25 +00:00
Omar Polo
207b3e80d8 Store clients inside a splay tree
From day one we've been using a static array of client struct to hold
the clients data.  This has variuos drawbacks, among which:

 * reuse of the storage  ("shades of heartbleed")
 * maximum fixed amount of clients connected at the same time
 * bugs are harder to debug

The last point in particular is important because if we mess the client
ids, or try to execute some functions (e.g. the various fcgi_*) after a
client has been disconnected, it's harder to "see" this "use after
free"-tier kind of bug.

Now I'm using a splay tree to hold the data about the live connections.
Each client' data is managed by malloc.  If we try to access a client
data after the disconnection we'll probably crash with a SIGSEGV and
find the bug is more easy.  

Performance-wise the connection phase should be faster since we don't
have to loop anymore to find an empty spot in the clients array, but
some operations could be slightly slower (compare the O(1) access in an
array with a SPLAY_FIND operation -- still be faster than O(n) thought.)
2021-10-07 11:20:34 +00:00
Omar Polo
4cd2520965 one FastCGI connection per client
FastCGI is designed to multiplex requests over a single connection, so
ideally the server can open only one connection per worker to the
FastCGI application and that's that.

Doing this kind of multiplexing makes the code harder to follow and
easier to break/leak etc on the gmid side however.  OpenBSD' httpd
seems to open one connection per client, so why can't we too?

One connection per request is still way better (lighter) than using
CGI, and we can avoid all the pitfalls of the multiplexing (keeping
track of "live ids", properly shut down etc...)
2021-10-07 10:47:02 +00:00
Omar Polo
3096da4ef4 allow to run only a subset of the runtime tests
with
	make TESTS='test_1 test_2 ...' regress

now it's possible to run only that specified subset of tests.  It's
really useful during debugging :)
2021-10-07 08:55:44 +00:00
Omar Polo
e4daebe44a plug a memory leak
c->req is set in client_read but never deallocated
2021-10-06 17:38:37 +00:00
Omar Polo
807a80cb9e fmt 2021-10-06 16:36:31 +00:00
Omar Polo
b4c6cd9768 add the upload target to ease publishing the site 2021-10-04 13:01:41 +00:00
Omar Polo
9212cf1ba9 [gemini] tweak the contrib page
I find it more readable with some empty lines here and there
2021-10-04 12:57:46 +00:00
Omar Polo
eb82dcfbf4 improve the service file usage instructions
Thanks Martin for providing these information :)
2021-10-04 12:56:11 +00:00
Omar Polo
12866f1911 add targets to serve the site locally 2021-10-04 12:54:46 +00:00
Omar Polo
ae6870fa3b import the capsule/website 2021-10-04 10:42:35 +00:00
Omar Polo
568419b2c1 add .cirrus.yml
Add a cirrus CI config file that runs the regression suite on linux
amd64/aarch64 and on freebsd.
2021-10-04 10:05:34 +00:00
Omar Polo
6e0f14d51e re-add sha script; it's used in the Makefile
While there, use it in the tests too
2021-10-04 09:40:05 +00:00
Omar Polo
2072343d6b sync changelog 2021-10-04 09:35:17 +00:00
Omar Polo
260becda9c reduced the timeout time for single checks 2021-10-04 09:34:39 +00:00
Omar Polo
d046e4d6b5 copy only `len' bytes, not the whole buffer
We ended up copying too much data from the fastcgi process.
2021-10-04 09:31:43 +00:00