Ubuntu 10.04
Sponsored Link

Install Postfix2010/07/25

  Install Postfix to configure SMTP server.

[1] Install Postfix
root@mail05:~#
aptitude -y install postfix postfix-tls sasl2-bin


# Enter



# select "No Configuration", configure manually later


root@mail05:~#
cp /usr/lib/postfix/main.cf /etc/postfix/main.cf

root@mail05:~#
vi /etc/postfix/main.cf


# line 59: uncomment

mail_owner = postfix

# line 76: uncomment and specify hostname

myhostname =
mail05.srv.world


# line 83: uncomment and specify domain name

mydomain =
srv.world


# line 104: uncomment

myorigin = $mydomain

# line 118: uncomment

inet_interfaces = all

# line 166: uncomment

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

# line 209: uncomment

local_recipient_maps = unix:passwd.byname $alias_maps

# line 268: add your local network

mynetworks = 127.0.0.0/8,
10.0.0.0/24


# line 388: uncomment

alias_maps = hash:/etc/aliases

# line 399: uncomment

alias_database = hash:/etc/aliases

# line 421: uncomment ( Maildir )

home_mailbox = Maildir/

# line 526: uncomment

header_checks = regexp:/etc/postfix/header_checks
# add the line

body_checks = regexp:/etc/postfix/body_checks


# line 552: make it comment and add below

#
smtpd_banner = $myhostname ESMTP $mail_name (@@DISTRO@@)
smtpd_banner = $myhostname ESMTP


# line 626: add

sendmail_path =
/usr/sbin/postfix


# line 631: add

newaliases_path =
/usr/bin/newaliases


# line 636: add

mailq_path =
/usr/bin/mailq


# line 642: add

setgid_group =
postdrop


# line 646: make it comment

#
html_directory =

# line 650: make it comment

#
manpage_directory =

# line 655: make it comment

#
sample_directory =

# line 659: make it comment

#
readme_directory =

# add at the bottom: limit an email size 10M

message_size_limit = 10485760

# limit mailbox 1G

mailbox_size_limit = 1073741824


# for SMTP-Auth settings

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth-client
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_client_restrictions = permit_mynetworks, reject_unknown_client, permit
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject


root@mail05:~#
vi /etc/postfix/header_checks


# add at the head (reject if email address is empty)

/^From:.*<#.*@.*>/ REJECT
/^Return-Path:.*<#.*@.*>/ REJECT
# hide Received line

/^Received:/ IGNORE


root@mail05:~#
vi /etc/postfix/body_checks


# reject if includes 'example.com' in mail body

/^(|[^>].*)example.com/ REJECT


root@mail05:~#
root@mail05:~#
/etc/init.d/postfix start

  * Starting Postfix Mail Transport Agent postfix
  ...done.
root@mail05:~#
sysv-rc-conf postfix on

Matched Content