Pyro5
Pyro5 copied to clipboard
Allow providing factory functions for SSLContext creation for server and client sockets?
We've got a need to heavily customize the SSLContext creation and parameters; however the current code does leave much to be desired. Could it be possible to allow setting a function that takes the config object and returns a SSLContext for both server and client socket; these could then default to two functions that do call socketutil.get_ssl_context(...)
but it would be then easier to override for complex use cases?
For now, you could just monkeypatch the current get_ssl_context
function in the socketutil
module, after importing Pyro5, and substitute it with your own?
You can start by looking at what it does currently https://github.com/irmen/Pyro5/blob/8db91b617dd08508053e54dea2a781749a00ffc8/Pyro5/socketutil.py#L528C1-L528C10 and write your own
def my_get_ssl_context(....)
....
Pyro5.socketutil.get_ssl_context = my_get_ssl_context
Yes, that was our initial idea. Will go for that.