Postfix is a very popular mail server . It
is robust and easy to setup . It acts as a MTA ( mail transfer agent ) that can
receive your mail and drop it into a local mailbox .
How to configure postfix:
The packages required to install postfix
are postfix , postfix-ldap , postfix -pcre .
#apt-get install postfix postfix-pcre postfix-ldap
The first configuration file for postfix is
/etc/postfix/main.cf
#vi /etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a
commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the
name. The Debian default
# is /etc/mailname.
myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name
(Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate
"delayed mail" warnings
#delay_warning_time = 4h
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database =
btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database =
btree:${queue_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz
in the postfix-doc package for
# information on enabling SSL in the smtp
client.
myhostname = asim.emergen.org
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = asim.emergen.org, , localhost
relayhost =
mynetworks = 127.0.0.0/8 192.168.1.0
mailbox_size_limit = 0
mailbox_transport = dovecot
recipient_delimiter = +
inet_interfaces = all
The second configuration for postfix is
/etc/mailname . Here we define the fully qualified domain name .
#vi /etc/mailname
asim.emergen.org
The third file is /etc/postfix/master.cf
smtp
inet n -
n - -
smtpd
pickup
fifo n -
- 60 1
pickup
cleanup
unix n -
- - 0
cleanup
qmgr
fifo n -
- 300 1
qmgr
#qmgr
fifo n -
- 300 1
oqmgr
rewrite
unix - -
- - -
trivial-rewrite
bounce
unix - -
- - 0
bounce
defer
unix - -
- - 0
bounce
trace
unix - -
- - 0
bounce
verify
unix - -
- - 1
verify
flush
unix n -
- 1000? 0
flush
proxymap
unix - -
n - -
proxymap
smtp
unix - -
n - -
smtp
relay
unix - -
- - -
smtp
showq
unix n -
- - -
showq
error
unix - -
- - -
error
local
unix - n
n - -
local
virtual
unix - n
n - -
virtual
lmtp
unix - -
n - -
lmtp
anvil
unix -
- n -
1 anvil
dovecot
unix - n
n - -
pipe
flags=DRhu user=vmail:vmail
argv=/usr/lib/dovecot/deliver -d ${recipient}
mailman unix -
n n -
- pipe
flags=FR
user=list
argv=/var/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
maildrop
unix - n
n - -
pipe
flags=DRhu user=vmail argv=/opt/maildrop/bin/maildrop -d ${recipient}
uucp
unix - n
n - -
pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail
($recipient)
ifmail
unix - n
n - -
pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp
unix - n
n - -
pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -d -t$nexthop -f$sender
$recipient
scalemail-backend unix -
n n -
2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
${nexthop} ${user} ${extension}
gnarwl
unix - n
n - -
pipe
flags=F user=vmail argv=/usr/bin/gnarwl -a $user
smtp-amavis
unix - -
n - 2 lmtp
-o
smtp_data_done_timeout=1200
-o
disable_dns_lookups=yes
-o
smtp_send_xforward_command=yes
127.0.0.1:10025 inet n
- n - - smtpd
-o
content_filter=
-o
local_recipient_maps=
-o
relay_recipient_maps=
-o
smtpd_restriction_classes=
-o
smtpd_client_restrictions=
-o
smtpd_helo_restrictions=
-o
smtpd_sender_restrictions=
-o
smtpd_recipient_restrictions=permit_mynetworks,reject
-o
mynetworks=127.0.0.0/8
-o
strict_rfc821_envelopes=yes
After this , start the service
#/etc/init.d/postfix start
To
verify whether postfix is working correctly
#telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 asim.emergen.org ESMTP Postfix (Ubuntu)
Dovecot
Dovcecot acts as an MDA ( mail delivery
agent ) .It handles final delivery of messages for a system's local recipients
.
The package required to install dovecot is
dovecot – common , dovecot – pop3d and dovecot – imapd .
#apt-get install dovecvot-common
dovecot-pop3d dovecot-imapd
The main configuration file is
#vi /etc/dovecot/dovecot.conf
protocols = imap imaps pop3 pop3s
#ssl_disable = no
#ssl_cert_file =
/etc/postfix/tls/server.pem
#ssl_key_file = /etc/postfix/tls/key.pem
log_timestamp = "%Y-%m-%d %H:%M:%S
"
#login_greeting = Dovecot ready.
#max_mail_processes = 1024
mail_extra_groups = vmail
#mail_debug = yes
default_mail_env =
maildir:%h:INDEX=/var/dovecot/indexes/%h
disable_plaintext_auth = no
protocol imap {
#
mail_plugins = quota imap_quota
#
mail_plugin_dir = /usr/lib/dovecot/modules/imap
}
protocol pop3 {
pop3_uidl_format
= %08Xu%08Xv
#
mail_plugins = quota
#
mail_plugin_dir = /usr/lib/dovecot/modules/pop3
}
protocol lda {
#
mail_plugins = quota
#
mail_plugin_dir = /usr/lib/dovecot/modules/imap
postmaster_address
= postmaster@emergen.org
auth_socket_path
= /var/run/dovecot-auth-master
log_path
= /var/log/dovecot-deliver.log
info_log_path
= /var/log/dovecot-deliver.log
}
auth default {
mechanisms
= plain
socket
listen {
master
{
protocols = imap imaps pop3 pop3s
#ssl_disable = no
#ssl_cert_file =
/etc/postfix/tls/server.pem
#ssl_key_file = /etc/postfix/tls/key.pem
log_timestamp = "%Y-%m-%d %H:%M:%S
"
#login_greeting = Dovecot ready.
#max_mail_processes = 1024
mail_extra_groups = vmail
#mail_debug = yes
default_mail_env =
maildir:%h:INDEX=/var/dovecot/indexes/%h
disable_plaintext_auth = no
protocol imap {
#
mail_plugins = quota imap_quota
#
mail_plugin_dir = /usr/lib/dovecot/modules/imap
}
protocol pop3 {
pop3_uidl_format
= %08Xu%08Xv
#
mail_plugins = quota
#
mail_plugin_dir = /usr/lib/dovecot/modules/pop3
}
protocol lda {
#
mail_plugins = quota
#
mail_plugin_dir = /usr/lib/dovecot/modules/imap
postmaster_address
= postmaster@emergen.org
auth_socket_path
= /var/run/dovecot-auth-master
log_path
= /var/log/dovecot-deliver.log
info_log_path
= /var/log/dovecot-deliver.log
}
auth default {
mechanisms
= plain
socket
listen {
master
{
path
= /var/run/dovecot-auth-master
mode = 0600
user = vmail # User running
Dovecot LDA
}
}
passdb
pam {
}
#
LDAP database
userdb
ldap {
args
= /etc/dovecot/dovecot-ldap.conf
}
user
= vmail
}
plugin {
#
Default quota for all users is set to 100 MB with a
#
limit of 5000 messages in Mailbox.
#
quota = maildir:storage=102400:messages=500
}
64,1 Bot
The second configuration file is
#vi /etc/dovecot/dovecot-ldap.conf
hosts = asim.emergen.org
ldap_version = 3
base = ou=people,dc=asim,dc=emergen,dc=org
scope = subtree
user_attrs =
uid,mailMessageStore,,,,,mailQuotaSize=quota
user_filter =
(&(&(objectClass=qmailUser)(accountStatus=active))(|(mailAlternateAddress=%u)(mail=%u)(uid=%u)))
user_global_uid = 1005
user_global_gid = 1005
Now, we have to define the authentication
type in the file /etc/default/saslauthd .
#vi /etc/default/saslauthd
No comments:
Post a Comment