2053 Commits

Author SHA1 Message Date
Joris Vink
773790c18b fix more fallout from printf format attributes. 2022-08-17 13:19:25 +02:00
Daniel Fahlgren
0dc4d1adaa Remove unused define 2022-08-17 13:16:27 +02:00
Daniel Fahlgren
2211bb8f97 Some platforms doesn't have a /tmp/ directory where temporary files can be
stored. Make it possible to override that location compile time.
2022-08-17 13:16:25 +02:00
Daniel Fahlgren
5ddfc2131c Constify filemap_entry argument to filemap_serve() 2022-08-17 13:16:21 +02:00
Daniel Fahlgren
5e21de3a4c Add printf format attributes and fix fallout 2022-08-17 13:16:18 +02:00
Joris Vink
cde7cc10a0 4.2.3-rc2 4.2.3-rc2 2022-08-15 13:21:03 +02:00
Joris Vink
64248dc39f Merge branch 'master' into 4.x-releng 2022-08-15 13:20:50 +02:00
Joris Vink
25ea10fea7 Be better. 2022-08-10 10:20:18 +02:00
Joris Vink
73be741bfd Allow authenticators on filemaps.
This commit introduces the ability to add authenticators to filemaps.
Just like in normal routes, the authenticators will be resolved first
before allowing access to the filemap entries.

Configuration wise, the authenticator is an optional value after the
filemap config directive:

	filemap / webroot myauth

In the Python API you can now pass the authenticator for a filemap entry
but turning the value of the filemap into a tuple with the first entry
being the path and the second being the auth dict:

	AUTH AUTH={
	    "type": "cookie",
	    "value": "cookiename",
	    "redirect": "/auth/",
	    "verify": verify_cookie
	}

	domain.filemaps({
	    "/css/": "webroot/css",
	    "/secret/": ("webroot/secret", AUTH)
	})
2022-08-10 10:13:01 +02:00
Joris Vink
7ad48c7e46 bump to 4.2.3-rc1 2022-08-08 14:07:25 +02:00
Joris Vink
36989db0ea Merge branch 'master' into 4.x-releng 2022-08-08 14:07:09 +02:00
Joris Vink
8a0aad31fe Update README with new text 2022-08-08 12:49:55 +02:00
Joris Vink
e2fcedfaec Differentiate between normal shutdown and fatal.
The parent process never differentiated between a worker process
asking for a shutdown or a worker process calling fatalx() when
it came to its exit code.

I made some changes here so the parent process will exit with
an exit code 1 if anything worker related went wrong (fatalx/death policy).
2022-08-08 11:02:27 +02:00
Joris Vink
7316f372d1 If no result was available, use Py_None. 2022-08-04 13:19:02 +02:00
Joris Vink
fd94fba3c7 Python 3.10 improvements.
The coroutines results are now relayed back via PyIter_Send() and
no longer obtainable via _PyGen_FetchStopIterationValue().

This means that our kore.gather() would not be able to return any
values from any of the coroutines it governed.

Fix this by saving the object returned in PyIter_Send() and using it
later in pygather_reap_coro().
2022-08-04 09:56:41 +02:00
Joris Vink
30c8652534 More Python 3.10.x changes.
Handle PYGEN_RETURN in case our prerequest handlers return actual
values instead of None.

Mimic PySendResult for older versions for now.
2022-07-14 11:48:32 +02:00
Joris Vink
f6c54042c5 Improve Python 3.10.x support.
Python 3.10.x its PyIter_Send() will return PYGEN_ERROR if the
generator returned (as opposed to yielding) if the result returned
is Py_None and no argument was given to PyIter_Send(). Which is counter
intuitive since it seems it should give us a PYGEN_RETURN as per its
documentation.

It also no longer sets PyExc_StopIteration in this case so we cannot depend
on that anymore to figure out if a coroutine has finished.

This caused Kore to respond with a 500 immediately after coroutines
ran to completion as it was looking for the PyExc_StopIteration exception.

Fix this by simply doing another check if an exception happened before
we enter the code path where Kore would spew the 500.
2022-07-14 10:56:27 +02:00
Joris Vink
f7a76f7e96 Improvements for kore.recvmsg() in Python.
The cmsghdr contains a length (cmsg_len) which indicates the length
of the data in combination with the cmsghdr length itself.

Remove the length of the cmsghdr before passing it back up to callers
so they don't need to bother with it.

