Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


gmail_as_a_relay_on_linux_centos8

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
gmail_as_a_relay_on_linux_centos8 [2022/03/18 14:28] juckinsgmail_as_a_relay_on_linux_centos8 [2022/03/30 14:01] juckins
Line 1: Line 1:
-==== GMail as a Relay on Linux CENTOS8 ====+==== GMail as a Relay on Linux Ubunutu 20.04 LTS and CENTOS8 ====
  
 Using Postfix for this solution. Using Postfix for this solution.
Line 5: Line 5:
   dnf install postfix ca-certificates mutt   dnf install postfix ca-certificates mutt
   dnf install cyrus-sasl, cyrus-sasl-gssapi, cyrus-sasl-lib, cyrus-sasl-plain   dnf install cyrus-sasl, cyrus-sasl-gssapi, cyrus-sasl-lib, cyrus-sasl-plain
 +  systemctl start postfix
 +  systemctl enable postfix
  
 Follow instructions at https://www.linode.com/docs/guides/configure-postfix-to-send-mail-using-gmail-and-google-workspace-on-debian-or-ubuntu/  Follow instructions at https://www.linode.com/docs/guides/configure-postfix-to-send-mail-using-gmail-and-google-workspace-on-debian-or-ubuntu/ 
Line 13: Line 15:
     * The "Less Secure Apps" is not available in Gmail if your account is configured for 2-factor authentication     * The "Less Secure Apps" is not available in Gmail if your account is configured for 2-factor authentication
     * Everything should work OK.     * Everything should work OK.
 +
 +Perform the following steps as root:
 +  
 +  cd /etc/postfix
 +  cp main.cf main.cf.distro
 +  mkdir /etc/postfix/sasl
 +  cd /etc/postfix/sasl
 +  vi sasl_passwd
 +
 +Add this line:
 +
 +  [smtp.gmail.com]:587 [email protected]:password
 +
 +  postmap /etc/postfix/sasl/sasl_passwd
 +  chown root:root /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db
 +  chmod 0600 /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db
 +
 +  vi /etc/postfix/main.cf
 +
 +Comment out this line:
 +
 +  #smtp_tls_security_level = may
 +
 +Now wdd to the end of the main.cf file:
 +
 +  # Local Edits
 +  relayhost = [smtp.gmail.com]:587
 +  # Enable SASL authentication
 +  smtp_sasl_auth_enable = yes
 +  # Disallow methods that allow anonymous authentication
 +  smtp_sasl_security_options = noanonymous
 +  # Location of sasl_passwd
 +  smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
 +  # Enable STARTTLS encryption
 +  smtp_tls_security_level = encrypt
 +  # Location of CA certificates
 +  smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
 +
 +Restart postfix:
 +
 +  systemctl restart postfix
  
gmail_as_a_relay_on_linux_centos8.txt · Last modified: 2022/05/21 18:40 by juckins