Commit Graph

15 Commits

Author SHA1 Message Date
Daniel Melani a5342a0120 Remove libressl log message.
The feature has been removed.
2023-02-22 19:15:42 +01:00
Joris Vink 83d1ff1013 Get rid of the openssl libcrypto allocation hooks.
In practice this rarely works anyway as other libs can end up
allocating things before we even reach main() as demonstrated
on the discord channel earlier.
2023-01-25 08:00:45 +01:00
Joris Vink 2f5d274059 Rework runtime init a little bit.
It was hardcoded that if KORE_USE_PYTHON was defined we would
look at the passed argument on the command-line as the python
script or module to be run.

This won't work when adding more runtimes.

So instead call a kore_runtime_resolve() function that in
turn calls each available runtime its resolve function.

That resolve function will check if its a script / module
that it can load, and if so will load it.

This way we can remove all those KORE_USE_PYTHON blocks in the
Kore startup path and we pave the way for lua.
2023-01-16 21:00:01 +01:00
Joris Vink 922ce7fefb Force OpenSSL to use Kore allocators.
LibreSSL does not support this, which is fair as its designed
for OpenBSD which has malloc and friends that do nice things.
2023-01-05 19:23:24 +01:00
Joris Vink f82e4fe967 kill debug 2022-12-28 15:49:42 +01:00
Joris Vink 8b701a9f0e Change how we handle EVP_PKEY for privsep.
We used to just call EVP_PKEY_get1_RSA() and set the domain
and RSA_METHOD on that.

But with OpenSSL 3, the EVP_PKEY_get1_RSA() function returns a cached
copy of the internal provider struct and any changes we make are not
reflected back. So we can't use it to set the domain and custom method.

Instead just create our own EVP_PKEY from scratch, coupled with an
RSA key that contains just n and e from the public key.

Works with both 1.1.x and 3.0.x.
2022-12-28 15:43:56 +01:00
Joris Vink 17b6f3bbc6 Disable deprecated warnings for OpenSSL 3.
Until the replacement is done, make sure Kore builds against OpenSSL 3
so it can be used as most distros made the move towards it.
2022-12-28 11:09:15 +01:00
Joris Vink 80db912c34 Improve CRL reloading.
When a CRL is reloaded, disconnect any TLS clients that authenticated
with a certificate that is now in the CRL.

Improve log messages while here.
2022-09-05 10:59:28 +02:00
Joris Vink a2d312d0a0 kore_debug() has been unused for years.
Kill all useless messages, convert useful ones into kore_log() instead.
2022-08-18 15:20:55 +02: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 7f74790da7 Define KORE_PRIVATE_KEY per TLS backend. 2022-02-18 10:50:17 +01:00
Joris Vink 80383024a3 For each TLS backend let us use correct types. 2022-02-18 10:47:05 +01:00
Joris Vink a9f7bd7faf rename ssl prefixed things to tls. 2022-02-18 10:20:28 +01:00
Joris Vink feb90208ef Add kore_tls_x509_data().
Use it in the Python code, which requires it.
2022-02-18 09:14:30 +01:00
Joris Vink 99a1581e19 Initial work splitting OpenSSL code away.
This work moves all TLS / crypto related code into a tls_openssl.c
file and adds a tls_none.c which contains just stubs.

Allows compilation of Kore with TLS_BACKEND=none to remove building
against OpenSSL.

Also adds code for SHA1/SHA2 taken from openssh-portable so we don't
depend on those being present anymore in libcrypto.
2022-02-17 13:45:28 +01:00