April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

SMTP relay server with RHEL

I prefer to use corporate mail server for mail relay mails from Linux box.

While settingup Nagios for my friend and as he insisted using Gmail to send Nagios alters I found interesting post.

Install dependencies.

yum -y install openssl-perl

If /etc/pki/CA/private/cakey.pem does not exists

/etc/pki/tls/misc/CA.pl -newca

That will create the cakey.pem file in /etc/pki/CA/private

Then edit the file /etc/pki/tls/openssl.cnf and set

dir = /etc/pki/CA

Generate CSR (in /etc/postfix/certs)

openssl genrsa -out itchy.key 1024
openssl req -new -key itchy.key -out itchy.csr
openssl ca -out itchy.pem -infiles itchy.csr

Postfix Configuration

relayhost = [smtp.gmail.com]:587

#auth
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

#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:/dev/urandom
smtp_tls_scert_verifydepth = 5
smtp_tls_key_file=/etc/postfix/certs/itchy.key
smtp_tls_cert_file=/etc/postfix/certs/itchy.pem
smtpd_tls_ask_ccert = yes
smtpd_tls_req_ccert =no
smtp_tls_enforce_peername = no

cat /etc/postfix/sasl_passwd

gmail-smtp.l.google.com user@gmail.com:password
smtp.gmail.com user@gmail.com:password

postmap /etc/postfix/sasl_passwd

/etc/init.d/postfix reload

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>