Author Topic: Solution: Using GMail with Avast and a SPAM filter  (Read 51464 times)

0 Members and 1 Guest are viewing this topic.

Offline yildi

  • Jr. Member
  • **
  • Posts: 28
Solution: Using GMail with Avast and a SPAM filter
« on: January 18, 2005, 09:36:23 AM »
Hi,

I think I have developed quite a general solution for configuring a full chain of programs for GMail.
The basic idea has already been suggested in these forums but the instructions were less than complete. I propose here full instructions for configuring the chain of programs in order to let STunnel (an Open Source software) to assume  the SSL part of the connection (necessary for the secured POP and SMTP required by GMail).

ThunderBird - Spamhilator-Avast-Stunnel pour GMail
and
ThunderBird - Spamhilator-Avast for non SSL POP

both work now and also SecureSMTP for GMail.

You can easily adapt these instructions for your particular Pop client and SPAM filter.

So, let me draft some sort of a FAQ following my recent experience.

A/ Installing and preparing STUNNEL

Download OPENSSL for Windows from http://www.slproweb.com/products/Win32OpenSSL.html and install it.
Download STUNNEL for WIndows from http://www.stunnel.org/download/binaries.html. This an exe file and you can place it on any specific folder (eg. in C:\stunnel).
In the folder where you have copied stunnel, you will create its configuration file.

So launch your notepad and type the following (adapt it if necessary) in a blank document:

Code: [Select]
# We're running as a client to SSLify the GMail POP connection
client=yes

# POP3 service, listens on localhost:11110
[gmail-pop3s]
accept=127.0.0.1:11110
connect=pop.gmail.com:995 #or the SSL port of your Secure POP server if you use another service.

# SMTP service, listens on localhost:11025
[gmail-smtps]
accept=localhost:11025
connect=smtp.gmail.com:465 #or the SSL port of your Secure SMTP server if you use another service.
Save this file in the same folder as the stunnel exe under the name stunnel.conf

Open a windows command window and switch to the folder where stunnel has been placed.
Execute the following command to launch stunnel as a Windows service (you will hence be able to stop or manage it using the standard windows console for services):
stunnelexecutablename -install

stunneexecutablename will be something like stunnel-4.07 (depends on the version you download, 4.07 is the actual stable version)

Now you will observe a new icon (something like a network folder) in the right taskbar and if you double click on the icon, you will be able to open the log window (nothing very interesting will be visible for now). If you have made an error in the configuration file, stunnel will refuse to be launched. In this case check the syntax (comparing with the above one) and the ports numbers of your service.

Now we can configure the mail client.

B/ Setting the mail client.

I will assume that you have two kind of POP accounts,  one normal (toto@myserver.com) and one secured (toto2@gmail.com).
I will also assume that your SPAM filter uses the port 120 (like SPAMILATOR) if not, adapt the following instructions.

Configuring the normal POP account.

Server: localhost Port: 120 (for spamilator, adapt it for the port listened by your filter)
username: pop.myserver.com&toto  (this is format used by SPAMI, if your filter expects another scheme please adapt it)

Configuring the secure POP account
Server: localhost Port: 120 (for spamilator, adapt it for the port listened by your filter)
username: localhost&toto2&11110 

(this is format used by SPAMILATOR, if your filter expects another scheme please adapt it - the last element is the port number that will be listened by STUNNEL - and  also by AVAST, see below - in order to be converted to a  SSL flow toward pop.gmail.com, as specified in stunnel.conf)

Setting the secure SMTP for GMail:

Server: localhost  Port: 11025  (the port listened by STunnel and  by AVAST -see below)
User name: toto2

The setting of the normal SMTP is... normal.

We have a last configuration to do.

C/ Setting Avast.ini

As you probably know, this file sits in avastfolder\data subfolder.
You open it in the Notepad and locate and edit (and complete) the following section (leave the rest of the settings as such, I only give here the settings that you should modify; we will just add the ports to listen and the listeneing of these ports on the locahost - IgnoreLocalhost=0):
Code: [Select]
[MailScanner]
PopRedirectPort=110,1110,1120,11110
SmtpRedirectPort=25,215,225,1025,11025
IgnoreLocalhost=0
AutoRedirect=1
You save this file and now you must now be able to check all your accounts (the first time your mail client will ask you your passwords for the secure connections).

Tell me if this is understandable and if it works for you.

Good luck.

Murat

Offline wanidoob

  • Jr. Member
  • **
  • Posts: 21
  • Uggly Bob !
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #1 on: March 01, 2005, 07:02:02 PM »
I am very interesting in this configurations,
but I don't understand the real route of data. Is this exact ? :
(example for POP)

1/ For a secure POP account :

Thunderbird (login "127.0.0.1&toto2&11110" send to 127.0.0.1:120)
<=> Spamilator (login "toto2" send to 127.0.0.1:11110)
 +  Avast (with PopRedirectPort=11110)
