|
cCusDeployed
Deploying Tunnelblick
This document describes how to create a deployed version of Tunnelblick and was last modified 2010-02-23. It reflects the behavior of Tunnelblick built from the r412 source code.
What is a Deployed Version?A deployed version of Tunnelblick is a customized version of Tunnelblick.app which can include everything necessary to install and run Tunnelblick and connect to one or more VPNs. In particular, it may include one or more OpenVPN configuration files, and, usually, certificate and key files for authentication. It can also include shell scripts and text that will appear in Tunnelblick's "about" window, and can specify user preferences that are forced to particular values and are read-only. A Deployed version can specify additional commands and submenus to be added to the Tunnelblick menu, including specific programs to be run when a menu item is chosen. A Deployed version can also specify programs to be run at the end of the Tunnelblick launch process and/or before a connection is attempted. These features are described in Additional Menu Commands and Programs. Note: By default, deployed versions of Tunnelblick display only the deployed configurations. They do not display private or shared configurations. To display shared or private configurations, set the "usePrivateConfigurationsWithDeployedOnes" or "useSharedConfigurationsWithDeployedOnes" preferences to yes. (See Preferences). How it WorksYou create a deployed version of Tunnelblick by putting a "Deploy" folder into the Contents/Resources folder of Tunnelblick.app. Deploy can contain any one or a combination of configuration files, certificate and key files, up/down scripts, and a "forced-preferences.plist" file. Since Deploy and its contents can not be modified by a non-administrator user, this is a secure way to ensure that your users do not tamper with any settings that you wish to protect. If Contents/Resources/Deploy exists, Tunnelblick's behavior changes:
Note: if configuration files are not in Deploy, their names may be changed by an unprivileged user. Any forced preferences for a configuration whose name has been changed will be ignored, because the forced preferences will be referring to the original configuration name.
Certificate and key files may usually be referenced within a configuration file without path information:
Each time Tunnelblick starts:
Backups of DeployBackups of Deploy are created in /Library/Application Support/Tunnelblick/Backup/A/B/C/D/E…/TunnelblickBackup, where /A/B/C/D/E… is the absolute path to Tunnelblick.app itself. For example, if Tunnelblick.app is located in /Applications, the Deploy backup would be stored in /Library/Application Support/Tunnelblick/Backup/Applications/TunnelblickBackup. This allows each copy of Tunnelblick on a computer to have its own backup. Up to three backups are kept for each copy of Tunnelblick: the current and previous Deploy, and Deploy at the time Tunnelblick was first run from it's current location. If Tunnelblick.app is moved, a new backup will be created for the new location the first time Tunnelblick.app is run in the new location. The old backup will continue to exist, however, this is not in itself a security risk because moving Tunnelblick.app (after it is first run and a backup of Deploy has been made) requires authorization by an administrator. It is suggested that any such move be followed by deletion of the backup, which also requires an administrator. Otherwise a fresh copy of Tunnelblick in the old position in the file hierarchy could be used to connect to the VPN because its Deploy folder would be "recovered" from the backup the first time it is run. If Tunnelblick.app is renamed (which, depending on where it is stored, may not require an administrator's username/password), the backup mechanism still works normally. Note: Tunnelblick disables updates if the app has been renamed. If two copies of Tunnelblick.app exist within the same folder in the filesystem hierarchy (with different names), they will use the same backup. This could lead to problems if one uses Deploy and the other doesn't, or if the contents of the Deploy folders are not identical. One way to have multiple Tunnelblicks in one folder without causing this problem is to locate the Tunnelblick.apps in different folders, but put aliases to each of them in the folder that is visible to the user. Multiple copies of Tunnelblick.app cannot be placed in the same folder without an administrator doing it, so this should not be a security risk. Signed vs. Unsigned VersionsA copy of Tunnelblick can be signed or unsigned. All non-Deployed versions of Tunnelblick should be signed versions, but signing interferes with some Deployed configurations. Use an unsigned version if users will be able to store usernames/passwords/passphrases in the Keychain and the Deploy folder is added after the Tunnelblick build process (which is where signing is usually done). See Tunnelblick and Digital Signatures for details. Additional Menu Commands and ProgramsIf the Deploy folder contains a "Menu" subfolder, it can contain items that will be added to the Tunnelblick menu (either as menu items or submenus) and programs that will be executed when Tunnelblick launches and before a connection is made. The “Menu” folder can contain zero or more additional items to be inserted into the Tunnelblick menu, immediately above the “Quit Tunnelblick” item. Each item in the Menu folder should be either a subfolder or an executable file with an .executable extension:
Note: An "executable" file may be any executable file. The .executable extension is required so that Tunnelblick will set permissions on the file to allow it to be executed by the user. The file will be owned by root, with permissions of 755. The first “runOnLaunch” and “runOnConnect” files to be found will be the only ones processed. Care should be taken to name subfolders such that they are alphabetically after these files; otherwise the subfolder(s) will be processed first, and any “runOnLaunch” and “runOnConnect” file in them will be processed first and be used when Tunnelblick is launched or a connection is attempted. Items from the Menu folder (and any subfolders) will be listed on the menu in alphabetic order by filename. Names (of files used as menu commands and folders used as submenu names) are modified for display to the user in the menu as follows:
ExampleIf /Contents/Resources/Deploy/Menu/ contains: 000.runOnConnect.wait.executable 001_First.addToMenu.executable The bottom of the Tunnelblick menu will look like this: VPN Details…
--------
Options
--------
First
Second
Third
Fourth >
Sub-1
Sub-2
Fifth
--------
Quit TunnelblickIn this example, the prefixes 001_, 002_, etc. specify the order in which the items will be listed, but are removed (along with the extensions) before being displayed to the user. If the appropriate Localizable.strings file contains “First” = “XXXXX” “Second” = “YYYYY” Then the bottom of the Tunnelblick menu will look like this: VPN Details…
--------
Options
--------
XXXXX
YYYYY
Third
Fourth >
Sub-1
Sub-2
Fifth
--------
Quit TunnelblickIn addition to the menu commands and submenu added, the file 000_.runOnLaunch.wait.executable will be run at the end of the Tunnelblick launch process. Because ".wait" is specified, Tunnelblick will wait until the program finishes and examine the program's exit status. If the exit status is zero, Tunnelblick will finish launching, including making and "connect on launch" connections. If the exit status is non-zero, Tunnelblick will terminate immediately without any indication to the user other than an entry in the Console log. Before each connection attempt (either automatic or user-initiated), 000_.runOnConnect.wait.executable will be run before the connection is made. (It will be called with the same arguments used to run the openvpnstart program.) Because ".wait" is specified, Tunnelblick will wait until the program finishes and examine the program's exit status. If the exit status is zero, Tunnelblick will attempt to make the connection. If the exit status is non-zero, the connection will be abandoned without any indication to the user other than an entry in the Console log. What about Updates?A version of Tunnelblick with Deploy will work with Tunnelblick's standard update process, either through the the built-in update mechanism, or by reinstalling, upgrading, or downgrading Tunnelblick. An update replaces Tunnelblick.app with a new copy without Deploy; however, when the updated program is first run, Deploy will be restored from the backup copy, and will then be used normally. Note: "about.html" is not included in standard Tunnelblick updates, so it will be lost when there is a standard update because it is not located in Deploy. Forced PreferencesPreferences in Deploy/forced-preferences.plist override the user's normal preferences located in ~/Library/Preferences/com.openvpn.tunnelblick.plist. Wildcards can be used to simplify the specification of forced preferences for multiple configurations. Forced preferences are implemented as follows:
A forced preference consisting only of an asterisk ("*") will be ignored. For example, with forced preferences of *useDNS= TRUE and config1useDNS = FALSE, configuration config1 will be forced to not use DNS, and all other configurations will be forced to use DNS. The user will not be able to change any useDNS preferences. Another example: forced preferences of *ABCuseDNS= TRUE, *DEFuseDNS= FALSE, configuration configABC will be forced to use DNS, and configDEF will be forced to not use DNS. The user will be able to change useDNS preferences for other configurations, if any. There are two exceptions to the way forced preferences work:
SeePreferences for a list of all preferences. Up and Down ScriptsIf "Set nameserver" is selected, Tunnelblick.app starts OpenVPN with the "--up" and "--down" options specifying scripts to be run after the tunnel is established and before it is torn down. The standard scripts are Contents/Resources/client.up.osx.sh and Contents/Resources/client.down.osx.sh if "Monitor connection" is checked, and Contents/Resources/client.nomonitor.up.osx.sh and Contents/Resources/client.nomonitor.down.osx.sh if "Monitor connection" is not checked. However, if Contents/Resources/Deploy/config-name.up.sh, config-name.down.sh, config-name.nomonitor.up.sh, or config-name.nomonitor.down.sh exist, each will be used instead of the corresponding standard script. What is Needed to Make a Deployed VersionTo make a deployed version of Tunnelblick, you need whatever is required to connect to your VPN. To be more specific, you need:
How to Make a Deployed Version
That's it! You are done! Tunnelblick.app has your new version of Tunnelblick with a Deploy folder containing everything that Tunnelblick needs for connection to your VPN. However, DO NOT RUN THIS COPY. Instead, make a copy of it and use the copy. When Tunnelblick is first run it makes changes to the ownership and permissions of parts of the application. That makes it inconvenient to copy, move, or modify the application after it has been run without entering administrator credentials, so keep a copy that has never been run. How to Use a Deployed VersionUsing a deployed version of Tunnelblick is the same as using a non-deployed version, except:
Creating a .zip File for DeploymentTo create a .zip file of your new version of Tunnelblick:
Creating a .dmg File for Deployment
Within a few moments, your .dmg file will be created. PLEASE USE THE TUNNELBLICK DISCUSSION GROUP FOR COMMENTS OR QUESTIONS | |