3 navsection: installguide
4 title: Configure webshell
7 Copyright (C) The Arvados Authors. All rights reserved.
9 SPDX-License-Identifier: CC-BY-SA-3.0
12 # "Introduction":#introduction
13 # "Prerequisites":#prerequisites
14 # "Update config.yml":#configure
15 # "Update nginx configuration":#update-nginx
16 # "Install packages":#install-packages
17 # "Configure shellinabox":#config-shellinabox
18 # "Configure pam":#config-pam
19 # "Confirm working installation":#confirm-working
21 h2(#introduction). Introduction
23 Arvados supports @webshell@, which allows ssh access to shell nodes via the browser. This functionality is integrated in @Workbench@.
25 @Webshell@ is provided by the @shellinabox@ package which runs on each shell node for which webshell is enabled. For authentication, a supported @pam library@ that allows authentication against Arvados is also required. One Nginx (or similar web server) virtualhost is also needed to expose all the @shellinabox@ instances via https.
27 h2(#prerequisites). Prerequisites
29 # "Install Workbench 2":{{site.baseurl}}/install/install-workbench2-app.html
30 # "Set up a shell node":{{site.baseurl}}/install/install-shell-server.html
32 h2(#configure). Update config.yml
34 Edit the cluster config at @config.yml@ and set @Services.WebShell.ExternalURL@. Replace @zzzzz@ with your cluster id. Workbench will use this information to activate its support for webshell.
40 ExternalURL: <span class="userinput">https://webshell.ClusterID.example.com/</span>
44 h2(#update-nginx). Update Nginx configuration
46 The arvados-webshell service will be accessible from anywhere on the internet, so we recommend using SSL for transport encryption. This Nginx virtualhost could live on your Workbench server, or any other server that is reachable by your Workbench users and can access the @shell-in-a-box@ service on the shell node(s) on port 4200.
48 Use a text editor to create a new file @/etc/nginx/conf.d/arvados-webshell.conf@ with the following configuration. Options that need attention are marked in <span class="userinput">red</span>.
51 upstream arvados-webshell {
52 server <span class="userinput">shell.ClusterID.example.com</span>:<span class="userinput">4200</span>;
57 server_name webshell.<span class="userinput">ClusterID.example.com</span>;
59 proxy_connect_timeout 90s;
60 proxy_read_timeout 300s;
63 ssl_certificate <span class="userinput">/YOUR/PATH/TO/cert.pem</span>;
64 ssl_certificate_key <span class="userinput">/YOUR/PATH/TO/cert.key</span>;
66 location /<span class="userinput">shell.ClusterID</span> {
67 if ($request_method = 'OPTIONS') {
68 add_header 'Access-Control-Allow-Origin' '*';
69 add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
70 add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
71 add_header 'Access-Control-Max-Age' 1728000;
72 add_header 'Content-Type' 'text/plain charset=UTF-8';
73 add_header 'Content-Length' 0;
76 if ($request_method = 'POST') {
77 add_header 'Access-Control-Allow-Origin' '*';
78 add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
79 add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
81 if ($request_method = 'GET') {
82 add_header 'Access-Control-Allow-Origin' '*';
83 add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
84 add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
87 proxy_ssl_session_reuse off;
88 proxy_read_timeout 90;
89 proxy_set_header X-Forwarded-Proto https;
90 proxy_set_header Host $http_host;
91 proxy_set_header X-Real-IP $remote_addr;
92 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
93 proxy_pass http://arvados-webshell;
98 Note that the location line in the nginx config matches your shell node hostname *without domain*, because that is how the shell node was defined in the "Set up a shell node":{{site.baseurl}}/install/install-shell-server.html#vm-record instructions. It makes for a more user friendly experience in Workbench.
100 For additional shell nodes with @shell-in-a-box@, add @location@ and @upstream@ sections as needed.
102 {% assign arvados_component = 'shellinabox libpam-arvados-go' %}
104 {% include 'install_packages' %}
106 h2(#config-shellinabox). Configure shellinabox
108 h3. Red Hat, AlmaLinux, and Rocky Linux
110 Edit @/etc/sysconfig/shellinaboxd@:
113 # TCP port that shellinboxd's webserver listens on
116 # SSL is disabled because it is terminated in Nginx. Adjust as needed.
117 OPTS="--disable-ssl --no-beep --service=/<span class="userinput">shell.ClusterID.example.com</span>:AUTH:HOME:SHELL"
122 <code># <span class="userinput">systemctl enable shellinabox</span></code>
123 <code># <span class="userinput">systemctl start shellinabox</span></code>
127 h3. Debian and Ubuntu
129 Edit @/etc/default/shellinabox@:
132 # TCP port that shellinboxd's webserver listens on
133 SHELLINABOX_PORT=4200
135 # SSL is disabled because it is terminated in Nginx. Adjust as needed.
136 SHELLINABOX_ARGS="--disable-ssl --no-beep --service=/<span class="userinput">shell.ClusterID.example.com</span>:AUTH:HOME:SHELL"
141 <code># <span class="userinput">systemctl enable shellinabox</span></code>
142 <code># <span class="userinput">systemctl start shellinabox</span></code>
147 h2(#config-pam). Configure pam
149 Use a text editor to create a new file @/etc/pam.d/shellinabox@ with the following configuration. Options that need attention are marked in <span class="userinput">red</span>.
152 # This example is a stock debian "login" file with pam_arvados
153 # replacing pam_unix. It can be installed as /etc/pam.d/shellinabox .
155 auth optional pam_faildelay.so delay=3000000
156 auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so
157 auth requisite pam_nologin.so
158 session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close
159 session required pam_env.so readenv=1
160 session required pam_env.so readenv=1 envfile=/etc/default/locale
162 # The first argument is the address of the API server. The second
163 # argument is this shell node's hostname. The hostname must match the
164 # "hostname" field of the virtual_machine record.
165 auth [success=1 default=ignore] /usr/lib/pam_arvados.so <span class="userinput">ClusterID.example.com</span> <span class="userinput">shell.ClusterID.example.com</span>
167 auth requisite pam_deny.so
168 auth required pam_permit.so
170 auth optional pam_group.so
171 session required pam_limits.so
172 session optional pam_lastlog.so
173 session optional pam_motd.so motd=/run/motd.dynamic
174 session optional pam_motd.so
175 session optional pam_mail.so standard
177 @include common-account
178 @include common-session
179 @include common-password
181 session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open
184 h2(#confirm-working). Confirm working installation
186 We recommend using the "Cluster diagnostics tool.":diagnostics.html
188 Here are some other checks you can perform manually.
190 A user should now be able to log in to the shell server, using webshell via workbench. Please refer to "Accessing an Arvados VM with Webshell":{{site.baseurl}}/user/getting_started/vm-login-with-webshell.html