Postfix as a send-only SMTP relay: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 5: | Line 5: | ||
inet_interfaces = loopback-only | inet_interfaces = loopback-only | ||
mynetworks = 127.0.0.0/8 | mynetworks = 127.0.0.0/8 | ||
relayhost = [smtp.example.net]: | relayhost = [smtp.example.net]:465 | ||
smtp_sasl_auth_enable = yes | smtp_sasl_auth_enable = yes | ||
smtp_sasl_security_options = noanonymous | smtp_sasl_security_options = noanonymous | ||
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd | smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd | ||
smtp_tls_security_level = | smtp_tls_security_level = encrypt | ||
smtp_tls_wrappermode = yes | |||
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt | smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt | ||
sender_canonical_maps = regexp:/etc/postfix/sender_canonical_maps | sender_canonical_maps = regexp:/etc/postfix/sender_canonical_maps | ||
| Line 15: | Line 16: | ||
*Put to <code>/etc/postfix/sasl/sasl_passwd</code> the login data of the SMTP host: | *Put to <code>/etc/postfix/sasl/sasl_passwd</code> the login data of the SMTP host: | ||
<pre> | <pre> | ||
[smtp.example.net]: | [smtp.example.net]:465 username:password | ||
</pre> | </pre> | ||
*<code># postmap /etc/postfix/sasl/sasl_passwd</code> | *<code># postmap /etc/postfix/sasl/sasl_passwd</code> | ||
*<code># chmod 600 /etc/postfix/sasl/*</code> | |||
*Put your SMTP host address to <code>/etc/postfix/sender_canonical_maps</code>: | *Put your SMTP host address to <code>/etc/postfix/sender_canonical_maps</code>: | ||
<pre>/.+/ user@example.net</pre> | <pre>/.+/ user@example.net</pre> | ||
*<code># postmap /etc/postfix/sender_canonical_maps</code> | *<code># postmap /etc/postfix/sender_canonical_maps</code> | ||
*Add something like | *Add something like | ||
<pre>root: user | <pre># Person who should get root's mail. Don't receive mail as root! | ||
#root: you | |||
root: user | |||
... | |||
# Put your local aliases here. | |||
user: user@example.org</pre> | user: user@example.org</pre> | ||
:to | :to <code>/etc/aliases</code>; then run the command <code>newaliases</code> | ||
*Add something like | |||
<pre>set from="user <user@example.org>"</pre> | |||
:to the end of <code>/etc/nail.rc</code> | |||
*<code># /etc/rc.d/rc.postfix restart</code> | |||
[[Category: Linux]] | [[Category: Linux]] | ||
Latest revision as of 02:38, 23 June 2020
# mkdir -p /etc/postfix/sasl- Add the following parameters to the end of
/etc/postfix/main.cf:
myhostname = localhost.example.com inet_interfaces = loopback-only mynetworks = 127.0.0.0/8 relayhost = [smtp.example.net]:465 smtp_sasl_auth_enable = yes smtp_sasl_security_options = noanonymous smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd smtp_tls_security_level = encrypt smtp_tls_wrappermode = yes smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt sender_canonical_maps = regexp:/etc/postfix/sender_canonical_maps
- Put to
/etc/postfix/sasl/sasl_passwdthe login data of the SMTP host:
[smtp.example.net]:465 username:password
# postmap /etc/postfix/sasl/sasl_passwd# chmod 600 /etc/postfix/sasl/*- Put your SMTP host address to
/etc/postfix/sender_canonical_maps:
/.+/ user@example.net
# postmap /etc/postfix/sender_canonical_maps- Add something like
# Person who should get root's mail. Don't receive mail as root! #root: you root: user ... # Put your local aliases here. user: user@example.org
- to
/etc/aliases; then run the commandnewaliases
- Add something like
set from="user <user@example.org>"
- to the end of
/etc/nail.rc
# /etc/rc.d/rc.postfix restart