---------- Forwarded message ---------- From: Неворотин Вадим nevorotin@gmail.com Date: 2010/6/29 Subject: Re: [Dovecot] Work with auth socket To: Steffen Kaiser skdovecot@smail.inf.fh-brs.de
Hmm, I have some problems with realization of authentication throw dovecot socket.
I've wrote such script:
#!/usr/bin/perl
$login = "test"; $passwd = "test";
#utf8::encode($login); # I don't know are we really need it #utf8::encode($passwd);
my $service = "ejabberd"; my $timeout = 1; my $socket = '/var/spool/postfix/private/auth-client';
my $sock = new IO::Socket::UNIX(Type => SOCK_STREAM, Peer => $socket) or die "Can't open socket.";
my $sel = new IO::Select($sock); while (1) { $sel->can_read($timeout) or last; defined recv($sock, my $buf, 256, 0) or warn 'Error while reading response'; print $buf; }
send($sock,"VERSION\t1\t0\nCPID\t$$\n",0) or die "Can't write to $socket";
my $base64 = encode_base64("\0$login\0$passwd"); $sock->send("AUTH\t1\tPLAIN\tservice=$service\tsecured\tresp=$base64\n") or die "Can't write to $socket";
my $i = 10; while ($i--) { $sel->can_read($timeout) or last; # "Timed out while waiting for response"; defined recv($sock, my $buf, 256, 0) or warn 'Error while reading response'; print $buf; }
And has such log:
# ./test.pl MECH PLAIN plaintext MECH LOGIN plaintext VERSION 1 0 SPID 26023 CUID 1818 DONE
So dovecot doesn't answer anything after AUTH command. May be http://wiki.dovecot.org/Authentication%20Protocol is not fully describe auth protocol?
2010/6/24 Неворотин Вадим nevorotin@gmail.com
Thank you!
2010/6/24 Steffen Kaiser skdovecot@smail.inf.fh-brs.de
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thu, 24 Jun 2010, Неворотин Вадим wrote:
I need to use Dovecot auth socket from my perl script to validate user's
passwords (for jabber server). Is there any information about how to communicate with dovecot auth socket?
http://search.cpan.org/~sasha/Authen-SASL-Authd-0.04/lib/Authen/SASL/Authd.p...
"NAME
Authen::SASL::Authd - Client authentication via Cyrus saslauthd or Dovecot authentication daemon."
http://wiki.dovecot.org/Authentication+Protocol
Regards,
- -- Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iQEVAwUBTCNOy7+Vh58GPL/cAQJXEQf/SHlQTrUo/OiNFSLteEuF6kGGY/iYGYZ2 CUEKLJQtE92yyGJqt7CYun3Z64llrkzYUGoJDnyPtEFgP2a1uqaEUyusilobuYfB E/B7zdRbHOD2+4afdwHocGundcfWB2GxZi+j454rCDWt5haX+cSd5Be561WdpyE0 yUc3raXLRz6qeRC/A+vmpbA4sbmm+Fd1fCHtwcQhOVvk+X7fJRLb30HUq1wRjyMi LBTv5TxCib+O34MPYpA6xLyrNCkjwAuhdshiw6KihVBx29U9HcoNtUIjfSqL6/gG vhKt6RfgahpytJm97LuDwE7GNf6/3oDeHlTJfAS5EfYdSqcnxxyfLw== =1C+5 -----END PGP SIGNATURE-----