Exim with SSL POP/SMTP/IMAP (using stunnel)

Source

# cd /etc/stunnel
 
[replace 'domain' with your domain]
 
# openssl req -newkey rsa:1024 -keyout mail.domain.com.tmp.pem -nodes -x509 -days 9999 -out mail.domain.com.tmp2.pem
 
# cat mail.domain.com.tmp.pem > mail.domain.com.pem && echo "" >> mail.domain.com.pem && cat mail.domain.com.tmp2.pem >> mail.domain.com.pem
 vi /etc/stunnel/stunnel.conf
# stunnel configuration file
# Copyright by Martin Vernooij - 2005
 
cert = /etc/stunnel/mail.domain.com.pem
pid = /var/run/stunnel/stunnel.pid
chroot = /var/run/stunnel
setuid = nobody
setgid = nobody
 
# Workaround for Eudora bug
options = DONT_INSERT_EMPTY_FRAGMENTS
 
# Some debugging stuff
debug = 3
output = /var/log/stunnel.log
 
# Some performance tunings
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
 
# Service-level configuration
 
[pop3s]
accept = 38.99.248.82:995
connect = 110
 
[imaps]
accept = 38.99.248.82:993
connect = 143
 
[smtps]
accept = 38.99.248.82:465
connect = 25
# mkdir /var/run/stunnel
# chown nobody:nobody /var/run/stunnel
 
# stunnel /etc/stunnel/stunnel.conf
 
# vi /etc/rc.d/rc.local 

add this line

stunnel /etc/stunnel/stunnel.conf
Tags: Linux security how-to mail SSL