The Satyavolu Family Website

Archive for April, 2009

Configuring Gmail as SMTP Relay on Elastix

Elastix uses Postfix, and getting Postfix configured to use Gmail as a SMTP Relay has been incredibly painful to do. This should not be as difficult as it turned out to be, but here is what I had to do to get things working.

Edit the /etc/postfix/main.cf file

nano /etc/postfix/main.cf

Change these lines to your external domain and the name of your elastix server:

################################
#Ingresado por yb-webadmin
mydomain = myrealdomain.gotdns.org
myhostname = elastix.myrealdomain.gotdns.org

Change the following line

#relayhost = [an.ip.add.ress]

to

relayhost = [smtp.gmail.com]:587

Create a new file /etc/postfix/sasl_passwd and put the following line in it

[smtp.gmail.com]:587       loginname@gmail.com:password

Then run the following command

postmap hash:/etc/postfix/sasl_passwd

Create a directory /etc/postfix/certs. Generate a self-signed certificate as follows

cd /etc/postfix/certs
openssl req -new -x509 -keyout cakey.pem -out cacert.pem -days 365
openssl genrsa -out gm.key 1024
openssl req -new -key gm.key -out gm.csr
openssl ca -cert cacert.pem -keyfile cakey.pem -out ./gm.pem -infiles gm.csr

If you get an error that says something like

Could not open directory ../../CA/newcerts

then do the following before you run the commands above

mkdir -p ../../CA/newcerts
touch ../../CA/index.txt
echo "01" >> ../../CA/serial

and after you are done, you can remove the above directory using

rm -rf ../../CA

Add the following lines to /etc/postfix/main.cf

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
 
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:/dev/urandom
smtp_tls_scert_verifydepth = 5
smtp_tls_key_file=/etc/postfix/certs/gm.key
smtp_tls_cert_file=/etc/postfix/certs/gm.pem
smtpd_tls_ask_ccert = yes
smtpd_tls_req_ccert =no
smtp_tls_enforce_peername = no

And finally run

postfix reload

Check your setup by sending a test email

mail myself@myemail.com

And check the logs for anything going wrong

tail -f /var/log/maillog

How to Choose a Doctor

HouseHaving a child is a exhilarating experience. Dealing with the health system in this country however, evokes the exact opposite emotion. One of the most traumatic experiences we had to revisit with the birth of our child was to pick a doctor, a pediatrician, for him and a OB/GYN for my wife. For myself, it was never really an issue, as I rarely visited the doctor. With a pregnancy and a child however, the doctor is critical, as we are likely to see that person a lot more than our parents :)

So I got to thinking – how do you pick a doctor. What do I look for in a doctor… (more…)