1 [[!meta title="Tails server: Self-hosted services behind Tails-powered Tor hidden services"]]
8 Secretly work on a document
9 ---------------------------
11 John, Jane and Miranda would like to secretly work on a
14 Possible solutions follow.
16 ### 1. Centrally hosted Etherpad
18 Tails can be used to access a centrally hosted Etherpad.
20 Their physical location and identities should be properly concealed
21 but the document itself can be intercepted by the server operators.
23 They would like to have other means than blind trust to keep the
26 ### 2. OpenPGP-encrypted messages in a shared mailbox or a drop.io space
28 Tails can be used to pass GnuPG-encrypted messages through a shared
29 mailbox or a drop.io space.
31 This sounds like a pretty good answer but they are under a lot of
32 pressure and are likely to make mistakes. Leaking a clear-text version
33 to the service provider would be fairly easy under stress.
35 ### 3. Gobby and SFTP servers behind a Tails-powered Tor hidden service
37 Anyone amongst John, Jane and Miranda could use Tails to host Gobby
38 and SFTP servers behind a Tor hidden service. Others would also use
41 Keeping such servers at hand, on a live system, behind an hidden
42 service is likely to prevent erroneous disclosure.
47 Let's talk about group collaboration, communication and data sharing
48 infrastructure, such as chat servers, wikis, or file repositories.
50 Hosting such data and infrastructure *in the cloud* generally implies
51 to trust the service providers not to disclose content, usage or users
52 location information to third-parties. Hence, there are many threat
53 models in which cloud hosting is not suitable.
55 Tor partly answers the *users location* part; this is great, but
56 *content* is left unprotected.
58 There are two main ways to protect such content: either to encrypt it
59 client-side (*security by design*), or to avoid putting it into
60 untrusted hands in the first place.
62 Cloud solutions that offer security by design are rare and generally
63 not mature yet. The *Tails server* project is about exploring the
64 other side of the alternative: avoiding to put private data into
65 untrusted hands in the first place.
67 This is made possible thanks to Tor hidden services, that allow users
68 to offer location-hidden services, and make self-hosting possible in
69 many threat models. Self-hosting has its own lot of problems, however,
70 particularly in contexts where the physical security of the hosting
71 place is not assured. Combining Tor hidden services with Tails'
72 amnesia property and limited support for persistent encrypted data
73 allows to protect content, to a great degree, even in such contexts.
75 This vision aims at making it easy for end-users to implement
76 solutions described above and based on Tor hidden services hosted on a
79 Tails server should be able to run common services like a web
80 server, a Jabber daemon, wiki, file repository, etc.
82 Data and configuration for services would be stored on an encrypted
83 flash media. Targeted hardware to run "Tails server" would be an
84 old laptop with broken hard-disk, battery, screen or keyboard;
85 something quite common these days.
87 In short, setting up a new Tails server would be done by:
89 1. Alice plugs a USB stick into a running desktop Tails system.
90 2. Alice uses a GUI to easily configure the needed services.
91 3. Alice unplugs the USB stick, that now contains encrypted services
92 configuration and data storage space.
93 4. Alice plugs that USB stick (and possibly a Tails Live CD) into the
94 old laptop that was dedicated to run Tails server.
95 5. Once booted, Alice enters the encryption passphrase either directly
96 using the keyboard or through a web interface listening on the
98 6. Then, Bob can use the configured services once he gets a hold on
99 the hidden service address. (The *petname system for Tor hidden
100 services* project would be very complementary to this one, by
103 Tails server should content itself with hardware that is a bit old
104 (such as a PIII-450 laptop with 256MB of RAM) and/or half broken (e.g.
105 non-functional hard-disk, screen or keyboard).
110 This project [was accepted](https://www.torproject.org/getinvolved/volunteer.html.en#tailsServer)
111 for GSoC 2012, and worked a bit before the student dropped the ball.
112 You can check the proposal [here](https://dustri.org/pub/tails_server.pdf)
114 The challenges behind this project are:
115 * Design and write the services configuration GUI [keywords: edit configuration files, upgrade between major Debian versions, debconf, Config::Model, augeas].
116 * How to create the hidden service key? [keywords: Vidalia, control protocol].
117 * Adapt the Tails boot process to allow switching to "server mode" when appropriate.
118 * Add support, to the Tails persistence setup process, for asking an encryption passphrase without X, and possibly with a broken keyboard and/or screen [keywords: local network, SSL/TLS?, certificate?].
123 Turn an USB stick into an USB Tails server stick
124 ------------------------------------------------
125 The user should be able to create a Tails server USB stick, which should boot in Tails server mode by default, and no more to Tails. During this milestone, there are no or only small differences between Tails and Tails server except that the system is aware that he is booting into Tails server.
127 Unlocking persistence without a GUI
128 ---------------------------------------
129 The end user should be able to unlock and boot a Tails server USB stick without any GUI.
131 Remote administration
132 ---------------------
133 The user should be able to have a secure shell (SSH) on the machine, to do administration tasks without a physical access to the Tails server, or a GUI. Please note that this shell is not a Tor hidden service for now.
135 Remove unnecessary/irrelevant things from boot process
136 ------------------------------------------------------
137 Tails server should not spawn a full-featured desktop anymore: the goal of this iteration is to remove as much irrelevant services as possible (e.g GNOME, Xorg, ...) in order to reduce boot-time and system resources. The only way the user have to do administration's related tasks is to use SSH.
139 Setup Tor hidden services
140 -------------------------
141 This part is a little bit unclear for now.
143 Setup and start a gobby service
144 -------------------------------
145 This is the first Tor hidden service implementation and it will allow the user to run a Gobby service from the Tails server. This step does not involve any configuration of the service, only the setup; no user interactions are involved during this milestone, since there is no configuration involved.
147 Basic configuration management
148 ------------------------------
149 The user should be able to edit the configuration of the Gobby service during the creation of the Tails server USB stick; like using a password, changing the service's name,
152 Requirement/Deliverable
153 =======================
154 * Clean design and documentation
155 * Everything hosted through Tor hidden services
157 * Switch to Tails server on boot
158 * Support for persistence to save preferences/configurations.
159 * GUI configuration tool
165 Switch to "server mode" at boot time
166 ------------------------------------
168 What follows is a preliminary implementation plan that allows us to
169 ship ISO images that are able to boot in "server mode" or in "desktop
172 This should be refined to integrate better into the standard Debian
173 Live boot process. E.g. the standard persistence support should be
174 used to iterate over block devices, find the one that contains the
175 server configuration and decrypt it.
177 When starting a server we *must* have the server configuration present
178 on a USB drive during boot, so we can simply check for its presence
179 with a hook in early init. If present, then we enter server mode and
180 don't start X, network manager, etc., otherwise we just boot Tails
181 in the normal fashion.
183 Elaborating on my suggestion above, what I describe below will have the
184 server mode init sequence logic happily contained in two init scripts
185 that are specifically made for this purpose, so no other init scripts
186 will be bloated with conditionals or altered in any way:
188 As I said, we introduce two new init scripts:
190 1. `server-check`, which is run as early as possible (i.e. as
191 soon as the filesystem is up and we can mount USB drives)
192 2. `server-mode`, which is run once the network is up
194 `server-check` will loop through all USB drives (even the one Tails
195 is running from if running from USB) and for each `$X` of them, in
198 1. check for the presence of a storage media containing a Tails-server configuration,
199 using GPT partition's label.
200 2. if the check failed continue to loop
201 3. if the check succeeds, ask the passphrase and activate persistance storage (see below)
203 So, if no drive contained a server configuration `server-check` exits and boot continues as usual. If a Tails-server configuration was encountered, the file `/var/lib/live/tails-server-mode` is created.
205 `server-mode` will check if the server state file exists and contains
206 a valid path to a file, namely the server configuration. If the check
207 fails, boot continues as usual, otherwise the server-mode service
208 will, in chronological order, take care of:
210 1. receiving the configuration encryption password some how
211 2. decrypting $(cat /var/lib/live/tails-server-mode)
212 3. starting the ssh daemon, http server, wiki software, etc.
213 using their decrypted configuration files
214 4. updating torrc with the decrypted configuration
215 5. sending tor a SIGHUP so it will reload its configuration and
216 finally start the hidden service(s)
218 If any of the above fails an appropriate error message should be shown
219 to the user. Possibly we could start X and network manager (i.e. like
220 in a normal boot) show the error there and then let the user try to
221 sort out the error, e.g. by mounting the server configuration and
222 editing the faulty config file, or by using the GUI you talked about
223 to create a completely new server configuration.
227 The default for a given Tails server installation is to boot in Tails server
230 ### Check configuration presence
231 When Tails boots, it will at some point
232 check for the presence of a storage media containing a Tails server
233 configuration, using GPT partition's label. So, the boot continues in
234 Tails server mode, if not, boot continues for normal Tails, the user
235 warned, and prompted about what should be done, either reboot in
236 Tails, or recheck for a preference USB stick.
238 ### Asking the passphrase and activating persistence storage
239 (this part is not chronological)
241 #### Advertising on the LAN
242 Tails-server needs to advertise his presence and location on the LAN.
243 The less worth manner is to use avahi/zeroconf. Since they can be more than on Tails-server on
244 the same LAN, I think that the user may choose the named advertised by avahi for his server; since the LAN is an untrusted network, using the .onion hidden service name for this purpose is not an option.
247 Since the most common setup is a LAN with a modem/router
248 provided by the ISP, they contains at least one untrusted machine. So MITM attacks are likely to happen; this is why we need to be able to authenticate the server. Doing so require that the client carry some informations about the server (certificates, and/or ssh keys).
251 A possible solution would be to take advantage of the cryptsetup/dropbear integration in debian to boot encrypted (but /boot) system. The client would log using ssh into Tails-
252 server, and enter the passphrase using a custom shell which is
253 roughly a passphrase-prompt. To make this solution more user
254 friendly, a lightweight GUI on the client side that would basically launch avahi, scan the network, show available Tails-server (since they can be many), ask for a passphrase for the selected
255 Tails-server and finally stop avahi could be easily developed.
258 Another way would be to use a simple webpage (php/apache are overkill : a simple CGI would be fine) to get the passphrase. This approach allows a simple client-side GUI in that starts/stops
259 avahi, and scans and lists Tails-servers (they can be severals).
260 When clicked, iceweasel simply opens the selected server's webpage. This should even be doable in fairly small shell script using zenity. this solution has the advantage of being platform-
264 Self signed certificates do more harms than good, since they scare the user because of the browser warning. But, because Tails-server can only be created from Tails, generated
265 certificates fingerprint could be stored in a ~/.Tails-server folder
266 on the client : Any certificates found there would be added to
267 iceweasel on as soon as Tails has opened the persistent volume
268 and found this preset. Client's Ssh public key must be stored too,
269 and written in the /.ssh/known hoss of the server.
271 ### ervices configuration with preseed
272 Once Tails server is booted, it will preseed the Debian system's debconf database with the settings
273 obtained from the Tails server configuration files.
275 ### Services installation
276 Service's packages will be installed by APT (to
277 take advantage of dependencies resolutions, upgrades, ..). Since the
278 persistence code bind-mounting the cache directory onto the location
279 where APT normally looks, there's nothing more to tell APT about.
282 ### Services configuration patches
283 As previously said, not every packages
284 will be configurable in a suitable manner. We will have to patch some
285 software's configurations after their setup.
288 Since not every services supports autostart, this is the step during which
289 they will be started. Moreover, some service configurations where patch
292 Installation process of services softwares
293 ------------------------------------------
294 Two solutions are available: either install all server softwares in the
295 default Tails, or install them dynamically from the USB stick during
296 the boot of Tails server. Even if the second solution is better (because
297 it will not unnecessary bloat Tails), the first one is much more simpler to
298 implement, and since it's not a critical (or even important) feature, it can
299 be implemented later, outside the scope of the GSoC.
301 Configuration management
302 ------------------------
303 Tails-server will often require custom "default" configuration for a bunch
304 of softwares due to its nature. Service configuration requires a nice way to
305 handle the configuration files in order to avoid a complete disparate mess.
306 In an ideal world, every services configurations should be handled by deb-
307 conf (and not by some ugly monkey patching). Doing so will keep Tails-
308 server upgrade-proof, since configuration file's format are not frozen, and
309 may evolve between updates, using debconf will make this transparent.
310 ### Upstream (Debian)
311 The best way is to ask to the related package maintainers to
312 add in debconf options that we want to access from debconf to configure
313 the package if they are not already present. Since the freeze of Wheezy (the
314 next Debian stable) is planed for June, I don't think there will be time for
315 this to happen any time soon. Most likely the debconf approach way will
316 be postponed to the Wheezy + 1 Debian release(probably in 3 years).
319 If we can't get the options we want from the package maintainers, the
320 most appropriate solution is to patch configurations files on bootime. Such
321 patches can be augeas scripts, Config::Model somethings, or whatever seems
325 Some cases don't fit well into the "debconf or patch on boot" alternative.
326 These situations would have to solved on a case-per-case basis.
330 When a new version of Tails is available, the server admin should be warned
331 about this. Tails already implements this mechanism in it's GUI, but as Tails
332 server cannot rely on GUI in its normal operation, this must be redesigned.
333 As a placeholder, the admin should be invited to subscribe to the amnesia-
336 Tails server configuration GUI
337 ------------------------------
338 The purpose of this GUI would
339 be to properly setup a persistence USB key for tail-server, with services
340 configuration, authentication means, ...
345 As contributed by adrelanos on tails-dev
346 (<50293C63.2040807@riseup.net>), servers are supposed to run over
347 longer periods without rebooting, days or weeks so Tails's current
348 implementation with tails_htp is not sufficient for Tails Server.
352 > My recommendation is to run htpdate periodically, perhaps every
353 > hour. Time exact minute should be randomized to avoid creating
354 > a network fingerprint.
356 > Given what you already implemented with `tails_htp`, running
357 > `tails_htp` frequently probable won't be hard. As I need it for aos,
358 > I am planing to add a script to /etc/cron.daily, it will run another
359 > script in background to avoid blocking anachron during the sleep
360 > delay. The other script will simply pick a number between 0 and 3600
361 > from /dev/random, sleep for the delay and then restart the
369 * [git-annex' pairing design](http://git-annex.branchable.com/design/assistant/pairing/)
371 ### Vidalia's hidden services support
373 In 0.3.x: was removed, should become a plugin someday: it's a [GSoC
374 project](https://github.com/feroze/vidalia-plugins/tree/hiddenservice)
375 by Feroze Naina <ferozenaina@gmail.com>; early in August 2012, is
376 "awaiting being merged into the vidalia-plugins repo".
378 In 0.2.x: works mostly well but we need to wait for
379 [[!tor_bug 2579]] to be fixed.
381 ### The Incognito implementation
383 The old Incognito actually has a very rudimentary support for hidden
384 services which was setup in a similar way. However, it is limited to
385 hosting static html pages using lighthttpd, but the script used might
388 - http://www.browseanonymouslyanywhere.com/incognito/uploadfiles/docs.html#hidden
389 - https://svn.torproject.org/svn/incognito/trunk/root_overlay/etc/init.d/hidden-service
391 ### Anonymous Web Application Framework
393 https://piratenpad.de/p/AnonymousWebApplicationFramework
396 Simplified edition of this project
399 ### Would it be easier to implement a simpler version of this project?
401 Would a simplified version of this project be easier to implement, and could it act as a precursor to the full blown implementation?
403 * No remote administration. Less remote access is usually more secure. Many users will not want to use their desktop machines SSH client for administration because it is not amnesic
404 * No zeroconf, zeroconf is insecure and advertises too many details on the local LAN
405 * The basics of this project is to tell the tor configuraiton file there is a hidden service listening on a certain local port (e.g. apache) and to run that server software inside tails. Vidalia has a GUI for this too. This is a simpler version of the project, and would work to provide a hidden service from within a tails livecd
406 * Would it be preferred to have the screenlock software installed as well so the server can run with a locked screen. Would need to have the ALT+F1,F2 etc gettys disabled or password protected.
407 * A simpler version that does provide a hidden service, but only the bare minimum other features, would not prevent all the other useful features specified in this document from being implemented at a later date, and may get more people interested in using it
408 * Some of the features in this document make more work to get them running, but would actually decrease security and anonymity (advertising on LAN, administering from a LAN PC)