Adding SASL authentication support to PyLibMCCache

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding SASL authentication support to PyLibMCCache

emorley
Hi

For apps running on Heroku, two of the main memcached options are MemCachier and Memcached Cloud [1]. Both of these control access via SASL authentication, which isn't supported by Django's current pylibmc backend [2], even though pylibmc supports it [3]. As such, currently the django-pylibmc backend has to be used instead [4].

I'd like to add SASL auth support to the Django pylibmc backend to make this unnecessary, which is just a case of passing the relevant parameters through to the pylibmc client during its instantiation [5]. A previous newsgroup discussion about this is at [6].

SASL auth requires binary mode, so I'll also need to add support for that - for which there is already a Django ticket filed [7].

I have a couple of questions:
a) Will a PR to add SASL authentication support be accepted?
b) If yes to (a), should the `username`, `password` and `binary` fields be added to the top level `CACHES['foo']` dict, or nested inside `OPTIONS` within that? I'm presuming within OPTIONS? Examples: [8].

Many thanks,

Ed

[1] https://elements.heroku.com/addons#caching
[2] https://github.com/django/django/blob/1.9.1/django/core/cache/backends/memcached.py#L181
[3] https://github.com/lericson/pylibmc/blob/1.5.0/src/pylibmc/client.py#L125
[4] https://github.com/django-pylibmc/django-pylibmc
[5] eg: https://github.com/django-pylibmc/django-pylibmc/blob/v0.6.1/django_pylibmc/memcached.py#L85-L91
[6] https://groups.google.com/forum/#!searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ
[7] https://code.djangoproject.com/ticket/15815
[8] https://emorley.pastebin.mozilla.org/8858134

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMtUAxsdbJu1TTk4KZiz9Zu%3DzC6-6WKEerS0Wv6gXgx_GzzTTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding SASL authentication support to PyLibMCCache

Tim Graham-2
I found an old discussion about it, but it didn't attract much interest at the time: https://groups.google.com/d/topic/django-developers/pISp20wuu0E/discussion

On Saturday, January 30, 2016 at 7:21:49 PM UTC-5, Ed Morley wrote:
Hi

For apps running on Heroku, two of the main memcached options are MemCachier and Memcached Cloud [1]. Both of these control access via SASL authentication, which isn't supported by Django's current pylibmc backend [2], even though pylibmc supports it [3]. As such, currently the django-pylibmc backend has to be used instead [4].

I'd like to add SASL auth support to the Django pylibmc backend to make this unnecessary, which is just a case of passing the relevant parameters through to the pylibmc client during its instantiation [5]. A previous newsgroup discussion about this is at [6].

SASL auth requires binary mode, so I'll also need to add support for that - for which there is already a Django ticket filed [7].

I have a couple of questions:
a) Will a PR to add SASL authentication support be accepted?
b) If yes to (a), should the `username`, `password` and `binary` fields be added to the top level `CACHES['foo']` dict, or nested inside `OPTIONS` within that? I'm presuming within OPTIONS? Examples: [8].

Many thanks,

Ed

