[exim] Pam and Mysql or Other

Top Page
Delete this message
Reply to this message
Author: Silmar A. Marca
Date:  
To: exim-users
Subject: [exim] Pam and Mysql or Other
After a hard retry, this is a example (test ok, run in my server..):
Scheme:
- If user auth not contain "@", this is not a virtual domain. This is a real
user...
- If user auth contain "@", this is a virtual domain. This is mysql or other
base user (the password is in MD5)...




######################################################################
#                    MAIN CONFIGURATION SETTINGS                     #
######################################################################
.ifdef MYSQL_SERVER
 hide mysql_servers     = MYSQL_SERVER
 MYSQL_PASSWD_MD5_LOGIN = SELECT popbox.password_md5  from popbox ........
 MYSQL_PASSWD_MD5_PLAIN = SELECT popbox.password_md5  from popbox ........
.endif


######################################################################
#                   AUTHENTICATION CONFIGURATION                     #
######################################################################
begin authenticators


# PLAIN: user e pass codificados em base64-coded - usado pelo Netscape
plain:
  driver                = plaintext
  public_name           = PLAIN
.ifdef MYSQL_SERVER
  server_condition      = "${if eq {${if match{$2}{@}{yes}{no}}}{yes}\
    {${if and{\
        {!eq {$2}{}} {!eq {$3}{}} \
        {eq {${lookup mysql {MYSQL_PASSWD_MD5_PLAIN}{$value}{*:*}}}{${md5:$3}}}
\
      }{yes}{no}}}\
      {${if pam{$2:${sg{$3}{:}{::}}}{yes}{no}}}}"
.else
  server_condition      = ${if pam{$2:${sg{$3}{:}{::}}}{yes}{no}}
.endif
  server_set_id = $2


# LOGIN: codificacao em md5-encoded com usado pelo Outlook Express
login:
  driver                = plaintext
  public_name           = LOGIN
  server_prompts        = "Username:: : Password::"
.ifdef MYSQL_SERVER
  server_condition      = "${if eq {${if match{$1}{@}{yes}{no}}}{yes}\
    {${if and{\
        {!eq {$1}{}} {!eq {$2}{}} \
        {eq {${lookup mysql {MYSQL_PASSWD_MD5_LOGIN}{$value}{*:*}}}{${md5:$2}}}
\
      }{yes}{no}}}\
      {${if pam{$1:${sg{$2}{:}{::}}}{yes}{no}}}}"
.else
  server_condition      = ${if pam{$1:${sg{$2}{:}{::}}}{yes}{no}}
.endif
  server_set_id = $1




Cordialmente, Silmar A. Marca
GrupoGSN - Desenvolvimento, Implantação e Verificação de Servidores
Profissionais baseados em Linux/Novell
http://www.grupogsn.com.br/~marca/
------------------------------------------------------------
Se algo não lhe faz mal (fisico, moral ou psicologicamente),
experimente! O máximo e você perder tempo! E tempo, e
o que você tem a vida toda pra perder.....
Mais vale um instante de prazer que uma eternidade fútil!
------------------------------------------------------------