it:linux:debian:mailserver

Mails mit virtuellen Domains auf Debian Squeeze

  • /etc/postfix/main.cf:
    myhostname = localhost 
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = $myhostname
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    home_mailbox = Maildir/
    
    virtual_mailbox_domains = /etc/postfix/vhosts
    virtual_mailbox_base = /var/mail/vhosts
    virtual_mailbox_maps = hash:/etc/postfix/vmaps
    virtual_minium_uid = 1000
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
  • ACHTUNG: /var/mail/vhosts muss dem Benutzer vmail (5000:5000) gehören:
    groupadd -g 5000 vmail
    useradd -u 5000 -g 5000 -s /bin/false vmail
    chown vmail:vmail /var/mail/
  • /etc/postfix/vhosts:
    example.com
  • /etc/postfix/vmaps:
    info@example.com example.com/info/
  • postmap /etc/postfix/vmaps
    /etc/init.d/postfix restart
  • ACHTUNG: Domainverzeichnisse (/var/mail/vhosts/example.com) müssen selbst angelegt werden
  • aptitude install dovecot-common dovecot-imapd dovecot-pop3d
  • /etc/dovecot/dovecot.conf:
    base_dir = /var/run/dovecot/
    protocols = imap
    disable_plaintext_auth = yes
    shutdown_clients = yes
    log_path = /var/log/dovecot
    info_log_path = /var/log/dovecot.info
    log_timestamp = "%Y-%m-%d %H:%M:%S "
    
    login_dir = /var/run/dovecot/login
    login_chroot = yes
    login_user = dovecot
    login_greeting = Dovecot ready.
    mail_location = maildir:/var/mail/vhosts/%d/%n
    mmap_disable = no
    valid_chroot_dirs = /var/spool/vmail
    protocol imap {
      login_executable = /usr/lib/dovecot/imap-login
      mail_executable = /usr/lib/dovecot/imap
    }
    auth_executable = /usr/lib/dovecot/dovecot-auth
    auth_verbose = yes
    auth default {
      mechanisms = plain cram-md5
      passdb passwd-file {
        args = /etc/dovecot/passwd
      }
      userdb passwd-file {
        args = /etc/dovecot/users
      }
      user = root
      socket listen {
          client {
            # The client socket is generally safe to export to everyone. Typical use
            # is to export it to your SMTP server so it can do SMTP AUTH lookups
            # using it.
            path = /var/spool/postfix/private/auth-client
            mode = 0660
            user = postfix
            group = postfix
          }
        }
    }
sudo postconf -e 'smtpd_sasl_auth_enable = yes'
sudo postconf -e 'smtpd_sasl_security_options = noplaintext,noanonymous'
sudo postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
sudo postconf -e 'smtpd_sasl_type = dovecot'
sudo postconf -e 'smtpd_sasl_path = private/auth-client'
sudo echo "mech_list: cram-md5" > /etc/postfix/sasl/smtpd.conf
  • 143: IMAP
  • 993: IMAP SSL/TLS
  • 25: SMTP
  • it/linux/debian/mailserver.txt
  • Zuletzt geändert: 2015/12/24 14:26
  • von 127.0.0.1