jaysonsantos / python-binary-memcached

A pure python module (thread safe) to access memcached via it's binary protocol with SASL auth support.
MIT License
164 stars 57 forks source link

Add TLS support for TCP sockets #211

Closed moisesguimaraes closed 4 years ago

moisesguimaraes commented 4 years ago

This PR is still a work in progress. I would like to add tests to it before merging.


This change is Reviewable

jaysonsantos commented 4 years ago

Hey @moisesguimaraes sorry for the delay. First of all, thanks for the PR! I was looking around and could not see a standard API on memcached libraries, didn't I look right or none of them implement SSL? I would like to always maintain the same API like other libraries e.g. pylibmc, but if none of them implement this I guess it would be ok to use tls_context.

moisesguimaraes commented 4 years ago

Hi @jaysonsantos. So far there is no support at all for TLS in python memcached clients. You can follow our research here: https://etherpad.openstack.org/p/oslo-cache-tls-support-worksheet

I think working with the context will give more flexibility on which TLS implementation or which TLS options are set in place. It is basically decoupling it and handling it as a dependency injection. Otherwise we would have to have params for keys, certificates, allowed TLS version, allowed cipher suites, and many more TLS options.

jaysonsantos commented 4 years ago

Hey @moisesguimaraes I've just rebased your branch with master to see how it goes on the tests

jaysonsantos commented 4 years ago

The tests are being skipped on travis, is there any way to make them work there? https://travis-ci.org/jaysonsantos/python-binary-memcached/jobs/642982975?utm_medium=notification&utm_source=github_status

moisesguimaraes commented 4 years ago

Tests are skipped when the Memcached server itself was not built with TLS support. That will take a while, but my team is working on pushing TLS enablement upstream. A way to make it work would be to recompile memcached with --enable-tls.