————————————————–

Configure Postfix SMTP service

———————————————-

#  yum  install  postfix*

Edit main.cf:
#  vim  /etc/postfix/main.cf

Line 75 & 83 (enable and edit):

myhostname  =  abc.com

mydomain  =  com

Line 99 (enable):

myorigin  =  $mydomain

Line 116 & 119 (enable and edit):

inet_interfaces  =  all

inet_protocols  =  ipv4

Line 165 (enable):

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

Line 264 (enable and edit):

mynetworks  =  192.168.7.0/24, 127.0.0.0/8

Line 419 (enable):

home_mailbox  =  Maildir/

Line 545 & 546 (enable and edit):

header_checks = regexp:/etc/postfix/header_checks

body_checks = regexp:/etc/postfix/body_checks

Line 571 (enable):

smtpd_banner  =  $myhostname  ESMTP

Add following 7 lines at the end of file (SMTP-auth settings):

smtpd_sasl_type  =  dovecot

smtpd_sasl_path  =  private/auth

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

To limit an email size (10M), add:

message_size_limit  =  10485760

To limit mailbox (1G), add:

mailbox_size_limit  =  1073741824

Save & quit.

#  vim  /etc/postfix/header_checks

Line 330 (just below to: “header_checks” ), add:

/^From:.*<#.*@.*>/REJECT

/^Return-Path:.*<#.*@.*>/REJECT

Save & quit.

Create a new file “body_checks” in /etc/postfix and edit.

#  vim  /etc/postfix/body_checks

Add the line:

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

Save & quit.

#  service  postfix  start

In case you need to open port 25/tcp, run this:

#  iptables  -A  INPUT  -p  tcp  – -dport  25  -j  ACCEPT

———————————————————

Configure Dovecot POP/IMAP service

———————————————————

#  yum install  dovecot*

#  vim  /etc/dovecot/dovecot.conf

Enable line 26 (by removing #):

listen  =  *, ::

Save & quit.

#  vim  /etc/dovecot/conf.d/10-auth.conf

Line 9:

disable_plaintext_auth  =  no

Line 97:

auth_mechanisms  =  plain  login

Save & quit.

#  vim  /etc/dovecot/conf.d/10-mail.conf

Line 30:

mail_location  =  maildir:~/Maildir

Save & quit.

#  vim  /etc/dovecot/conf.d/10-master.conf

Line 88 to 92 (enable by removing # and edit as given):

unix_listener  /var/spool/postfix/private/auth {

mode = 0666

user = postfix

group = postfix

}

Save & quit.

#  service  dovecot  start

In case you need to open port 143/tcp, run this:

#  iptables  -A  INPUT  -p  tcp  – -dport  143  -j  ACCEPT

Advertisements