Avast WEBforum

Consumer Products => Avast Free Antivirus / Premium Security (legacy Pro Antivirus, Internet Security, Premier) => Topic started by: yildi on January 18, 2005, 09:36:23 AM

Title: Solution: Using GMail with Avast and a SPAM filter
Post by: yildi 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
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: wanidoob 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
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: ori 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?
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: sded 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.
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: ori on March 10, 2005, 05:44:46 PM
Thanks :)
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: Lisandro 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?
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: o2xygen 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
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: sded 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!
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: o2xygen 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
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: sded 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.
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: o2xygen 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
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: sded 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
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: o2xygen 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
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: sded 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.
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: o2xygen 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 :)
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: sded on April 24, 2005, 06:28:26 PM
Glad to hear it is working for you.  If you have another ISP that supports secure email (besides gmail), you can adapt the gmail stuff by using ports like 11112 and 11027 in TB & avast!, adding lines to stunnel.conf for the new servers, and removing the protocol=smtp line from the smtp setup (gmail uses ssl and an unusual port, most ISPs use tls and port 25).  You can also do secure IMAP this way (with port 993 in stunnel ) if your ISP supports it.  Avast!/Stunnel/OpenSSL gives pretty good flexibility once you get through the initial setup.
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: rdsu on June 16, 2005, 02:57:58 PM
With the new incoming version of Thunderbird, we will not need to have another program to avast! check virus in messages from POP3 with SSL ;D

See this post: http://forums.mozillazine.org/viewtopic.php?p=1543696#1543696

Regards
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: Ryu701 on December 16, 2005, 08:48:13 PM
Hello. I use Win XP Home, Avast 4.6.739 , Thunderbird 1.0.7 , Stunnel 4.11 and OpenSSL 0.9.8.a.

I want to check my gmail account with Avast and made these configurations as told above:

I changed TB configuration of gmail account as localhost, port 11111 and 11026 and no SSL.
I changed stunnel.conf as described here and I didnt forget the first line: "client=yes".
I added required ports, 11111 and 11026 to Avast! internet mail configuration and I am sure that they are in Avast.INI.

However I still have problems.

When Avast Internet Mail scanner is on, I can send emails but I can not get them. Thunderbird says that "Connected to localhost.." but nothing happens for long time. When I turn Internet Mail scanner off I can receive them.

Another strange thing is, although "add note to sent messages" option is checked in Avast there are not any note in sent messages.

Can you help me please? What can be wrong?
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: Lisandro on December 17, 2005, 02:34:04 AM
Hello. I use Win XP Home, Avast 4.6.739 , Thunderbird 1.0.7 , Stunnel 4.11 and OpenSSL 0.9.8.a.
I have Win XP Pro, avast 4.6.739, Thunderbird 1.5, Stunnel 4.14 (with OpenSSL library inside of it).

I use TB configuration of gmail account as 127.0.0.1, port 11110 and no SSL.
I changed stunnel.conf to

Code: [Select]
# GMail
client=yes

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

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

I added required ports, 11110 and 11025 to avast! Internet Mail provider settings (Redirection).

Just some questions, do you use any Spam killer application? Any local proxy filter (like an annonimizer)?
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: Ryu701 on December 18, 2005, 01:40:34 AM
Tech, thank you for your reply. I use neither a Spam killer application nor a local proxy filter. But I found the cause of my problem. 

Ignorelocalhost=0 line must be added to avast.ini.

But if Avast's version is 4.6, this setting must be changed by Avast interface; manually editing avast.ini has no effect.

Now, after trying many hours, I can finally scan my sending and receiving emails of both Gmail and non SSL mail accounts.  :D

This FAQ (http://forum.avast.com/index.php?topic=8775.msg97026#msg97026) was helpful for me, anybody experiencing problems with these complex configurations may refer to it.
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: Lisandro on December 18, 2005, 03:05:47 AM
Manually editing avast.ini has no effect.
Oh... I should told you before...
The Mail Service must be stopped before the manual change.
Glad you've find another path to happiness  8)
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: whkrems on December 25, 2005, 03:01:19 AM
I finally got Avast to work with SSL\gmail using outlook Express. Posting my configuration in hope of helping someone.
Installed OpenSSL and Stunnel.
------------------------------------------

(Avast set the Listen ports.)
(I set log=20 for Max logging)

Avast4.ini:
-----------------------------------
[MailScanner]
DefaultSmtpServer=smtp.gmail.com
DefaultPopServer=pop.gmail.com
UseDefaultSmtp=0
AutoSetProtection=1
ShowTrayIcon=1
Log=20
SmtpListen=127.0.0.1:1245
PopListen=127.0.0.1:1244
ImapListen=127.0.0.1:143
PopRedirectPort=11110
SmtpRedirectPort=11125
ImapRedirectPort=143
NntpRedirectPort=119
IgnoreAddress=
IgnoreLocalhost=0
AutoRedirect=1
StartPop=1
StartSmtp=1
StartImap=1
StartNntp=1
====================================


Stunnel.conf:
-------------------------------------------------------------------------
# We're running as a client to SSLify the GMail POP connection
client=yes
debug=debug

# 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:11125
[gmail-smtps]
TIMEOUTconnect = 10
accept=127.0.0.1:11125
connect=smtp.gmail.com:465
#or the SSL port of your Secure SMTP server if you use another service.
===========================================

Outlook Express:
--------------------------------------------
Incoming mail server: 127.0.0.1
Outgoing mail server: 127.0.0.1
Server requires Authentication is checked.
Server Ports:
Outgoing (SMTP) 11125
Incoming (pop3) 11110
Server reqiures SSL: is Unchecked.
===========================================
(all other settings in Outlook Express left the way they were set by GmailConfig.exe.)

My Thanks to this forum.
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: Lisandro on December 26, 2005, 01:17:49 PM
I finally got Avast to work with SSL\gmail using outlook Express. Posting my configuration in hope of helping someone.
We're glad with you...

I set log=20 for Max logging
You can downgrade the log capacity to avoid such a big log file  ;)
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: whkrems on January 15, 2006, 03:33:09 PM
Well, had Avast working with gmail using Outlook Express on Windows Xp SP2.
  Can not get it to work after doing complete restore and using Windows XP without service packs or updates.
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: Lisandro on January 15, 2006, 03:52:06 PM
Well, had Avast working with gmail using Outlook Express on Windows Xp SP2.
Can not get it to work after doing complete restore and using Windows XP without service packs or updates.

Maybe you have to install Stunnel again (the new versions include the OpenSSL drivers).
Taka look here: http://forum.avast.com/index.php?topic=10428.0 to see how to set up secure email with avast!.
Advanced configuration: please refer to this post http://forum.avast.com/index.php?topic=8775.msg97026#msg97026
Title: Re: Solution: Using GMail with Avast and a SPAM filter
Post by: CharleyO on January 15, 2006, 04:59:05 PM
***

whkrems ... you should also update XP to SP2!

Otherwise, your computer is usafe from many exploits.  :(


***