Mailserver: Debian, Postfix, Dovecot

5,491

I have found this tutorial which I'm following now, it's very good and descriptive.

Share:
5,491

Related videos on Youtube

Emil
Author by

Emil

Updated on September 18, 2022

Comments

  • Emil
    Emil almost 2 years

    I'm trying to set up a Dovecot and Postfix mailserver. My wishes for the server:

    • IMAPS
    • SMTP (secure if is it an option?)
    • Both IMAPS and SMTP must require an user from MySQL, same table.
    • Mails are stored as maildir in /home/mail/domain/account

    That's it so far I think, however I succeeded to mess something somewhere. Right now I'm stuck at receiving mails, which I believe is the first part.

    I get this this in mail.

    Sep  1 22:04:38 Debian-60-squeeze-64-minimal postfix/smtpd[9490]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
    Sep  1 22:04:38 Debian-60-squeeze-64-minimal postfix/smtpd[9490]: connect from xxx.yyy.dk[xx.xx.200.10]
    Sep  1 22:04:38 Debian-60-squeeze-64-minimal dovecot: auth(default): new auth connection: pid=9490
    Sep  1 22:04:39 Debian-60-squeeze-64-minimal postfix/smtpd[9490]: 06A5118F4F19: client=xxx.yyy.dk[xx.xx.200.10]
    Sep  1 22:04:39 Debian-60-squeeze-64-minimal postfix/cleanup[9493]: 06A5118F4F19: message-id=<[email protected]>
    Sep  1 22:04:39 Debian-60-squeeze-64-minimal postfix/qmgr[9342]: 06A5118F4F19: from=<[email protected]>, size=11227, nrcpt=1 (queue active)
    Sep  1 22:04:39 Debian-60-squeeze-64-minimal postfix/smtpd[9490]: disconnect from xxx.yyy.dk[xx.xx.200.10]
    Sep  1 22:04:39 Debian-60-squeeze-64-minimal postfix/qmgr[9342]: warning: connect to transport private/dovecot: No such file or directory
    Sep  1 22:04:39 Debian-60-squeeze-64-minimal postfix/error[9494]: 06A5118F4F19: to=<[email protected]>, relay=none, delay=0.14, delays=0.13/0.01/0/0, dsn=4.3.0, status=deferred (mail transport unavailable)
    

    This line in mail.warn

    Sep  1 22:04:38 Debian-60-squeeze-64-minimal postfix/smtpd[9490]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
    

    Please, not just a link to a tutorial, have tried the whole day to figure this one out. Thanks.

    I have this main.cnf

    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    biff = no
    append_dot_mydomain = no
    #delay_warning_time = 4h
    myhostname = xxx.dk
    myorigin = xxx.dk
    mydestination = localhost, localhost.localdomain
    relayhost =
    mynetworks = 127.0.0.0/8
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    
    # Virtual mailbox settings
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_base = /home/mail
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
    virtual_minimum_uid = 5000
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    virtual_transport = dovecot
    dovecot_destination_recipient_limit = 1
    # SASL Authentication
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_exceptions_networks = $mynetworks
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_sasl_type = dovecot
    smtpd_sasl_path = private/auth
    
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    message_size_limit = 30720000
    virtual_alias_domains =
    smtpd_sasl_authenticated_header = yes
    smtpd_use_tls = yes
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    virtual_create_maildirsize = yes
    virtual_maildir_extended = yes
    virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
    virtual_mailbox_limit_override = yes
    virtual_maildir_limit_message = "The user you are trying to reach is over quota."
    virtual_overquota_bounce = yes
    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 $send$
    

    This is the relevant line in master.cf I think

    maildrop unix - n n - - pipe 
    flags=DRhu user=mail argv=/usr/lib/dovecot/deliver -d ${recipient}
    

    This happens if I execute /usr/lib/dovecot/deliver I think I can execute it.

    # /usr/lib/dovecot/deliver
    Fatal: destination user parameter (-d user) not given
    

    Or

    # /usr/lib/dovecot/deliver -d emil
    

    (nothing happens then). Neither cases provided any folders in /home/mail

    • mailq
      mailq almost 13 years
      In the log your transport is given as dovecot but in your master.cf you showed maildrop. This does not match. Which is the correct one? Or which transport is returned by mysql-virtual_transports.cf?
  • mailq
    mailq almost 13 years
    The one with dovecot in the first column. If there is none then this is the problem. If there is one then you didn't provide the full path to deliver.
  • Emil
    Emil almost 13 years
    These are the lines in dynamicmaps.cf: tcp /usr/lib/postfix/dict_tcp.so dict_tcp_open (line break) mysql /usr/lib/postfix/dict_mysql.so dict_mysql_open This is the relevant in master.cf i think maildrop unix - n n - - pipe (line break) flags=DRhu user=mail argv=/usr/lib/dovecot/deliver -d ${recipient} — sorry for the format, I'm not sure if I can post this reply any better?
  • FooBee
    FooBee almost 13 years
    @Emil: You can always edit your original question to add info, like I did now. Can you execute /usr/lib/dovecot/deliver?