Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux_wiki:configure_a_system_to_forward_all_email_to_a_central_mail_server [2016/10/04 23:37] billdozor [Null Client Setup] |
linux_wiki:configure_a_system_to_forward_all_email_to_a_central_mail_server [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 8: | Line 8: | ||
**You will be expected to configure a null client only**. (server that forwards mail but does not receive any) | **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**) | ||
---- | ---- | ||
Line 32: | Line 40: | ||
\\ | \\ | ||
Configure postfix parameters | Configure postfix parameters | ||
+ | * Option A: Use postconf (faster if you have an idea what parameters you need to configure)< | ||
+ | postconf relayhost | ||
- | | + | # check all settings |
+ | postconf | grep < | ||
+ | |||
+ | # configure - important | ||
+ | postconf -e ' | ||
+ | |||
+ | # configure - probably already defaults (or set to localhost) | ||
+ | postconf -e ' | ||
+ | postconf -e ' | ||
+ | postconf -e ' | ||
+ | </ | ||
+ | | ||
# Relayhost to forward mail to | # Relayhost to forward mail to | ||
relayhost = [192.168.1.151] | relayhost = [192.168.1.151] | ||
- | # Forward from loopback interfaces | + | # Forward from loopback interfaces |
inet_interfaces = loopback-only | inet_interfaces = loopback-only | ||
- | inet_protocols = ipv4 | ||
# Configure destination as blank, because we aren't delivering mail locally (only forwarding outgoing) | # Configure destination as blank, because we aren't delivering mail locally (only forwarding outgoing) | ||
Line 47: | Line 67: | ||
# Configure domain | # Configure domain | ||
mydomain = example.com | mydomain = example.com | ||
- | |||
- | # Prevent postfix from putting mail into mail boxes (not required on exam objectives) | ||
- | local_transport = error: local delivery disabled</ | ||
- | * Option B: Use postconf< | ||
- | postconf relayhost | ||
- | |||
- | # check all settings | ||
- | postconf | grep < | ||
- | |||
- | # configure | ||
- | postconf -e ' | ||
- | postconf -e ' | ||
- | postconf -e ' | ||
- | postconf -e ' | ||
- | postconf -e ' | ||
</ | </ | ||
+ | |||
\\ | \\ | ||
Line 107: | Line 113: | ||
Edit the main configuration file | Edit the main configuration file | ||
<code bash> | <code bash> | ||
+ | #-- vim directly | ||
vim / | vim / | ||
+ | # listening interfaces | ||
inet_interfaces = all | inet_interfaces = all | ||
- | inet_protocols = ipv4 | + | |
+ | # Accept mail for these domains | ||
mydestination = example.com, | mydestination = example.com, | ||
+ | |||
+ | #-- postconf method | ||
+ | |||
+ | # check settings | ||
+ | postconf | grep inet_ | ||
+ | postconf | grep mydestination | ||
+ | |||
+ | # configure | ||
+ | postconf -e ' | ||
+ | postconf -e ' | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | Check postfix syntax | ||
+ | <code bash> | ||
+ | postfix check | ||
</ | </ | ||
Line 124: | Line 149: | ||
====== Null Client Testing ====== | ====== Null Client Testing ====== | ||
- | **From server1**. | + | **From server1** |
Install a mail client (if not already installed) | Install a mail client (if not already installed) | ||
Line 134: | Line 159: | ||
Send a test message | Send a test message | ||
<code bash> | <code bash> | ||
- | echo "This is the subject body" | mail -s "This is a postfix forward test" root@server2.example.com | + | echo "Did it work?" | mail -s "This is a postfix forward test" root@server2.example.com |
</ | </ | ||
Line 141: | Line 166: | ||
<code bash> | <code bash> | ||
tail -f / | tail -f / | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | **From server2** | ||
+ | |||
+ | On the postfix relayhost, check root's mail | ||
+ | <code bash> | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== Troubleshooting ====== | ||
+ | |||
+ | On the sending client, to view the mail queue | ||
+ | <code bash> | ||
+ | postqueue -p | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | Flush the sending mail queue after fixing a problem to get rid of stuck messages | ||
+ | <code bash> | ||
+ | postqueue -f | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | If a message is stuck and won't flush, it can be removed | ||
+ | <code bash> | ||
+ | postsuper -d < | ||
+ | </ | ||
+ | * Instead of a single queue_id, you can specify the keyword ' | ||
+ | |||
+ | \\ | ||
+ | On the receiving server, check the maillog for reasons a message did not deliver | ||
+ | <code bash> | ||
+ | tail / | ||
</ | </ | ||
---- | ---- | ||