Tunneling SMTP via SSH


By design we do not permit off-campus machines to use our SMTP
server. If we did permit it, we would be allowing any and all
to use our SMTP server for the distribution of SPAM, the bane
of system adminstrators everywhere. However, off-campus machines
can use retrieve email using POP or IMAP; but in order to send
email you should use your ISP's SMTP server. For most people this
is satisfactory; for some it is not. For those in the latter 
category the good news is that there is a relatively simple
mechanism by which they can send mail via our SMTP server while
off-campus. This mechanism is called SMTP tunneling, and it is
easy to set up on a Windows machine; even easier to set up on
a Linux box.


Windows Instructions

1. Download and install TeraTerm SSH as per our instructions
at: http://www.cs.toronto.edu/cslab/ttssh.html

Make sure it is working correctly before proceeding to step 2.
Specifically make sure that you can initiate an SSH connection to
dvp.cs.toronto.edu or qew.cs.toronto.edu. Once verified, go to step 2.


2. Close and start up ttssh again.

a. cancel the popup TeraTerm new connection window
b. click on setup and select "ssh forwarding"
c. click add
d. ensure that "forward local port" is toggled and
   supply the following parameters:

   1. Forward local port: 25
   2. to remote machine: mail.cs.toronto.edu
   3. port: 25

   Select ok

e. The port forwarding window should now display:

   Local 25 to remote "mail.cs.toronto.edu" port 25

   Select ok

f. In the main tera term window, select "file" and "New connection..."

g. connect to host: qew.cs.toronto.edu (or dvp) and make sure SSH is toggled.
   click ok. 

h. login with your username and password

Keep TeraTerm running as you do the next steps.

i. In your mail client adjust your smtp settings so that the
   SMTP server is set to: 127.0.0.1


  (The idea being that 127.0.0.1 is the local IP address of your workstation, 
   and all connections to 127.0.0.1 port 25 will be forwarded via the TeraTerm
   SSH tunnel to mail.cs.toronto.edu) 

j. Now retrieve and send mail. 
  

Linux Instructions

1. Install SSH on your Linux box (should be installed by default).

2. Run the following command:

   ssh -l username -L 25:mail.cs.toronto.edu:25 cs.toronto.edu

3. In your mail client adjust your smtp settings so that the
   SMTP server is set to: 127.0.0.1

4. Send mail.