no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | tech:linux:setup_postfix_relay [2014/11/15 15:13] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Setup Postfix to function as relay host ====== | ||
| + | Setup Postfix to function as relay host with authentication | ||
| + | * Create a password maps file | ||
| + | * You can create multiple entries in the sasl_passwd file for multiple domains | ||
| + | < | ||
| + | echo " | ||
| + | chown root:root / | ||
| + | chmod 600 / | ||
| + | postmap / | ||
| + | </ | ||
| + | |||
| + | * Update / | ||
| + | < | ||
| + | relayhost = mailserver.example.com | ||
| + | smtp_sasl_auth_enable = yes | ||
| + | smtp_sasl_password_maps = hash:/ | ||
| + | smtp_sasl_security_options = | ||
| + | </ | ||
| + | |||
| + | * Restart/ | ||
| + | |||
| + | ===== Another Example ===== | ||
| + | Typical configuration for an internal server (inside a LAN) that uses an SMTP server (also internal) to send mail. | ||
| + | |||
| + | Append this to main.cf | ||
| + | < | ||
| + | mydomain = mail.dev08.example.org | ||
| + | myhostname = mail.dev08.example.org | ||
| + | myorigin = $mydomain | ||
| + | append_dot_mydomain = no | ||
| + | relayhost = td006 | ||
| + | smtp_host_lookup = native | ||
| + | </ | ||
| + | |||
| + | Below is a configuration diff that was generated from a Ubuntu Trusty default Postfix install as " | ||
| + | |||
| + | <code diff> | ||
| + | diff --git a/ | ||
| + | index eb619b9..1539d7d 100644 | ||
| + | --- a/ | ||
| + | +++ b/ | ||
| + | @@ -33,8 +33,12 @@ alias_maps = hash:/ | ||
| + | | ||
| + | | ||
| + | | ||
| + | -relayhost = smtp.localdomain | ||
| + | +relayhost = localsmtp | ||
| + | +smtp_host_lookup = native | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | Not exactly sure why, but sometimes it is required to include '' | ||
| + | ===== Generic mapping for outgoing SMTP mail ===== | ||
| + | Since the from address will not appear as host.localdomain and be treated as junk mail, to rewrite relayed mail from address use '' | ||
| + | |||
| + | Reference: http:// | ||
| + | |||
| + | Append to main.cf: | ||
| + | < | ||
| + | # Address rewriting | ||
| + | smtp_generic_maps = hash:/ | ||
| + | </ | ||
| + | |||
| + | Once updated do hash and reload (as root): | ||
| + | <code bash> | ||
| + | postmap / | ||
| + | / | ||
| + | </ | ||