1
0
mirror of https://git.kore.io/kore.git synced 2024-11-11 04:39:00 +01:00
Commit Graph

1838 Commits

Author SHA1 Message Date
Joris Vink
774cc56ed2 Python: Add an req.connection.x509dict
This dictionary for now only contains the subject and issuer names
from the client certificate (if one was provided) with their
X509_NAME components.

Eg:

{
  "issuer": {
    "C": "SE",
    "O": "kore autogen: x509name-test",
    "CN": "localhost"
  },
  "subject": {
    "C": "SE",
    "O": "kore autogen: x509name-test",
    "CN": "localhost"
  }
}
2021-12-11 22:37:15 +01:00
Joris Vink
ca4ffa457c Add a kore_x509_issuer_name() function.
Rework the underlying X509_NAME juggling into a kore_x509name_foreach()
so that it can be called for multiple locations.
2021-12-11 22:36:31 +01:00
Joris Vink
cf6cf5f820 Always align pool element lengths properly.
Enforce 8-byte alignment on the pool element lengths.
2021-12-11 22:35:37 +01:00
Joris Vink
685f504564 Log if no TLS server was configured 2021-12-11 21:59:41 +01:00
Joris Vink
a641c29301 Add SYS_newfstatat to keymgr seccomp rules.
From Aurelien Jarno via patches@
2021-12-11 20:34:44 +01:00
Joris Vink
a54f806978 Don't let kore build with openssl 3 again.
The whole privilege separation breaks with OpenSSL 3, even if it builds.

I guess it is somewhat time to start on donutls.
2021-12-06 23:58:13 +01:00
Joris Vink
0337af2067 note on openssl 3 2021-12-06 21:27:11 +01:00
Joris Vink
06803e2592 Get kore to at least build with openssl 3 2021-12-06 21:21:21 +01:00
Joris Vink
93bf18be81 Handle DELETE maybe having a request body. 2021-12-06 14:44:07 +01:00
Joris Vink
480e589dd5 The DELETE method may have a request body. 2021-12-06 14:43:52 +01:00
Joris Vink
6b2609c2b8 Allow DELETE for kore.httpclient() to have body.
The DELETE method could have an HTTP body, so allow it in the
kore.httpclient() python call.
2021-12-06 14:16:58 +01:00
Joris Vink
a9ee15bff6 Improve closing of a kore.socket() in Python API.
When a kore.socket() is closed from any coroutine, make sure any other
coroutines waiting on events on the socket are awoken so they properly
can return errors.
2021-12-02 22:47:17 +01:00
Joris Vink
5ac62b17bc Python coro under-the-hood improvements.
- Change python coroutine id to a uint64_t.
- Add kore.task_id() to return active coro its id.
2021-12-02 21:58:13 +01:00
Joris Vink
86ecb85f03 use correct privsep name for acme 2021-12-02 19:33:20 +01:00
Joris Vink
0d39e5c62a Allow setting of TARGET_PLATFORM.
This overrides the linux seccomp building, useful
for cross compiling Kore to other linux architectures.
2021-11-29 15:43:43 +01:00
Joris Vink
efc7b3d9a6 Improve how the parent handles workers.
- Make sure we drain the worker log channel if it dies
  so we can flush out any lingering log messages.

- Get rid of the raise() in the parent to signal ourselves
  we should terminate. Instead depend on the new kore_quit.

- Always attempt to reap children one way or the other.
2021-11-03 17:23:05 +01:00
Joris Vink
155c7dfbde prefix fatal messages with FATAL 2021-11-03 17:22:53 +01:00
Joris Vink
a7e1d1d22a Remove keymgr cleaning keys logs.
its such a dumb log message, obviously its going to cleanup keys.
2021-11-03 17:16:34 +01:00
Joris Vink
01e85fd717 Two small python improvements.
- Decrement bytes count when python_cmsg_to_list() fails.
- Use correct define for PYSOCKET_TYPE_RECVFROM.
2021-11-03 15:19:43 +01:00
Joris Vink
5962a94504 wrap pipeline in PG_VERSION_NUM >= 140000 2021-10-27 22:39:29 +02:00
Joris Vink
960730a062 On MacOS put the OpenSSL flags under FEATURES_INC.
Use this to pick them up automatically for kodev.
2021-10-27 22:28:08 +02:00
Joris Vink
fa97544f01 Handle PGRES_PIPELINE_* for PQResult() 2021-10-27 22:27:42 +02:00
Joris Vink
c68eb0c705 make sure we add to LDFLAGS 2021-10-27 17:59:14 +02:00
Joris Vink
995b6b8586 On macos use pkg-config for openssl. 2021-10-27 14:34:06 +02:00
Joris Vink
98d5909b7d bring back python_import and python_path.
These were mistakingly removed a while ago.
2021-10-20 11:20:25 +02:00
Joris Vink
23b95448cc Hide worker logs behind kore_quiet. 2021-10-05 12:29:50 +02:00
Joris Vink
0af7258c30 Don't include kore config in all builds just yet. 2021-10-04 19:18:15 +02:00
Joris Vink
d078bdfb95 Add a gen command to kodev.
This will generate an asset file for Kore based on the source file
or directory given.

