Differences
This shows you the differences between two versions of the page.
linux_wiki:configure_a_system_to_forward_all_email_to_a_central_mail_server [2016/10/04 22:44] billdozor [Forward Email: Postfix Setup] |
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) | ||
- | |||
- | ---- | ||
- | |||
- | ====== Forward Email: Postfix Setup ====== | ||
- | |||
- | A mail null client forwards local email. It does not receive any mail from network sources. | ||
- | |||
- | \\ | ||
- | Install required package | ||
- | <code bash> | ||
- | yum install postfix | ||
- | </ | ||
- | |||
- | \\ | ||
- | Enable and start the postfix service | ||
- | <code bash> | ||
- | systemctl enable postfix | ||
- | systemctl start postfix | ||
- | </ | ||
- | |||
- | \\ | ||
- | Edit the main configuration | ||
- | <code bash> | ||
- | vim / | ||
- | |||
- | ## Set the origin (where mail came from) to the domain variable | ||
- | myorigin = $mydomain | ||
- | |||
- | # Relayhost to forward mail to | ||
- | # gmail for testing purposes; exam will provide an IP/hostname of a mail server to use | ||
- | relayhost = [smtp.gmail.com]: | ||
- | |||
- | # 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 | ||
- | </ | ||
- | |||
- | \\ | ||
- | **NOT ON EXAM** -> Gmail specific: Add gmail settings to the main.cf file | ||
- | <code bash> | ||
- | vim / | ||
- | |||
- | |||
- | #### Gmail specific settings - NOT ON THE EXAM #### | ||
- | smtp_use_tls = yes | ||
- | smtp_sasl_auth_enable = yes | ||
- | smtp_sasl_password_maps = hash:/ | ||
- | smtp_tls_CAfile = / | ||
- | smtp_sasl_security_options = noanonymous | ||
- | smtp_sasl_tls_security_options = noanonymous | ||
- | #### End of Gmail specific settings #### | ||
- | </ | ||
- | |||
- | \\ | ||
- | **NOT ON EXAM** -> Gmail specific: Config to sign into a secure SMTP | ||
- | <code bash> | ||
- | vim / | ||
- | |||
- | [smtp.gmail.com]: | ||
- | </ | ||
- | * Replace username and password with actual gmail username and password. | ||
- | |||
- | \\ | ||
- | **NOT ON EXAM** -> Gmail specific: Set restrictive permissions on the sasl file | ||
- | <code bash> | ||
- | chown root: | ||
- | chmod 640 / | ||
- | </ | ||
- | |||
- | \\ | ||
- | **NOT ON EXAM** -> Gmail specific: Convert sasl file so postfix can use it | ||
- | <code bash> | ||
- | postmap / | ||
- | </ | ||
- | |||
- | \\ | ||
- | Check postfix syntax | ||
- | <code bash> | ||
- | postfix check | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ====== Forward Mail: Client Mail Testing ====== | ||
- | |||
- | Install a mail client (if not already installed) | ||
- | <code bash> | ||
- | yum install mailx | ||
- | </ | ||
- | |||
- | \\ | ||
- | Send a test message | ||
- | <code bash> | ||
- | echo "This is the subject body" | mail -s "This is a postfix forward test" username@gmail.com | ||
- | </ | ||
- | |||
- | \\ | ||
- | Watch the mail log file for status messages | ||
- | <code bash> | ||
- | tail -f / | ||
- | </ | ||
- | |||
- | ---- | ||