今天用原cookie紀錄登入Nextcloud時發現,TOTP 兩步驗證沒打勾,但原先是有設定,且能使用的!
嘗試登出、再登入,結果兩步驗證就無法過關,幸好有先將備援碼記錄下來!
登入後發現,確實TOTP 兩步驗證無法啟用,且出現一段錯誤。
Doctrine\DBAL\Exception\TableExistsException: An exception occurred while executing ‘CREATE TABLE `oc_twofactor_totp_secrets` (`id` INT AUTO_INCREMENT NOT NULL, `user_id` VARCHAR(64) DEFAULT ” NOT NULL, `secret` LONGTEXT NOT NULL, `state` INT DEFAULT 2 NOT NULL, UNIQUE INDEX totp_secrets_user_id (`user_id`), PRIMARY KEY(`id`)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE = InnoDB ROW_FORMAT = compressed’: SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘oc_twofactor_totp_secrets’ already exists
嗯,看不懂,所以土法煉鋼,嘗試移除重裝不行,同上錯誤。要將oc_twofactor_totp_secrets移除也不行,
直到關閉SELinux就過關!最近都沒異動啊!?重設一次SELinux試試
#semanage fcontext -a -t httpd_sys_rw_content_t '/home/data(/.*)?'
#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/config(/.*)?'
#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/apps(/.*)?'
#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/.htaccess'
#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/.user.ini'
#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?'
#restorecon -Rv '/var/www/nextcloud/'
#restorecon -Rv '/home/data/'
#setsebool -P httpd_can_network_memcache on
#setsebool -P httpd_can_sendmail on
#setsebool -P httpd_use_cifs on
#setsebool -P httpd_can_network_connect_db on
#setsebool -P httpd_can_network_connect on
再試還是不行,最後在關SELinux下,重裝Two Factor U2F、啟用後,再開啟SELinux,重新與QRCode驗證即過關,詭異!
1/5 後記,NextCloud更新15.0版後,並更新 Two Factor U2F 為2.1.5,在啟用SELinux下,可正常安裝並使用!