This allows other build systems to more easily generate asset
files if their compilation steps are different.
2021-09-22 22:39:42 +02:00
Joris Vink
1fcc9345a6 add cflags/ldflags commands to kodev.
These will spew out the required CFLAGS and LDFLAGS respectively
when compiling source code for use in Kore applications.

This should make it easier to integrate this into existing
build systems where using kodev may be a bit annoying.

Eg: gcc -Wall -std=c99 `kodev cflags` koreapp.c `kodev ldflags` -o koreapp.so
2021-09-22 20:50:09 +02:00
Joris Vink
3e85d36532 The *_CheckExact() family sets no exceptions.
So set a runtime exception if the objects passed mismatch.
2021-09-22 16:48:21 +02:00
Joris Vink
af45284641 count acme domains when configured with Python 2021-09-21 20:47:23 +02:00
Joris Vink
01370c262d fix builds with DEBUG. 2021-09-21 20:47:16 +02:00
Joris Vink
17ceb32e23 Cleanup single/dso files properly with kodev clean.
Obey the out_dir too, in case its set differently.
2021-09-21 20:17:44 +02:00
Joris Vink
46b7a962bf be verbose about filemap resolving. 2021-09-21 16:17:46 +02:00
Joel Arbring
31aaf128a1 Check for .so file where we create it 2021-09-17 20:04:46 +02:00
Joris Vink
63bbc1fa0f Be sure content_length is 0, just in case. 2021-09-17 19:56:35 +02:00
Joris Vink
6b1f02e6b0 Remove another dead assignment. 2021-09-17 19:53:31 +02:00
Joris Vink
9f6043bbde Remove dead assignment. 2021-09-17 19:52:52 +02:00
Joris Vink
bcfb79a389 Remove dead assignment and unused vars. 2021-09-17 19:49:32 +02:00
Joris Vink
351eec7eb4 Add the on_body_chunk handler for routes.
If set, will call a given handler with the prototype of

`void body_chunk(struct http_request *req, const void *data, size_t len);`

for each chunk of the received HTTP body, allowing a developer to handle
it in their own way.

The incoming body is still being handled and retained in the same way
as before (in a kore_buf or temporary file).

While here, allow HTTP_STATUS_CONTINUE to work via http_response() and
make the handling of incoming HTTP header data a bit better.
2021-09-17 19:30:22 +02:00
Joris Vink
f5a58368b7 HTTP improvements.
Introduce an on_headers callback for routes, allowing one to inspect
the headers before the request is processed further.

Additionall,

Add a new way of obtaining HTTP headers. Much like http_argument_get_*()
functions, these new APIs allow you to fetch the data of an HTTP header
as a specified C type.

The new APIs are:

* http_request_header_int16()
* http_request_header_uint16()
* http_request_header_int32()
* http_request_header_uint32()
* http_request_header_int64()
* http_request_header_uint64()
* http_request_header_float()
* http_request_header_double()

Should make it easier to operate in HTTP header data in a safe way.
No need to always roll your own string to int conversion functions.
2021-09-15 22:16:22 +02:00
Joris Vink
e98a4ddab5 Change how routes are configured in Kore.
Routes are now configured in a context per route:

route /path {
	handler handler_name
	methods get post head
	validate qs:get id v_id
}

All route related configurations are per-route, allowing multiple
routes for the same path (for different methods).

The param context is removed and merged into the route context now
so that you use the validate keyword to specify what needs validating.
2021-09-15 11:09:52 +02:00
Joris Vink
2576427dc0 Simplify if a worker needs to be added to msg.
Just look if the kore_worker data structure its ps member is non NULL.
If it is, it was started by the parent process at some point.
2021-09-14 15:45:34 +02:00
Joris Vink
a2d48feeb7 Lets make sure milliseconds are formatted nicely. 2021-09-14 09:36:33 +02:00
Joris Vink
41511c1683 Log timestamps in UTC for, add milliseconds.
This is when using the normal foreground logs or a specified logfile.
2021-09-14 09:30:17 +02:00
Joris Vink
b6ec4081d5 Oops, remove debug. 2021-09-13 22:55:09 +02:00
Joris Vink
824d6421d5 Use correct format for strftime(). 2021-09-13 22:54:05 +02:00
Joris Vink
983f5a03f5 Initial mem and log earlier.
Kill the kodev mention.
2021-09-13 15:33:42 +02:00
Joris Vink
450aabbea1 Add timestamp prefix to log when not using syslog. 2021-09-13 15:07:43 +02:00
Joris Vink
77848e0708 Always use logfile when set, even if !foreground. 2021-09-12 15:19:37 +02:00