Commit Graph

1746 Commits

Author SHA1 Message Date
Joris Vink cf9e97f087 Improve TLS settings and dependencies.
- Kore now only supports OpenSSL 1.1.1 and LibreSSL 3.x.
- Revise the default TLS ciphersuites.
- Kore now carries ffdhe4096.pem and installs it under PREFIX/share/kore.
- Kore its tls_dhparam config setting defaults to the path mentioned above
  so you no longer have to set it.
2021-04-21 10:48:00 +02:00
Joris Vink 960fe5afd3 drop unused __init__ in cli generation 2021-04-20 10:00:46 +02:00
Joris Vink a27227d37f Rework how kodev create does python apps.
Drop the kore.conf for python apps, all configuration
can be done from inside the python code since kore4.

Adds all the basic goo in the app.py file to get up and running.
2021-04-19 09:47:18 +02:00
Joris Vink b6cb6c14f2 kore_json_strerror() no longer takes a param. 2021-04-18 11:57:53 +02:00
Frederic Cambus 087da688dd Stop hardcoding HTTP error codes in http_error_response() calls.
Use predefined HTTP_STATUS_* macros instead.
2021-04-18 11:36:23 +02:00
Joris Vink eea4177657 new BEERs available for grabs 2021-04-09 20:16:57 +02:00
Frederic Cambus a92f6d17cc Stop hardcoding HTTP/1.1 in access logs, Kore also supports HTTP/1.0. 2021-04-08 10:20:37 +02:00
Joris Vink 44bffcb1c9 Unix socket path improvements.
- Unlink the socket path if possible before attempting to bind to it.
- Unlink the socket path if possible when Kore is shutting down.

inspired by a diff from Joel Arbring via patches@
2021-04-08 09:25:19 +02:00
Frederic Cambus b6570e10a9 Do not send the HSTS header if tls is not enabled in the server context. 2021-04-08 09:17:06 +02:00
Joris Vink cc276e2471 Add kore_json_item_attach().
Allows a JSON subtree to be engrafted after creation.

from Joel Arbring via patches@
2021-04-08 09:10:58 +02:00
Joris Vink 81a09a04d6 Use route instead of old static/dynamic. 2021-04-07 14:52:41 +02:00
Joris Vink a160a9e7ff Use the correct directive for unix binds. 2021-04-07 14:51:11 +02:00
Joris Vink 9cfcd9a4be JSON API improvements.
- Try harder to mark integers as KORE_JSON_TYPE_INTEGER, especially if
  they fit in the internal representation of one (int64_t).

- Move error codes into the JSON code itself, rather then requiring
  a kore_json data structure. This allows the JSON API to relay errors
  such as "item not found" or "type mismatch" properly when looking at items.

- When asking for a KORE_JSON_TYPE_INTEGER_U64 and a KORE_JSON_TYPE_INTEGER
  was found with the same name, check if it could be returned properly and do
  so if possible.
2021-03-30 14:19:48 +02:00
Joris Vink 0031f0271e update counts to reflect reality
much beer is owed.
2021-03-26 10:54:47 +01:00
Joris Vink 85b93f7957 KORE_SECCOMP_FILTER() does not require a semicolumn.
It's a wrapper around a function.
2021-03-23 15:03:47 +01:00
Joris Vink 754eab5b4b sync config with reality 2021-03-10 17:30:01 +01:00
Joris Vink 25d47db9e7 Let VERSION depend on OBJDIR. 2021-03-09 15:13:45 +01:00
Joris Vink 26fdbc4030 Add -fno-common to CFLAGS.
Newer compilers have this enabled by default, instead of -fcommon
so enable it here to catch any problems early.
2021-01-31 14:54:26 +01:00
Joris Vink 0549295f30 Cleanup integer types for # Python arguments.
Define PY_SSIZE_T_CLEAN before pulling in Python.h
2021-01-28 13:34:43 +01:00
Joris Vink c36a7759f1 Get Kore to build with Python 3.10.0a3. 2021-01-28 10:17:02 +01:00
Joris Vink 20c38fca57 Add link to new release 2021-01-25 23:33:05 +01:00
Joris Vink 37b25da83d Make sure kore-serve builds. 2021-01-23 11:57:20 +01:00
Joris Vink a575881cb9 Enable TLS 1.3 with LibreSSL 3.2.2. 2021-01-21 15:17:21 +02:00
Joris Vink 1d931b2f9e Beer multiplication 2021-01-14 13:32:01 +01:00
Daniel Fahlgren 017bbff881 Neither 'in' not 'pad' are format specifiers. Replace with a call to
kore_buf_append() instead. At best 'len' is unused, but if 'in' contains a
percentage sign bad things might happen.
2021-01-14 13:31:27 +01:00
Joris Vink 4e2ca90095 Move Kore hook functions to kore/hooks.h. 2021-01-11 23:58:26 +01:00
Joris Vink cef5ac4003 bump copyright year. 2021-01-11 23:46:08 +01:00
Joris Vink 37f85ed663 rename foreground to kore_foreground. 2021-01-11 23:35:16 +01:00
Joris Vink 599617e7b4 More ACME protocol improvements.
- Make sure tls-alpn01 works even if the underlying SSL library ends up
  calling the ALPN callback *before* the SNI extension was parsed and
  the correct domain was selected.

