8784: Fix test for latest firefox.
[arvados.git] / doc / install / install-keep-web.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install Keep-web server
5 ...
6
7 The Keep-web server provides read-only HTTP access to files stored in Keep. It serves public data to unauthenticated clients, and serves private data to clients that supply Arvados API tokens. It can be installed anywhere with access to Keep services, typically behind a web proxy that provides SSL support. See the "godoc page":http://godoc.org/github.com/curoverse/arvados/services/keep-web for more detail.
8
9 By convention, we use the following hostnames for the Keep-web service:
10
11 <notextile>
12 <pre><code>download.<span class="userinput">uuid_prefix</span>.your.domain
13 collections.<span class="userinput">uuid_prefix</span>.your.domain
14 *.collections.<span class="userinput">uuid_prefix</span>.your.domain
15 </code></pre>
16 </notextile>
17
18 The above hostnames should resolve from anywhere on the internet.
19
20 h2. Install Keep-web
21
22 Typically Keep-web runs on the same host as Keepproxy.
23
24 On Debian-based systems:
25
26 <notextile>
27 <pre><code>~$ <span class="userinput">sudo apt-get install keep-web</span>
28 </code></pre>
29 </notextile>
30
31 On Red Hat-based systems:
32
33 <notextile>
34 <pre><code>~$ <span class="userinput">sudo yum install keep-web</span>
35 </code></pre>
36 </notextile>
37
38 Verify that @Keep-web@ is functional:
39
40 <notextile>
41 <pre><code>~$ <span class="userinput">keep-web -h</span>
42 Usage of keep-web:
43   -allow-anonymous
44         Serve public data to anonymous clients. Try the token supplied in the ARVADOS_API_TOKEN environment variable when none of the tokens provided in an HTTP request succeed in reading the desired collection. (default false)
45   -attachment-only-host string
46         Accept credentials, and add "Content-Disposition: attachment" response headers, for requests at this hostname:port. Prohibiting inline display makes it possible to serve untrusted and non-public content from a single origin, i.e., without wildcard DNS or SSL.
47   -listen string
48         Address to listen on: "host:port", or ":port" to listen on all interfaces. (default ":80")
49   -trust-all-content
50         Serve non-public content from a single origin. Dangerous: read docs before using!
51 </code></pre>
52 </notextile>
53
54 {% assign railscmd = "bundle exec ./script/get_anonymous_user_token.rb --get" %}
55 {% assign railsout = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" %}
56 If you intend to use Keep-web to serve public data to anonymous clients, configure it with an anonymous token. You can use the same one you used when you set up your Keepproxy server, or use the following command on the <strong>API server</strong> to create another. {% include 'install_rails_command' %}
57
58 Install runit to supervise the Keep-web daemon.  {% include 'install_runit' %}
59
60 The basic command to start Keep-web in the service run script is:
61
62 <notextile>
63 <pre><code>export ARVADOS_API_HOST=<span class="userinput">uuid_prefix</span>.your.domain
64 export ARVADOS_API_TOKEN="<span class="userinput">{{railsout}}</span>"
65 exec sudo -u nobody keep-web \
66  -listen=<span class="userinput">:9002</span> \
67  -attachment-only-host=<span class="userinput">download.uuid_prefix.your.domain</span> \
68  -allow-anonymous \
69  2&gt;&amp;1
70 </code></pre>
71 </notextile>
72
73 Omit the @-allow-anonymous@ argument if you do not want to serve public data.
74
75 Set @ARVADOS_API_HOST_INSECURE=1@ if your API server's SSL certificate is not signed by a recognized CA.
76
77 h3. Set up a reverse proxy with SSL support
78
79 The Keep-web service will be accessible from anywhere on the internet, so we recommend using SSL for transport encryption.
80
81 This is best achieved by putting a reverse proxy with SSL support in front of Keep-web, running on port 443 and passing requests to Keep-web on port 9002 (or whatever port you chose in your run script).
82
83 Note: A wildcard SSL certificate is required in order to support a full-featured secure Keep-web service. Without it, Keep-web can offer file downloads for all Keep data; however, in order to avoid cross-site scripting vulnerabilities, Keep-web refuses to serve private data as web content except when it is accessed using a "secret link" share. With a wildcard SSL certificate and DNS configured appropriately, all data can be served as web content.
84
85 For example, using Nginx:
86
87 <notextile><pre>
88 upstream keep-web {
89   server                127.0.0.1:<span class="userinput">9002</span>;
90 }
91
92 server {
93   listen                <span class="userinput">[your public IP address]</span>:443 ssl;
94   server_name           download.<span class="userinput">uuid_prefix</span>.your.domain
95                         collections.<span class="userinput">uuid_prefix</span>.your.domain
96                         *.collections.<span class="userinput">uuid_prefix</span>.your.domain
97                         ~.*--collections.<span class="userinput">uuid_prefix</span>.your.domain;
98
99   proxy_connect_timeout 90s;
100   proxy_read_timeout    300s;
101
102   ssl                   on;
103   ssl_certificate       <span class="userinput"/>YOUR/PATH/TO/cert.pem</span>;
104   ssl_certificate_key   <span class="userinput"/>YOUR/PATH/TO/cert.key</span>;
105
106   location / {
107     proxy_pass          http://keep-web;
108     proxy_set_header    Host            $host;
109     proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
110   }
111 }
112 </pre></notextile>
113
114 {% include 'notebox_begin' %}
115 If you restrict access to your Arvados services based on network topology -- for example, your proxy server is not reachable from the public internet -- additional proxy configuration might be needed to thwart cross-site scripting attacks that would circumvent your restrictions. Read the "'Intranet mode' section of the Keep-web documentation":https://godoc.org/github.com/curoverse/arvados/services/keep-web#hdr-Intranet_mode now.
116 {% include 'notebox_end' %}
117
118 h3. Configure DNS
119
120 Configure your DNS servers so the following names resolve to your Nginx proxy's public IP address.
121 * @download.uuid_prefix.your.domain@
122 * @collections.uuid_prefix.your.domain@
123 * @*--collections.uuid_prefix.your.domain@, if you have a wildcard SSL certificate valid for @*.uuid_prefix.your.domain@ and your DNS server allows this without interfering with other DNS names.
124 * @*.collections.uuid_prefix.your.domain@, if you have a wildcard SSL certificate valid for these names.
125
126 If neither of the above wildcard options is feasible, you have two choices:
127 # Serve web content at @collections.uuid_prefix.your.domain@, but only for unauthenticated requests (public data and collection sharing links). Authenticated requests will always result in file downloads, using the @download@ name. For example, the Workbench "preview" button and the "view entire log file" link will invoke file downloads instead of displaying content in the browser window.
128 # In the special case where you know you are immune to XSS exploits, you can enable the "trust all content" mode in Keep-web (with the @-trust-all-content@ command line flag) and Workbench (with the @trust_all_content@ item in @application.yml@). With both of these enabled, inline web content can be served from a single @collections@ host name; no wildcard DNS or certificate is needed. Do not do this without understanding the security implications described in the "Keep-web documentation":http://godoc.org/github.com/curoverse/arvados/services/keep-web.
129
130 h3. Tell Workbench about the Keep-web service
131
132 Workbench has features like "download file from collection" and "show image" which work better if the content is served by Keep-web rather than Workbench itself. We recommend using the two different hostnames ("download" and "collections" above) for file downloads and inline content respectively.
133
134 Add the following entry to your Workbench configuration file (@/etc/arvados/workbench/application.yml@). This URL will be used for file downloads.
135
136 <notextile>
137 <pre><code>keep_web_download_url: https://download.<span class="userinput">uuid_prefix</span>.your.domain/c=%{uuid_or_pdh}
138 </code></pre>
139 </notextile>
140
141 Additionally, add *one* of the following entries to your Workbench configuration file, depending on your DNS setup. This URL will be used to serve user content that can be displayed in the browser, like image previews and static HTML pages.
142
143 <notextile>
144 <pre><code>keep_web_url: https://%{uuid_or_pdh}--collections.<span class="userinput">uuid_prefix</span>.your.domain
145 keep_web_url: https://%{uuid_or_pdh}.collections.<span class="userinput">uuid_prefix</span>.your.domain
146 keep_web_url: https://collections.<span class="userinput">uuid_prefix</span>.your.domain/c=%{uuid_or_pdh}
147 </code></pre>
148 </notextile>