Postfix, Dovecot blocking Mailman user unknown error

Discussion in 'Installation/Configuration' started by cFoo, Jan 31, 2013.

  1. cFoo

    cFoo New Member

    I've followed the perfect installation instructions. I used Till's instructions to get Postfix and Dovecot to play nicely. Postfix and Dovecot are running, mailman web interface works, user subscription via the GUI works, it's all great.. except. It seems like Dovecot is blocking emails destined for mailman.


    From the log, the email doesn't get to mailman. It appeared to die here:
    Jan 31 14:14:25 scorponok dovecot: auth-worker: mysql(localhost): Connected to database dbispconfig
    Jan 31 14:14:25 scorponok postfix/pipe[29977]: A99271D00BB1: to=<mylist@mydomain.xx>, relay=dovecot, delay=0.37, delays=0.04/0.02/0/0.31, dsn=5.1.1, status=bounced (user unknown)

    dovecot.conf
    Code:
    protocols = imap pop3
    auth_mechanisms = plain login
    disable_plaintext_auth = no
    log_timestamp = "%Y-%m-%d %H:%M:%S "
    mail_privileged_group = vmail
    ssl_cert = </etc/postfix/smtpd.cert
    ssl_key = </etc/postfix/smtpd.key
    passdb {
      args = /etc/dovecot/dovecot-sql.conf
      driver = sql
    }
    userdb {
      args = /etc/dovecot/dovecot-sql.conf
      driver = sql
    }
    plugin {
      quota = dict:user::file:/var/vmail/%d/%n/.quotausage
      sieve=/var/vmail/%d/%n/.sieve
    }
    service auth {
      unix_listener /var/spool/postfix/private/auth {
        group = postfix
        mode = 0660
        user = postfix
      }
      unix_listener auth-userdb {
        group = vmail
        mode = 0600
        user = vmail
      }
      user = root
    }
    protocol imap {
      mail_plugins = quota imap_quota
    }
    protocol pop3 {
      pop3_uidl_format = %08Xu%08Xv
      mail_plugins = quota
    }
    protocol lda {
      mail_plugins = sieve quota
    }
    
    postfix/main.cf
    Code:
    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no
    append_dot_mydomain = no
    readme_directory = /usr/share/doc/postfix
    
    # TLS parameters
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_use_tls = yes
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    
    myhostname = mydomain.host.xx
    alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
    alias_database = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
    myorigin = /etc/mailname
    mydestination = mydomain.host.xx, localhost, localhost.localdomain
    relayhost =
    mynetworks = 127.0.0.0/8 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    html_directory = /usr/share/doc/postfix/html
    virtual_alias_domains =
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf, hash:/var/lib/mailman/data/virtual-mailman
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_mailbox_base = /var/vmail
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, reject_unauth_destination
    smtpd_tls_security_level = may
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
    relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
    smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf
    smtpd_client_message_rate_limit = 100
    maildrop_destination_concurrency_limit = 1
    maildrop_destination_recipient_limit = 1
    virtual_transport = dovecot
    header_checks = regexp:/etc/postfix/header_checks
    mime_header_checks = regexp:/etc/postfix/mime_header_checks
    nested_header_checks = regexp:/etc/postfix/nested_header_checks
    body_checks = regexp:/etc/postfix/body_checks
    owner_request_special = no
    dovecot_destination_recipient_limit = 1
    smtpd_sasl_type = dovecot
    smtpd_sasl_path = private/auth
    content_filter = amavis:[127.0.0.1]:10024
    receive_override_options = no_address_mappings
    message_size_limit = 0
    
    mm_cfg
    Code:
    from Defaults import *
    MAILMAN_SITE_LIST = 'mailman'
    DEFAULT_URL_PATTERN = 'http://%s/cgi-bin/mailman/'
    PRIVATE_ARCHIVE_URL = '/cgi-bin/mailman/private'
    IMAGE_LOGOS         = '/images/mailman/'
    DEFAULT_EMAIL_HOST = 'mydomain.xx'
    DEFAULT_URL_HOST   = 'mydomain.xx'
    add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
    DEFAULT_SERVER_LANGUAGE = 'en'
    USE_ENVELOPE_SENDER    = 0
    DEFAULT_SEND_REMINDERS = 0
    MTA='Postfix'
    POSTFIX_STYLE_VIRTUAL_DOMAINS = ['mydomain.xx', 'mydomain2.xx']
    
    
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Are the aliases for the mailing list which xou created in ispconfig listed in /var/lib/mailman/data/aliases ?
     
  3. cFoo

    cFoo New Member

    Yes they are. All the stanza are there.
     
  4. cFoo

    cFoo New Member

    Solved

    The problem is in the relay=dovecot part. What you need to do is configure your mailman transport to use local instead of dovecot. Otherwise, dovecot cannot resolve your virtual domain.

    Follow these instructions:
    http://wiki.list.org/display/DOC/Ma...ith Mailman generated transport or other maps

    Ignore point number (2).
    You need to tell Postfix to map your virtual alias maps. So keep it in there.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Where exactly did you change the "relay=dovecot" to local? Or do you mean to set virtual_transport = dovecot to virtual_transport = local in main.cf?
     
    Last edited: Feb 5, 2013
  6. cFoo

    cFoo New Member

    Adding the script /etc/mailman/virtual_to_transport
    Code:
    #!/bin/sh
    sed -r -e 's/(^[^#]\S+\s+).+$/\1local/' $1 > /var/lib/mailman/data/transport-mailman
    /usr/sbin/postmap /var/lib/mailman/data/transport-mailman
    When you run bin/genaliases mailman will generate the transport-mailman with a list aliases mapping to local. Example,

    Code:
    ...
    # STANZA START: test
    # CREATED: Sun Feb  3 12:49:43 2013
    test@yourdomain.net              local
    test-admin@yourdomain.net        local
    test-bounces@yourdomain.net      local
    test-confirm@yourdomain.net      local
    ..
    
    Why this works is beyond my understanding of mailman. If you look at virtual-mailman that mapping should have picked up the mapping and directs the mail to aliases which then delivers to mailman. With the transport-mailman mapping, essentially you are sending it to the local system and letting the local services deal with it. I think.
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, yes this makes sense. I will test this on my server and see how it can be integrated into the ispconfig installer so that the mailman setup works out of the box in future.
     
  8. esaaix

    esaaix New Member

    I followed this thread,
    my problem was :
    after trying to post a mail to mailman@mydomain.tld list I recieved an error msg with <mailman@mydomain.tld>: user unknown
    and after this thread, I finished with an error msg <mailman@mydomain.tld>: user unknown "mailman"

    In the postfix logs that's :
    Code:
    Jun 12 16:50:41 MY_DOMAIN amavis[6916]: (06916-03) Passed CLEAN, [xxx.xxx.xxx.xx] [xxx.xxx.xxx.xx] <testeur@MY_DOMAIN.tld> -> <mailman@MY_DOMAIN.tld>, Message-ID: <51B88AB8.90103@MY_DOMAIN.tld>, mail_id: ZABhkjINR28g, Hits: -1, size: 632, queued_as: 8B3C84172F, 417 ms
    Jun 12 16:50:41 MY_DOMAIN postfix/smtp[9756]: 18FBF410A3: to=<mailman@MY_DOMAIN.tld>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.69, delays=0.27/0/0/0.42, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=06916-03, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 8B3C84172F)
    Jun 12 16:50:41 MY_DOMAIN postfix/qmgr[29724]: 8B3C84172F: from=<testeur@MY_DOMAIN.tld>, size=1102, nrcpt=1 (queue active)
    Jun 12 16:50:41 MY_DOMAIN postfix/qmgr[29724]: 18FBF410A3: removed
    Jun 12 16:50:41 MY_DOMAIN postfix/local[9760]: 8B3C84172F: to=<mailman@MY_DOMAIN.tld>, relay=local, delay=0.38, delays=0.21/0.04/0/0.14, dsn=5.1.1, status=bounced (unknown user: "mailman")
    Jun 12 16:50:41 MY_DOMAIN postfix/cleanup[9755]: E84544173B: message-id=<20130612145041.E84544173B@MY_DOMAIN.tld>
    Jun 12 16:50:42 MY_DOMAIN postfix/bounce[9761]: 8B3C84172F: sender non-delivery notification: E84544173B
    Jun 12 16:50:42 MY_DOMAIN postfix/qmgr[29724]: E84544173B: from=<>, size=2975, nrcpt=1 (queue active)
    Jun 12 16:50:42 MY_DOMAIN postfix/qmgr[29724]: 8B3C84172F: removed
    Jun 12 16:50:42 MY_DOMAIN postfix/pipe[9762]: E84544173B: to=<testeur@MY_DOMAIN.tld>, relay=dovecot, delay=0.36, delays=0.12/0/0/0.23, dsn=2.0.0, status=sent (delivered via dovecot service)
    Jun 12 16:50:42 MY_DOMAIN postfix/qmgr[29724]: E84544173B: removed
    what's wrong ?

    the main.cf is
    Code:
    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    append_dot_mydomain = no
    biff = no
    config_directory = /etc/postfix
    content_filter = amavis:[127.0.0.1]:10024
    default_transport = smtp
    delay_warning_time = 1h
    inet_interfaces = all
    inet_protocols = ipv4
    mailbox_size_limit = 51200000
    mydestination = localhost
    myhostname = MY_DOMAIN.tld
    mynetworks = 127.0.0.0/8 MY_DOMAIN_P.0/24 [::ffff:127.0.0.0]/104 [::1]/128
    myorigin = /etc/mailname
    readme_directory = no
    receive_override_options = no_address_mappings
    recipient_delimiter = +
    relay_domains = mysql:/etc/postfix/mysql_relay_domains.cf
    relay_transport = relay
    relayhost = 
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    smtpd_recipient_restrictions = permit_mynetworks,  permit_sasl_authenticated,  reject_non_fqdn_hostname,  reject_non_fqdn_sender,  reject_non_fqdn_recipient,  reject_unauth_destination,  reject_unauth_pipelining,  check_policy_service inet:127.0.0.1:10023,  reject_invalid_hostname
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
    smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtpd_use_tls = yes
    transport_maps = hash:/var/lib/mailman/data/transport-mailman
    virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf,hash:/var/lib/mailman/data/virtual-mailman
    virtual_gid_maps = static:3000
    virtual_mailbox_base = /home/facteur
    virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_mailbox_domains.cf
    virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
    virtual_transport = dovecot
    virtual_uid_maps = static:3000
    and the mm_cfg.py
    Code:
    MAILMAN_SITE_LIST = 'mailman'
    DEFAULT_URL_PATTERN = 'http://%s/adm_listes/'
    PRIVATE_ARCHIVE_URL = '/cgi-bin/mailman/private'
    IMAGE_LOGOS         = '/images/mailman/'
    DEFAULT_EMAIL_HOST = 'MY_DOMAIN.tld'
    DEFAULT_URL_HOST   = 'MY_DOMAIN.tld'
    add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
    POSTFIX_STYLE_VIRTUAL_DOMAINS = ['MY_DOMAIN.tld']
    POSTFIX_MAP_CMD = '/var/lib/mailman/data/virtual_to_transport'
    MTA='Postfix'
    GLOBAL_PIPELINE.insert(1, 'SpamAssassin')
    all the mailman aliases, virtual-mailman and transport-mailman are up-to-date and well-formed.
    mailman-request and mailman-bounces can send mails with no problem.

    thanks for the help.
     
  9. wseitz

    wseitz New Member HowtoForge Supporter

    Many thanks for the review. I understand from other posts that this issue should be addressed by now, but I am facing exactly the same problem with a server that i recently set up on Centos 6.5 / dovecot / postfix / ispconf / apache etc using the most recent "perfect server" how-to: normal mails work fine, and the welcome mails from mailman also arrive as they should, but if I sent a mail to the list the message bounces with an "unkown user"

    May 20 12:10:16 xxxWebServer postfix/local[16485]: 8952C1213F7: to=<btc-all@yyy.ch>, relay=local, delay=0.13, delays=0.06/0.03/0/0.05, dsn=5.1.1, status=bounced (unknown user: "btc-all")

    here is the configuration:

    # postconf -n
    alias_database = hash:/etc/aliases hash:/var/lib/mailman/data/aliases
    alias_maps = hash:/etc/aliases hash:/var/lib/mailman/data/aliases
    always_bcc = archive@xxx.ch
    body_checks = regexp:/etc/postfix/body_checks
    broken_sasl_auth_clients = yes
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    content_filter = amavis:[127.0.0.1]:10024
    daemon_directory = /usr/libexec/postfix
    data_directory = /var/lib/postfix
    debug_peer_level = 2
    header_checks = regexp:/etc/postfix/header_checks
    html_directory = no
    inet_interfaces = all
    inet_protocols = all
    mail_owner = postfix
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    mime_header_checks = regexp:/etc/postfix/mime_header_checks
    mydestination = xxxwebserver.xxxlocal, localhost, localhost.localdomain
    myhostname = yyy.ch
    mynetworks = 127.0.0.0/8 [::1]/128
    nested_header_checks = regexp:/etc/postfix/nested_header_checks
    newaliases_path = /usr/bin/newaliases.postfix
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks
    queue_directory = /var/spool/postfix
    readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
    receive_override_options = no_address_mappings
    relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
    relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
    sample_directory = /usr/share/doc/postfix-2.6.6/samples
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    smtp_tls_security_level = may
    smtpd_client_message_rate_limit = 100
    smtpd_client_restrictions = check_client_access mysql:/etc/postfix/mysql-virtual_client.cf
    smtpd_recipient_restrictions = check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_sasl_path = private/auth
    smtpd_sasl_type = dovecot
    smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_tls_security_level = may
    smtpd_use_tls = yes
    transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    unknown_local_recipient_reject_code = 550
    virtual_alias_domains =
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf, hash:/etc/mailman/virtual-mailman
    virtual_gid_maps = static:5000
    virtual_mailbox_base = /var/vmail
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_transport = dovecot
    virtual_uid_maps = static:5000


    and /etc/mailman/mm_cfg.py


    # -*- python -*-

    # Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc.
    #
    # This program is free software; you can redistribute it and/or
    # modify it under the terms of the GNU General Public License
    # as published by the Free Software Foundation; either version 2
    # of the License, or (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program; if not, write to the Free Software
    # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    # 02110-1301 USA


    """This is the module which takes your site-specific settings.

    From a raw distribution it should be copied to mm_cfg.py. If you
    already have an mm_cfg.py, be careful to add in only the new settings
    you want. The complete set of distributed defaults, with annotation,
    are in ./Defaults. In mm_cfg, override only those you want to
    change, after the

    from Defaults import *

    line (see below).

    Note that these are just default settings - many can be overridden via the
    admin and user interfaces on a per-list or per-user basis.

    Note also that some of the settings are resolved against the active list
    setting by using the value as a format string against the
    list-instance-object's dictionary - see the distributed value of
    DEFAULT_MSG_FOOTER for an example."""


    #######################################################
    # Here's where we get the distributed defaults. #

    from Defaults import *

    ##############################################################
    # Put YOUR site-specific configuration below, in mm_cfg.py . #
    # See Defaults.py for explanations of the values. #

    #-------------------------------------------------------------
    # The name of the list Mailman uses to send password reminders
    # and similar. Don't change if you want mailman-owner to be
    # a valid local part.
    MAILMAN_SITE_LIST = 'mailman'

    #-------------------------------------------------------------
    # If you change these, you have to configure your http server
    # accordingly (Alias and ScriptAlias directives in most httpds)
    DEFAULT_URL_PATTERN = 'http://%s/cgi-bin/mailman/'
    PRIVATE_ARCHIVE_URL = '/cgi-bin/mailman/private'
    IMAGE_LOGOS = '/images/mailman/'

    #-------------------------------------------------------------
    # Default domain for email addresses of newly created MLs
    DEFAULT_EMAIL_HOST = 'yyy.ch'
    #-------------------------------------------------------------
    # Default host for web interface of newly created MLs
    DEFAULT_URL_HOST = 'yyy.ch'
    #-------------------------------------------------------------
    # Required when setting any of its arguments.
    add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)

    #-------------------------------------------------------------
    # The default language for this server.
    DEFAULT_SERVER_LANGUAGE = 'en'

    #-------------------------------------------------------------
    # Iirc this was used in pre 2.1, leave it for now
    USE_ENVELOPE_SENDER = 0 # Still used?

    #-------------------------------------------------------------
    # Unset send_reminders on newly created lists
    DEFAULT_SEND_REMINDERS = 0

    #-------------------------------------------------------------
    # Uncomment this if you configured your MTA such that it
    # automatically recognizes newly created lists.
    # (see /usr/share/doc/mailman/README.Exim4.Debian or
    # /usr/share/mailman/postfix-to-mailman.py)
    # MTA=None # Misnomer, suppresses alias output on newlist

    #-------------------------------------------------------------
    # Uncomment if you use Postfix virtual domains (but not
    # postfix-to-mailman.py), but be sure to see
    # /usr/share/doc/mailman/README.Debian first.
    MTA='Postfix'
    POSTFIX_STYLE_VIRTUAL_DOMAINS = ['yyy.ch']
    #-------------------------------------------------------------
    # Uncomment if you want to filter mail with SpamAssassin. For
    # more information please visit this website:
    # http://www.jamesh.id.au/articles/mailman-spamassassin/
    GLOBAL_PIPELINE.insert(1, 'SpamAssassin')

    #POSTFIX_MAP_CMD = '/var/lib/mailman/data/virtual_to_transport.sh'
    POSTFIX_MAP_CMD = '/etc/mailman/virtual_to_transport.sh'
    # Note - if you're looking for something that is imported from mm_cfg, but you
    # didn't find it above, it's probably in /usr/lib/mailman/Mailman/Defaults.py.


    Can somebody point me in the right direction, pls!!
     

Share This Page