[1] <a href="https://elements.heroku.com/addons#caching" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Felements.heroku.com%2Faddons%23caching\46sa\75D\46sntz\0751\46usg\75AFQjCNGBUJVDO1QpOKKglUY4TdgZdmobjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Felements.heroku.com%2Faddons%23caching\46sa\75D\46sntz\0751\46usg\75AFQjCNGBUJVDO1QpOKKglUY4TdgZdmobjg&#39;;return true;">https://elements.heroku.com/addons#caching
[2] <a href="https://github.com/django/django/blob/1.9.1/django/core/cache/backends/memcached.py#L181" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fblob%2F1.9.1%2Fdjango%2Fcore%2Fcache%2Fbackends%2Fmemcached.py%23L181\46sa\75D\46sntz\0751\46usg\75AFQjCNGSULetnpX1kQzyyl31JQePUXfReg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fblob%2F1.9.1%2Fdjango%2Fcore%2Fcache%2Fbackends%2Fmemcached.py%23L181\46sa\75D\46sntz\0751\46usg\75AFQjCNGSULetnpX1kQzyyl31JQePUXfReg&#39;;return true;">https://github.com/django/django/blob/1.9.1/django/core/cache/backends/memcached.py#L181
[3] <a href="https://github.com/lericson/pylibmc/blob/1.5.0/src/pylibmc/client.py#L125" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Flericson%2Fpylibmc%2Fblob%2F1.5.0%2Fsrc%2Fpylibmc%2Fclient.py%23L125\46sa\75D\46sntz\0751\46usg\75AFQjCNHqouAKUtqSqxGy--uzKjISwUjQ8w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Flericson%2Fpylibmc%2Fblob%2F1.5.0%2Fsrc%2Fpylibmc%2Fclient.py%23L125\46sa\75D\46sntz\0751\46usg\75AFQjCNHqouAKUtqSqxGy--uzKjISwUjQ8w&#39;;return true;">https://github.com/lericson/pylibmc/blob/1.5.0/src/pylibmc/client.py#L125
[4] <a href="https://github.com/django-pylibmc/django-pylibmc" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc\46sa\75D\46sntz\0751\46usg\75AFQjCNGnlbLQMWI8eZtCSNn2G-CGpIV4fA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc\46sa\75D\46sntz\0751\46usg\75AFQjCNGnlbLQMWI8eZtCSNn2G-CGpIV4fA&#39;;return true;">https://github.com/django-pylibmc/django-pylibmc
[5] eg: <a href="https://github.com/django-pylibmc/django-pylibmc/blob/v0.6.1/django_pylibmc/memcached.py#L85-L91" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc%2Fblob%2Fv0.6.1%2Fdjango_pylibmc%2Fmemcached.py%23L85-L91\46sa\75D\46sntz\0751\46usg\75AFQjCNHUnKHppPLWNwR0MvsJ25yQPHM4rQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc%2Fblob%2Fv0.6.1%2Fdjango_pylibmc%2Fmemcached.py%23L85-L91\46sa\75D\46sntz\0751\46usg\75AFQjCNHUnKHppPLWNwR0MvsJ25yQPHM4rQ&#39;;return true;">https://github.com/django-pylibmc/django-pylibmc/blob/v0.6.1/django_pylibmc/memcached.py#L85-L91
[6] <a href="https://groups.google.com/forum/#%21searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/forum/#%21searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/forum/#%21searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ&#39;;return true;">https://groups.google.com/forum/#!searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ
[7] <a href="https://code.djangoproject.com/ticket/15815" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fcode.djangoproject.com%2Fticket%2F15815\46sa\75D\46sntz\0751\46usg\75AFQjCNHpug2SZlN4dyexTjNyunMvGzqJoQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fcode.djangoproject.com%2Fticket%2F15815\46sa\75D\46sntz\0751\46usg\75AFQjCNHpug2SZlN4dyexTjNyunMvGzqJoQ&#39;;return true;">https://code.djangoproject.com/ticket/15815
[8] <a href="https://emorley.pastebin.mozilla.org/8858134" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\46sa\75D\46sntz\0751\46usg\75AFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\46sa\75D\46sntz\0751\46usg\75AFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;">https://emorley.pastebin.mozilla.org/8858134

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/9ab8eb77-28d2-47cc-a047-2e85835b2133%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding SASL authentication support to PyLibMCCache

emorley
Hi Tim,

Thank you for your reply.

Yeah I spotted that discussion (it's [6] in the OP). Back then Heroku (and other PaaS providers) were less common (and I'm not sure how many of those users frequent this list).

Given that django-pylibmc has 8000 downloads a month on PyPI (and this is bearing in mind that Heroku re-uses the virtualenv, so Heroku deployments won't be counted in that figure aside from updates) I think there is a case for including it in the default backend - given it would only be a 5-10 line addition. Even for people who won't be using auth, the new binary mode is faster, so could be useful regardless.

I'm happy to put together a PR to make the impact/complexity easier to judge, if that helps?

Before I do that I would just need to know whether the `username`, `password` and `binary` fields should be added to the top level `CACHES['foo']` dict, or nested inside `OPTIONS` within that? Examples:
https://emorley.pastebin.mozilla.org/8858134

Many thanks,

Ed

On Monday, 1 February 2016 18:47:17 UTC, Tim Graham wrote:
I found an old discussion about it, but it didn't attract much interest at the time: <a href="https://groups.google.com/d/topic/django-developers/pISp20wuu0E/discussion" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/topic/django-developers/pISp20wuu0E/discussion&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/django-developers/pISp20wuu0E/discussion&#39;;return true;">https://groups.google.com/d/topic/django-developers/pISp20wuu0E/discussion

On Saturday, January 30, 2016 at 7:21:49 PM UTC-5, Ed Morley wrote:
Hi

For apps running on Heroku, two of the main memcached options are MemCachier and Memcached Cloud [1]. Both of these control access via SASL authentication, which isn't supported by Django's current pylibmc backend [2], even though pylibmc supports it [3]. As such, currently the django-pylibmc backend has to be used instead [4].

I'd like to add SASL auth support to the Django pylibmc backend to make this unnecessary, which is just a case of passing the relevant parameters through to the pylibmc client during its instantiation [5]. A previous newsgroup discussion about this is at [6].

SASL auth requires binary mode, so I'll also need to add support for that - for which there is already a Django ticket filed [7].

I have a couple of questions:
a) Will a PR to add SASL authentication support be accepted?
b) If yes to (a), should the `username`, `password` and `binary` fields be added to the top level `CACHES['foo']` dict, or nested inside `OPTIONS` within that? I'm presuming within OPTIONS? Examples: [8].

