Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Access POP and SMTP through an HTTP proxy UNIX
My companny limits Internet access to http/ https through a proxy. I have found a way to send and receive email through this proxy.
  1. Install and compile connect.c. You must have the compilers and other tools from the Apple Developers Tools (every other *nix system includes these!). I installed the compiled connect.c into /usr -> local -> bin/sconnect. To automatically send and receive email using the connect.c tool, you will have to a) change inetd.conf and b) set up a special account on your email tool which sends and receives email on ports other than the standard 25 and 110.

  2. Changes to /private/etc/services. I chose port 26 and 111 for sending and receiving email. Edit your services file so that it contains:
    smtp_work        26/tcp                 #smtp used through firewall
    pop3_work       111/tcp                 #pop3 from work
    #sunrpc         111/tcp    rpcbind      #SUN Remote Procedure Call
    #sunrpc         111/udp    rpcbind      #SUN Remote Procedure Call
    
    Note how the existing sunrpc lines are invalidated by inserting the '#' as the first character

  3. Changes to /private/etc/inetd.conf. Edit this file so that it contains the following;
    smtp_work stream tcp nowait root /usr/local/bin/sconnect       
       /usr/localbin/sconnect -H proxy.yourcompany.com:80 
       smtpserver.provider.com 25
       
    pop3_work  stream  tcp  nowait  root  /usr/local/bin/sconnect   
       /usr/local/bin/sconnect -H proxy.yourcompany.com:80 
       popserver.provider.com 110
    
    There are two long lines above, each is shown on three lines for easier display here. When entering these lines, replace the line breaks with spaces. Note: my email provider allows me send email using a password associated with my account. Most ISP's don't allow SMTP connections unless the incoming connection has an IP which is on one of their netblocks).

  4. Restart inetd. Either reboot, or use ps aux | grep inet to find the process ID of inetd and then restart inetd using kill -HUP inetdProcess_ID.

  5. Set up an email account in your email software which uses the special ports decribed above (ie, shown above receiving on port 111, and sending on port 26).
I would enjoy hearing from other users about tools like connect, tunnel, or any tools used to traverse socks servers.
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[15,127 views]  

Access POP and SMTP through an HTTP proxy | 10 comments | Create New Account
Click here to return to the 'Access POP and SMTP through an HTTP proxy' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Access POP and SMTP through an HTTP proxy
Authored by: foobar104 on Jul 28, '03 09:54:12AM

Sorry for blasting off on a tangent, but enough with the "every other UNIX includes these" crap, okay? It's simply not true. AIX, Solaris, and IRIX all include developer tools as an unbundled option, not installed by default. So do Linux and FreeBSD.

The developer tools that were current when your Mac was built came with your machine. (Assuming you have a recent Mac.) The up-to-date tools are available as a free download. NO MORE COMPLAINING ABOUT UNBUNDLED DEVELOPER TOOLS.



[ Reply to This | # ]
Access POP and SMTP through an HTTP proxy
Authored by: sierratarn on Jul 28, '03 10:17:41AM

Three things.....

There is a missing slash in the line:

smtp_work stream tcp nowait root /usr/local/bin/sconnect
/usr/localbin/sconnect -H proxy.yourcompany.com:80
smtpserver.provider.com 25

which should read:

smtp_work stream tcp nowait root /usr/local/bin/sconnect
/usr/local/bin/sconnect -H proxy.yourcompany.com:80
smtpserver.provider.com 25

Also this may not be an ideal solution for laptops as e-mail programs won't see this pop server as the same pop server that they use outside the network. I'd been toying with a model that uses SSH tunnels. The solution would be to set the e-mail "server" as localhost that can then connect through a ssh machine in the middle (outside the firewall) or directly to the e-mail server depending upon the settings of the ssh port forwarding which will be transparent to the local e-mail program.

Finally, there are several *nix systems that don't come with developer tools installed. I am happy to download a more current version of dev tools than the OS that came with my machine.



[ Reply to This | # ]
Dev Tool Complaints
Authored by: sgi_oh_too on Jul 28, '03 11:22:05AM

Right On! You hit the nail on the head!



[ Reply to This | # ]
Access POP and SMTP through an HTTP proxy
Authored by: network23 on Jul 28, '03 10:49:24AM

Can anyone point me to a good howto manual to compile something like this? I'm not that comfortable with compiling just yet and cannot find my previous resources. thanks.

---
Live and Direct, only from
Network 23



[ Reply to This | # ]
Access POP and SMTP through an HTTP proxy
Authored by: sierratarn on Jul 28, '03 10:59:28AM

To compile the program (having installed developer tools) have connect.c in the current directory and run the command:

gcc connect.c -o sconnect

that will create a file called sconnect that is the binary and can me moved to /usr/local/bin



[ Reply to This | # ]
Access POP and SMTP through an HTTP proxy
Authored by: housemaister on Jul 28, '03 11:19:50AM

You shouldn't use this lower port numbers because they are maybe reserved for other things.
With 26 there shouldn't be a big problem, but 111 is reserved for rpc's (see http://docs.info.apple.com/article.html?artnum=106439)
Better is using ports >= 1024 or even five digit numbers.



[ Reply to This | # ]
Access POP and SMTP through an HTTP proxy
Authored by: jtalkington on Jul 28, '03 02:02:58PM

Actually, this will only work on poorly set up proxy servers. Any installation that is set up properly disables CONNECT to any port except 443, and especially port 25, so that spammers can't use the proxy for sending mail...



[ Reply to This | # ]
Access POP and SMTP through an HTTP proxy
Authored by: jgillin on Jul 28, '03 03:43:29PM

Hi, would it be possible to route all email through http only? I work within various companies and I would like to use Mail - not .Mac Webmail.

I have previously posted a way to logon to .Mac through the terminal - which I use regularly, but if anyone had a better solution - please enlighten me.

Thanking you in advance...



[ Reply to This | # ]
Access POP and SMTP through an HTTP proxy
Authored by: sjk on Jul 29, '03 12:33:16AM

inetd was deprecated with Jaguar in favor of xinetd. See sample files in /etc/xinetd.d and read the man pages for xinetd and xinetd.conf.



[ Reply to This | # ]
Access POP and SMTP through an HTTP proxy
Authored by: crephoto on Jan 13, '04 05:23:40PM

I had this working under Jaguar (OS X V10.2), but I can't seem to make it work under Panther. The proxy services seem to be working (they show up in a port scan), but the Panther version of the Mail App doesn't appear to be calling the connect function when I tell it to use the associated port. I am using Mail Version 1.3 (v606) under OSX version 10.3.

Also, Panther comes with a built-in "Mail Server Proxy" under the Network Preferences. The Web proxy works fine (I'm connected through it right now), but I can't for the life of me make any pop or smtp proxies work using the OSX Mail application.

Contact me with any info at charles at estabrooks dot org.



[ Reply to This | # ]