Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2fa TOTP stopped working on Nextcloud 12 #5391

Closed
Pnumekin opened this issue Jun 13, 2017 · 9 comments
Closed

2fa TOTP stopped working on Nextcloud 12 #5391

Pnumekin opened this issue Jun 13, 2017 · 9 comments

Comments

@Pnumekin
Copy link

2fa TOTP was working correctly, and then stopped to work. I have to disable 2fa totp to be able to login again.
Bug report from advice @ChristophWurst

Steps to reproduce

  1. Activate 2fa totp app
    2.Try to login

Expected behaviour

Should pop the twofactor challenge, then I should enter my 6 digits code and finally login to Nextcloud.

Actual behaviour

Error message from Nginx
`

An error occurred.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.

`

Server configuration

Operating system: Debian Jessie

Web server: Nginx 1.13.1

Database: Mysql Ver 14.14

PHP version: PHP 5.6.30

Nextcloud version: 12.0.0

Updated from an older Nextcloud/ownCloud or fresh install: Updated from Nextcloud 11

Where did you install Nextcloud from: Manual install with zip file.

Signing status:

Signing status
No errors have been found.

List of activated apps:

App list
Enabled:
  - activity: 2.5.2
  - bruteforcesettings: 1.0.2
  - calendar: 1.5.3
  - comments: 1.2.0
  - contacts: 1.5.3
  - dav: 1.3.0
  - federatedfilesharing: 1.2.0
  - files: 1.7.2
  - files_external: 1.3.0
  - files_pdfviewer: 1.1.1
  - files_sharing: 1.4.0
  - files_texteditor: 2.4.1
  - files_trashbin: 1.2.0
  - files_versions: 1.5.0
  - files_videoplayer: 1.1.0
  - gallery: 17.0.0
  - gpxedit: 0.0.6
  - logreader: 2.0.0
  - lookup_server_connector: 1.0.0
  - nextcloud_announcements: 1.1
  - notifications: 2.0.0
  - oauth2: 1.0.5
  - password_policy: 1.2.2
  - provisioning_api: 1.2.0
  - serverinfo: 1.2.0
  - sharebymail: 1.2.0
  - spreed: 2.0.1
  - systemtags: 1.2.0
  - theming: 1.3.0
  - twofactor_backupcodes: 1.0.0
  - twofactor_totp: 1.3.0
  - updatenotification: 1.2.0
  - workflowengine: 1.2.0
  - workin2gether: 0.9.6
Disabled:
  - admin_audit
  - encryption
  - external
  - federation
  - firstrunwizard
  - gpxpod
  - survey_client
  - user_external
  - user_ldap

Nextcloud configuration:

Config report
{
    "system": {
        "instanceid": "oce05aj3yyfm",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "grenier.boubux.com"
        ],
        "datadirectory": "\/home\/cloud-data",
        "overwrite.cli.url": "https:\/\/grenier.boubux.com",
        "dbtype": "mysql",
        "version": "12.0.0.29",
        "dbname": "Nextcloud",
        "dbhost": "localhost",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "Europe\/Paris",
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "mail_from_address": "grenier",
        "mail_smtpmode": "php",
        "mail_domain": "boubux.com",
        "default_language": "fr",
        "log_type": "owncloud",
        "logfile": "\/var\/log\/nextcloud.log",
        "loglevel": 2,
        "appstore.experimental.enabled": true,
        "maintenance": false,
        "theme": ""
    }
}

Are you using external storage, if yes which one: one local smb

Are you using encryption: no

Are you using an external user-backend, if yes which one: No

Client configuration

Browser: Firefox 53.0.3 (64 bits)

Operating system: Linux Mint 18 64bit

Logs

Web server error log

Web server error log
2017/06/13 19:37:52 [crit] 639#639: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.0.254, server: grenier.boubux.com, request: "GET /status.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "grenier.boubux.com"


Nextcloud log (data/nextcloud.log)

