Jump to: navigation, search

Dev/Build Documentation/0.2.1

This is an outdated version. See Dev/Build Documentation

Source Code: https://github.com/Whonix/Whonix/tree/0.2.1

Download: https://github.com/Whonix/Whonix/archive/0.2.1.zip

# Version: TorBOX 0.2.1

# Copyright: adrelanos (aka proper)
#
# License: GPL v3 or any later
#
# Any changes you pull changes into this source will be also licensed
# under GPL v3 or any later. Additionally you grant proper the right to
# re-license your work under a different license. If that is not acceptable,
# you can either fork this source under GPL v3 or any later or contact proper.
# Contact proper, if you require this source code under different license.

This page documents how the [Download binary distribution images] are built. If you have any questions or need help let us know on [Dev#Questions /TorBOX/Dev#Question].

The scripts used to build a certain version of a TorBOX-Gateway or TorBOX-Workstation image can be found in the VM at /usr/share/doc/torbox (in TorBox 0.2 at /usr/local/bin/tor-*) and through the wiki history.

Following these instructions will build version TorBOX 0.2.1 based on Tor 0.2.3 and Ubuntu Precise.

Knowledge assumed: Virtualization and networking basic principles; operation of your platform; Linux knowledge: how to install Ubuntu and basic command line knowledge.

Only one prerequisites: you need a working internet connection.

For discussion related to the development and build process of TorBOX images go [Dev/ TorBOX/Dev/].

Build Anonymity[edit]

While downloading the required tools for building TorBOX your internet service provider could if he want notice that you want to build TorBOX. This is esspecially interesting, if you want to redistribute TorBOX, but still want to stay anonymous. The full story can be read in the chapter [SecurityAndHardening#BuildAnonymity Build Anonymity].

Build Security[edit]

  • Build on a dedicated build system, install security updates...
  • All install media and all downloaded/used code must be verified (including all software on the host).
  • Hashes or fingerprints listed on the wiki are not to be trusted, same goes for the scripts, verify them (and make use of the history feature).
  • Read [Trust TorBOX/Trust]

Host preparation[edit]

    • Read and apply if necessary [Readme#NetworkTimeSyncing "Network Time Syncing"]!

We recommend you to use a dedicated OS installation just for hosting the TorBOX VMs (See [SecurityAndHardening TorBOX/SecurityAndHardening])

You need to use Ubuntu. The build scripts could be adapted to run on other*NIX systems as well but currently they assume apt-get to be available. You need about 15 GB of free space.

Install the latest security updates, install VirtualBox (and qemu-kvm which is required to mount the VirtualBox .vdi images). Reboot to apply kernel updates.

sudo apt-get update && sudo apt-get dist-upgrade
sudo apt-get install virtualbox qemu genisoimage
sudo reboot

If you are going to use VirtualBox inside VirtualBox, be sure to change your host key. VirtualBox -> Preferences -> Input -> Host Key. The "outside" and the "inside" Host Key must differ, otherwise you can not leave the VM "inside" anymore. The "outside" VirtualBox hostkey may NOT bectrl.1 ,, 1 Because the one is used by VBoxSDL "inside".

Building on Windows is no longer supported. Redistributed TorBOX builds should be build on Linux. If you want to port the TorBOX build scripts to Windows, please contact us. Running TorBOX on a Windows host with VirtualBox installed should still be possible.

Using an apt cacher to speed up downloading[edit]

OPTIONAL

Does only work with TorBOX-Gateway. ,, Does not work for TorBOX-Workstation because it never gets direct access to the host by design. We could think about installing apt-cacher-ng on TorBOX-Gateway, if there are any security implications.

Go to TorBOX_Gateway script and comment in the lineAcquire::http { Proxy "http://192.168.0.2:3142"; };, i.e. remove the # (hash) in front of it.

If you want to build multiple times (for debugging etc.), it might make sense to install a local apt proxy on your build machine. That safes download time and traffic. ,,Thanks to source.

sudo apt-get install apt-cacher-ng


sudo nano /etc/apt/apt.conf


Acquire::http { Proxy "http://127.0.0.1:3142"; };


sudo apt-get update

Source Code Intro[edit]

If you prefer to read and understand the source code just by reading scripts you may skip this optional chapter. This chapter is dedicated to give an introduction into the TorBOX source code. It can be quite difficult to get started with hacking existing big complex projects.

TorBOX_Build is a script, which simply runs all other scripts. Actually it's "optional". It has very little functionality besides running all other scripts. You are free to run all scripts one by one. That is useful for learning and for debugging purposes. In case you want to fix a bug or in case you want to upgrade the distribution or in case you want to switch the operating system or whatever you are better off running the steps manually. You can use the Build script as a reference for which steps have to be run in which order.

Ironically currently most scripts are used to create a virtual machine image, which contains the operating system and the either the TorBOX_Gateway or the TorBOX_Workstation script. Scripts needed for creation the virtual machine image are TorBOX_GetISO, TorBOX_ModifyISO, TorBOX_CreateVM and TorBOX_Image. GetISO downloads and verifies the operating system iso image.

ModifyISO mounts the downloaded iso image as read only, copies it, modifies the copied iso image by adding preseeding (unattended installation), unmounts the iso and finally creates preseed.iso, which contains the operating system installer disc modified not to require any user interaction while installing. This process already sets up lots of important privacy settings and other stuff, such as UTC timezone, hostname ubuntu, US language, username user and so on. (See [SecurityAndHardening TorBOX/SecurityAndHardening] and the ModifyISO script itself for a list of all changes and why.) Preseed.iso is configured to power off itself when it's done installing so the TorBOX_Build script can continue.

TorBOX_CreateVM creates VirtualBox machines with all settings required for secure networking, devices, security settings. Which those settings are in details can be again read in Security And Hardening or the script itself. CreateVM is also responsible for starting virtual machines while building. That happens two times, the first time the operating system will be installed and the second time either the TorBOX_Gateway or the TorBOX_Workstation script will be installed.

TorBOX_Image allow to mount the virtual hdd images. This is required because we have to somehow get the TorBOX_Gateway or the TorBOX_Workstation script into the virtual hdds, so we can install them. With TorBOX 0.1.3 we used ssh, but that was suboptimal. 1Image also allows to copy the TorBOX_Gateway or the TorBOX_Workstation script to /usr/local/bin/ inside the virtual hdd images. It also adds autostarting them only once as soon as the virtual machine gets started next time. This is done by adding the script to /etc/rc.local. rc.local will look if the installer log exists and if that is so, the script will not be run again. rc.local will also power off the VM if the TorBOX_Gateway or TorBOX_Workstation script finished. 2

,, 1 It required manually installing an ssh server just for getting the script into the virtual hdds. Ok, that could also be done with preseed. But it involves weakening the isolation of the VM from the host. The MAC address of the host could be seen my the VM. ,, 2 /etc/rc.local will be reverted by the TorBOX_Gateway or the TorBOX_Workstation script.

TorBOX_Gateway or the TorBOX_Workstation will transform the installed operating system into the TorBOX-Gateway or into the TorBOX-Workstation. They update the system, install security relevant software, install useful applications for an anonymous general purpose operating system, set up all relevant privacy and anonymity required settings, desktop manager etc.

Thus, given the nature of the build step orientated scripts, you can easily work on the different aspects of TorBOX. For example, once you have created a clean virtual machine with the operating system only, you can make a clone or snapshot, run either the TorBOX_Gateway or the TorBOX_Workstation script as often as you need to test your changes and if something goes wrong, go back to the clone or snapshot. You don't have to build everything from scratch again. 3

,, 3 For example, we could add the TorBOX_Gateway or TorBOX_Workstation script to the preseed.iso and let it run after installing. If something would go wrong, you would have to reinstall the whole operating system every time again. That's why we use separate steps.

Thetorcheck script will only be copied into TorBOX-Workstation and is supposed to be run in TorBOX-Workstation only. Checks network connection, Tor Browser version, SocksPort and TransPort IP and stream isolation.

Get the TorBOX source code[edit]

Get all our scripts (currently 8) and save them in one folder, it's best to create a new folder called TorBOX_src in your home directory. It is important that they are all named correctly!

Check the source code for error or malicious edits. Make use of the history feature of torproject.org's wiki.

"TorBOX_Build" script https://trac.torproject.org/projects/tor/wiki/doc/TorBOX/Dev/Build

"TorBOX_GetISO" script https://trac.torproject.org/projects/tor/wiki/doc/TorBOX/Dev/GetISO

"TorBOX_ModifyISO" script https://trac.torproject.org/projects/tor/wiki/doc/TorBOX/Dev/ModifyISO

"TorBOX_CreateVM" script https://trac.torproject.org/projects/tor/wiki/doc/TorBOX/Dev/CreateVM

"TorBOX_Image" script https://trac.torproject.org/projects/tor/wiki/doc/TorBOX/Dev/Image

"TorBOX-Gateway" script https://trac.torproject.org/projects/tor/wiki/doc/TorBOX/Dev/TGScript

"TorBOX-Workstation" script https://trac.torproject.org/projects/tor/wiki/doc/TorBOX/Dev/TWScript

"torcheck" script https://trac.torproject.org/projects/tor/wiki/doc/TorBOX/Dev/torcheck

Create the Images[edit]

Preparations[edit]

Make the build script executable:

chmod +x ~/TorBOX_source/TorBOX_*

Make sure there aren't any VMs in VirtualBox already called "TorBOX-Gateway" or "TorBOX-Workstation" (TODO: automate that)

VM Creation[edit]

,, -all not supported yet.

(1). Open a shell and type:

sudo ~/TorBOX_source/TorBOX_Build -tg

(2). Check if all went ok.

(3). Power on TorBOX_Gateway

(4). Open a shell and type:

sudo ~/TorBOX_source/TorBOX_Build -tw

The scripts can fail for many reasons, please report back any issues!

How to use the ova images[edit]

Reboot both VMs. Please read the [Readme Readme]!

Final Steps (Only Required For Redistribution)[edit]

  • [LeakTests Leak Testing]!
  • [TestAndTroubleshoot Test] the images before release! TODO: Needs big revision with all TorBOX features.
  • Update the [Changelog Changelog].
  • Create hash sums for verification.

    sha512sum TorBOX-Gateway.ova sha512sum TorBOX-Workstation.ova

  • Upload the images.
  • Post hash sums to build documentation.
  • Post download links to build documentation.
  • At least a few testers should test before posting a news. Testers may be found by posting a news.
  • Finally announce: Post a news.



Impressum | Datenschutz | Haftungsausschluss

https | (forcing) onion
Share: Twitter | Facebook | Google+
This is a wiki. Want to improve this page? Help welcome, volunteer contributions are happily considered! See Conditions for Contributions to Whonix, then Edit! IP addresses are scrubbed, but editing over Tor is recommended. Edits are held for moderation. Whonix (g+) is a licensee of the Open Invention Network. Unless otherwise noted above, content of this page is copyrighted and licensed under the same Free (as in speech) license as Whonix itself.