Forum Linux.debian/ubuntu Probleme postfix / Mysql

Posté par  .
Étiquettes : aucune
0
3
oct.
2006
Bonjour,

j'ai quelques soucis pour l'installation de postfix / mysql ...
j'arrive a m'authentifier avec outlook mais impossible de recevoir de mail

tail /var/log/mail.log
--------------------------
Oct  3 10:50:07 localhost postfix/pickup[22256]: 227661200701: uid=0 from=Oct  3 10:50:07 localhost postfix/cleanup[22258]: warning: 227661200701: virtual_alias_maps map lookup problem for root@monserveur.net
Oct 3 10:50:07 localhost postfix/pickup[22256]: warning: maildrop/7FCCD12006FE: Error writing message file
Oct 3 10:50:38 localhost postfix/trivial-rewrite[22279]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Oct 3 10:50:38 localhost postfix/trivial-rewrite[22279]: fatal: mysql:/etc/postfix/mysql/mysql_virtual_alias_maps.cf(0,100): table lookup problem
Oct 3 10:50:39 localhost postfix/smtpd[22271]: warning: premature end-of-input
on private/rewrite socket while reading input attribute name
Oct 3 10:50:39 localhost postfix/smtpd[22271]: warning: problem talking to service rewrite: Success


tail /var/log/mysql/mysql.log
-----------------------------------


37 Init DB postfix
37 Query SHOW TABLE STATUS LIKE 'domain'
37 Query SELECT COUNT(*) FROM mysql.user
37 Query SHOW TABLE STATUS FROM `postfix` LIKE 'domain'
37 Query SHOW FULL COLUMNS
FROM `postfix`.`domain`
37 Quit
061003 11:14:08 38 Connect postfix@localhost on
38 Init DB postfix
38 Query SELECT username, password, "", '5000', '5000', '/var/spool/vmail/', maildir, "", "", "" FROM mailbox WHERE username = "beanl@monserveur.net"


Mon main.cf
-----------------


# See /usr/share/postfix/main.cf.dist for a commented, more complete version

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = monserveur.net, localhost.localdomain, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8, 192.168.0.0/24
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all


virtual_alias_maps = mysql:/etc/postfix/mysql/mysql_virtual_alias_maps.cf

virtual_gid_maps = static:5000
virtual_uid_maps = static:5000

virtual_mailbox_base = /var/spool/vmail/
virtual_mailbox_domains = mysql:/etc/postfix/mysql/mysql_virtual_domains_maps.cfvirtual_mailbox_maps = mysql:/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf
virtual_mailbox_limit = 51200000
virtual_minimum_uid = 5000
virtual_transport = virtual


#Tuto lea linux
#virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_aliases.cf
#virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains.cf
#virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailboxes.cf
#virtual_mailbox_base = /var/spool/vmail
#virtual_uid_maps = static:5000
#virtual_gid_maps = static:5000
#virtual_transport = virtual

#virtual_create_maildirsize = yes
#virtual_mailbox_extended = yes
#virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
#virtual_mailbox_limit_override = yes
#virtual_maildir_limit_message = "Desole, la boite email de l'utilisateur est pleine, essayez plus tard."
#virtual_overquota_bounce = yes



Mon authmysqlrc
----------------------

MYSQL_SERVER            localhost
MYSQL_USERNAME postfix
MYSQL_PASSWORD postfix

#MYSQL_SOCKET /var/run/mysqld/mysqld.sock

#MYSQL_PORT 0

#MYSQL_OPT 0

MYSQL_DATABASE postfix
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
# MYSQL_CLEAR_PWFIELD clear
# DEFAULT_DOMAIN example.com

MYSQL_UID_FIELD '5000'
MYSQL_GID_FIELD '5000'

MYSQL_LOGIN_FIELD username

MYSQL_HOME_FIELD '/var/spool/vmail/'
#MYSQL_NAME_FIELD name

MYSQL_MAILDIR_FIELD maildir


##NAME: MYSQL_DEFAULTDELIVERY:0
#
# Courier mail server only: optional field specifies custom mail delivery
# instructions for this account (if defined) -- essentially overrides
# DEFAULTDELIVERY from ${sysconfdir}/courierd
#
# MYSQL_DEFAULTDELIVERY defaultdelivery

