3 navsection: installguide
4 title: Install Keep-web server
7 Copyright (C) The Arvados Authors. All rights reserved.
9 SPDX-License-Identifier: CC-BY-SA-3.0
12 # "Introduction":#introduction
13 # "Configure DNS":#introduction
14 # "Update config.yml":#update-config
15 # "Update nginx configuration":#update-nginx
16 # "Install keep-web package":#install-packages
17 # "Start the service":#start-service
18 # "Restart the API server and controller":#restart-api
19 # "Confirm working installation":#confirm-working
21 h2(#introduction). Introduction
23 The Keep-web server provides read/write HTTP (WebDAV) 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 TLS support. See the "godoc page":http://godoc.org/github.com/curoverse/arvados/services/keep-web for more detail.
25 By convention, we use the following hostnames for the Keep-web service:
28 <pre><code>download.<span class="userinput">uuid_prefix</span>.your.domain
29 collections.<span class="userinput">uuid_prefix</span>.your.domain
30 *.collections.<span class="userinput">uuid_prefix</span>.your.domain
34 The above hostnames should resolve from anywhere on the internet.
36 h2(#dns). Configure DNS
38 It is important to properly configure the download service to migitate cross-site-scripting (XSS) attacks. A HTML page can be stored in collection. If an attacker causes a victim to visit that page through Workbench, it will be rendered by the browser. If all collections are served at the same domain, the browser will consider collections as coming from the same origin and having access to the same browsing data, enabling malicious Javascript on that page to access Arvados on behalf of the victim.
40 Browser security is based on domain names. We having separate domains for each collection
44 # Serve preview links using uuid or pdh in subdomain
45 # (requires wildcard DNS and TLS certificate)
46 # https://*.collections.ClusterID.example.com
48 # Serve preview links using uuid or pdh in main domain
49 # (requires wildcard DNS and TLS certificate)
50 # https://*--collections.ClusterID.example.com
53 limiting preview to circumstances where the collection is not accessed with the user's regular full-access token.
55 # Serve preview links by setting uuid or pdh in the path.
56 # This configuration only allows previews of public data or
57 # collection-sharing links, because these use the anonymous
58 # user token or the token is already embedded in the URL.
59 # Other data must be handled as downloads via WebDAVDownload:
60 # https://collections.ClusterID.example.com
62 The configuration option @Services.WebDAV.ExternalURL@ is the base URL for Workbench inline preview. If blank, use WebDAVDownload instead, and disable inline preview. If both are empty, downloading collections from workbench will be impossible.
67 # Base URL for download links. If blank, serve links to WebDAV
68 # with disposition=attachment query param. Unlike preview links,
69 # browsers do not render attachments, so there is no risk of XSS.
71 # If WebDAVDownload is blank, and WebDAV uses a
72 # single-origin form, then Workbench will show an error page
74 # Serve download links by setting uuid or pdh in the path:
75 # https://download.ClusterID.example.com
78 Configure your DNS servers so the following names resolve to your keep-web server's public IP address.
79 * @download.ClusterID.example.com@
80 * @collections.ClusterID.example.com@
81 * @*--collections.ClusterID.example.com@, if you have a wildcard TLS certificate valid for @*.ClusterID.example.com@ and your DNS server allows this without interfering with other DNS names.
82 * @*.collections.ClusterID.example.com@, if you have a wildcard TLS certificate valid for these names.
84 If neither of the above wildcard options is feasible, you have two choices:
85 # Serve web content at @collections.ClusterID.example.com@, 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.
86 # In the special case where you know you are immune to XSS exploits, you can enable the "trust all content" mode in Keep-web and Workbench (setting @Collections.TrustAllContent: true@ on the config file). With this 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.
88 h2(#update-config). Update config.yml
90 {% assign railscmd = "bundle exec ./script/get_anonymous_user_token.rb --get" %}
91 {% assign railsout = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" %}
92 If you intend to use Keep-web to serve public data to anonymous clients, configure it with an anonymous token. Use the following command on the <strong>API server</strong> to create an anonymous user token. {% include 'install_rails_command' %}
94 Update @Services.WebDAV@ and @Services.WebDAVDownload@ in config.yml:
100 <span class="userinput">"http://collections.<span class="userinput">ClusterID</span>.example.com:9002/": {}</span>
101 ExternalURL: "https://collections.<span class="userinput">ClusterID</span>.example.com"
104 <span class="userinput">"http://download.<span class="userinput">ClusterID</span>.example.com:9002/": {}</span>
105 ExternalURL: "https://download.<span class="userinput">ClusterID</span>.example.com"
107 AnonymousUserToken: "{{railsout}}"
109 TrustAllContent: false
113 Set @Users.AnonymousUserToken: ""@ (empty string) or leave it out if you do not want to serve public data.
115 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.
117 Additionally, one of the following entries on your cluster configuration file (depending on your DNS setup) tells Workbench which URL will be used to serve user content that can be displayed in the browser, like image previews and static HTML pages.
121 <span class="userinput">uuid_prefix</span>:
124 ExternalURL: "https://*--collections.<span class="userinput">uuid_prefix</span>.example.com"
125 ExternalURL: "https://*.collections.<span class="userinput">uuid_prefix</span>.example.com"
126 ExternalURL: "https://collections.<span class="userinput">uuid_prefix</span>.example.com"
130 h3. Update nginx configuration
132 The Keep-web service will be accessible from anywhere on the internet, so we recommend using TLS for transport encryption.
134 This is best achieved by putting a reverse proxy with TLS 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).
136 Note: A wildcard TLS 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 TLS certificate and DNS configured appropriately, all data can be served as web content.
138 Use a text editor to create a new file @/etc/nginx/conf.d/keep-web.conf@ with the following configuration. Options that need attention are marked with “TODO”.
142 server 127.0.0.1:<span class="userinput">9002</span>;
146 listen <span class="userinput">[TODO: your public IP address]</span>:443 ssl;
147 server_name download.<span class="userinput">ClusterID</span>.example.com
148 collections.<span class="userinput">ClusterID</span>.example.com
149 *.collections.<span class="userinput">ClusterID</span>.example.com
150 ~.*--collections.<span class="userinput">ClusterID</span>.example.com;
152 proxy_connect_timeout 90s;
153 proxy_read_timeout 300s;
156 ssl_certificate <span class="userinput"/>YOUR/PATH/TO/cert.pem</span>;
157 ssl_certificate_key <span class="userinput"/>YOUR/PATH/TO/cert.key</span>;
160 proxy_pass http://keep-web;
161 proxy_set_header Host $host;
162 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
164 client_max_body_size 0;
165 proxy_http_version 1.1;
166 proxy_request_buffering off;
171 {% include 'notebox_begin' %}
172 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.
173 {% include 'notebox_end' %}
175 h2. Install Keep-web package
177 Typically Keep-web runs on the same host as Keepproxy.
182 <pre><code># <span class="userinput">yum install keepproxy</span>
186 h3. Debian and Ubuntu
189 <pre><code># <span class="userinput">apt-get install keepproxy</span>
193 h2(#start-service). Start the service
195 If your system does not use systemd, skip this section and follow the "runit instructions":#runit instead.
197 If your system uses systemd, the keep-web service should already be set up. Start it and check its status:
200 <pre><code>~$ <span class="userinput">sudo systemctl restart keep-web</span>
201 ~$ <span class="userinput">sudo systemctl status keep-web</span>
202 ● keep-web.service - Arvados Keep web gateway
203 Loaded: loaded (/lib/systemd/system/keep-web.service; enabled)
204 Active: active (running) since Sat 2019-08-10 10:33:21 UTC; 3 days ago
205 Docs: https://doc.arvados.org/
206 Main PID: 4242 (keep-web)
207 CGroup: /system.slice/keep-web.service
208 └─4242 /usr/bin/keep-web