Many thanks,

Ed

[1] <a href="https://elements.heroku.com/addons#caching" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Felements.heroku.com%2Faddons%23caching\46sa\75D\46sntz\0751\46usg\75AFQjCNGBUJVDO1QpOKKglUY4TdgZdmobjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Felements.heroku.com%2Faddons%23caching\46sa\75D\46sntz\0751\46usg\75AFQjCNGBUJVDO1QpOKKglUY4TdgZdmobjg&#39;;return true;">https://elements.heroku.com/addons#caching
[2] <a href="https://github.com/django/django/blob/1.9.1/django/core/cache/backends/memcached.py#L181" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fblob%2F1.9.1%2Fdjango%2Fcore%2Fcache%2Fbackends%2Fmemcached.py%23L181\46sa\75D\46sntz\0751\46usg\75AFQjCNGSULetnpX1kQzyyl31JQePUXfReg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fblob%2F1.9.1%2Fdjango%2Fcore%2Fcache%2Fbackends%2Fmemcached.py%23L181\46sa\75D\46sntz\0751\46usg\75AFQjCNGSULetnpX1kQzyyl31JQePUXfReg&#39;;return true;">https://github.com/django/django/blob/1.9.1/django/core/cache/backends/memcached.py#L181
[3] <a href="https://github.com/lericson/pylibmc/blob/1.5.0/src/pylibmc/client.py#L125" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Flericson%2Fpylibmc%2Fblob%2F1.5.0%2Fsrc%2Fpylibmc%2Fclient.py%23L125\46sa\75D\46sntz\0751\46usg\75AFQjCNHqouAKUtqSqxGy--uzKjISwUjQ8w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Flericson%2Fpylibmc%2Fblob%2F1.5.0%2Fsrc%2Fpylibmc%2Fclient.py%23L125\46sa\75D\46sntz\0751\46usg\75AFQjCNHqouAKUtqSqxGy--uzKjISwUjQ8w&#39;;return true;">https://github.com/lericson/pylibmc/blob/1.5.0/src/pylibmc/client.py#L125
[4] <a href="https://github.com/django-pylibmc/django-pylibmc" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc\46sa\75D\46sntz\0751\46usg\75AFQjCNGnlbLQMWI8eZtCSNn2G-CGpIV4fA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc\46sa\75D\46sntz\0751\46usg\75AFQjCNGnlbLQMWI8eZtCSNn2G-CGpIV4fA&#39;;return true;">https://github.com/django-pylibmc/django-pylibmc
[5] eg: <a href="https://github.com/django-pylibmc/django-pylibmc/blob/v0.6.1/django_pylibmc/memcached.py#L85-L91" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc%2Fblob%2Fv0.6.1%2Fdjango_pylibmc%2Fmemcached.py%23L85-L91\46sa\75D\46sntz\0751\46usg\75AFQjCNHUnKHppPLWNwR0MvsJ25yQPHM4rQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc%2Fblob%2Fv0.6.1%2Fdjango_pylibmc%2Fmemcached.py%23L85-L91\46sa\75D\46sntz\0751\46usg\75AFQjCNHUnKHppPLWNwR0MvsJ25yQPHM4rQ&#39;;return true;">https://github.com/django-pylibmc/django-pylibmc/blob/v0.6.1/django_pylibmc/memcached.py#L85-L91
[6] <a href="https://groups.google.com/forum/#%21searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/forum/#%21searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/forum/#%21searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ&#39;;return true;">https://groups.google.com/forum/#!searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ
[7] <a href="https://code.djangoproject.com/ticket/15815" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fcode.djangoproject.com%2Fticket%2F15815\46sa\75D\46sntz\0751\46usg\75AFQjCNHpug2SZlN4dyexTjNyunMvGzqJoQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fcode.djangoproject.com%2Fticket%2F15815\46sa\75D\46sntz\0751\46usg\75AFQjCNHpug2SZlN4dyexTjNyunMvGzqJoQ&#39;;return true;">https://code.djangoproject.com/ticket/15815
[8] <a href="https://emorley.pastebin.mozilla.org/8858134" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\46sa\75D\46sntz\0751\46usg\75AFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\46sa\75D\46sntz\0751\46usg\75AFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;">https://emorley.pastebin.mozilla.org/8858134

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/8e19c698-5a3c-4aee-88fe-267cfb515a9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding SASL authentication support to PyLibMCCache

