Memcached with SASL: Couldn't find mech PLAIN
I'm trying to get memcached working with SASL. I'm compiling memcached and libevent from source.
These are the steps I took (both under root and a user, same result):
Having these packages:
cyrus-sasl.x86_64 2.1.23-13.el6_3.1 @anaconda-CentOS-201303020151.x86_64/6.4
cyrus-sasl-devel.x86_64 2.1.23-13.el6_3.1 @cloudlinux-x86_64-server-6
cyrus-sasl-lib.x86_64 2.1.23-13.el6_3.1 @anaconda-CentOS-201303020151.x86_64/6.4
-
mkdir -p ~/working/sasl
nano ~/.bashrc
appending:
export PATH=$HOME/working/bin:$PATH
export LD_LIBRARY_PATH=:$HOME/working/lib:$HOME/working/include/:$LD_LIBRARY_PATH
export SASL_CONF_PATH=$HOME/working/sasl
export MEMCACHED_SASL_PWDB=$HOME/working/sasl/my.sasldb
-
. ~/.bashrc
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar zxvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=$HOME/working
make
make install
cd ~
wget http://www.memcached.org/files/memcached-1.4.16.tar.gz
tar zxvf memcached-1.4.16.tar.gz
cd memcached-1.4.16
./configure --enable-sasl --enable-sasl-pwdb --prefix=$HOME/working
make
make install
saslpasswd2 -c -a memcached -f ~/working/sasl/my.sasldb mymemcached
nano ~/working/sasl/memcached.conf
insert:
mech_list: plain cram-md5
log_level: 5
sasldb_path: ~/working/sasl/my.sasldb
-
memcached -d -l 127.0.0.1 -p 11211 -m 64 -S -vvv -u root
Now I try to login (using a php script)
<26 server listening (binary)
<27 send buffer was 245760, now 268435456
<27 server listening (udp)
<27 server listening (udp)
<27 server listening (udp)
<27 server listening (udp)
<28 new binary client connection.
28: going from conn_new_cmd to conn_waiting
28: going from conn_waiting to conn_read
28: going from conn_read to conn_parse_cmd
<28 Read binary protocol data:
<28 0x80 0x21 0x00 0x05
<28 0x00 0x00 0x00 0x00
<28 0x00 0x00 0x00 0x17
<28 0x00 0x00 0x00 0x00
<28 0x00 0x00 0x00 0x00
<28 0x00 0x00 0x00 0x00
authenticated() in cmd 0x21 is true
28: going from conn_parse_cmd to conn_nread
mech: ``PLAIN'' with 18 bytes of data
SASL (severity 2): Couldn't find mech PLAIN
sasl result code: -4
Unknown sasl response: -4
>28 Writing an error: Auth failure.
>28 Writing bin response:
>28 0x81 0x21 0x00 0x00
>28 0x00 0x00 0x00 0x20
>28 0x00 0x00 0x00 0x0d
>28 0x00 0x00 0x00 0x00
>28 0x00 0x00 0x00 0x00
>28 0x00 0x00 0x00 0x00
28: going from conn_nread to conn_mwrite
28: going from conn_mwrite to conn_new_cmd
28: going from conn_new_cmd to conn_waiting
28: going from conn_waiting to conn_read
28: going from conn_read to conn_closing
<28 connection closed.
I can't figure out what is going wrong, maybe I'm missing a library or an ENV var, or I mis-configured something. I don't know.
The reason I need to keep everything in ~/working is because I want to use this under CloudLinux CageFS, where users have a fully working environment, but can't change anything in /usr/ dirs etc. So everything needs to stay in their home user. But I'm not getting it to work under root either.
Solution 1:
I was facing same issue.
After debugging with multiple option solved it by installing below package.
cyrus-sasl-plain
sudo yum install cyrus-sasl-plain
Post this, it started working fine.