| 1 |
<!-- saved from url=(0022)http://internet.e-mail --> |
| 2 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> |
| 3 |
<HTML> |
| 4 |
<HEAD> |
| 5 |
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1"> |
| 6 |
<TITLE></TITLE> |
| 7 |
<META NAME="GENERATOR" CONTENT="StarOffice/5.2 (Win32)"> |
| 8 |
<META NAME="CREATED" CONTENT="20010220;7501784"> |
| 9 |
<META NAME="CHANGED" CONTENT="16010101;0"> |
| 10 |
<STYLE> |
| 11 |
<!-- |
| 12 |
@page { margin: 2cm } |
| 13 |
--> |
| 14 |
</STYLE> |
| 15 |
</HEAD> |
| 16 |
<BODY> |
| 17 |
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><FONT SIZE=4 STYLE="font-size: 16pt"><U><B>VNC |
| 18 |
over STUNNEL with a Linux server and Windows 2000 client HOWTO</B></U></FONT></P> |
| 19 |
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><BR> |
| 20 |
</P> |
| 21 |
<P STYLE="margin-bottom: 0cm">19 February 2001</P> |
| 22 |
<P STYLE="margin-bottom: 0cm">ver 1.0</P> |
| 23 |
<P STYLE="margin-bottom: 0cm">by Craig Furter and Arno van der Walt</P> |
| 24 |
<P STYLE="margin-bottom: 0cm">contact us at <A HREF="mailto:[email protected]">[email protected]</A> |
| 25 |
and <A HREF="mailto:[email protected]">[email protected]</A></P> |
| 26 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 27 |
</P> |
| 28 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 29 |
</P> |
| 30 |
<P STYLE="margin-bottom: 0cm">We assume that you have already |
| 31 |
downloaded VNCServer and VNCViewer.</P> |
| 32 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 33 |
</P> |
| 34 |
<P STYLE="margin-bottom: 0cm">First of all there is a step by step |
| 35 |
HOWTO and then we'll look at the theory behind all this.</P> |
| 36 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 37 |
</P> |
| 38 |
<OL> |
| 39 |
<LI><P STYLE="margin-bottom: 0cm">Download and install OpenSSL, |
| 40 |
SSLeay, and Stunnel on the Linux/Unix box. Download the modules.</P> |
| 41 |
</OL> |
| 42 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">a) |
| 43 |
[root@anthrax$]gunzip openssl-x.xx.tar.gz (repeat for all 3 the |
| 44 |
modules)</P> |
| 45 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">b) |
| 46 |
[root@anthrax$]tar – xvf openssl-x.xx.tar (repeat for all 3 the |
| 47 |
modules)</P> |
| 48 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm"><BR> |
| 49 |
</P> |
| 50 |
<OL> |
| 51 |
<LI><P STYLE="margin-bottom: 0cm">Copy the following to Notepad and |
| 52 |
save the file as VNCRegEdit.REG on the Windows 2000 box</P> |
| 53 |
</OL> |
| 54 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">--cut here and copy |
| 55 |
to VNCRegEdit.REG then double click the file to |
| 56 |
import--<BR>REGEDIT4<BR><BR>[HKEY_LOCAL_MACHINE\Software\ORL\WinVNC3]<BR>AllowLoopback=dword:00000001<BR><BR>[HKEY_LOCAL_MACHINE\Software\ORL\WinVNC3\Default]<BR>AllowLoopback=dword:00000001<BR>--stop |
| 57 |
here--<BR><BR> |
| 58 |
</P> |
| 59 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm"><BR> |
| 60 |
</P> |
| 61 |
<OL> |
| 62 |
<LI><P STYLE="margin-bottom: 0cm">Install Stunnel on the Windows |
| 63 |
2000 machine by copying the following files to your \WINNT\SYSTEM32\ |
| 64 |
directory</P> |
| 65 |
</OL> |
| 66 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">a)libeay32.dll</P> |
| 67 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">b)libssl.dll</P> |
| 68 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">c)stunnel.pem</P> |
| 69 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm"><BR> |
| 70 |
</P> |
| 71 |
<OL> |
| 72 |
<LI><P STYLE="margin-bottom: 0cm">On the Linux box execute the |
| 73 |
following command as root and let it run in its own terminal.</P> |
| 74 |
</OL> |
| 75 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">./stunnel -d 5900 |
| 76 |
-r 5901</P> |
| 77 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm"><BR> |
| 78 |
</P> |
| 79 |
<OL> |
| 80 |
<LI><P STYLE="margin-bottom: 0cm">Execute vncserver (it should run |
| 81 |
as display:1 when you execute the ps aux |grep vnc command)</P> |
| 82 |
</OL> |
| 83 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm"><BR> |
| 84 |
</P> |
| 85 |
<OL> |
| 86 |
<LI><P STYLE="margin-bottom: 0cm">Now on the Windows 2000 machine |
| 87 |
execute the following command and let it run in its own terminal.</P> |
| 88 |
</OL> |
| 89 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">stunnel -d 5900 -r |
| 90 |
unix.ip.address:5900 -c</P> |
| 91 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">.</P> |
| 92 |
<OL> |
| 93 |
<LI><P STYLE="margin-bottom: 0cm">And on the Windows 2000 machine |
| 94 |
open VNCviewer and connect to localhost specifying no display</P> |
| 95 |
</OL> |
| 96 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">ie. 10.10.1.53 in |
| 97 |
the window</P> |
| 98 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm"><BR> |
| 99 |
</P> |
| 100 |
<OL> |
| 101 |
<LI><P STYLE="margin-bottom: 0cm">For each additional display repeat |
| 102 |
steps 4 – 6 and increment the specified ports with 2 ie. The |
| 103 |
Linux command will look as follows:</P> |
| 104 |
</OL> |
| 105 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm"> ./stunnel -d 5902 |
| 106 |
-r 5903 |
| 107 |
</P> |
| 108 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">and the Windows |
| 109 |
2000 command as follows: |
| 110 |
</P> |
| 111 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">stunnel -d 5902 -r |
| 112 |
unix.ip.address:5902</P> |
| 113 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">and remember to |
| 114 |
start another vncserver on the Linux box for each VNC display</P> |
| 115 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 116 |
</P> |
| 117 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 118 |
</P> |
| 119 |
<OL> |
| 120 |
<LI><P STYLE="margin-bottom: 0cm">The display number on the |
| 121 |
vncviewer must also be incremented with two ie:</P> |
| 122 |
</OL> |
| 123 |
<P STYLE="margin-left: 0.5cm; margin-bottom: 0cm">10.10.1.53:2 etc.</P> |
| 124 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 125 |
</P> |
| 126 |
<P STYLE="margin-bottom: 0cm"><FONT SIZE=4><U>The THEORY</U></FONT></P> |
| 127 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 128 |
</P> |
| 129 |
<P STYLE="margin-bottom: 0cm"><U>Tunneling:</U></P> |
| 130 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 131 |
</P> |
| 132 |
<P STYLE="margin-bottom: 0cm">What this means is that software |
| 133 |
(daemon) runs on the client and server machine. In this case, the |
| 134 |
Windows 2000 machine is the client and the server is the *NIX |
| 135 |
machine. Stunnel will then run as client on Windows 2000 and server |
| 136 |
mode on the UNIX box.<BR><BR>eg:<BR>Windows:<BR>stunnel -d 5900 -r |
| 137 |
unix.ip.address:5900 -c<BR><BR>UNIX<BR>stunnel -d 5900 -r 5901<BR><BR>This |
| 138 |
means that connecting to VNC display 0 in the localhost will transfer |
| 139 |
all the calls to the *NIX machine on display 1. So the VNC server on |
| 140 |
the *NIX machine must be running on display 1. Not display 0. If you |
| 141 |
run stunnel before VNC, VNC will automatically move to display 1 |
| 142 |
noticing that port 5900 ("display" 0) is already in |
| 143 |
use).<BR><BR>What happens now is that when you connect to port 5900 |
| 144 |
on the Windows machine via an "unsecured" connection, a |
| 145 |
secure "tunnel" is opened from Windows 2000 to the *NIX |
| 146 |
machine on port 5900. The *NIX machine then opens a "unsecured" |
| 147 |
connection to itself on port 5901. We now have a secure tunnel |
| 148 |
available.</P> |
| 149 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 150 |
</P> |
| 151 |
<P STYLE="margin-bottom: 0cm"><U>A bit about VNC and displays</U></P> |
| 152 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 153 |
</P> |
| 154 |
<P STYLE="margin-bottom: 0cm">The -d is the listening IPaddress:port |
| 155 |
and the -r is the remote IPaddress:port. VNC uses port 5900 for |
| 156 |
display 0. That means that display 1 will be 5901. If you want VNC |
| 157 |
server to listen for a connection on port 80 then the display number |
| 158 |
will be 80 - 5900 = -5820. If you want VNC server to<BR>listen on |
| 159 |
port 14000 then the display number is 14000 - 5900 = 8100.<BR><BR>So |
| 160 |
all you have to do is run stunnel on the UNIX machine and VNC on the |
| 161 |
desired "display" number.</P> |
| 162 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 163 |
</P> |
| 164 |
<P STYLE="margin-bottom: 0cm"><U>VNC on the Windows 2000 machine</U></P> |
| 165 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 166 |
</P> |
| 167 |
<P STYLE="margin-bottom: 0cm">To connect from the client machine you |
| 168 |
need to enter the client machine's IP address and the "display" |
| 169 |
(from the port conversion). But VNC will think that you are trying to |
| 170 |
connect to the local machine and does not allow this. To override |
| 171 |
this add the following to your registry.<BR><BR>--cut here and copy to |
| 172 |
anything.reg. then double click the file to |
| 173 |
import--<BR>REGEDIT4<BR><BR>[HKEY_LOCAL_MACHINE\Software\ORL\WinVNC3]<BR>AllowLoopback=dword:00000001<BR><BR>[HKEY_LOCAL_MACHINE\Software\ORL\WinVNC3\Default]<BR>AllowLoopback=dword:00000001<BR>--stop |
| 174 |
here--<BR><BR>Now VNC will not complain. So you need to always run |
| 175 |
stunnel in client mode on the Windows machine and then connect with |
| 176 |
VNCViewer to the localhost on the correct "display". By the |
| 177 |
way, *NIX doesn't complain about this. There is no setting needed if |
| 178 |
*NIX to *NIX.</P> |
| 179 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 180 |
</P> |
| 181 |
<P STYLE="margin-bottom: 0cm"><U>VNC's Java client</U></P> |
| 182 |
<P STYLE="margin-bottom: 0cm"><BR> |
| 183 |
</P> |
| 184 |
<P STYLE="margin-bottom: 0cm">Unfortunately this will not work well |
| 185 |
with the built-in web version. If you did not known about it, try |
| 186 |
http'ing into a machine running VNC server on it, to port 58XX (where |
| 187 |
XX is the display number), and the Java client will be loaded.<BR><BR> |
| 188 |
</P> |
| 189 |
</BODY> |
| 190 |
</HTML> |