Nextcloud log
Error	index	Exception: Could not load two-factor auth provider OCA\TwoFactorBackupCodes\Provider\BackupCodesProvider
/var/www/grenier/lib/private/Authentication/TwoFactorAuth/Manager.php - line 123: OC\Authentication\TwoFactorAuth\Manager->getProviders(Object(OC\User\User), true)
/var/www/grenier/core/Controller/TwoFactorChallengeController.php - line 86: OC\Authentication\TwoFactorAuth\Manager->getBackupProvider(Object(OC\User\User))
[internal function] OC\Core\Controller\TwoFactorChallengeController->selectChallenge('/index.php/apps...')
/var/www/grenier/lib/private/AppFramework/Http/Dispatcher.php - line 160: call_user_func_array(Array, Array)
/var/www/grenier/lib/private/AppFramework/Http/Dispatcher.php - line 90: OC\AppFramework\Http\Dispatcher->executeController(Object(OC\Core\Controller\TwoFactorChallengeController), 'selectChallenge')
/var/www/grenier/lib/private/AppFramework/App.php - line 114: OC\AppFramework\Http\Dispatcher->dispatch(Object(OC\Core\Controller\TwoFactorChallengeController), 'selectChallenge')
/var/www/grenier/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47: OC\AppFramework\App main('TwoFactorChalle...', 'selectChallenge', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
[internal function] OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
/var/www/grenier/lib/private/Route/Router.php - line 299: call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
/var/www/grenier/lib/base.php - line 1000: OC\Route\Router->match('/login/selectch...')
/var/www/grenier/index.php - line 40: OC handleRequest()
{main}
@Dozecloud-llc
Copy link

try removing the 2fa app and reinstalling it

@ChristophWurst
Copy link
Member

Could not load two-factor auth provider OCA\TwoFactorBackupCodes\Provider\BackupCodesProvider

This looks strange. Did you somehow remove/delete the backup codes app? As in are there any files in apps/twofactor_backupcodes?

@Pnumekin
Copy link
Author

First I checked inside apps/twofactor_backupcodes and I have
appinfo css js l10n lib settings templates

Then in admin page I have deactivated twofactor app, and then delete it. After installing it again I still have my problem.

@ChristophWurst
Copy link
Member

Thanks. That does actually look good. Still, I have the feeling that a file could be missing. Could you please run php -f occ integrity:check-app twofactor_backupcodes inside your Nextcloud's directory. If there are any changed/missing/extra files in the backup codes app, it should report it.

@ChristophWurst
Copy link
Member

Updated from an older Nextcloud/ownCloud or fresh install: Updated from Nextcloud 11

Did you update recently? Maybe the opcache was not cleared and old code is executed. Would make sense to restart your webserver once in that case.

@Pnumekin
Copy link
Author

Pnumekin commented Jun 14, 2017

Thanks for your support
php -f occ integrity:check-app twofactor_backupcodes
return nothing.

I had restarted Nginx (and complete server) several times since my problem without effect on my bug.
I have restarted Nginx right now, and bug is still there

Edit : Sorry I can't remember when I made my upgrade, maybe some days after the release of Nextcloud 12. I have upgraded following this guide https://docs.nextcloud.com/server/12/admin_manual/maintenance/manual_upgrade.html
(Normal upgrade through admin page isn't working on my server)

@ChristophWurst
Copy link
Member

Thanks for checking. No output from the integrity check means that all files have passed the check. Thus the file/class reported as missing should be available on the file system.

Maybe it helps to triple check apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php. It should be identical to https://github.com/nextcloud/server/blob/98e26f8b5c8b238e7f3556e900c524ce78bde95a/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php

This is just a wild guess, but did you maybe copy over a previous version of the backup codes app during your update? Or maybe you've not replaced it properly by the new code?

@Pnumekin
Copy link
Author

The problem is solved, you were right about a version problem during the update !
I have followed this
If you are using 3rd party applications, look in your new nextcloud/apps/ directory to see if they are there. If not, copy them from your old apps/ directory to your new one. Make sure the directory permissions of your third party application directories are the same as for the other ones.

So I have copy/paste my old twofactor_backupcodes to my new install... My mistake !
I have downloaded again Nextcloud 12 again, replaced my twofactor_backupcodes folder by the one from zip file, and after a quick update and code check when connecting to Nextcloud, everything is working again.

Thank you very much for your time and your support, and my apologize for my mistake.

@ChristophWurst
Copy link
Member

Great! 😄

I'm closing this ticket now that the issues is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants