linux_wiki:configure_a_system_to_forward_all_email_to_a_central_mail_server

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux_wiki:configure_a_system_to_forward_all_email_to_a_central_mail_server [2018/05/10 22:41]
billdozor [Null Client Testing]
linux_wiki:configure_a_system_to_forward_all_email_to_a_central_mail_server [2019/05/25 23:50]
Line 1: Line 1:
-====== 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) 
- 
----- 
- 
-====== Lab Setup ====== 
- 
-The following virtual machines will be used: 
-  * server1.example.com (192.168.1.150) -> Configure SMTP null client (**on the exam**) 
-  * server2.example.com (192.168.1.151) -> Configure central mail server for client testing (**NOT on the exam**) 
- 
----- 
- 
-====== 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 
-<code bash> 
-yum install postfix 
-</code> 
- 
-\\ 
-Enable and start the postfix service 
-<code bash> 
-systemctl enable postfix 
-systemctl start postfix 
-</code> 
- 
-\\ 
-Configure postfix parameters 
-  * Option A: Use postconf (faster if you have an idea what parameters you need to configure)<code bash># check a setting 
-postconf relayhost 
- 
-# check all settings 
-postconf | grep <keyword> 
- 
-# configure 
-postconf -e 'relayhost = [192.168.1.151]' 
-postconf -e 'inet_interfaces = loopback-only' 
-postconf -e 'mydestination =' 
-postconf -e 'mydomain = example.com' 
-</code> 
-  * Option B: Edit the main configuration<code bash>vim /etc/postfix/main.cf 
- 
-# Relayhost to forward mail to 
-relayhost = [192.168.1.151] 
- 
-# Forward from loopback interfaces 
-inet_interfaces = loopback-only 
- 
-# Configure destination as blank, because we aren't delivering mail locally (only forwarding outgoing) 
-mydestination =  
- 
-# Configure domain 
-mydomain = example.com 
-</code> 
- 
- 
-\\ 
-Check postfix syntax 
-<code bash> 
-postfix check 
-</code> 
- 
-\\ 
-Restart the service 
-<code bash> 
-systemctl restart postfix 
-</code> 
- 
----- 
- 
-====== 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 
-<code bash> 
-yum install postfix 
-</code> 
- 
-\\ 
-Enable and start postfix 
-<code bash> 
-systemctl enable postfix 
-systemctl start postfix 
-</code> 
- 
-\\ 
-Open the firewall to receive SMTP 
-<code bash> 
-firewall-cmd --permanent --add-service=smtp 
-firewall-cmd --reload 
-</code> 
- 
-\\ 
-Edit the main configuration file 
-<code bash> 
-#-- vim directly 
-vim /etc/postfix/main.cf 
- 
-# listening interfaces 
-inet_interfaces = all 
- 
-# Accept mail for these domains 
-mydestination = example.com, server2.example.com, server2 
- 
-#-- postconf method 
-  
-# check settings 
-postconf | grep inet_ 
-postconf | grep mydestination 
-  
-# configure 
-postconf -e 'inet_interfaces = all' 
-postconf -e 'mydestination = example.com, server2.example.com, server2' 
-</code> 
- 
-\\ 
-Check postfix syntax 
-<code bash> 
-postfix check 
-</code> 
- 
-\\ 
-Restart the service 
-<code bash> 
-systemctl restart postfix 
-</code> 
- 
----- 
- 
-====== Null Client Testing ====== 
- 
-**From server1** 
- 
-Install a mail client (if not already installed) 
-<code bash> 
-yum install mailx 
-</code> 
- 
-\\ 
-Send a test message 
-<code bash> 
-echo "Did it work?" | mail -s "This is a postfix forward test" root@server2.example.com 
-</code> 
- 
-\\ 
-Watch the mail log file for status messages 
-<code bash> 
-tail -f /var/log/maillog 
-</code> 
- 
-\\ 
-**From server2** 
- 
-On the postfix relayhost, check root's mail 
-<code bash> 
-mail 
-</code> 
- 
----- 
- 
-====== Troubleshooting ====== 
- 
-On the sending client, to view the mail queue 
-<code bash> 
-postqueue -p 
-</code> 
- 
-\\ 
-Flush the sending mail queue after fixing a problem to get rid of stuck messages 
-<code bash> 
-postqueue -f 
-</code> 
- 
-\\ 
-If a message is stuck and won't flush, it can be removed 
-<code bash> 
-postsuper -d <queue_id> 
-</code> 
-  * Instead of a single queue_id, you can specify the keyword 'ALL' 
- 
-\\ 
-On the receiving server, check the maillog for reasons a message did not deliver 
-<code bash> 
-tail /var/log/maillog 
-</code> 
- 
----- 
  
  • linux_wiki/configure_a_system_to_forward_all_email_to_a_central_mail_server.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)