[exim] How to make EXIM authenticate directly against IMAP

Pàgina inicial
Delete this message
Reply to this message
Autor: Marc Perkel
Data:  
A: lannygodsey, exim-users
CC: 
Assumptes vells: Re: [exim] Why doesn't Exim authenticate against IMAP directly?
Assumpte: [exim] How to make EXIM authenticate directly against IMAP
OK - this works. Thanks a lot Lanny!!!!

What this does is allows you to SMTP authentication against IMAP. This
means that the same login for your IMAP server will work for
authenticated SMTP. Exim does not need to know anything about the
backend of your IMAP server. I modified the code to allow for
authenticating against a different host than localhost.

*** contents of /etc/exim/perl.pl ***

#!/usr/bin/perl

# Parameters Host Account Password

use Net::IMAP::Simple::SSL;

sub imapLogin {
my $host = shift;
my $account = shift;
my $password = shift;

# open a connection to the IMAP server
my $server = new Net::IMAP::Simple($host);

   # login, if success return 1 (true?) and 0 (false?)
   if ($server->login( $account, $password )) {
      return 1;
   } else {
      return 0;
   }
   $server->close();
}


*** end perl.pl ***



######################################################################
#                   AUTHENTICATION CONFIGURATION                     #
######################################################################


perl_startup = do '/etc/exim/perl.pl'
perl_at_start


begin authenticators

plain:
driver = plaintext
public_name = PLAIN
server_condition = ${perl{imapLogin}{localhost}{$2}{$3}}
server_set_id = $2


login:
driver = plaintext
public_name = LOGIN
server_prompts = "Username:: : Password::"
server_condition = ${perl{imapLogin}{localhost}{$1}{$2}}
server_set_id = $1


It's a lot better when people help you make something work rather than
grill you about what you shouldn't do it. You're a hero Lanny!

The next step is to add a lookup table for remote domains that I can
look up to see what IMAP server to authenticate against.