liuqian1990 / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

memcached: SASL authentication not working in CentOS 6 64-bit #350

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I installed memcached via remi repo
2. Configured memcached for SASL support using info posted in memcached notes:
echo "mech_list: plain" > /etc/sysconfig/memcached.conf
echo "myname:mypass" > /tmp/memcached-sasl-db

3. Then added the following lines into the /etc/init.d/memcached file:
export MEMCACHED_SASL_PWDB=/tmp/memcached-sasl-db
export SASL_CONF_PATH=/etc/sysconfig/memcached.conf

What is the expected output? What do you see instead?
It to work when testing auth via memcp

Errors in the error log:

authenticated() in cmd 0x21 is true
mech:  ``PLAIN'' with 28 bytes of data
SASL (severity 1): unable to open Berkeley db /etc/sasldb2: No such file or 
directory
SASL (severity 1): unable to open Berkeley db /etc/sasldb2: No such file or 
directory
SASL (severity 2): Password verification failed
sasl result code:  -20
Unknown sasl response:  -20
>30 Writing an error: Auth failure.

I create a blank file /etc/sasldb2 and get the following in the log:

authenticated() in cmd 0x21 is true
mech:  ``PLAIN'' with 29 bytes of data
SASL (severity 2): Password verification failed
sasl result code:  -13
Unknown sasl response:  -13
>30 Writing an error: Auth failure.

What version of the product are you using? On what operating system?
CentOS 6 64-bit 
memcached  x86_64  1.4.15-2.el6.remi 
2.6.32-431.el6.x86_64

Original issue reported on code.google.com by stevencr...@gmail.com on 6 Dec 2013 at 1:37

GoogleCodeExporter commented 9 years ago
I complied it myself instead and now im getting the error...

authenticated() in cmd 0x21 is true
mech:  ``PLAIN'' with 28 bytes of data
WARNING: Failed to open sasl database </etc/memcached/memcached-sasl-db>: 
Permission denied
SASL (severity 2): Password verification failed
sasl result code:  -20
Unknown sasl response:  -20

yet:
[root@sevrer ~]# ls -lsd /etc/memcached
4 drw-r--r-- 2 memcached memcached 4096 Dec  6 09:02 /etc/memcached
[root@server ~]# ls -ls /etc/memcached
total 8
4 -rw-r--r-- 1 memcached memcached 17 Dec  6 08:06 memcached.conf
4 -rw-r--r-- 1 memcached memcached 37 Dec  6 09:02 memcached-sasl-db

Original comment by stevencr...@gmail.com on 6 Dec 2013 at 5:07

GoogleCodeExporter commented 9 years ago
Ok, I fixed the issue by doing chown -R root:root /etc/memcached and then chmod 
-R 777 /etc/memcached (this is only a memcache server so i dont really care 
about other user access to this folder).

Now in the logs I get:
authenticated() in cmd 0x21 is true
mech:  ``PLAIN'' with 28 bytes of data
INFO: User <myname@server2.ourdomain.com> failed to authenticate
SASL (severity 2): Password verification failed
sasl result code:  -20
Unknown sasl response:  -20
>30 Writing an error: Auth failure.

How can I set so that when authenticating it only looks at the username and 
memcached deosnt care about the at symbol and server hostname connecting to it 
(since I only have myname:mypass in the memcached sasl db)?

Original comment by stevencr...@gmail.com on 6 Dec 2013 at 7:44

GoogleCodeExporter commented 9 years ago
I don't think you can do that so far as I know :( sorry.

Original comment by dorma...@rydia.net on 20 Apr 2014 at 1:15