You can use stunnel to implement pop smtp imap access encrypted by the mail server.
What is stunnel, here is not introduced, please see stunnel official website http://www.stunnel.org
First check the installation package
[Root @ mailsvr12/] # rpm-qa | grep-I stunnel
Stunnel-4.15-2.el5.1
The key to STUNNEL is the PEM key,
The fastest way to generate a key is to generate a key pair at a hidden location on the official website at http://www.stunnel.org/pem.
Copy the generated key to/etc/stunnel. pem and clear the previous key. If no, create this file.
Modify permissions
[Root @ mailsvr12/] # chmod 600/etc/stunnel. pem
The following is the configuration file.
[Root @ mailsvr12/] # cat/etc/stunnel. conf
# Sample stunnel configuration file
Cert =/etc/stunnel. pem # key storage location
Chroot =/var/run/stunnel/
# PID is created inside chroot jail
Pid =/stunnel. pid
Setuid = nobody
Setgid = nobody
[Pop3s]
Accept = 995
Connect = 1, 110
[Imaps]
Accept = 993
Connect = 1, 143
[Ssmtp]
Accept = 465
Connect = 25
---------------------------------------------------------------------------
Note the following in the above stunnel. conf file:
/Var/run/stunnel/to create this file, the nobody user has the Read and Write Permissions
Start stunnel
[Root @ mailsvr12/] #/usr/sbin/stunnel &-add this sentence to/etc/rc. local and start it randomly.
View the process in ps-ef.
Nobody 4134 1 0 09:22? 00:00:00/usr/sbin/stunnel
This article from the "Xi'an chuangyue Network | Xi'an enterprise mailbox | enterprise mailbox" blog, please be sure to retain this source http://chenzhuo.blog.51cto.com/150592/238570
This article is from bkjia.com technical blog
[Root @ mailsvr12/] # netstat-nap | grep stunnel
Tcp 0 0 0.0.0.0: 993 0.0.0.0: * LISTEN 4134/stunnel
Tcp 0 0 0.0.0.0: 995 0.0.0.0: * LISTEN 4134/stunnel
Tcp 0 0 0.0.0.0: 465 0.0.0.0: * LISTEN 4134/stunnel
Unix 2 [] DGRAM 4418813 4134/stunnel
You can see that the port listens normally. Then, emails such as foxmail or outlook can be accessed through an encrypted channel.