Difference between revisions of "Postfix Mail relaying with smtp auth"

From Bitbull Wiki
Jump to navigation Jump to search
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
==notice==
+
=notice=
 
this is a sample config to enable mail sending for system mails or forward mails from mailserver by smtp-auth.
 
this is a sample config to enable mail sending for system mails or forward mails from mailserver by smtp-auth.
  
 
=howto=
 
=howto=
 +
==SMTP AUTH==
 
<pre>
 
<pre>
 
vi /etc/postfix/password
 
vi /etc/postfix/password
Line 23: Line 24:
  
 
/etc/init.d/postfix restart
 
/etc/init.d/postfix restart
 +
</pre>
 +
 +
==WITH TLS==
 +
<pre>
 +
yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain
 +
 +
 +
vi /etc/postfix/main.cf
 +
---
 +
smtp_enforce_tls = yes
 +
smtp_tls_security_level = encrypt
 +
---
 +
 +
/etc/init.d/postfix restart
 +
</pre>
 +
 +
[[Category:Linux]]
 +
 +
==CHANGE SYSTEM SENDER==
 +
<pre>
 +
vi /etc/postfix/main.cf
 +
---
 +
sender_canonical_maps = regexp:/etc/postfix/canonical
 +
---
 +
 +
vi /etc/postfix/canonical
 +
---
 +
/^.*localhost.*/      send@mydomain.com
 +
/^.*localdomain.*/    send@mydomain.com
 +
---
 +
</pre>
  
 
[[Category:Linux]]
 
[[Category:Linux]]

Latest revision as of 12:04, 30 September 2021

1 notice

this is a sample config to enable mail sending for system mails or forward mails from mailserver by smtp-auth.

2 howto

2.1 SMTP AUTH

vi /etc/postfix/password
---
#smtp.isp.com       username:password
smtp.mydomain.com         send-user@mydomain.com:mySecretePassword
---

chown root:root /etc/postfix/password
chmod 0600 /etc/postfix/password
postmap hash:/etc/postfix/password

vi /etc/postfix/main.cf
---
relayhost = smtp.mydomain.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/password
smtp_sasl_security_options =
---

/etc/init.d/postfix restart

2.2 WITH TLS

yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain


vi /etc/postfix/main.cf
---
smtp_enforce_tls = yes
smtp_tls_security_level = encrypt
---

/etc/init.d/postfix restart

2.3 CHANGE SYSTEM SENDER

vi /etc/postfix/main.cf
---
sender_canonical_maps = regexp:/etc/postfix/canonical
---

vi /etc/postfix/canonical
---
/^.*localhost.*/      send@mydomain.com
/^.*localdomain.*/    send@mydomain.com
---