Merge branch 'stable' into devel
[tails.git] / wiki / src / contribute / how / mirror.mdwn
blob1594360898a22f316ab014e647b94fde4841e9ee
1 [[!meta title="Set up a Tails mirror"]]
3 <div id="intro">
5 <p>Setting up a Tails BitTorrent or HTTPS mirror helps Tails users
6 downloading it faster and more reliably.</p>
8 [[!toc levels=2]]
10 </div>
12 <a id="bittorrent"></a>
14 BitTorrent
15 ==========
17 It's really easy to help Tails users downloading it over BitTorrent...
18 especially if you are already a BitTorrent user.
20 1. Get the latest BitTorrent files
21 ----------------------------------
23 Here are the latest available BitTorrent files:
25 [[!map pages="torrents/files/*.torrent"]]
27 2. Share Tails images
28 ---------------------
30 Feed your preferred BitTorrent client with the `.torrent` files
31 downloaded at the previous step. Make sure you open and/or forward the
32 needed ports in your router and/or firewall configuration so that you
33 are a real seed.
35 3. Stay tuned!
36 --------------
38 As a contributor to Tails availability over BitTorrent, it is very
39 important you share the very latest published version, and only this
40 one: users need to be able to quickly download it and upgrade when we
41 release security fixes, and there is no need to help propagate
42 outdated versions with security flaws.
44 New versions are announced on:
46 * our [[news list|about/contact#amnesia-news]]
48 * our <a href='/torrents/rss/index.rss'>RSS</a> and
49   <a href='/torrents/rss/index.atom'>Atom</a> feeds that announce new available
50   BitTorrent files.
52 <a id="http"></a>
53 <a id="https"></a>
55 HTTPS
56 =====
58 Requirements
59 ------------
61 In order to efficiently help users download Tails images and upgrades, you need:
63 - a **1Gbps** Internet uplink or faster
65 - **80 GiB** of disk space
67 - sufficiently privileged access to a **HTTPS** web server
69 - ability to also serve the content over Rsync
71 - **unfiltered access** to your web server (no GeoIP blocking, no IP bans, no
72   CAPTCHAs, etc.): we want people everywhere to be able to download Tails
74 - either a system operated by a professional team with on-call people 24/7,
75   or a high-availability setup
77 If you satisfy these practical requirements, please read on!
78 Else, please consider seeding Tails images over [[BitTorrent|mirror#bittorrent]] instead.
80 The big picture
81 ------------------
83 All downloads are currently served from a diverse pool of mirrors
84 (see the [[design document|contribute/design/mirrors]] for details).
86 Every HTTPS mirror makes our files available under a fixed URL
87 (e.g. `https://yourdomain.org/pub/tails/`)
88 that contains per-version sub-directories (such as
89 `https://yourdomain.org/pub/tails/stable/tails-i386-lenny-0.6.2/`).
91 Our automated server-side redirector periodically checks each mirrors' health
92 (using Rsync) and is able to redirect users to the nearest mirror
93 based on IP geolocation data.
95 Alongside our mirror pool redirecting to mirrors using their own domain, we maintain
96 a DNS Round Robin pool for the `dl.amnesia.boum.org` hostname. This pool serves as a
97 fallback, we add only a few fast and reliable mirrors to it.
99 We only accept mirrors that provide a SSL certificate deemed valid by
100 Firefox for the exact hostname used.
102 Pick a hostname for your mirror
103 -------------------------------
105 Your web server needs to answer HTTP and HTTPS requests sent to
106 a _dedicated_ hostname that is unique, within our mirror pool.
107 Furthermore, your web server should answer requests sent to `dl.amnesia.boum.org`
108 (your mirror could be added to our fallback mirror pool at any moment).
110 Use a hostname of your choice, under a domain you control.
111 For example, if you control `example.com`, you can call your Tails
112 mirror `tails.example.com`.
114 Manual set up
115 -------------------------
117 ### 1. Set up your web server
119 Set up a virtual host for the hostname chosen at the
120 previous step. The virtual host will need to
121 have indexing enabled.
123 Files must be served over HTTP and HTTPS. To be helpful in our
124 context, this requires a certificate that is considered valid by
125 mainstream web browsers; you can get such a certificate free of charge,
126 from [Let's Encrypt](https://letsencrypt.org/) for example.
128 #### Apache configuration example
130         <VirtualHost YOUR_WEBSERVER_IP:80>
131            ServerName yourdomain.org
132            ServerAlias dl.amnesia.boum.org
133            RewriteEngine On
134            RewriteRule ^/?(.*) https://%{SERVER_NAME}/pub/$1 [R=permanent,L]
135         </VirtualHost>
137         <VirtualHost YOUR_WEBSERVER_IP:443>
138            ServerName yourdomain.org
139            ServerAdmin YOUR_EMAIL
141            SSLEngine on
142            SSLCertificateFile /etc/apache2/ssl/apache.crt
143            SSLCertificateKeyFile /etc/apache2/ssl/apache.key
145            DocumentRoot /var/www/YOUR_PATH/
146            <Directory /var/www/YOUR_PATH/>
147               Options Indexes
148               AllowOverride None
149               IndexIgnore README.html
150               IndexOptions FancyIndexing FoldersFirst IgnoreCase NameWidth=50
151               IndexOrderDefault Descending Date
152            </Directory>
153         </VirtualHost>
155 <div class="tip">
156 You can harden this configuration using the
157 <a href="https://mozilla.github.io/server-side-tls/ssl-config-generator/">
158 Mozilla SSL Configuration Generator</a>.
159 </div>
161 #### Lighttpd configuration example
163         $HTTP["host"] =~ "^(\d+\.)?dl\.amnesia\.boum\.org$" {
164                 server.document-root = "/var/www/YOUR_PATH/"
165                 server.dir-listing = "enable"
166         }
168 #### nginx configuration example
170         server {
171                 server_name dl.amnesia.boum.org;
172                 root /var/www/YOUR_PATH;
173                 location / {
174                         autoindex on;
175                 }
176         }
178 ### 2. Download the files
180 Download a snapshot of the current Tails files:
182         rsync -rt --delete \
183                  mirrors.rsync.tails.boum.org::amnesia-archive /var/www/YOUR_PATH/
185 <a id="cron"></a>
187 ### 3. Schedule the pulling of the files
189 Your mirror should sync every hour + a random time (maximum 40 minutes).
190 Use `cron` or equivalent to schedule the same `rsync` command
191 as above. For example, you can create a file in `/etc/cron.d/` with
192 this content:
194     0 * * * * root sleep $(shuf --input-range=0-2400 --head-count=1) && flock -n /var/run/lock/tails-mirror-rsync rsync -rt --delete mirrors.rsync.tails.boum.org::amnesia-archive /var/www/YOUR_PATH/
196 ### 4. Set up a read-only Rsync server
198 You must also provide the archive via Rsync, as this is needed for our setup to
199 automatically determine the health of your mirror. Please take note of the
200 Rsync URL and include it when you send your mirrors' information to us.
202 You can now [[ask for your mirror to be added to the pool|mirror#http-pool]].
204 <a id="http-pool"></a>
206 Go wild: ask for your mirror to be added to the pool
207 ----------------------------------------------------
209 As soon as your web and Rsync servers are ready, please email us the HTTP and Rsync
210 URLs so that we can add your mirror to the pool.
212 <div class="note">
214 We will publish your email address, associated with the URL of your
215 mirror, in a file hosted on our website. If you are not comfortable
216 with this, give us an email alias that we can publish without
217 revealing additional information, such as
218 <emph>webmaster@your-mirror.org</emph>.
220 </div>
222 # Talk to us
224 To get in touch with the sysadmins who manage our pool of mirror, write to
225 <sysadmins@tails.net> ([[OpenPGP key|doc/about/openpgp_keys#sysadmins]]).