I am using Radius Manager 3.9, Radius Authentication server for my users for hotspot & PPPoE since 2 year but there is no email functionality to email to users when they register or upgrade their plan,and expiry date of account. I also mailed to DMASOFTLAB regarding this. He replied that install a email server. In a normal behaviour, I will not prefer to install a mail server only for Radius Manager. after lots of experiments, I decided to use gmail as a relay server to email to my users.
First of all check that sendmail is installed on your system or not if it is then stop the service and remove it.
Verify the sendmail package
#rpm -q sendmail
check service status
#service sendmail status
#yum remove sendmail
Now install postfix
#yum install postfix openssl openssl-perl
Now create a password file so that postfix can authenticate gmail servers. You do this by create a file named sasl_passwd in /etc/postfix.
#echo “smtp.gmail.com smtp_user:smtp_passwd” > /etc/postfix/sasl_passwd
for security reasons you can hash/encrypt this file
Make sure the sasl_passwd and sasl_passwd.db files are readable/writable only by root
$ chmod 600 /etc/postfix/sasl_passwd $ chmod 600 /etc/postfix/sasl_passwd.db
Need to create a Certificate Authority (if you don’t already have one) but you can do this one by multiple ways, two are
# cd /etc/pki/tls/misc
# ./CA.pl -newca
You will be prompted for the file name (just hit Enter). Then you will be asked for a PEM pass phrase, which you need to remember. You can fill out the Country Name, State or Province Name, Locality Name, Organization Name, and Organizational Unit Name to your liking (or take the defaults). You need to remember the Organization Name (if you changed it) as it must match one in a key we create later. For the Common Name, fill in “CA” (without quotes). Take defaults for everything else and when prompted to enter the pass phrase you need to enter the same one you did above.
# cd /etc/pki/tls
# mkdir gmail_relay
# cd gmail_relay
# openssl genrsa -out server.key 1024
# openssl req -new -key server.key -out server.csr
# openssl ca -out server.pem -infiles server.csr
The second openssl command above will prompt you for the Country, State, Locality, etc parameters again. The only value that has to match what was entered for the Certificate Authority is the Organization Name. For the Common Name you should put your server name (fully qualified preferred, but does not really matter). The last command will prompt you for your CA pass phrase that you used earlier. When asked if you want to Sign the certificate, say yes. also when asked if you should commit it, say yes.
Generate your own CA certificate
a. Change directory to /etc/pki/tls/certs
b.Create a key and test certificate in one file
You will something like
# make hostname.pem
ou are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank
Country Name (2 letter code) [GB]:
State or Province Name (full name) [Berkshire]:
Locality Name (eg, city) [Newbury]:
Organization Name (eg, company) [My Company Ltd]:
Organizational Unit Name (eg, section) :
Common Name (eg, your name or your server’s hostname) :
Email Address :
c. Fill-up the necessary information and copy the file on /etc/postfix as cacert.pem
#cp /etc/pki/tls/certs/hostname.pem /etc/postfix/cacert.pem
My mail.cfg file configuration
Finally you can past the following lines to /etc/postfix/main.cf file
#Gmail as Relay server for Postfix
smtp_sasl_security_options = noanonymous
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
Restart postfix and send a test email
$ postfix reload $ sendmail email@example.com Test relay thru Gmail Troubleshooting Monitor postfix mail log in sperate session by using following command $ tail -f /var/log/maillog
Amit Kumar Sinsinwar