##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_AUXOPTIONS:0
#
# Auxiliary options. The MYSQL_AUXOPTIONS field should be a char field that
# contains a single string consisting of comma-separated "ATTRIBUTE=NAME"
# pairs. These names are additional attributes that define various per-account
# "options", as given in INSTALL's description of the "Account OPTIONS"
# setting.
#
# MYSQL_AUXOPTIONS_FIELD auxoptions
#
# You might want to try something like this, if you'd like to use a bunch
# of individual fields, instead of a single text blob:
#
# MYSQL_AUXOPTIONS_FIELD CONCAT("disableimap=",disableimap,",disablepop3=",disablepop3,",disablewebmail=",disablewebmail,",sharedgroup=",sharedgroup)
#
# This will let you define fields called "disableimap", etc, with the end result# being something that the OPTIONS parser understands.


##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, clearpw, uid, gid, home, maildir, quota, fullname, options
#
# The username field should include the domain (see example below).
#
# 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), $(domain), $(service)
#
# If a $(domain) is empty (not given by the remote user) the default domain
# name is used in its place.
#
# $(service) will expand out to the service being authenticated: imap, imaps,
# pop3 or pop3s. Courier mail server only: service will also expand out to
# "courier", when searching for local mail account's location. In this case,
# if the "maildir" field is not empty it will be used in place of
# DEFAULTDELIVERY. Courier mail server will also use esmtp when doing
# authenticated ESMTP.
#
# This example is a little bit modified adaptation of vmail-sql
# database scheme:
#
# MYSQL_SELECT_CLAUSE SELECT CONCAT(popbox.local_part, '@', popbox.domain_name), \
# CONCAT('{MD5}', popbox.password_hash), \
# popbox.clearpw, \
# domain.uid, \
# domain.gid, \
# CONCAT(domain.path, '/', popbox.mbox_name), \
# '', \
# domain.quota, \
# '', \
# CONCAT("disableimap=",disableimap,",disablepop3=", \
# disablepop3,",disablewebmail=",disablewebmail, \
# ",sharedgroup=",sharedgroup) \
# FROM popbox, domain \
# WHERE popbox.local_part = '$(local_part)' \
# AND popbox.domain_name = '$(domain)' \
# AND popbox.domain_name = domain.domain_name


##NAME: MYSQL_ENUMERATE_CLAUSE:0
#
# {EXPERIMENTAL}
# Optional custom SQL query used to enumerate accounts for authenumerate,
# in order to compile a list of accounts for shared folders. The query
# should return the following fields: name, uid, gid, homedir, maildir
#
# Example:
# MYSQL_ENUMERATE_CLAUSE SELECT CONCAT(popbox.local_part, '@', popbox.domain_name), \
# domain.uid, \
# domain.gid, \
# CONCAT(domain.path, '/', popbox.mbox_name), \
# '' \
# 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)'
#


Mon authdaemonrc
-----------------------------

##VERSION: $Id: authdaemonrc.in,v 1.8 2001/10/07 02:16:22 mrsam Exp $
#
# Copyright 2000-2001 Double Precision, Inc. See COPYING for
# distribution information.
#
# authdaemonrc created from authdaemonrc.dist by sysconftool
#
# Do not alter lines that begin with ##, they are used when upgrading
# this configuration.
#
# This file configures authdaemond, the resident authentication daemon.
#
# Comments in this file are ignored. Although this file is intended to
# be sourced as a shell script, authdaemond parses it manually, so
# the acceptable syntax is a bit limited. Multiline variable contents,
# with the \ continuation character, are not allowed. Everything must
# fit on one line. Do not use any additional whitespace for indentation,
# or anything else.

##NAME: authmodulelist:0
#
# The authentication modules that are linked into authdaemond. The
# default list is installed. You may selectively disable modules simply
# by removing them from the following list. The available modules you
# can use are: authcustom authcram authuserdb authldap authpgsql authmysql authpam

#authmodulelist="authpam"
authmodulelist="authpam authmysql"

##NAME: authmodulelistorig:1
#
# This setting is used by Courier's webadmin module, and should be left
# alone

authmodulelistorig="authcustom authcram authuserdb authldap authpgsql authmysql authpam"