This also fixes a mistake where we ended up copying extra data
from the ancdata buffer that was unintended.
2022-04-22 17:01:06 +02:00
Joris Vink
d5846c0b9c 4.2.2 4.2.2 2022-04-20 12:02:48 +02:00
Joris Vink
3a86b07c38 Merge branch 'master' into 4.x-releng 2022-04-20 12:02:24 +02:00
Joris Vink
5e47218ccd bump for newer release 2022-04-20 12:02:00 +02:00
Joris Vink
fab2e0f746 moving to 4.2.2 2022-04-20 12:00:49 +02:00
Joris Vink
66de41fb8a Merge branch 'master' into 4.x-releng 2022-04-20 11:38:50 +02:00
Joris Vink
b0a5257f93 rename RELEASE to RELEASE.md 2022-04-20 11:37:58 +02:00
Joris Vink
3516d50be3 adjust log messages 2022-04-20 11:10:01 +02:00
Joris Vink
dcdfce5763 Unbreak x509dict.
I accidentally swapped issuer and subject while constructing it.
2022-04-20 11:06:10 +02:00
Joris Vink
8969c14575 Add a quick and dirty release procedure.
Mostly for myself so I remember the goodies.
2022-03-21 14:22:46 +01:00
Joris Vink
11e553f5c9 Merge branch 'master' into 4.x-releng 4.2.1 2022-03-21 12:52:11 +01:00
Joris Vink
48ae94eb47 Pull in stddef.h in seccomp.h.
offsetof() on Linux is defined in it.
2022-03-21 12:51:22 +01:00
Joris Vink
3587e88249 adjust README version number 2022-03-21 12:46:29 +01:00
Joris Vink
2c54c2dab2 Merge branch 'master' into 4.x-releng 2022-03-21 12:44:28 +01:00
Joris Vink
f072e4d5e4 update README with correct versions 2022-03-21 12:44:01 +01:00
Joris Vink
1ae07ade1c This will be Kore 4.2.1 2022-03-21 12:28:24 +01:00
Joris Vink
a85b44e9d9 Merge branch 'master' into 4.x-releng 2022-03-21 12:28:14 +01:00
Joris Vink
38d7a5f88d Fix handling kore_tls_connection_accept() return codes.
When this code was moved from src/connection.c into src/tls_openssl.c
a return wouldn't break us out from kore_connection_handle() as
previously expected.

This ment that Kore would move the connection into established state
immediately even if SSL_accept() needed to read more.

This broke TLS client authentication as Kore its belts and suspenders
kept throwing a 403 due to the code not properly obtaining the client
certificate when expected.
2022-03-21 12:23:38 +01:00
Joris Vink
5bfd61d136 Hide kore_pymodule behind !KORE_SINGLE_BINARY.
Unbreaks building single binaries with Python support.
2022-03-21 08:52:38 +01:00
Joris Vink
c290412f62 Merge branch 'master' into 4.x-releng 4.2.0 2022-03-18 21:06:33 +01:00
Joris Vink
057080b991 adjust release file for 4.2.0 2022-03-18 14:51:45 +01:00
Joris Vink
cd53f7a407 Merge remote-tracking branch 'origin/4.x-releng' into 4.x-releng 2022-03-18 14:51:06 +01:00
Joris Vink
f9c3fac6fa Add logfile to example configuration 2022-03-15 19:37:17 +01:00
Joris Vink
8689df70d9 adjust example configuration 2022-03-15 19:30:57 +01:00
Joris Vink
5ef70e78e9 prepare for 4.2.0 2022-03-15 17:25:30 +01:00
Joris Vink
0d305ecf5a fix format specifier, previous commit touched a bit too much. 2022-03-15 13:47:35 +01:00
Joris Vink
5021eeb597 use correct format specifier for size_t 2022-03-15 13:39:01 +01:00
Joris Vink
41b6b858e6 move to beta3 4.2.0-beta3 2022-03-01 10:00:34 +01:00
Joris Vink
419ed53b0e Merge branch 'master' into 4.x-releng 2022-03-01 09:59:48 +01:00
Joris Vink
78d667abc7 Set socklen to 0 by default in pysocket_async_recv(). 2022-02-20 21:30:17 +01:00
Joris Vink
a65be853f0 Simplify python_push_integer().
We're not doing anything with ret, so kill it.
2022-02-20 21:27:35 +01:00
Joris Vink
a7aa51d8d5 Fix unhappy path cleanup.
The whole while (cnt-- >= 0) idiom is busted since cnt started
at 0 and if the first call to PyUnicode_FromStringAndSize() fails
then we're attempting to access -1.
2022-02-20 21:25:18 +01:00
Joris Vink
daca80f1cb execve() its envp shouldn't be NULL. 2022-02-20 21:20:14 +01:00