In order to test a mail server, you will need to set up a DNS server.
Remove the sendmail package (sendmail is more complicated to configure):
# yum erase sendmail
Install the postfix package:
# yum install -y postfix
Add a new rule to the firewall:
# iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT
Save the firewall configuration:
# service iptables save
Activate the postfix service at boot:
# chkconfig postfix on
Start the postfix service:
# service postfix start
Let’s assume that your server is called mail.example.com on the 192.168.1.0/24 network.
Edit the /etc/postfix/main.cf file and change the following directives:
myhostname = mail.example.com mydomain = example.com myorigin = $mydomain inet_interfaces = all mydestination = $mydomain, $myhostname, localhost.$mydomain, localhost mynetworks = 192.168.1.0/24, 127.0.0.0/8
Check the syntax:
# postfix check
Check the non-default configuration:
# postconf -n
Reload the postfix configuration:
# service postfix reload
Set the ‘allow_postfix_local_write_mail_spool‘ SElinux boolean to ‘on’:
# setsebool -P allow_postfix_local_write_mail_spool on
Test from a client (it should display: 25/tcp open smtp):
# yum install -y nmap # nmap mail.example.com
Alternatively, test from a client:
# yum install -y telnet # telnet mail.example.com 25
In addition, you can look at configuring a MTA to forward (relay) email through a smart host.
Leave a Reply
You must be logged in to post a comment.