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 ===Warning: Only try this if you know what you’re doingThis is recommended only for advanced users, proceed with caution.<br><br>}}I took This tutorial is now available as the information from Amahi [[this page httphttps://carltonwww.orileyamahi.netorg/blogapps/?p=31postfix-mail-relay Post Mail Relay]] and modified them slightly for Fedora 14 / Amahi 6application. <br><br>
First of allThis can be used to send mails from your Amahi 7 or greater (Fedora 19 or greater) HDA and to receive system emails. To receive emails meant for the root user, install postfix and remove sendmail: you have to [[Forward_System_Emails|Forward System Emails]] after finishing this tutorial. You also might want to take a look at [[Masquerade_email_address|Masquerade email address]] as well.<br>
# yum REF: [http://opentodo.net/2013/03/postfix-y install postfix<br># yum smtp-y remove sendmail<br>Openssl and opensslrelay-perl are needed to generate certificates and create SSL connections to GMail<br>Openssl should be installed already, but to be sure: <br># yum -y install openssl opensslsmtp-gmail-perl<br>A Certificate Authority is needed com Postfix SMTP relay to create the necessary certificatesSMTP gmail. You can skip the next paragraph if you already have one:<br>com]
# cd /etc/pki/tls/misc* First of all, install postfix and remove sendmail: <br># .<pre>yum -y install postfix mailxyum -y remove sendmail</CA.pl –newca<brpre>
*You will be prompted for Add the following to the bottom of the file name, hit enter to create a new CA/etc/postfix/main.cf.* You will do not need to enter a passphrase next, be sure to remember change anything else in it.*Choose the Country Name, State or Province Name, Locality Name, Organization Name, and Organizational Unit Name to your liking. Be sure to remember as the values, they will be needed in last setting for any option is the key creation laterone that is saved. *For the Common Name, type “CA” (without quotes)<pre>####Gmail SMTP Relay#TLS parameterssmtpd_use_tls=yessmtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scachesmtp_tls_session_cache_database = btree:${data_directory}/smtp_scachesmtp_tls_note_starttls_offer = yessmtp_tls_policy_maps = hash:/etc/postfix/tls_policy #Relay host configurationrelayhost = [smtp. *Take defaults for everything else and when prompted enter the passphrase from abovegmail.<br>com]:587 Now a key that is sent to GMail to start the SSL encryption will be created#SASL Configurationsmtp_sasl_auth_enable = yessmtp_sasl_password_maps = hash: /etc/postfix/sasl_passwdsmtp_sasl_security_options = noanonymoussmtp_sasl_mechanism_filter = plainsmtp_sasl_tls_security_options = noanonymous</pre><br/>
# cd * Create /etc/pkipostfix/tls<br>sasl_passwd file with your Gmail login credentials that looks like below:# mkdir gmail_relay<br># cd gmail_relay<brpre># openssl genrsa -out server[smtp.key 1024<br># openssl req -new -key servergmail.key -out servercom]:587 user@gmail.csrcom:Password<br/pre>You will be prompted for country etc. like when creating the CA. Enter the same values. <br/>As Common Name, now enter the name of your server, FQDN or not, your choice. <brb># openssl ca -out server.pem -infiles server.csrNOTE:<br/b>You will need Change ''user'' to your username and ''password'' to enter your passphrase again at this pointgmail crredentials.<br/>When asked if you want to sign the key, answer yes, same when asked if to commit it.
Add * Build the following to the bottom of the file password database: <br><pre>postmap hash:/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.sasl_passwd</pre>
#### GMail SSL SMTP Relay* Create /etc/postfix/tls_policy file that looks like below:relayhost = <pre>[smtp.gmail.com]:587encrypt</pre><br />* Build the policy database: <br><pre>postmap /etc/postfix/tls_policy</pre>
#auth* Protect the files with your Gmail login data:<pre>chmod 600 /etc/postfix/sasl_passwdchmod 600 /etc/postfix/sasl_passwd.dbsmtp_sasl_auth_enable=yeschmod 600 /etc/postfix/tls_policysmtp_sasl_password_maps = hash:chmod 600 /etc/postfix/tls_policy.db</pre><!--chown postfix /etc/postfix/sasl_passwdchown postfix /etc/postfix/sasl_passwd.dbchown postfix /etc/postfix/tls_policychown postfix /etc/postfix/tls_policy.db-->
#tlssmtp_use_tls = yessmtp_sasl_security_options = noanonymous smtp_sasl_tls_security_options = noanonymoussmtp_tls_note_starttls_offer = yestls_random_source = dev* Restart Postfix:/dev/urandomsmtp_tls_scert_verifydepth = 5smtp_tls_key_file=/etc/pki/tls/gmail_relay/server<pre>systemctl restart postfix.keysmtp_tls_cert_file=service</etc/pki/tls/gmail_relay/server.pemsmtpd_tls_ask_ccert = yessmtpd_tls_req_ccert =nosmtp_tls_enforce_peername = noCreate /etc/postfix/sasl_passwd file with your GMail login credentials that looks like below:pre>
gmail-smtp.l.google.com user@gmail.com* Set Postifx to start on boot:password<brpre>smtp.gmail.com user@gmailsystemctl enable postfix.com:passwordservice<br/pre>
Obviously* Now try sending a mail, you need to change ‘’user’’ to your username and ‘’password’’ to it should reach your Gmail account:<pre>echo test 1 2 | mail -s "Test mail" user@gmail password. com<br/pre>
Create the password database: <br>
# postmap hash<b>NOTE:</etc/postfix/sasl_passwdb> 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}
Protect the files with your GMail login data:Restart Postfix systemctl restart postfix
# chmod 600 /etc/postfix/sasl_passwd* Receive the following message: connect to smtp.gmail.com[2607:f8b0:400e:c05::6d]:587: Network is unreachable # chmod 600 :To correct this problem, change /etc/postfix/sasl_passwdmain.dbcf as follows: # chown inet_protocol = ipv4:Restart postfix /etc/postfix/sasl_passwd # chown systemctl reload postfix /etc/postfix/sasl_passwd.db Restart Postfix and enjoy having your email from your server sent through your GMail account:
# /etc/init.d/postfix restartSee also:<br>[[Forward_System_Emails|Forward System Emails]]<br>[[Monitor_System_Logs_via_E-mail|Monitor System Logs via E-mail]]<br>
12,424

edits