<=> STunnel (login "toto2" send to pop.gmail.com:995)


2/ For other POP accounts :

Thunderbird (login "pop.myserver.com&toto" send to 127.0.0.1:120)
<=> Spamilator (login "toto" send to pop.myserver.com:110)
 +  Avast (with PopRedirectPort=110)

If it is exact, I have tryed this (without the anti-spam step) :

Thunderbird (login "toto2" send to 127.0.0.1:995)
<=> stunnel (login "toto2" send to pop.gmail.com:995)

Stunnel.conf:
Code: [Select]
[gmail-pop3]
client=yes
accept=127.0.0.1:995
connect=pop.gmail.com:995

And it doesn't work : no error message but no pass request niether email poped...


edit: now I've done it :
http://forum.avast.com/index.php?topic=11627.msg100504#msg100504
« Last Edit: April 25, 2005, 03:23:32 PM by wanidoob »
english newbie ::) + network newbie :-\ ... ... ... so please be patient :-*

Offline ori

  • Newbie
  • *
  • Posts: 2
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #2 on: March 10, 2005, 03:54:49 PM »
I tried the configuration and I received stunnel generated the following error:


2005.03.10 16:49:25 LOG3[3240:3484]: Error resolving 'pop.gmail.com': servname is not supported for ai_socktype (EAI_SERVICE)
Cannot resolve 'pop.gmail.com:995 #or the SSL port of your Secure POP server if you use another service.' - delaying DNS lookup

Later when I tried to call the pop from my mail client (outlook express) I received
the same error.

I use WinXP Pro SP2.

Does anyone have any idea what is the reason to the error?

Offline sded

  • Avast Evangelist
  • Super Poster
  • ***
  • Posts: 1718
  • Me llamo Ed
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #3 on: March 10, 2005, 04:31:25 PM »
Move the # comment to a separate line wherever it appears; can't be on same line as connect statement.
Windows 7 x64HP-SP1-No UAC, Opera 11.51, Avast! Internet Security 6.0.128, Webroot SecureAnywhere latest beta, Windows FW off, MVPS HOSTS, SAS/MBAM offline, Macrium Reflect just in case ;)

Offline ori

  • Newbie
  • *
  • Posts: 2
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #4 on: March 10, 2005, 05:44:46 PM »
Thanks :)

Offline Lisandro

  • Avast team
  • Certainly Bot
  • *
  • Posts: 67273
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #5 on: March 22, 2005, 02:02:28 AM »
ThunderBird - Spamhilator-Avast-Stunnel for GMail

stunnel.conf
# SMTP service, listens on localhost:11025
[gmail-smtps]
accept=localhost:11025
connect=smtp.gmail.com:465 #or the SSL port of your Secure SMTP server if you use another service.

Setting the secure SMTP for GMail:
Server: localhost  Port: 11025  (the port listened by STunnel and  by AVAST)
User name: toto2

Avast.ini
[MailScanner]
PopRedirectPort=110,11110
SmtpRedirectPort=25,11025
IgnoreLocalhost=0
AutoRedirect=1

Murat, I can do everything, except get my outbound mail scanned... Is it really possible?
The best things in life are free.

Offline o2xygen

  • Jr. Member
  • **
  • Posts: 70
  • I'm not a llama!
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #6 on: April 23, 2005, 10:36:15 PM »
Because I didn't clearly understand.... $%*&&*
1)Do I need that spamhiliator thing?
2)DO i need to do part B ? I am not using spamhilator

Offline sded

  • Avast Evangelist
  • Super Poster
  • ***
  • Posts: 1718
  • Me llamo Ed
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #7 on: April 23, 2005, 11:12:56 PM »
To set up gmail with avast!, you need to do 3 things:
1) In your email client, use
localhost:11111 for your pop server
localhost:11026 for your smtp server
Do not check "use secure"

2) In avast! email provider add
11111 to the pop3 ports to redirect
11026 to the smtp ports to redirect

3) With a text editor, create Stunnel.conf (or cut/paste below)
Stunnel.conf, the configuration file, looks exactly like this for gmail:
(fixed to add client=yes in edit)

client=yes
# POP3 service, listens on localhost:11111
[gmail-pop3s]
accept=localhost:11111
connect=pop.gmail.com:995

# SMTP service, listens on localhost:11026
[gmail-smtps]
protocol=smtp
accept=localhost:11026
connect=smtp.gmail.com:587

You need to download and install OpenSSL from http://www.openssl.org/related/binaries.html and Stunnel from http://www.stunnel.org/download/binaries.html and install them.  Stunnel can either be installed as a windows service or added to your startup group.  Put stunnel.conf in the same folder as stunnel.

