Small HOWTO on configuring POP3 SSL with Fetchmail.
Here I assume that the server’s SSL certificate is a Self Signed Certificate
1) openssl s_client -connect mail.logicalwebhost.com:995 -showcerts
Execute this command to fetch the details of the server and also the certificate.
The output will be something like below:
rrs@laptop:~ $ openssl s_client -connect mail.someserver.com:995 -showcerts
CONNECTED
depth=0 /C=US/ST=CA/L=San Jose/O=Some Internet Hosting Services/OU=Automatically-generated POP3 SSL key/CN=mail.somehost.com/emailAddress=postmaster@researchut.com
verify error:num=18:self signed certificate
verify return:1
depth=0 /C=US/ST=CA/L=San Jose/O=Some Internet Hosting Services/OU=Automatically-generated POP3 SSL key/CN=mail.somehost.com/emailAddress=postmaster@researchut.com
verify return:1
—-
Certificate chain
0 s:/C=US/ST=CA/L=San Jose/O=Some Internet Hosting Services/OU=Automatically-generated POP3 SSL key/CN=mail.somehost.com/emailAddress=postmaster@researchut.com
i:/C=US/ST=CA/L=San Jose/O=Some Internet Hosting Services/OU=Automatically-generated POP3 SSL key/CN=mail.somehost.com/emailAddress=postmaster@researchut.com
---- BEGIN CERTIFICATE ----
---- END CERTIFICATE ----
2) Copy the certificate beginning from
"---- BEGIN CERTIFICATE ----" to "---- END CERTIFICATE ----"and save it with some name (foo.pem) into your ~/.certs folder
3) Run, `c_rehash ~/.certs`. You’ll get some output like the following
rrs@laptop:~ $ c_rehash .certs/
Doing .certs/
googlepop.pem => 34ceaf75.0
thwate.pem => ddc328ff.0
mail.somehost.com.pem => e76e0724.0
Notice the “somehost” line. That’s what your certificates output is.
4) Now configure your .fetchmailrc as follows
poll mail.somehost.com with proto POP3
user ‘username’ there with password ‘passWord’ is ‘rrs’ here options flush no rewrite ssl sslcertck sslcertpath ‘/home/rrs/.certs/’
smtphost localhost
5) Run fetchmail with the -v option to run in verbose mode to see the output. You should see something like the following:
Oct 2 03:13:34 laptop fetchmail12287: 6.2.5 querying mail.somehost.com (protocol POP3) at Sun 02 Oct 2005 03:13:34
AM IST: poll started
Oct 2 03:13:38 laptop fetchmail12287: Issuer Organization: Some Internet Hosting Services
Oct 2 03:13:38 laptop fetchmail12287: Issuer CommonName: mail.somehost.com
Oct 2 03:13:38 laptop fetchmail12287: Server CommonName: mail.somehost.com
Oct 2 03:13:38 laptop fetchmail12287: mail.somehost.com key fingerprint: 15:16:28:C3:60:82:E1:AE:D3:77:77:80:DC:BC
:F0:57
Oct 2 03:13:40 laptop fetchmail12287: POP3< +OK Hello there.
Oct 2 03:13:40 laptop fetchmail12287: POP3> CAPA
Oct 2 03:13:41 laptop fetchmail12287: POP3< +OK Here’s what I can do:
Oct 2 03:13:41 laptop fetchmail12287: POP3< STLS
Oct 2 03:13:41 laptop fetchmail12287: POP3< TOP
Oct 2 03:13:41 laptop fetchmail12287: POP3< USER
Oct 2 03:13:41 laptop fetchmail12287: POP3< LOGIN-DELAY 10
Oct 2 03:13:41 laptop fetchmail12287: POP3< PIPELINING
Oct 2 03:13:41 laptop fetchmail12287: POP3< UIDL
Oct 2 03:13:41 laptop fetchmail12287: POP3< IMPLEMENTATION Courier Mail Server
Oct 2 03:13:41 laptop fetchmail12287: POP3< .
Oct 2 03:13:41 laptop fetchmail12287: POP3> USER user@domain.com
Oct 2 03:13:42 laptop fetchmail12287: POP3< +OK Password required.
Oct 2 03:13:42 laptop fetchmail12287: POP3> PASS *
Oct 2 03:13:44 laptop fetchmail12287: POP3< +OK logged in.
Oct 2 03:13:47 laptop fetchmail12287: POP3> STAT
Oct 2 03:13:48 laptop fetchmail12287: POP3< +OK 0 0
Oct 2 03:13:48 laptop fetchmail12287: No mail for user@domain.com at mail.somehost.com
Oct 2 03:13:48 laptop fetchmail12287: POP3> QUIT
Oct 2 03:13:49 laptop fetchmail12287: POP3< +OK Bye-bye.
Oct 2 03:13:49 laptop fetchmail12287: 6.2.5 querying mail.somehost.com (protocol POP3) at Sun 02 Oct 2005 03:13:49
AM IST: poll completed
That’s it. Your fetchmail is configured to fetch mails using POP3 SSL. Now you’re much safer with your passwords.
Please drop a comment if you find this small HOWTO useful.
Bob () - 06 December '06 - 07:05
Trackback link: