Access POP and SMTP through an HTTP proxy

Jul 28, '03 09:29:00AM

Contributed by: linuxguy21042

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.

Comments (10)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030718150308455