Claude Paroz
Le lundi 22 février 2016 13:00:31 UTC+1, Ed Morley a écrit :
(...)

I'm happy to put together a PR to make the impact/complexity easier to judge, if that helps?


Yes, it always help to see the code.
 
Before I do that I would just need to know whether the `username`, `password` and `binary` fields should be added to the top level `CACHES['foo']` dict, or nested inside `OPTIONS` within that? Examples:
<a href="https://emorley.pastebin.mozilla.org/8858134" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\46sa\75D\46sntz\0751\46usg\75AFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\46sa\75D\46sntz\0751\46usg\75AFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;">https://emorley.pastebin.mozilla.org/8858134

I would say that if username and password are not mandatory, put them in options. But no strong opinion here.

Claude

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/774dd4dc-b45e-4d2d-b25a-d12d081ca53f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding SASL authentication support to PyLibMCCache

Tim Graham-2
As it so happens, someone else ended up tackling this problem for a different use case in https://github.com/django/django/pull/6233.

There's a small design discussion on the pull request about how to structure OPTIONS (possibly deprecating the current behavior of pylibmc that passes them directly to client.behaviors) if anyone would like to weigh in.

On Monday, February 22, 2016 at 1:36:02 PM UTC-5, Claude Paroz wrote:
Le lundi 22 février 2016 13:00:31 UTC+1, Ed Morley a écrit :
(...)

I'm happy to put together a PR to make the impact/complexity easier to judge, if that helps?


Yes, it always help to see the code.
 
Before I do that I would just need to know whether the `username`, `password` and `binary` fields should be added to the top level `CACHES['foo']` dict, or nested inside `OPTIONS` within that? Examples:
<a href="https://emorley.pastebin.mozilla.org/8858134" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\46sa\75D\46sntz\0751\46usg\75AFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\46sa\75D\46sntz\0751\46usg\75AFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;">https://emorley.pastebin.mozilla.org/8858134

I would say that if username and password are not mandatory, put them in options. But no strong opinion here.

Claude

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/95987755-0ade-4c3d-a806-52f1b3393af5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding SASL authentication support to PyLibMCCache

emorley
In reply to this post by emorley
Just to follow up on this - general support for passing options to memcached clients has landed on master [1], so it's now possible to enable binary mode, pass SASL credentials and also control any other settings using OPTIONS.

For examples, see the end of the cache arguments documentation:
https://docs.djangoproject.com/en/dev/topics/cache/#cache-arguments

I'm going to try and backport these changes (plus ticket #27152) to django-pylibmc, so the same Django settings file will work for both, to make transitioning from "older Django+django-pylibmc backend" to "Django 1.11+ with stock backend" easier. My ideal end-state is for django-pylibmc to eventually become redundant for the majority of users, with all but the too-specific (eg compression) features being merged into the native backend.

Best wishes,

Ed

[1] https://github.com/django/django/pull/7160

On Monday, 22 February 2016 12:00:31 UTC, Ed Morley wrote:
Hi Tim,

Thank you for your reply.

Yeah I spotted that discussion (it's [6] in the OP). Back then Heroku (and other PaaS providers) were less common (and I'm not sure how many of those users frequent this list).

Given that django-pylibmc has 8000 downloads a month on PyPI (and this is bearing in mind that Heroku re-uses the virtualenv, so Heroku deployments won't be counted in that figure aside from updates) I think there is a case for including it in the default backend - given it would only be a 5-10 line addition. Even for people who won't be using auth, the new binary mode is faster, so could be useful regardless.

I'm happy to put together a PR to make the impact/complexity easier to judge, if that helps?

Before I do that I would just need to know whether the `username`, `password` and `binary` fields should be added to the top level `CACHES['foo']` dict, or nested inside `OPTIONS` within that? Examples:
<a href="https://emorley.pastebin.mozilla.org/8858134" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;">https://emorley.pastebin.mozilla.org/8858134

Many thanks,

Ed

On Monday, 1 February 2016 18:47:17 UTC, Tim Graham wrote:
I found an old discussion about it, but it didn't attract much interest at the time: <a href="https://groups.google.com/d/topic/django-developers/pISp20wuu0E/discussion" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/topic/django-developers/pISp20wuu0E/discussion&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/django-developers/pISp20wuu0E/discussion&#39;;return true;">https://groups.google.com/d/topic/django-developers/pISp20wuu0E/discussion

On Saturday, January 30, 2016 at 7:21:49 PM UTC-5, Ed Morley wrote:
Hi

For apps running on Heroku, two of the main memcached options are MemCachier and Memcached Cloud [1]. Both of these control access via SASL authentication, which isn't supported by Django's current pylibmc backend [2], even though pylibmc supports it [3]. As such, currently the django-pylibmc backend has to be used instead [4].

I'd like to add SASL auth support to the Django pylibmc backend to make this unnecessary, which is just a case of passing the relevant parameters through to the pylibmc client during its instantiation [5]. A previous newsgroup discussion about this is at [6].

SASL auth requires binary mode, so I'll also need to add support for that - for which there is already a Django ticket filed [7].

I have a couple of questions:
a) Will a PR to add SASL authentication support be accepted?
b) If yes to (a), should the `username`, `password` and `binary` fields be added to the top level `CACHES['foo']` dict, or nested inside `OPTIONS` within that? I'm presuming within OPTIONS? Examples: [8].

