Nextcloud 20.0.4のセキュリティ&セットアップ警告に対応

先日 Nextcloud 19.0.6 から 20.0.4 にアップデートしました.
すると「セキュリティ&セットアップ警告」画面にいくつか警告が出てきたのでその対応メモです.

20201227 19:12:04 2470200

セキュリティ&セットアップ警告
サーバーのセキュリティとパフォーマンスにとって重要なことは、すべてが正確に設定されていることです。あなたの助けとなるよう、Nextcloudでは一部の自動チェックを行っています。詳細な情報は、リンク先のドキュメントを参照してください。

セットアップに関して警告がいくつかあります。
The old server-side-encryption format is enabled. We recommend disabling this. For more details see the documentation.
データベースにいくつかのインデックスがありません。 大きなテーブルにインデックスを追加すると、自動的に追加されないまでに時間がかかる可能性があるためです。 "occ db:add-missing-indices"を実行することによって、インスタンスが実行し続けている間にそれらの欠けているインデックスを手動で追加することができます。 インデックスが追加されると、それらのテーブルへのクエリは通常はるかに速くなります。
テーブル "oc_cards"のインデックス "cards_abiduri"が見つかりません。
The database is missing some primary keys. Due to the fact that adding primary keys on big tables could take some time they were not added automatically. By running "occ db:add-missing-primary-keys" those missing primary keys could be added manually while the instance keeps running.
Missing primary key on table "oc_federated_reshares".
Missing primary key on table "oc_systemtag_object_mapping".
Missing primary key on table "oc_comments_read_markers".
Missing primary key on table "oc_collres_resources".
Missing primary key on table "oc_collres_accesscache".
Missing primary key on table "oc_filecache_extended".
データベース内のいくつかの列で、big intへの変換が行われていません。 大きなテーブルでカラムタイプを変更すると時間がかかることがあるため、自動的には変更されませんでした。 'occ db:convert-filecache-bigint'を実行することによって、それらの保留中の変更は手動で適用できます。 この操作は、インスタンスがオフラインの間に行う必要があります。 詳細についてはこれに関するドキュメントページを読んでください。
federated_reshares.share_id
filecache_extended.fileid
share_external.id
share_external.parent
インストールガイド ↗を再確認して、 ログ にあるすべてのエラーや警告を確認してください。

データベースにいくつかのインデックスがありません。

データベースから修正していきます.まあ書いてあるコマンドを叩くだけですが.

$ sudo -u www-data php ${NEXTCLOUDPATH}/occ db:add-missing-indices
Check indices of the share table.
Check indices of the filecache table.
Check indices of the twofactor_providers table.
Check indices of the login_flow_v2 table.
Check indices of the whats_new table.
Check indices of the cards table.
Adding cards_abiduri index to the cards table, this can take some time...
cards table updated successfully.
Check indices of the cards_properties table.
Check indices of the calendarobjects_props table.
Check indices of the schedulingobjects table.
Check indices of the oc_properties table.

The database is missing some primary keys.

The database is missing some primary keys. Due to the fact that adding primary keys on big tables could take some time they were not added automatically. By running “occ db:add-missing-primary-keys” those missing primary keys could be added manually while the instance keeps running.
Missing primary key on table “oc_federated_reshares”.
Missing primary key on table “oc_systemtag_object_mapping”.
Missing primary key on table “oc_comments_read_markers”.
Missing primary key on table “oc_collres_resources”.
Missing primary key on table “oc_collres_accesscache”.
Missing primary key on table “oc_filecache_extended”.

$ sudo -u www-data php ${NEXTCLOUDPATH}/occ db:add-missing-primary-keys
Check primary keys.
Adding primary key to the federated_reshares table, this can take some time...
federated_reshares table updated successfully.
Adding primary key to the systemtag_object_mapping table, this can take some time...
systemtag_object_mapping table updated successfully.
Adding primary key to the comments_read_markers table, this can take some time...
comments_read_markers table updated successfully.
Adding primary key to the collres_resources table, this can take some time...
collres_resources table updated successfully.
Adding primary key to the collres_accesscache table, this can take some time...
collres_accesscache table updated successfully.
Adding primary key to the filecache_extended table, this can take some time...
filecache_extended table updated successfully.

データベース内のいくつかの列で、big intへの変換が行われていません。

データベース内のいくつかの列で、big intへの変換が行われていません。 大きなテーブルでカラムタイプを変更すると時間がかかることがあるため、自動的には変更されませんでした。 ‘occ db:convert-filecache-bigint’を実行することによって、それらの保留中の変更は手動で適用できます。 この操作は、インスタンスがオフラインの間に行う必要があります。

$ sudo -u www-data php ${NEXTCLOUDPATH}/occ db:convert-filecache-bigint
Following columns will be updated:

* federated_reshares.share_id
* filecache_extended.fileid
* share_external.id
* share_external.parent

This can take up to hours, depending on the number of files in your instance!
Continue with the conversion (y/n)? [n] y

The old server-side-encryption format is enabled. We recommend disabling this.

ここはE2EEで使うサーバサイドの暗号化形式で古い形式が有効になっているのを無効にしたほうがいいよって警告のようです.

The old server-side-encryption format is enabled. We recommend disabling this. For more details see the documentation.

古い形式が使われているかを確認します.

$ sudo -u www-data php ${NEXTCLOUDPATH}/occ encryption:scan:legacy-format
Scanning all files for legacy encryption
Scanning all files for matoken
Scanning all files for hoge
  :

encryption:scan:legacy-format

古い形式は使われていなかったので設定( ${NEXTCLOUDPATH/config/config.php )で明示的に無効にしてしまいます.

-  'encryption.legacy_format_support' => false,
+  'encryption.legacy_format_support' => true,

もし古い形式が残っていて移行したいでもマスターキーを設定していないという場合は該当ファイルの所持ユーザーにデータをコピーし直してもらう必要がありそうです.あまりやりたくない作業ですね.(以下のページを見るとクライアントがアップロードし直しをしてくれるのかもしれない)

これで再読込するとすべてのチェックに合格しました :)

20201227 19:12:47 2533788

環境
$ sudo -u www-data php /var/www/files.matoken.org/occ -V
Nextcloud 20.0.4
$ dpkg-query -W php mariadb-server
mariadb-server  1:10.3.27-0+deb10u1
php     2:7.3+69
$ lsb_release -dr
Description:    Debian GNU/Linux 10 (buster)
Release:        10
$ uname -vm
#1 SMP Debian 4.19.160-2 (2020-11-28) x86_64

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です