##NAME: daemons:0
#
# The number of daemon processes that are started. authdaemon is typically
# installed where authentication modules are relatively expensive: such
# as authldap, or authmysql, so it's better to have a number of them running.
# PLEASE NOTE: Some platforms may experience a problem if there's more than
# one daemon. Specifically, SystemV derived platforms that use TLI with
# socket emulation. I'm suspicious of TLI's ability to handle multiple
# processes accepting connections on the same filesystem domain socket.
#
# You may need to increase daemons if as your system load increases. Symptoms
# include sporadic authentication failures. If you start getting
# authentication failures, increase daemons. However, the default of 5
# SHOULD be sufficient. Bumping up daemon count is only a short-term
# solution. The permanent solution is to add more resources: RAM, faster
# disks, faster CPUs...

daemons=5

##NAME: version:0
#
# When you have multiple versions of authdaemond.* installed, authdaemond
# just picks the first one it finds. Set "version" to override that.
# For example: version=authdaemond.plain

version=""

##NAME: authdaemonvar:0
#
# authdaemonvar is here, but is not used directly by authdaemond. It's
# used by various configuration and build scripts, so don't touch it!

authdaemonvar=/var/run/courier/authdaemon


cat /etc/postfix/mysql/mysql_virtual_alias_maps.cf
------------------------------------------------------------------

user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address
additional_conditions = and active = '1'


cat /etc/postfix/mysql/mysql_virtual_domains_maps.cf
---------------------------------------------------------------------

user = postfix
password = postfix
#hosts = unix:/var/run/mysqld/mysqld.sock
hosts = localhost
dbname = postfix
table = domain
select_field = description
where_field = domain
additional_conditions = and backupmx = '0' and active = '1'


cat /etc/postfix/mysql/mysql_virtual_mailbox_maps.cf
------------------------------------------------------------------------

user = postfix
password = postfix
#hosts = unix:/var/run/mysqld/mysqld.sock
hosts = localhost
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
additional_conditions = and active = '1'



ls -l /var/spool/
-----------------------------------

drwxrwxrwx   3 vmail       vmail       4096 2006-10-01 17:32 vmail



Merci pour l'aide :)
  • # Connexion mysql

    Posté par  . Évalué à 2.

    Bonjour,

    Postfix et mysql tournent bien sur la même machine ?
    Quelle est la version de mysql ?
    Que se passe-t-il lorsque tu essaies de te connecter à mysql en local avec la commande suivante ?
    mysql -u postfix -ppostfix postfix

    Si ça ne marche pas, c'est que les droits n'ont pas été bien accordés à l'utilisateur postfix. Il faudra alors exécuter, en tant qu'administrateur mysql :
    GRANT ALL on postfix.* to postfix@localhost identified by 'postfix'
    • [^] # Re: Connexion mysql

      Posté par  . Évalué à 2.

      Oui postfix et mysql tourne sur la meme machine.

      la version de mysql est la 4.1 fournit par les depot de la debian Sarge.

      mysql -u postfix -ppostfix postfix
      ok tout fonctionne :)


      Merci pour l'aide :)
  • # Re

    Posté par  . Évalué à 3.

    Oct 3 10:50:38 localhost postfix/trivial-rewrite[22279]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

    Ce qui veut dire que postfix ne parvient pas à se connecter au server MySQL car celui ci n'écoute pas sur le socket Unix /var/run/mysqld/mysqld.sock

    Ne perd pas de vue que de nombreux sous systèmes de Postfix sont chrooté dans /var/spool/postfix/. Donc Postifx cherche en fait à se connecter dans /var/spool/postfix/var/run/mysqld/mysql.sock. Il te vérifier que ton MySQL est bien lancé et configuré pour écouter sur ces socket unix:


    [root@rei]:~# grep socket /etc/mysql/my.cnf
    socket = /var/run/mysqld/mysqld.sock
    socket = /var/spool/postfix/var/run/mysqld/mysqld.sock
    • [^] # Re: Re

      Posté par  . Évalué à 1.

      ok le probleme est resolu, c'etait effectivement un probleme de chroot :)

      Merci a toi ++

Suivre le flux des commentaires

Note : les commentaires appartiennent à celles et ceux qui les ont postés. Nous n’en sommes pas responsables.