Postfix server configuration

Postfix server (Debian / Ubuntu) is:

  • configured to primary domain
  • listening on SMTP port 25 on home-server machine
    From Internet it delivers email for following domain:
    From LAN it delivers email for following domain: home.lan

  • Every LAN computer forwards it’s mail for any user to home-server mail server and is processed to users following rules in /etc/postfix/recipient_canonical
  • Sender mapping follows the rules in /etc/postfix/canonical and /etc/postfix/sender_canonical configuration files (not in use now).
  • All mail is forwarded to users in following virtual table /etc/postfix/virtual
  • Any internal email domain is changed following rules in /etc/postfix/generic configuration file
  • Do not forget to use command postmap /etc/postfix/configuration_file every time you change file with ‘hash:‘ prefix
  • After any configuration change you have to reload Postfix service postfix reload
    Postfix installation

    apt-get install postfix
    postmap /etc/aliases
    postmap /etc/postfix/canonical
    postmap /etc/postfix/sender_canonical
    postmap /etc/postfix/generic
    postmap /etc/postfix/virtual



    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    append_dot_mydomain = yes
    biff = no
    config_directory = /etc/postfix
    inet_interfaces =
    mailbox_command = /usr/bin/procmail
    mailbox_size_limit = 0
    mydomain =
    myhostname = mail.$mydomain
    mynetworks =
    myorigin = /etc/mailname
    recipient_delimiter = +
    relayhost =
    smtpd_banner = $myhostname NO UCE ESMTP
    smtpd_delay_reject = no
    smtpd_helo_required = yes
    canonical_maps = hash:/etc/postfix/canonical
    sender_canonical_maps = hash:/etc/postfix/sender_canonical
    recipient_canonical_classes = envelope_recipient
    recipient_canonical_maps = regexp:/etc/postfix/recipient_canonical
    smtp_generic_maps = hash:/etc/postfix/generic
    local_header_rewrite_clients = static:all
    smtpd_recipient_restrictions =
    unknown_address_tempfail_action = $reject_tempfail_action
    reject_tempfail_action = defer_if_permit
    strict_rfc821_envelopes = yes
    virtual_maps = hash:/etc/postfix/virtual
    mydestination = $myhostname, smtp.$mydomain, mail.$mydomain, home.lan, localhost, localhost.localdomain

    /etc/postfix/virtual virtual domain


    postmaster: admin
    webmaster: admin
    www-data: admin
    abuse: admin
    nagios: root





    Print Friendly, PDF & Email