Skip to main content

Mail Server Configuration in CentOS using Postfix

First thing to do is check if postfix and dovecot is installed in your Linux Machine
rpm -qa postfix
rpm -qa dovecot

If postfix and dovecot is not installed, then install it using yum command
yum install postfix dovecot -y

Now lets start configuring Mail Server:

1. Look for the below line and make necessary changes in vi /etc/postfix/main.cf

myhostname = mail.yj.bt
mydomain = yj.bt
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 127.0.0.0/8, 10.0.0.0/24
home_mailbox = Maildir/
smtpd_banner = $myhostname ESMTP
# Add at bottom for
# for SMTP-Auth setting
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

2. service sendmail stop
3. chkconfig sendmail off
4. Change the MTA from sendmail to Postfix

alternatives --config mta

5. service postfix start
6. chkconfig postfix on
7. Look for the below line and make necessary changes in vi /etc/dovecot.conf

protocols = imap imaps pop3 pop3s
mail_location = maildir:~/Maildir
mechanisms = plain login
socket listen { # uncomment
client { # uncomment
path = /var/spool/postfix/private/auth-client
mode = 0660 # uncomment
user = postfix # add new line
group = postfix # add new line
} # uncomment
} # uncomment

8. service dovecot start
9. chkconfig dovecot on

That's it, your linux machine will now function as mail server. Isn't that very simple for setting up a simple mail server. Please be mind that there is MX entry in your DNS point to the IP address of your mail server.

Comments

Popular posts from this blog

Know your Lha Zha, Sog Zha, Shi Zha

There is believe in Buddhism, that an individual person have got their own lucky day and bad luck day in a week. They are derived from the twelve animals similar to chiness horscope. Your birth year tells you which Buddhism zodiac sign you below to. Lha Zha and Sog Zha are belived to be good day while Shi zha is consider bad day.

IPTABLES

Under linux OS, we use iptables to secure the machine from any other external attack. In current scenario I am forwarding the packages from local interface to external interface and i have squid configured which will be acting as transparent proxy. Only selective port numbers are open for the network. 1. Save the script to a file. 2. Give permission to execute. chmod +x filename . 3. Execute the file as follows ./filename 4. save the output of the script to system iptables file, by running the command service iptables save 5. You are done, start/restart the iptables service. service iptables restart Script: #!/bin/sh # chmod +x file name to execute # eth0 LAN # eth1 WAN # Local IP range 192.168.0.0/25 # NATing # Transparent proxy iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -A INPUT -i lo -j ACCEPT iptables -A...