Changes

From Amahi Wiki
Jump to: navigation, search
no edit summary
{{MessageBox|backgroundcolor =#faa|image =Warning.png|heading = Send mail through your HDA using your Gmail account ==WARNING|message =This is recommended only for advanced users, proceed with caution.}}tagsThis tutorial is now available as the Amahi [https: //www.amahi.org/apps/postfix-mail gmail f14 postfix -relayPost Mail Relay] application.
Warning: Only try this if you know what you’re doing.<br><br>I took the information from [http://carlton.oriley.net/blog/?p=31 this page] and modified them slightly for Fedora 14 / Amahi 6. <br><br>First of all, install postfix and remove sendmail: <br>{{Code|yum -y install postfixyum -y remove sendmail}}Openssl and openssl-perl are needed to generate certificates and create SSL connections to GMail<br>Openssl should be installed already, but to be sure: <br>{{Code|yum -y install openssl openssl-perl}}A Certificate Authority is needed to create the necessary certificates. You This can skip the next paragraph if you already have one:<br>{{Code|cd /etc/pki/tls/misc./CA.pl –newca}}*You will be prompted for the file name, hit enter used to create a new CA.* You will need to enter a passphrase next, be sure to remember it.*Choose the Country Name, State send mails from your Amahi 7 or Province Name, Locality Name, Organization Name, and Organizational Unit Name to your liking. Be sure to remember the values, they will be needed in the key creation later. *For the Common Name, type “CA” greater (without quotesFedora 19 or greater). *Take defaults for everything else HDA and when prompted enter the passphrase from above.<br>Now a key that is sent to Gmail to start the SSL encryption will be created: <br>{{Code|cd /etc/pki/tlsmkdir gmail_relaycd gmail_relayopenssl genrsa -out serverreceive system emails.key 1024openssl req -new -key server.key -out server.csr}}You will be prompted To receive emails meant for country etc. like when creating the CA. Enter the same values. <br>As Common Nameroot user, now enter the name of your server, FQDN or not, your choice. <br>{{Codeyou have to [[Forward_System_Emails|openssl ca -out serverForward System Emails]] after finishing this tutorial.pem -infiles server.csr}} You will need also might want to enter your passphrase again take a look at this point[[Masquerade_email_address|Masquerade email address]] as well.<br>When asked if you want to sign the key, answer yes, same when asked if to commit it.
Add the following to the bottom of the file REF: [http://opentodo.net/2013/etc03/postfix/main.cf. You do not need -smtp-relay-to-smtp-gmail-com Postfix SMTP relay to change anything else in it, as the last setting for any option is the one that is saved.{{Text|Text=#### Gmail SSL SMTP Relay relayhost <nowiki>=</nowiki> [smtp.gmail.com]:587
#auth smtp_sasl_auth_enable* First of all, install postfix and remove sendmail: <nowikibr>=</nowikipre>yesyum -y install postfix mailx smtp_sasl_password_maps <nowiki>=yum -y remove sendmail</nowikipre> hash:/etc/postfix/sasl_passwd
#tls* Add the following to the bottom of the file /etc/postfix/main.cf. You do not need to change anything else in it, as the last setting for any option is the one that is saved. smtp_use_tls <nowikipre>####Gmail SMTP Relay#TLS parameterssmtpd_use_tls=</nowiki> yes smtp_sasl_security_options <nowiki>smtpd_tls_session_cache_database =<btree:${data_directory}/nowiki> noanonymoussmtpd_scache smtp_sasl_tls_security_options <nowiki>smtp_tls_session_cache_database =<btree:${data_directory}/nowiki> noanonymoussmtp_scache smtp_tls_note_starttls_offer <nowiki>=</nowiki> yes tls_random_source <nowiki>smtp_tls_policy_maps =<hash:/nowiki> dev:etc/devpostfix/urandomtls_policy #Relay host configurationrelayhost = [smtp.gmail.com]:587 smtp_tls_scert_verifydepth <nowiki> #SASL Configurationsmtp_sasl_auth_enable =</nowiki> 5yes smtp_tls_key_file<nowiki>smtp_sasl_password_maps =</nowiki>hash:/etc/pkipostfix/tls/gmail_relay/server.keysasl_passwd smtp_tls_cert_file<nowiki>smtp_sasl_security_options =</nowiki>/etc/pki/tls/gmail_relay/server.pemnoanonymous smtpd_tls_ask_ccert <nowiki>smtp_sasl_mechanism_filter =</nowiki> yesplain smtpd_tls_req_ccert <nowiki>smtp_sasl_tls_security_options =noanonymous</nowikipre>no smtp_tls_enforce_peername <nowiki>=<br /nowiki> no}}Create /etc/postfix/sasl_passwd file with your Gmail login credentials that looks like below:{{Text|Text=gmail-smtp.l.google.com user@gmail.com:passwordsmtp.gmail.com user@gmail.com:password}}
Obviously, you need to change * Create /etc/postfix/sasl_passwd file with your Gmail login credentials that looks like below:<pre>[smtp.gmail.com]:587 user@gmail.com:Password</pre><br /><b>NOTE:</b> Change ''user'' to your username and ''password'' to your gmail passwordcrredentials. <br/>Create the password database: <br>{{Code|postmap hash:/etc/postfix/sasl_passwd}}
* Build the password database: <br><pre>postmap hash:/etc/postfix/sasl_passwd</pre> * Create /etc/postfix/tls_policy file that looks like below:<pre>[smtp.gmail.com]:587 encrypt</pre><br />* Build the policy database: <br><pre>postmap /etc/postfix/tls_policy</pre> * Protect the files with your Gmail login data:{{Code|<pre>chmod 600 /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd.db
chmod 600 /etc/postfix/tls_policy
chmod 600 /etc/postfix/tls_policy.db</pre><!--
chown postfix /etc/postfix/sasl_passwd
chown postfix /etc/postfix/sasl_passwd.db}chown postfix /etc/postfix/tls_policychown postfix /etc/postfix/tls_policy.db--> * Restart Postfix:<pre>systemctl restart postfix.service</pre> * Set Postifx to start on boot:<pre>systemctl enable postfix.service</pre> * Now try sending a mail, it should reach your Gmail account:<pre>echo test 1 2 | mail -s "Test mail" user@gmail.com</pre>  <b>NOTE:</b> Some ISPs will block emails sent using this method. Looking for a work around. == Troubleshooting ==* If you get the message " warning: SASL authentication failure: No worthy mechs found", install this package. yum install cyrus-sasl{,-plain}
:Restart Postfix{{Code|/etc/init.d/ systemctl restart postfix restart}}
Now try sending a mail* Receive the following message: connect to smtp.gmail.com[2607:f8b0:400e:c05::6d]:587: Network is unreachable:To correct this problem, it should reach your Gmail accountchange /etc/postfix/main.cf as follows: inet_protocol = ipv4:Restart postfix systemctl reload postfix
See also:<br>
[[Amahi_Mail_-_The_Free_Way]], not working on F14, yet.<br>[[Forward_System_Emails|Forward System Emails]]<br>[[Enable_Outgoing_Mail]], not working on F14, yet.<br>[[Monitor_System_Logs_via_E-mail|Monitor System Logs via E-mail]]<br>
12,424

edits