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.gmail. com]:587 #SASL Configurationsmtp_sasl_auth_enable = yessmtp_sasl_password_maps = hash:/etc/postfix/sasl_passwdsmtp_sasl_security_options = noanonymoussmtp_sasl_mechanism_filter = plain*Take defaults for everything else and when prompted enter the passphrase from above.smtp_sasl_tls_security_options = noanonymous<br/pre>Now a key that is sent to GMail to start the SSL encryption will be created: <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.db smtp_sasl_auth_enable=yeschmod 600 /etc/postfix/tls_policy smtp_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-->
#tls smtp_use_tls = yes smtp_sasl_security_options = noanonymous smtp_sasl_tls_security_options = noanonymous smtp_tls_note_starttls_offer = yes tls_random_source = dev* Restart Postfix:/dev/urandom smtp_tls_scert_verifydepth = 5 smtp_tls_key_file=/etc/pki/tls/gmail_relay/server<pre>systemctl restart postfix.key smtp_tls_cert_file=/etc/pki/tls/gmail_relayservice</server.pem smtpd_tls_ask_ccert = yes smtpd_tls_req_ccert =no smtp_tls_enforce_peername = no<brpre>
Create /etc/* Set Postifx to start on boot:<pre>systemctl enable postfix.service</sasl_passwd file with your GMail login credentials that looks like below:pre>
gmail-smtp.l.google.com user@gmail.com* Now try sending a mail, it should reach your Gmail account:password<brpre> smtp.gmail.com echo test 1 2 | mail -s "Test mail" user@gmail.com:password<br/pre>
Obviously, you need to change ''user'' to your username and ''password'' to your gmail password. <br>
Create the password database<b>NOTE: <br/b> Some ISPs will block emails sent using this method. Looking for a work around.
postmap hash== Troubleshooting ==* If you get the message " warning:/etc/postfix/sasl_passwdSASL authentication failure: No worthy mechs found", install this package. yum install cyrus-sasl{,-plain}
:Restart Postfix
systemctl restart postfix
Protect * Receive the files with your GMail login datafollowing message: connect to smtp.gmail.com[2607:f8b0:400e:c05::6d]:587: Network is unreachable:To correct this problem, change /etc/postfix/main.cf as follows: inet_protocol = ipv4:Restart postfix systemctl reload postfix
chmod 600 /etc/postfix/sasl_passwd chmod 600 /etc/postfix/sasl_passwd.db chown postfix /etc/postfix/sasl_passwd chown postfix /etc/postfix/sasl_passwd.db<br> Restart Postfix  /etc/init.d/postfix restart Now try sending a mail, it should reach your gmail account. See also:[[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