Difference between revisions of "Configure SMB"

From Organic Design wiki
(SFTP: Dokan)
(SFTP: 4 installs required for Dokan)
Line 9: Line 9:
 
Another excellent option is [[w:SFTP|SFTP]] which uses existing [[w:SSH|SSH]] authentication to transfer files and there are applications available for Windows which map this connectivity in to the file system like a normal file share. On Ubuntu, SFTP integration with the file system is a standard feature, simply go in to ''Places/Connect to server'', select ''SSH'', fill in the authentication details and the resource will be mounted as usual.
 
Another excellent option is [[w:SFTP|SFTP]] which uses existing [[w:SSH|SSH]] authentication to transfer files and there are applications available for Windows which map this connectivity in to the file system like a normal file share. On Ubuntu, SFTP integration with the file system is a standard feature, simply go in to ''Places/Connect to server'', select ''SSH'', fill in the authentication details and the resource will be mounted as usual.
  
A good Windows application for integrating SFTP in to the FS is [http://dokan-dev.net Dokan]. To install Dokan, you must first install the .Net framework which is started from [http://www.microsoft.com/downloads/details.aspx?familyid=333325FD-AE52-4E35-B531-508D977D32A6&displaylang=en here] (63MB). Then Download and install ''Dokan'' and then ''Dokan SSHFS'' from the [http://dokan-dev.net/download Dokan downloads page].
+
Unfortunately, the Windows client setup isn't quite as simple as the Ubuntu case, but there is a good application for integrating SFTP in to the FS called [http://dokan-dev.net Dokan]. There are a few other components to install onto the Windows machine before it's ready to map SSH drives as follows:
 +
*Install the Microsoft .Net framework starting [http://www.microsoft.com/downloads/details.aspx?familyid=333325FD-AE52-4E35-B531-508D977D32A6&displaylang=en here] (63MB)
 +
*Install the [http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&displaylang=en
 +
Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)]
 +
*Download and install the main ''Dokan'' library from the [http://dokan-dev.net/download Dokan downloads page]
 +
*Finally download and install Dokan's SSH support (''Dokan SSHFS'') also from the [http://dokan-dev.net/download Dokan downloads page]
  
 
== OpenVPN ==
 
== OpenVPN ==

Revision as of 03:58, 29 June 2008

Procedure.svg Configure SMB
Organic Design procedure

After doing some research, it seems that the most popular and reliable way of achieving an internet-based file share is using Samba over a Virtual Private Network (VPN). WebDav have turned out to be unreliable and temperamental.

SFTP

Another excellent option is SFTP which uses existing SSH authentication to transfer files and there are applications available for Windows which map this connectivity in to the file system like a normal file share. On Ubuntu, SFTP integration with the file system is a standard feature, simply go in to Places/Connect to server, select SSH, fill in the authentication details and the resource will be mounted as usual.

Unfortunately, the Windows client setup isn't quite as simple as the Ubuntu case, but there is a good application for integrating SFTP in to the FS called Dokan. There are a few other components to install onto the Windows machine before it's ready to map SSH drives as follows:

Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)]

OpenVPN

OpenVPN is a full-featured SSL VPN solution which can accomodate a wide range of configurations, including remote access, site-to-site VPNs, WiFi security, and enterprise-scale remote access solutions with load balancing, failover, and fine-grained access-controls. OpenVPN is a single program that is run on both the server hosting the share, and on the clients which will be accessing it.

Server configuration

First install OpenVPN with apt-get install openvpn, and set up the TUN/TAP device using the following shell commands from root (this step is specific to our VPS host which doesn't have these devices created by default, see the issue raised in their forum and the solution added to their wiki):

mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun

We'll go for a configuration which is as close to the default config file as possible to simplify the setup procedure. That means routed rather than bridged.

Creating Keys

There's a utility called easy-rsa in /usr/share/doc/openvpn/examples/easy-rsa which should be copied to another location (we use /etc/openvpn/easy-rsa. The default values for all certificates generated can be updated in the vars file. First, configure easy-rsa with the following shell commands:

cp -pR /usr/share/doc/openvpn/examples/easy-rsa /etc
cd /etc/easy-rsa
mkdir keys
. ./vars
./clean-all

Next we'll user easy-rsa to generate a master key, a server key and a couple of client keys (it's more secure for the client keys to be created locally, but we'll get that procedure sorted out another day!). Each of the commands requires a number of questions to be answered which can all be left as their defaults (which were set up in the vars file above), except for the common name setting which we'll set to "organicdesign-ca" for the master key, "server" for the server key, and the client name for all the client keys (e.g. "nad-laptop" or "zenia-office" for this example).

./build-ca
./build-key-server server
./build-key nad-laptop
./build-key zenia-office

Then after all the keys are made we must build the Diffie Hellman key exchange parameters.

./build-dh

All the generated key files are in the easy-rsa/keys. All the files having the .key suffix are secret and should only be communicated over encrypted connections like SCP. The ca.crt file belongs on the server and all the client machines as well. The files that start with a client name belong on that client machine.

Setting up Ubuntu workstations

First install OpenVPN and the configuration GUI using apt-get install openvpn network-manager-openvpn. The GUI adds a "VPN Connections" item to the network menu from the system tray which VPN's can be added, removed and configured from.

Setting up on Windows workstations

On Windows OpenVPN is normally run from the console, which can be a little annoying to have lying on the taskbar all the time. OpenVPN GUI lets you run OpenVPN without this console window. Instead you get an icon in the notification area (the area on the right side of the taskbar) from which you can control OpenVPN to start/stop your VPN tunnels, view the log, change your password and other useful things.

The simplest setup (and the only one covered here) is if your internet connection is through a normal LAN or Wifi adapter and uses DHCP (i.e. "obtain IP address automatically" is ticked).

After OpenVPN has been installed, you'll notice in network settings that an extra LAN connection has been added. First, right-click it and rename it to "OpenVPN". Then select both the original network connection that you connect to the internet through, and the OpenVPN connection, then right-click and select "Bridge connections" which takes a few seconds to complete. After that's done a new icon will appear in the network list called "Network bridge" or something which you can rename to "OpenVPN Bridge". No more settings are required if your original internet connection used DHCP.

See also