There are a large number of users of secure email with avast! who can help here in the forum if you have problems/questions.  Give it a try!
« Last Edit: April 24, 2005, 02:47:04 PM by sded »
Windows 7 x64HP-SP1-No UAC, Opera 11.51, Avast! Internet Security 6.0.128, Webroot SecureAnywhere latest beta, Windows FW off, MVPS HOSTS, SAS/MBAM offline, Macrium Reflect just in case ;)

Offline o2xygen

  • Jr. Member
  • **
  • Posts: 70
  • I'm not a llama!
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #8 on: April 24, 2005, 12:54:22 AM »
Thanks. Thats more straightforward

but
Thunderbird pops a message that could not connect to localhost. Connection refused
This happens everytime I press the get mail button

Offline sded

  • Avast Evangelist
  • Super Poster
  • ***
  • Posts: 1718
  • Me llamo Ed
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #9 on: April 24, 2005, 01:04:18 AM »
Check your server settings in TB and Avast! again.  Is Stunnel running without an error?  You can right click on the Icon to get a log of its activity to be sure.
« Last Edit: April 24, 2005, 01:16:38 AM by sded »
Windows 7 x64HP-SP1-No UAC, Opera 11.51, Avast! Internet Security 6.0.128, Webroot SecureAnywhere latest beta, Windows FW off, MVPS HOSTS, SAS/MBAM offline, Macrium Reflect just in case ;)

Offline o2xygen

  • Jr. Member
  • **
  • Posts: 70
  • I'm not a llama!
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #10 on: April 24, 2005, 11:39:37 AM »
These are the same... After restarting stunnel failed to start
This error:
Stunnel Server is down due to an error
You need to exit and correct the problem
Click Ok to view the log


2005.04.24 12:35:36 LOG5[408:1980]: stunnel 4.10 on x86-pc-mingw32-gnu WIN32+IPv6 with OpenSSL 0.9.7f 22 Mar 2005
2005.04.24 12:35:36 LOG3[408:1980]: stunnel.pem: No such file or directory (2)

2005.04.24 12:35:36 LOG3[408:1980]: Server is down



Tried to use the -uninstall command but the same error...  This stunnel.pem file is the error here

Offline sded

  • Avast Evangelist
  • Super Poster
  • ***
  • Posts: 1718
  • Me llamo Ed
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #11 on: April 24, 2005, 02:45:55 PM »
Sorry; when I cut and pasted the gmail setup for the stunnel.conf file, I didn't go back and get the prologue.  In Stunnel.conf, first line should be
client=yes
I'll go back and fix the earlier message
« Last Edit: April 24, 2005, 03:25:47 PM by sded »
Windows 7 x64HP-SP1-No UAC, Opera 11.51, Avast! Internet Security 6.0.128, Webroot SecureAnywhere latest beta, Windows FW off, MVPS HOSTS, SAS/MBAM offline, Macrium Reflect just in case ;)

Offline o2xygen

  • Jr. Member
  • **
  • Posts: 70
  • I'm not a llama!
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #12 on: April 24, 2005, 04:58:15 PM »
This seemed to solve that problem...
Now I can check for messages using Thunderbird, but I cannot download them... I see  to Thunderbird's information window (lower to the left) that there are 5 messages
TB says : Receiving: message 1 of 5
and doesn't do anything after that


If I switch off avast, then it stays like this for 1-2 minutes and then the message disappears and Nothing is downloaded

Sorry for the inconvenience

Offline sded

  • Avast Evangelist
  • Super Poster
  • ***
  • Posts: 1718
  • Me llamo Ed
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #13 on: April 24, 2005, 05:15:03 PM »
If it occurs even with avast! off, ?  What OS and firewall are you using?  Another thing you could do is try the same setup with Outlook Express.  It has very good logging capabilities under tools/options/maintenance/troubleshooting that will give you a log of all the server commands.  The log will be in your documents and settings/names/application data/identities/...
Also check your firewall to make sure you have allowed Stunnel to download the mail.
« Last Edit: April 24, 2005, 06:11:12 PM by sded »
Windows 7 x64HP-SP1-No UAC, Opera 11.51, Avast! Internet Security 6.0.128, Webroot SecureAnywhere latest beta, Windows FW off, MVPS HOSTS, SAS/MBAM offline, Macrium Reflect just in case ;)

Offline o2xygen

  • Jr. Member
  • **
  • Posts: 70
  • I'm not a llama!
Re: Solution: Using GMail with Avast and a SPAM filter
« Reply #14 on: April 24, 2005, 06:11:25 PM »
Sded, I found the problem... Thunderbird was dowloading duplicate emails... There was an email that had an attachment of 1.5mb and somehow Thunderbird inbox had 10-15 copies of that email... So I deleted it from my Gmail's inbox and then I pressed the get Mail button and thunderbird downloaded the New Messages ;D

It wasn't a problem with stunnel nor avast... Its this bug with TB downloading messages that have been downloaded before...

thanks sded for your help and time... I owe you
cheers :)