LibreSSL still does this, and older OpenSSL did too I believe, however
OpenSSL grew a clue and always makes sure SNI is called first.

Yes, TLS extensions have no fixed order but it still makes sense to
notify applications using your library of the SNI extension first
before anything else almost.

Oh well.
2021-01-05 23:25:29 +01:00
Joris Vink 4cace25330 Acme protocol updates.
- Adds POST-as-GET for all GET requests that would support it.
2021-01-05 22:01:36 +01:00
Joris Vink cb0f5a4137 Make sure koreapp.onmsg can log errors from Python. 2020-12-18 19:48:17 +01:00
Joris Vink d10ee4438d Duplicate __progname for the call to openlog().
Kore will mangle the argv[] array for setting process names in
a more friendly way but that could cause syslog to spew mangled
data as the ident.
2020-12-08 11:33:26 +01:00
Joris Vink 9227347b90 Fix concurrency problem in coroutines.
If a coroutine is woken up from another coroutine running from an
http request we can end up in a case where the call path looks like:

0 kore_worker_entry
1 epoll wait		<- bound to pending timers
2 http_process		<- first coro sleep
3 kore_python_coro_run	<- wakes up request
4 http_process		<- wakes up another coroutine
5 return to kore_worker_entry

In the case where 4 wakes up another coroutine but 1 is bound to a timer
and no io activity occurs the coroutine isn't run until the timer fires.

Fix this issue by always checking for pending coroutines even if the
netwait isn't INFINITE.
2020-12-07 11:11:21 +01:00
Joris Vink fd2cda5a43 include inttypes.h in json.c 2020-11-27 16:34:38 +01:00
Joris Vink 5421b7726e kore_json_init() should take a const void for the data. 2020-11-23 10:48:04 +01:00
Joris Vink 802a78c0b0 Make sure we check if consume whitespace failed. 2020-11-21 13:01:42 +01:00
Joris Vink d7fbce37f5 Better parsing of JSON integers and numbers.
Add 2 new types:
	KORE_JSON_TYPE_INTEGER
		signed integer type, internally stored as s64.

	KORE_JSON_TYPE_INTEGER_U64
		unsigned integer type, internally stored as u64.

Kore JSON parser will prefer marking integers as INTEGER_U64 if it
was unsigned and did not have fractions.
2020-11-19 14:56:17 +01:00
Joris Vink 760dff8b3c allow tab escape in JSON strings. 2020-11-19 09:55:41 +01:00
Joris Vink e712e3a951 consume any initial whitespace in JSON data. 2020-11-19 09:22:16 +01:00
Joris Vink 8008fe8b60 Don't allow unknown escaped characters in JSON parser. 2020-11-19 09:10:12 +01:00
Joris Vink 8c32f8f63b Small improvements to JSON parser.
- Don't allow garbage at the end of the JSON data (except whitespace).
- Don't allow objects such as {"a":"b",} or [a,]
2020-11-19 09:07:42 +01:00
Joris Vink 8aa9af1f0c force a dependency between seccomp.c and $(PLATFORM). 2020-10-30 10:12:29 +01:00
Joris Vink 90bf36a37b whitespace 2020-10-28 15:44:18 +01:00
Joris Vink 262a2512f1 Do not dispatch signals to workers without a valid pid.
thanks rille.
2020-10-16 13:06:08 +02:00
Joris Vink ce360e15d6 Update examples with latest single binary changes.
- Use kore_default_getopt() to let Kore do all argument parsing
  for the examples. They don't do any option parsing themselves.
2020-10-08 20:26:11 +02:00
Joris Vink 8f743213aa Add my helper build scripts for building custom binaries.
Allows building Kore with several different component versions.

Eg:
	$ ./build-kore.sh 1.1.1h 3.9.0 7.72.0 1.41.0

	Will build Kore with OpenSSL 1.1.1h, Python 3.9.0, Curl 7.72.0
	and nghttp2 (for curl) 1.41.0
2020-10-08 13:53:48 +02:00
Joris Vink 67cf3e872b Add kore_default_getopt().
This handles the default option parsing in Kore and should be called
by single_binary=yes builds in kore_parent_configure() unless they
want to handle their own argument parsing.
2020-10-08 13:51:50 +02:00
Joris Vink 4313c0eab5 Python: Add kore.socket.recvmsg()
Returns the ancillary data to the caller as a list.
2020-10-02 11:27:52 +02:00
Frederic Cambus af99a4d9e2 Conditionally allow syscalls required to run on arm.
Those syscalls do not exist on other Kore supported platforms, so we
must check that they exist before allowing them.
2020-09-17 17:41:03 +02:00
Frederic Cambus 28ea1b3c7e Add missing tests for SYS_mmap, fixes the build on arm. 2020-09-17 17:41:00 +02:00