Skip to main content

Ralsina.Me — Roberto Alsina's website

Squid authentication via POP or IMAP

A short tu­to­ri­al ex­plain­ing how to make Squid val­i­date its users against a POP or IMAP serv­er. It must be use­ful, be­cause I use it ;-)

Edwin Groothuis / 2006-04-03 06:48:

Thanks for this write up, but could you please update it so it uses the syntax of Squid 2.5?



It took me some time before I figured out why it complained so much about it :-)



Edwin

Roberto Alsina / 2006-04-03 06:53:

Done. It took me a while because I didn't notice your comment until yesterday ;-)

Adi / 2006-04-03 11:06:

Hi!

I am kind of new in working with linux and I have a problem about connecting a windows email client (outlook express)to an external mail server on pop3. Does your script help me do that?

I am runnig Linux FC1 with squid 2.5 stable 5 and made all the configurations you described but still receive the same error from outlook (cannot connect to server xxxx). The proxy settings are in place on windows as everything else works just fine via squid.



Thanks for your time.

Roberto Alsina / 2006-04-03 11:07:

Sorry, but your problem is much deeper than you think.



* Squid has nothing to do with mail, really. It only handles access to webpages and FTP servers.



* This script and config is about using a password to access squid, and uses an email server as a way to check if the password is correct. It has nothing to do with reading mail at all.



* What you want is probably a NATing firewall, or at least a POP3 proxy.



If you want, email me and I can try to give you a hand, but if this is for your work, what you really need to do is hire someone who knows networking to gie you a hand.

Huso / 2006-04-03 16:14:

Hi!

I have a problem, script output is under



Traceback (most recent call last):

File "popauth.py", line 21, in ?

[user,password]=line.split(' ')

ValueError: unpack list of wrong size



How can i do?

Roberto Alsina / 2006-04-03 16:15:

Huso: that shouldn't happen. It means that squid is passing malformed data to the script.



Specifically, it means that there is extra space (or a missing space) in the authentication data.



Please contact me via email!

LucA / 2006-04-04 01:52:

Hints for making a version of the script to work with ssl pop3 (port 995)?

Roberto Alsina / 2006-04-04 12:54:

LucA: well, you could use openssl (the command) to wrap a SSL connection into a call to os.popen.



Or you could use a python-ssl module, which I am sure is out there somewhere.

LOL / 2012-06-15 09:05:

Thank you, you are the man...


Contents © 2000-2024 Roberto Alsina