[Postfix espanol] Fw: postfix virtual con mysql

Alberto aalberto en euskalnet.net
Mie Abr 10 01:12:58 CEST 2002


----- Original Message -----
From: "Alberto" <aalberto en euskalnet.net>
To: "postfix español" <postfix-espanol en unicorn.ea4els.ampr.org>
Sent: Wednesday, April 10, 2002 12:10 AM
Subject: postfix virtual con mysql


> Hola a todos:
>
> Me estoy volviendo loco con este tema, y se que es posible que sea una
> cuestion de Courier o Mysql, pero como no estoy seguro, y si en cualquier
> caso me podeis ayudar, os lo agradeceria infinitamente.
>
> Tengo a Postfix dando servicio a unos cuantos usuarios del sistema, pero
> quiero configurar un dominio adicional para su gestion de modo virtual a
> traves de mysql, por supuesto, sin tocar las cuentas de los usuarios
reales
> del sistema ya existentes.
>
> He conseguido que lleguen mensajes a la cuenta pepe en domvirtual.com en
> /var/mail/mysql/pepe/ de los que por supuesto cuelgan los 3 subdirectorios
> propios del formato maildir (cur,new y tmp), pero cuando intento acceder a
> traves de imap, siempre me da error de login
>
> el formato de la base de datos mysql es:
> +----------+-----------+------+-----+---------+-------+
> | Field    | Type      | Null | Key | Default | Extra |
> +----------+-----------+------+-----+---------+-------+
> | id       | char(128) |      | PRI |         |       |
> | password | char(128) |      |     |         |       |
> | uid      | int(10)   |      |     | 0       |       |
> | gid      | int(10)   |      |     | 0       |       |
> | home     | char(255) |      |     |         |       |
> | maildir  | char(255) |      |     |         |       |
> +----------+-----------+------+-----+---------+-------+
> 6 rows in set (0.00 sec)
>
> /etc/courier/authmysqlrc...
> ##NAME: LOCATION:0
> #
> # The server name, userid, and password used to log in.
>
> MYSQL_SERVER            kbl
> MYSQL_USERNAME          postfix
> MYSQL_PASSWORD          postfix
>
> ##NAME: MYSQL_SOCKET:0
> #
> # MYSQL_SOCKET can be used with MySQL version 3.22 or later, it specifies
> the
> # filesystem pipe used for the connection
> #
> MYSQL_SOCKET            /var/mysql/mysql.sock
>
> ##NAME: MYSQL_PORT:0
> #
> # MYSQL_PORT can be used with MySQL version 3.22 or later to specify a
port
> to
> # connect to.
>
> MYSQL_PORT              3306
> ##NAME: MYSQL_OPT:0
> #
> # Leave MYSQL_OPT as 0, unless you know what you're doing.
>
> MYSQL_OPT               0
>
> ##NAME: MYSQL_DATABASE:0
> #
> # The name of the MySQL database we will open:
>
> MYSQL_DATABASE          mail
>
> ##NAME: MYSQL_USER_TABLE:0
> #
> # The name of the table containing your user data.  See README.authmysqlrc
> # for the required fields in this table.
>
> MYSQL_USER_TABLE        mxaliases
>
> ##NAME: MYSQL_CRYPT_PWFIELD:0
> #
> # Either MYSQL_CRYPT_PWFIELD or MYSQL_CLEAR_PWFIELD must be defined.  Both
> # are OK too. crypted passwords go into MYSQL_CRYPT_PWFIELD, cleartext
> # passwords go into MYSQL_CLEAR_PWFIELD.  Cleartext passwords allow
> # CRAM-MD5 authentication to be implemented.
>
> #MYSQL_CRYPT_PWFIELD    crypt
>
> ##NAME: MYSQL_CLEAR_PWFIELD:0
> #
> #
> MYSQL_CLEAR_PWFIELD     password
>
> ##NAME: MYSQL_DEFAULT_DOMAIN:0
> #
> # If DEFAULT_DOMAIN is defined, and someone tries to log in as 'user',
> # we will look up 'user en DEFAULT_DOMAIN' instead.
> #
> #
> DEFAULT_DOMAIN          tomate.fadlan.com
>
> ##NAME: MYSQL_UID_FIELD:0
> #
> # Other fields in the mysql table:
> #
> #
> # MYSQL_UID_FIELD - contains the numerical userid of the account
> #
> MYSQL_UID_FIELD         uid
>
> ##NAME: MYSQL_GID_FIELD:0
> #
> # Numerical groupid of the account
>
> MYSQL_GID_FIELD         gid
>
> ##NAME: MYSQL_LOGIN_FIELD:0
> #
> # The login id, default is id.  Basically the query is:
> #
> #  SELECT MYSQL_UID_FIELD, MYSQL_GID_FIELD, ... WHERE id='loginid'
> #
>
> MYSQL_LOGIN_FIELD       id
>
> ##NAME: MYSQL_HOME_FIELD:0
> #
> MYSQL_HOME_FIELD        home
>
> ##NAME: MYSQL_NAME_FIELD:0
> #
> # The user's name (optional)
>
> MYSQL_NAME_FIELD        name
>
> ##NAME: MYSQL_MAILDIR_FIELD:0
> #
> # This is an optional field, and can be used to specify an arbitrary
> # location of the maildir for the account, which normally defaults to
> # $HOME/Maildir (where $HOME is read from MYSQL_HOME_FIELD).
> #
> # You still need to provide a MYSQL_HOME_FIELD, even if you uncomment this
> # out.
> #
> MYSQL_MAILDIR_FIELD     maildir
>
> ##NAME: MYSQL_QUOTA_FIELD:0
> #
> # Define MYSQL_QUOTA_FIELD to be the name of the field that can optionally
> # specify a maildir quota.  See README.maildirquota for more information
> #
> #MYSQL_QUOTA_FIELD      quota
>
> ##NAME: MYSQL_WHERE_CLAUSE:0
> #
> # This is optional, MYSQL_WHERE_CLAUSE can be basically set to an
arbitrary
> # fixed string that is appended to the WHERE clause of our query
> #
> # MYSQL_WHERE_CLAUSE    server='mailhost.example.com'
>
> ##NAME: MYSQL_SELECT_CLAUSE:0
> #
> # (EXPERIMENTAL)
> # This is optional, MYSQL_SELECT_CLAUSE can be set when you have a
database,
> # which is structuraly different from proposed. The fixed string will
> # be used to do a SELECT operation on database, which should return fields
> # in order specified bellow:
> #
> # username, cryptpw, uid, gid, clearpw, home, maildir, quota, fullname
> #
> # Enabling this option causes ignorance of any other field-related
> # options, excluding default domain.
> #
> #
> # There are two variables, which you can use. Substitution will be made
> # for them, so you can put entered username (local part) and domain name
> # in the right place of your query. These variables are:
> #               $(local_part) and $(domain)
> #
> # If a $(domain) is empty (not given by the remote user) the default
domain
> # name is used in its place.
> #
> # This example is a little bit modified adaptation of vmail-sql
> # database scheme:
> #
> # MYSQL_SELECT_CLAUSE   SELECT popbox.local_part,                       \
> #                       CONCAT('{MD5}', popbox.password_hash),          \
> #                       domain.uid,                                     \
> #                       domain.gid,                                     \
> #                       popbox.clearpw,                                 \
> #                       CONCAT(domain.path, '/', popbox.mbox_name),     \
> #                       '',                                             \
> #                       domain.quota,                                   \
> #                       '',                                             \
> #                       FROM popbox, domain                             \
> #                       WHERE popbox.local_part = '$(local_part)'       \
> #                       AND popbox.domain_name = '$(domain)'            \
> #                       AND popbox.domain_name = domain.domain_name
> #
> ##NAME: MYSQL_CHPASS_CLAUSE:0
> #
> # (EXPERIMENTAL)
> # This is optional, MYSQL_CHPASS_CLAUSE can be set when you have a
database,
> # which is structuraly different from proposed. The fixed string will
> # be used to do an UPDATE operation on database. In other words, it is
> # used, when changing password.
> #
> # There are four variables, which you can use. Substitution will be made
> # for them, so you can put entered username (local part) and domain name
> # in the right place of your query. There variables are:
> #       $(local_part) , $(domain) , $(newpass) , $(newpass_crypt)
> #
> # If a $(domain) is empty (not given by the remote user) the default
domain
> # name is used in its place.
> # $(newpass) contains plain password
> # $(newpass_crypt) contains its crypted form
> #
> # MYSQL_CHPASS_CLAUSE   UPDATE  popbox                                  \
> #                       SET     clearpw='$(newpass)',                   \
> #                               password_hash='$(newpass_crypt)'        \
> #                       WHERE   local_part='$(local_part)'              \
> #                       AND     domain_name='$(domain)'
> #
>
> en fin, quizas no es tema ya de postfix, pero si teneis alguna idea, os
> estare muy agradecido.
>
> Por cierto, ya he consultado los 2 howtos que conozco al respecto:
> http://kummefryser.dk/HOWTO/mail/postfix_mysql.html
> http://www.sweeney.demon.co.uk/pfix_imap_virtual.html
>
> Gracias, un saludo a todos
>
> Alberto
>
>
>
>
>
>
>
>
> Agur,
> Alberto
>
> "Podemos asegurar que 5 de cada 10 personas son la mitad."
>
>
>
>
>

-
Para quitarte de la lista enviar la linea "unsubscribe postfix-espanol" en
el cuerpo de un mensaje a majordomo en WL0.org



Más información sobre la lista de distribución Postfix-es