Many thanks,

Ed

[1] <a href="https://elements.heroku.com/addons#caching" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Felements.heroku.com%2Faddons%23caching\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGBUJVDO1QpOKKglUY4TdgZdmobjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Felements.heroku.com%2Faddons%23caching\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGBUJVDO1QpOKKglUY4TdgZdmobjg&#39;;return true;">https://elements.heroku.com/addons#caching
[2] <a href="https://github.com/django/django/blob/1.9.1/django/core/cache/backends/memcached.py#L181" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fblob%2F1.9.1%2Fdjango%2Fcore%2Fcache%2Fbackends%2Fmemcached.py%23L181\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGSULetnpX1kQzyyl31JQePUXfReg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fblob%2F1.9.1%2Fdjango%2Fcore%2Fcache%2Fbackends%2Fmemcached.py%23L181\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGSULetnpX1kQzyyl31JQePUXfReg&#39;;return true;">https://github.com/django/django/blob/1.9.1/django/core/cache/backends/memcached.py#L181
[3] <a href="https://github.com/lericson/pylibmc/blob/1.5.0/src/pylibmc/client.py#L125" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Flericson%2Fpylibmc%2Fblob%2F1.5.0%2Fsrc%2Fpylibmc%2Fclient.py%23L125\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHqouAKUtqSqxGy--uzKjISwUjQ8w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Flericson%2Fpylibmc%2Fblob%2F1.5.0%2Fsrc%2Fpylibmc%2Fclient.py%23L125\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHqouAKUtqSqxGy--uzKjISwUjQ8w&#39;;return true;">https://github.com/lericson/pylibmc/blob/1.5.0/src/pylibmc/client.py#L125
[4] <a href="https://github.com/django-pylibmc/django-pylibmc" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGnlbLQMWI8eZtCSNn2G-CGpIV4fA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGnlbLQMWI8eZtCSNn2G-CGpIV4fA&#39;;return true;">https://github.com/django-pylibmc/django-pylibmc
[5] eg: <a href="https://github.com/django-pylibmc/django-pylibmc/blob/v0.6.1/django_pylibmc/memcached.py#L85-L91" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc%2Fblob%2Fv0.6.1%2Fdjango_pylibmc%2Fmemcached.py%23L85-L91\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHUnKHppPLWNwR0MvsJ25yQPHM4rQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango-pylibmc%2Fdjango-pylibmc%2Fblob%2Fv0.6.1%2Fdjango_pylibmc%2Fmemcached.py%23L85-L91\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHUnKHppPLWNwR0MvsJ25yQPHM4rQ&#39;;return true;">https://github.com/django-pylibmc/django-pylibmc/blob/v0.6.1/django_pylibmc/memcached.py#L85-L91
[6] <a href="https://groups.google.com/forum/#%21searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/forum/#%21searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/forum/#%21searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ&#39;;return true;">https://groups.google.com/forum/#!searchin/django-developers/pylibmc/django-developers/pISp20wuu0E/tamJ1h8zCzsJ
[7] <a href="https://code.djangoproject.com/ticket/15815" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F15815\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHpug2SZlN4dyexTjNyunMvGzqJoQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F15815\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHpug2SZlN4dyexTjNyunMvGzqJoQ&#39;;return true;">https://code.djangoproject.com/ticket/15815
[8] <a href="https://emorley.pastebin.mozilla.org/8858134" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Femorley.pastebin.mozilla.org%2F8858134\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGcIVFdpWH0uQfewq1EIjhihiA1tA&#39;;return true;">https://emorley.pastebin.mozilla.org/8858134

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/634c4d19-8efc-4ef9-a7da-5c3cf3bdd68d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.