Merge branch '19896-ldap-tls-downgrade'
authorTom Clegg <tom@curii.com>
Wed, 18 Jan 2023 14:26:55 +0000 (09:26 -0500)
committerTom Clegg <tom@curii.com>
Wed, 18 Jan 2023 14:26:55 +0000 (09:26 -0500)
fixes #19896

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

doc/admin/upgrading.html.textile.liquid
doc/install/install-postgresql.html.textile.liquid
lib/controller/router/request.go
lib/controller/router/request_test.go
sdk/python/setup.py
services/api/db/migrate/20221230155924_bigint_id.rb [new file with mode: 0644]
services/api/db/structure.sql
services/api/test/unit/user_test.rb

index 5b61c41e160b9913912d7f18f4ee0f9f5529d58a..4da168293e717c45042fd6f071f6a5c336e061e1 100644 (file)
@@ -28,14 +28,22 @@ TODO: extract this information based on git commit messages and generate changel
 <div class="releasenotes">
 </notextile>
 
-h2(#main). development main (as of 2022-12-22)
+h2(#main). development main (as of 2023-01-16)
 
 "previous: Upgrading to 2.5.0":#v2_5_0
 
+h3. Slow migration on upgrade
+
+This upgrade includes a database schema update (changing an integer column in each table from 32-bit to 64-bit) that may be slow on a large installation. Expect the arvados-api-server package upgrade to take longer than usual.
+
 h2(#v2_5_0). v2.5.0 (2022-12-22)
 
 "previous: Upgrading to 2.4.4":#v2_4_4
 
+h3. Dispatchers require PostgreSQL database access
+
+All dispatchers (cloud, LSF, and Slurm) now connect directly to the PostgreSQL database. Make sure these connections are supported by your network firewall rules, PostgreSQL connection settings, and PostgreSQL server configuration (in @pg_hba.conf@) as shown in the "PostgreSQL install instructions":{{site.baseurl}}/install/install-postgresql.html.
+
 h3. Google or OpenID Connect login restricted to trusted clients
 
 If you use OpenID Connect or Google login, and your cluster serves as the @LoginCluster@ in a federation _or_ your users log in from a web application other than the Workbench1 and Workbench2 @ExternalURL@ addresses in your configuration file, the additional web application URLs (e.g., the other clusters' Workbench addresses) must be listed explicitly in @Login.TrustedClients@, otherwise login will fail. Previously, login would succeed with a less-privileged token.
index a9614b9be58eba7afb2f9fae5bab6f79458e487d..5bb7e422da0097b8326558656328e73e7028b2a6 100644 (file)
@@ -28,8 +28,10 @@ h3(#centos7). CentOS 7
 ~$ <span class="userinput">scl enable rh-postgresql12 bash</span></pre></notextile>
 # Initialize the database
   <notextile><pre># <span class="userinput">postgresql-setup initdb</span></pre></notextile>
-# Configure the database to accept password connections
+# Configure the database to accept password connections from localhost
   <notextile><pre><code># <span class="userinput">sed -ri -e 's/^(host +all +all +(127\.0\.0\.1\/32|::1\/128) +)ident$/\1md5/' /var/lib/pgsql/data/pg_hba.conf</span></code></pre></notextile>
+# Configure the database to accept password connections from the local network (replace @10.9.8.0/24@ with your private network mask)
+  <notextile><pre><code># <span class="userinput">echo 'host all all 10.9.8.0/24 md5' | tee -a /var/lib/pgsql/data/pg_hba.conf</span></code></pre></notextile>
 # Configure the database to launch at boot and start now
   <notextile><pre># <span class="userinput">systemctl enable --now rh-postgresql12-postgresql</span></pre></notextile>
 
@@ -38,6 +40,8 @@ h3(#debian). Debian or Ubuntu
 Debian 10 (Buster) and Ubuntu 16.04 (Xenial) and later versions include a sufficiently recent version of Postgres.
 
 # Install PostgreSQL
-  <notextile><pre># <span class="userinput">apt-get --no-install-recommends install postgresql postgresql-contrib</span></pre></notextile>
+<notextile><pre># <span class="userinput">apt-get --no-install-recommends install postgresql postgresql-contrib</span></pre></notextile>
+# Configure PostgreSQL to accept password connections from the local network (replace @10.9.8.0/24@ with your private network mask)
+<notextile><pre># <span class="userinput">echo 'host all all 10.9.8.0/24 md5' | tee -a /etc/postgresql/*/main/pg_hba.conf</span></pre></notextile>
 # Configure the database to launch at boot and start now
 <notextile><pre># <span class="userinput">systemctl enable --now postgresql</span></pre></notextile>
index 31f2e1d7baf5098a377ffe9d1acd7b737958231d..97efe31726abe69d378a9742ac84042064d627b0 100644 (file)
@@ -61,7 +61,19 @@ func guessAndParse(k, v string) (interface{}, error) {
 // If the request has a parameter whose name is attrsKey (e.g.,
 // "collection"), it is renamed to "attrs".
 func (rtr *router) loadRequestParams(req *http.Request, attrsKey string) (map[string]interface{}, error) {
+       // Here we call ParseForm and ParseMultipartForm explicitly
+       // (even though ParseMultipartForm calls ParseForm if
+       // necessary) to ensure we catch errors encountered in
+       // ParseForm. In the non-multipart-form case,
+       // ParseMultipartForm returns ErrNotMultipart and hides the
+       // ParseForm error.
        err := req.ParseForm()
+       if err == nil {
+               err = req.ParseMultipartForm(int64(rtr.config.MaxRequestSize))
+               if err == http.ErrNotMultipart {
+                       err = nil
+               }
+       }
        if err != nil {
                if err.Error() == "http: request body too large" {
                        return nil, httpError(http.StatusRequestEntityTooLarge, err)
index 4544a6bb65f4692af7ffb15b190f6803c6f1bbc9..82f1fb8e89df9e8085b0a0e90a8a467365c0caa0 100644 (file)
@@ -8,6 +8,7 @@ import (
        "bytes"
        "encoding/json"
        "io"
+       "mime/multipart"
        "net/http"
        "net/http/httptest"
        "net/url"
@@ -116,7 +117,7 @@ func (tr *testReq) Request() *http.Request {
        }
        if tr.json {
                req.Header.Set("Content-Type", "application/json")
-       } else {
+       } else if tr.header.Get("Content-Type") == "" {
                req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
        }
        for k, v := range tr.header {
@@ -131,11 +132,18 @@ func (tr *testReq) bodyContent() string {
 
 func (s *RouterSuite) TestAttrsInBody(c *check.C) {
        attrs := map[string]interface{}{"foo": "bar"}
+
+       multipartBody := new(bytes.Buffer)
+       multipartWriter := multipart.NewWriter(multipartBody)
+       multipartWriter.WriteField("attrs", `{"foo":"bar"}`)
+       multipartWriter.Close()
+
        for _, tr := range []testReq{
                {attrsKey: "model_name", json: true, attrs: attrs},
                {attrsKey: "model_name", json: true, attrs: attrs, jsonAttrsTop: true},
                {attrsKey: "model_name", json: true, attrs: attrs, jsonAttrsTop: true, jsonStringParam: true},
                {attrsKey: "model_name", json: true, attrs: attrs, jsonAttrsTop: false, jsonStringParam: true},
+               {body: multipartBody, header: http.Header{"Content-Type": []string{multipartWriter.FormDataContentType()}}},
        } {
                c.Logf("tr: %#v", tr)
                req := tr.Request()
index 1daafc97adcf89e2f6fac2f1899db2003967f25c..1c65c4ced8ac8a61b6552279aee9584ef48c3b66 100644 (file)
@@ -49,7 +49,7 @@ setup(name='arvados-python-client',
           'ciso8601 >=2.0.0',
           'future',
           'google-api-core <2.11.0', # 2.11.0rc1 is incompatible with google-auth<2
-          'google-api-python-client >=1.6.2, <2',
+          'google-api-python-client >=2.1.0',
           'google-auth<2',
           'httplib2 >=0.9.2, <0.20.2',
           'pycurl >=7.19.5.1, <7.45.0',
diff --git a/services/api/db/migrate/20221230155924_bigint_id.rb b/services/api/db/migrate/20221230155924_bigint_id.rb
new file mode 100644 (file)
index 0000000..20791ae
--- /dev/null
@@ -0,0 +1,37 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class BigintId < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+  def up
+    change_column :api_client_authorizations, :id, :bigint
+    change_column :api_client_authorizations, :api_client_id, :bigint
+    change_column :api_client_authorizations, :user_id, :bigint
+    change_column :api_clients, :id, :bigint
+    change_column :authorized_keys, :id, :bigint
+    change_column :collections, :id, :bigint
+    change_column :container_requests, :id, :bigint
+    change_column :containers, :id, :bigint
+    change_column :groups, :id, :bigint
+    change_column :humans, :id, :bigint
+    change_column :job_tasks, :id, :bigint
+    change_column :jobs, :id, :bigint
+    change_column :keep_disks, :id, :bigint
+    change_column :keep_services, :id, :bigint
+    change_column :links, :id, :bigint
+    change_column :logs, :id, :bigint
+    change_column :nodes, :id, :bigint
+    change_column :users, :id, :bigint
+    change_column :pipeline_instances, :id, :bigint
+    change_column :pipeline_templates, :id, :bigint
+    change_column :repositories, :id, :bigint
+    change_column :specimens, :id, :bigint
+    change_column :traits, :id, :bigint
+    change_column :virtual_machines, :id, :bigint
+    change_column :workflows, :id, :bigint
+  end
+
+  def down
+  end
+end
index 45559757a7c1352ec1617e7dee1ba2e91d409a57..9f0e30fc47ae242b5643150947718de13791f397 100644 (file)
@@ -259,10 +259,10 @@ SET default_tablespace = '';
 --
 
 CREATE TABLE public.api_client_authorizations (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     api_token character varying(255) NOT NULL,
-    api_client_id integer NOT NULL,
-    user_id integer NOT NULL,
+    api_client_id bigint NOT NULL,
+    user_id bigint NOT NULL,
     created_by_ip_address character varying(255),
     last_used_by_ip_address character varying(255),
     last_used_at timestamp without time zone,
@@ -299,7 +299,7 @@ ALTER SEQUENCE public.api_client_authorizations_id_seq OWNED BY public.api_clien
 --
 
 CREATE TABLE public.api_clients (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     modified_by_client_uuid character varying(255),
@@ -349,7 +349,7 @@ CREATE TABLE public.ar_internal_metadata (
 --
 
 CREATE TABLE public.authorized_keys (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255) NOT NULL,
     owner_uuid character varying(255) NOT NULL,
     modified_by_client_uuid character varying(255),
@@ -389,7 +389,7 @@ ALTER SEQUENCE public.authorized_keys_id_seq OWNED BY public.authorized_keys.id;
 --
 
 CREATE TABLE public.collections (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     owner_uuid character varying(255),
     created_at timestamp without time zone NOT NULL,
     modified_by_client_uuid character varying(255),
@@ -444,7 +444,7 @@ ALTER SEQUENCE public.collections_id_seq OWNED BY public.collections.id;
 --
 
 CREATE TABLE public.container_requests (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     created_at timestamp without time zone NOT NULL,
@@ -508,7 +508,7 @@ ALTER SEQUENCE public.container_requests_id_seq OWNED BY public.container_reques
 --
 
 CREATE TABLE public.containers (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     created_at timestamp without time zone NOT NULL,
@@ -583,7 +583,7 @@ CREATE TABLE public.frozen_groups (
 --
 
 CREATE TABLE public.groups (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     created_at timestamp without time zone NOT NULL,
@@ -626,7 +626,7 @@ ALTER SEQUENCE public.groups_id_seq OWNED BY public.groups.id;
 --
 
 CREATE TABLE public.humans (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255) NOT NULL,
     owner_uuid character varying(255) NOT NULL,
     modified_by_client_uuid character varying(255),
@@ -662,7 +662,7 @@ ALTER SEQUENCE public.humans_id_seq OWNED BY public.humans.id;
 --
 
 CREATE TABLE public.job_tasks (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     modified_by_client_uuid character varying(255),
@@ -726,7 +726,7 @@ ALTER SEQUENCE public.job_tasks_qsequence_seq OWNED BY public.job_tasks.qsequenc
 --
 
 CREATE TABLE public.jobs (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     modified_by_client_uuid character varying(255),
@@ -787,7 +787,7 @@ ALTER SEQUENCE public.jobs_id_seq OWNED BY public.jobs.id;
 --
 
 CREATE TABLE public.keep_disks (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255) NOT NULL,
     owner_uuid character varying(255) NOT NULL,
     modified_by_client_uuid character varying(255),
@@ -833,7 +833,7 @@ ALTER SEQUENCE public.keep_disks_id_seq OWNED BY public.keep_disks.id;
 --
 
 CREATE TABLE public.keep_services (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255) NOT NULL,
     owner_uuid character varying(255) NOT NULL,
     modified_by_client_uuid character varying(255),
@@ -873,7 +873,7 @@ ALTER SEQUENCE public.keep_services_id_seq OWNED BY public.keep_services.id;
 --
 
 CREATE TABLE public.links (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     created_at timestamp without time zone NOT NULL,
@@ -913,7 +913,7 @@ ALTER SEQUENCE public.links_id_seq OWNED BY public.links.id;
 --
 
 CREATE TABLE public.logs (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     modified_by_client_uuid character varying(255),
@@ -966,7 +966,7 @@ CREATE TABLE public.materialized_permissions (
 --
 
 CREATE TABLE public.nodes (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     created_at timestamp without time zone NOT NULL,
@@ -1010,7 +1010,7 @@ ALTER SEQUENCE public.nodes_id_seq OWNED BY public.nodes.id;
 --
 
 CREATE TABLE public.users (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255) NOT NULL,
     created_at timestamp without time zone NOT NULL,
@@ -1073,7 +1073,7 @@ UNION ALL
 --
 
 CREATE TABLE public.pipeline_instances (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     created_at timestamp without time zone NOT NULL,
@@ -1117,7 +1117,7 @@ ALTER SEQUENCE public.pipeline_instances_id_seq OWNED BY public.pipeline_instanc
 --
 
 CREATE TABLE public.pipeline_templates (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     created_at timestamp without time zone NOT NULL,
@@ -1155,7 +1155,7 @@ ALTER SEQUENCE public.pipeline_templates_id_seq OWNED BY public.pipeline_templat
 --
 
 CREATE TABLE public.repositories (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255) NOT NULL,
     owner_uuid character varying(255) NOT NULL,
     modified_by_client_uuid character varying(255),
@@ -1200,7 +1200,7 @@ CREATE TABLE public.schema_migrations (
 --
 
 CREATE TABLE public.specimens (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     created_at timestamp without time zone NOT NULL,
@@ -1237,7 +1237,7 @@ ALTER SEQUENCE public.specimens_id_seq OWNED BY public.specimens.id;
 --
 
 CREATE TABLE public.traits (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255) NOT NULL,
     owner_uuid character varying(255) NOT NULL,
     modified_by_client_uuid character varying(255),
@@ -1303,7 +1303,7 @@ ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
 --
 
 CREATE TABLE public.virtual_machines (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255) NOT NULL,
     owner_uuid character varying(255) NOT NULL,
     modified_by_client_uuid character varying(255),
@@ -1339,7 +1339,7 @@ ALTER SEQUENCE public.virtual_machines_id_seq OWNED BY public.virtual_machines.i
 --
 
 CREATE TABLE public.workflows (
-    id integer NOT NULL,
+    id bigint NOT NULL,
     uuid character varying(255),
     owner_uuid character varying(255),
     created_at timestamp without time zone NOT NULL,
@@ -3185,5 +3185,7 @@ INSERT INTO "schema_migrations" (version) VALUES
 ('20220401153101'),
 ('20220505112900'),
 ('20220726034131'),
-('20220804133317');
+('20220804133317'),
+('20221230155924');
+
 
index 12384cba923d27da98e7d72897b1d644ce24f5cd..7e19ad5821eef83be9fa0de565a7f407521bf087 100644 (file)
@@ -805,4 +805,10 @@ class UserTest < ActiveSupport::TestCase
     assert_nil user.identity_url
   end
 
+  test "id overflows int32" do
+    uuid = users(:active).uuid
+    ActiveRecord::Base.connection.execute "update users set id=333222111000 where uuid='#{uuid}'"
+    u = User.find_by_uuid(uuid)
+    assert_equal 333222111000, u.id
+  end
 end