<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>smtp_ssh_tunnel</title><revhistory><revision><revnumber>14</revnumber><date>2021-02-05 10:29:55</date><authorinitials>eseide</authorinitials></revision><revision><revnumber>13</revnumber><date>2021-02-05 10:28:58</date><authorinitials>eseide</authorinitials></revision><revision><revnumber>12</revnumber><date>2021-02-05 10:27:49</date><authorinitials>eseide</authorinitials></revision><revision><revnumber>11</revnumber><date>2009-08-19 08:49:18</date><authorinitials>dcaspar</authorinitials></revision><revision><revnumber>10</revnumber><date>2009-08-18 07:24:40</date><authorinitials>dcaspar</authorinitials></revision><revision><revnumber>9</revnumber><date>2009-08-18 07:02:03</date><authorinitials>dcaspar</authorinitials></revision><revision><revnumber>8</revnumber><date>2009-08-17 15:51:36</date><authorinitials>dcaspar</authorinitials></revision><revision><revnumber>7</revnumber><date>2009-08-17 15:47:51</date><authorinitials>dcaspar</authorinitials></revision><revision><revnumber>6</revnumber><date>2009-08-17 15:37:44</date><authorinitials>dcaspar</authorinitials></revision><revision><revnumber>5</revnumber><date>2009-08-17 15:34:33</date><authorinitials>dcaspar</authorinitials><revremark>page was renamed from thunderbird</revremark></revision><revision><revnumber>4</revnumber><date>2009-08-17 15:10:55</date><authorinitials>dcaspar</authorinitials></revision><revision><revnumber>3</revnumber><date>2009-08-17 15:10:31</date><authorinitials>dcaspar</authorinitials></revision><revision><revnumber>2</revnumber><date>2009-08-17 15:08:52</date><authorinitials>dcaspar</authorinitials></revision><revision><revnumber>1</revnumber><date>2009-05-13 11:51:16</date><authorinitials>crose</authorinitials></revision></revhistory></articleinfo><section><title>Thunderbird</title><section><title>Sending Mails (SMTP) over an SSH tunnel</title><para>It is possible to send mails from outside our university using our mail server over an SSH-tunnel. To do this, you need two things: </para><itemizedlist><listitem><para>a SSH client like Putty or SSH Secure Shell </para></listitem><listitem><para>an additional smtp server entry in Thunderbird for our mail server </para></listitem></itemizedlist><para>The configuration of both the ssh client and thunderbird is described below. I've you are an advanced user and used to using SSH, especially in a shell, scroll down to get a very short explanation how you can establish the SSH tunnel using the ssh comandline tool. </para><section><title>Configuring the SSH client</title><para>As an example, we will demonstrate here how you have to configure SSH Secure Shell to build up an SSH tunnel to our network allowing you to use the math mail server. </para><para>Download and install SSH Secure Shell. You can download it from <ulink url="ftp://ftp.uni-koeln.de/pc/win32/inet/ssh329.exe">this location</ulink>, it is free for non-commercial use. </para><para>Start SSH Secure Shell. If you use it for the first time, you need to create a new profile. Click on &quot;File -&gt; Profiles -&gt; Add Profile ...&quot; and enter a name for your profile. </para><para><inlinemediaobject><imageobject><imagedata fileref="https://wiki.math.uzh.ch/public/smtp_ssh_tunnel/home/c/dcaspar/Desktop/Images?action=AttachFile&amp;do=get&amp;target=sshsecshell1.png"/></imageobject><textobject><phrase>/home/c/dcaspar/Desktop/Images/sshsecshell1.png</phrase></textobject></inlinemediaobject> </para><para>In the example, we created a new profile called &quot;dc&quot;. </para><para>Now, you need to configure the profile just created. Open the configuration windows via &quot;File -&gt; Profiles -&gt; Edit Profiles ...&quot; and select your profile from the displayed list. Make sure that the &quot;Connections&quot;-Panel is shown on the right side. Fill in the host name, your username and the portnumber as shown in the following table. The other options should work fine. </para><informaltable><tgroup cols="2"><colspec colname="col_0"/><colspec colname="col_1"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1" valign="top"><para>Host Name: </para></entry><entry colsep="1" rowsep="1" valign="top"><para>ssh.math.uzh.ch </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>User Name: </para></entry><entry colsep="1" rowsep="1"><para>(your mathusername) </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>Port Number: </para></entry><entry colsep="1" rowsep="1"><para>22 </para></entry></row></tbody></tgroup></informaltable><para><inlinemediaobject><imageobject><imagedata fileref="https://wiki.math.uzh.ch/public/smtp_ssh_tunnel?action=AttachFile&amp;do=get&amp;target=sshsecshell21.png"/></imageobject><textobject><phrase>sshsecshell21.png</phrase></textobject></inlinemediaobject> </para><para>Now select the &quot;Outgoing Tunneling&quot;-Panel on the right and Click on &quot;Add...&quot;. In the opened window, provide the following information as described bellow: </para><informaltable><tgroup cols="2"><colspec colname="col_0"/><colspec colname="col_1"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para>Display Name </para></entry><entry colsep="1" rowsep="1"><para>a name for this tunnel, e.g. &quot;smtp&quot; </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>Type </para></entry><entry colsep="1" rowsep="1"><para>TCP </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>Listen Port </para></entry><entry colsep="1" rowsep="1"><para>Enter a port above 1023, e.g. 25025 </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>Destination Host </para></entry><entry colsep="1" rowsep="1"><para>mail.math.uzh.ch </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>Destination Port </para></entry><entry colsep="1" rowsep="1"><para>2525 </para></entry></row></tbody></tgroup></informaltable><para><inlinemediaobject><imageobject><imagedata fileref="https://wiki.math.uzh.ch/public/smtp_ssh_tunnel?action=AttachFile&amp;do=get&amp;target=sshsecshell25.png"/></imageobject><textobject><phrase>sshsecshell25.png</phrase></textobject></inlinemediaobject> </para><para><inlinemediaobject><imageobject><imagedata fileref="https://wiki.math.uzh.ch/public/smtp_ssh_tunnel?action=AttachFile&amp;do=get&amp;target=sshsecshell31.png"/></imageobject><textobject><phrase>sshsecshell31.png</phrase></textobject></inlinemediaobject> </para><para>Click two times on &quot;Ok&quot; to store the Tunnel and close both the &quot;Add New Outgoing Tunnel&quot; window and the &quot;Profiles&quot; window. </para></section><section><title>Configure Thunderbird</title><para>Next, you need to configure Thunderbird to use your SSH tunnel. Open Thunderbird, open your account settings via &quot;Tools -&gt; Account Settings...&quot; and select &quot;Outgoing Server (SMTP)&quot; on the left. </para><para><inlinemediaobject><imageobject><imagedata fileref="https://wiki.math.uzh.ch/public/smtp_ssh_tunnel?action=AttachFile&amp;do=get&amp;target=thunbird1b.png"/></imageobject><textobject><phrase>thunbird1.png</phrase></textobject></inlinemediaobject> </para><para>Now, click on &quot;Add...&quot; on the right to bring up the &quot;SMTP Server&quot; window. Enter the following information: </para><informaltable><tgroup cols="2"><colspec colname="col_0"/><colspec colname="col_1"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para> Description </para></entry><entry colsep="1" rowsep="1"><para> Enter a description/name for this smtp server (optional) </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> Server Name </para></entry><entry colsep="1" rowsep="1"><para> 127.0.0.1 </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> Port </para></entry><entry colsep="1" rowsep="1"><para> the port you entered as listening port for your SSH tunnel (see section above), e.g. 25025 like in the example </para></entry></row></tbody></tgroup></informaltable><para>Check &quot;Use name and password&quot; and enter your math username. Select &quot;TLS&quot; under &quot;Use secure connection&quot;. </para><para><inlinemediaobject><imageobject><imagedata fileref="https://wiki.math.uzh.ch/public/smtp_ssh_tunnel?action=AttachFile&amp;do=get&amp;target=thunbird2.png"/></imageobject><textobject><phrase>thunbird2.png</phrase></textobject></inlinemediaobject> </para><para>Click &quot;Ok&quot; two times to close both windows and save the configuration. You are now ready to use SSH tunneling to send your mails. </para><para>Note: You can change your current smtp server for all of your accounts separately, simply open the account settings and select your account name on the left and change the server under &quot;Outgoing Server&quot; on the right. </para><para><inlinemediaobject><imageobject><imagedata fileref="https://wiki.math.uzh.ch/public/smtp_ssh_tunnel?action=AttachFile&amp;do=get&amp;target=usage3.png"/></imageobject><textobject><phrase>usage3.png</phrase></textobject></inlinemediaobject> </para></section><section><title>Sending mails over the SSH tunnel</title><para>To send mails over the SSH tunnel you need to connect to our network with your SSH client. In SSH Secure Shell, simply select your profile from &quot;File -&gt; Profiles -&gt; [name of your profile]&quot; and SSH Secure Shell will try automaticaly to connect to our network. Enter your password if you are asked for it. </para><para><inlinemediaobject><imageobject><imagedata fileref="https://wiki.math.uzh.ch/public/smtp_ssh_tunnel?action=AttachFile&amp;do=get&amp;target=usage1.png"/></imageobject><textobject><phrase>usage1.png</phrase></textobject></inlinemediaobject> </para><para>SSH Secure Shell tells you in the lower left corner if you are connected to our network or not.  If you are connected, write your mails as usual. </para><para>If you're done with your mails, simply close SSH Secure Shell. </para></section><section><title>Establishing the SSH tunnel for experts</title><para>If you are used to using SSH, especially via the ssh command line tool in a shell, you can simply create the necessary SSH tunnel with the following command: </para><screen><![CDATA[ssh [username]@ssh.math.uzh.ch -L [ListeningPort]:mail.math.uzh.ch:2525]]></screen><para>As an example, user dc creates an SSH tunnel with listening port 25025 with the following command: </para><screen><![CDATA[ssh dc@ssh.math.uzh.ch -L 25025:mail.math.uzh.ch:2525]]></screen></section></section></section></article>