linux_wiki:configure_a_system_to_forward_all_email_to_a_central_mail_server

This is an old revision of the document!


Configure A System To Forward All Email To A Central Mail Server

General Information

Configuring postfix.

On the exam, you will be provided all the information of an already configured central SMTP server.

You will be expected to configure a null client only. (server that forwards mail but does not receive any)


Null Client Setup

THIS IS ON THE EXAM: A mail null client forwards local email. It does not receive any mail from network sources.

From server1.


Install required package

yum install postfix


Enable and start the postfix service

systemctl enable postfix
systemctl start postfix


Edit the main configuration

vim /etc/postfix/main.cf
 
## Set the origin (where mail came from) to the domain variable
myorigin = $mydomain
 
# Relayhost to forward mail to
relayhost = [192.168.1.151]
 
# Forward from loopback interfaces and networks only (local system)
inet_interfaces = loopback-only
mynetworks = 127.0.0.0/8 [::1]/128
 
# Configure destination as blank, because we aren't delivering mail locally (only forwarding outgoing)
mydestination = 
 
# Prevent postfix from putting mail into mail boxes
local_transport = error: local delivery disabled


Check postfix syntax

postfix check


Restart the service

systemctl restart postfix

Postfix Central Mail Server

THIS IS NOT ON THE EXAM: This section setups up a mail server to receive mail in order to test the null client configured previously.

From server2


Install postfix

yum install postfix


Enable and start postfix

systemctl enable postfix
systemctl start postfix


Open the firewall to receive SMTP

firewall-cmd --permanent --add-service=smtp
firewall-cmd --reload


Edit the main configuration file

vim /etc/postfix/main.cf
 
inet_interfaces = all
inet_protocols = ipv4
mydestination = example.com, server2.example.com, server2


Restart the service

systemctl restart postfix

Null Client Testing

From server1.

Install a mail client (if not already installed)

yum install mailx


Send a test message

echo "This is the subject body" | mail -s "This is a postfix forward test" root@server2.example.com


Watch the mail log file for status messages

tail -f /var/log/maillog

  • linux_wiki/configure_a_system_to_forward_all_email_to_a_central_mail_server.1475638041.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)