Difference between revisions of "Configure SMB"
m (→Server configuration) |
m (→Server configuration) |
||
Line 10: | Line 10: | ||
=== Server configuration === | === 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 [http://forums.vpslink.com/linux/116-dev-net-tun-tun-tap-bridge-disabled-please-enable-it.html | + | 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 [http://forums.vpslink.com/linux/116-dev-net-tun-tun-tap-bridge-disabled-please-enable-it.html issue raised in their forum] and the [http://wiki.vpslink.com/index.php?title=TUN/TAP_device_with_OpenVPN_or_Hamachi solution added to their wiki]): |
<pre> | <pre> | ||
mkdir -p /dev/net | mkdir -p /dev/net |
Revision as of 11:56, 27 June 2008
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). Other solutions such as WebDav have turned out to be unreliable and temperamental.
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
The first choice in VPN configuration is whether to set it up using a bridging or routing methodology. Routing is very scalable and is transparent to the software using the network, but it is much more difficult to configure and maintain. The other option is bridging which is simpler to configure, but relies upon the software being used withint the network to be able to route host information itself. Since we only require one application (Samba) and it can be configured to route names as a WINS server, we have chosen to use the bridging configuration.
- The documentation for how to set it up in a bridging configuration can be found here.
- The general setup from which these instructions are derived is here
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
- VPN on OpenVZ (our VPS OS)