nextcloud / suspicious_login

Detect and warn about suspicious IPs logging into Nextcloud
GNU Affero General Public License v3.0
84 stars 25 forks source link

PHP Fatal error: causes update from 18.0.7 to 18.0.8 to fail #317

Closed HaleyACS closed 4 years ago

HaleyACS commented 4 years ago

Nextcloud system becomes unusable:

A occ -h returns: cf394fd77aca:/var/www/html$ occ -h -sh: occ: not found cf394fd77aca:/var/www/html$ ./occ -h PHP Fatal error: Declaration of Symfony\Component\Console\Input\ArrayInput::hasParameterOption($values, bool $onlyParams = false) must be compatible with Symfony\Component\Console\Input\InputInterface::hasParameterOption($values, $onlyParams = false) in /var/www/html/custom_apps/suspicious_login/vendor/symfony/console/Input/ArrayInput.php on line 202 Data log shows: {"reqId":"UU9bPOOz4PvChBABRmpU","level":3,"time":"2020-08-31 17:35:21","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"Declaration of Symfony\\Component\\Console\\Input\\ArrayInput::hasParamet erOption($values, bool $onlyParams = false) must be compatible with Symfony\\Component\\Console\\Input\\InputInterface::hasParameterOption($values, $onlyParams = false) at /var/www/html/custom_apps/suspicious_login/ven dor/symfony/console/Input/ArrayInput.php#202","userAgent":"--","version":"18.0.8.2"} Going into the docker-session, one can disable the app with: cf394fd77aca:/var/www/html$ ./occ app:disable suspicious_login suspicious_login disabled

ChristophWurst commented 4 years ago

Hmmmm. Smells like a conflict with another app. Could you disable all optional apps, then try again? If that works re-enable the now disabled apps step by step and always retry occ, as soon as it breaks we know the conflicting app.

mhbates commented 4 years ago

I had the same issue and just solved it by disabling Suspicious Login via occ. I didn't test to see if it was a specific app conflict, but I know that most optional apps were already disabled at that point.

jakeh999 commented 4 years ago

I also have this issue. Version 3.2 seems to completely break Nextcloud 18. Shown in the log: "Argument 1 passed to "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" must be an object, string given."

Reverting to version 3.1 fixes it.

Chillstice commented 4 years ago

Here to report that I also had this issue after the latest update to suspicous_login. @mhbates suggestion to disable it via occ worked.

toxiclung commented 4 years ago

+1 back online after disabled

ChristophWurst commented 4 years ago

Okay, so here's the deal: if nobody helps locate the conflict, we won't be able to fix the bug.

HaleyACS commented 4 years ago

Disabled everything that I can disable - still not working, same issue. Note that I checked the log and nextcloud after each disabled app. I can't play around too much, as this system is in production and classes start today in france. ` var/www/html # ./occ app:list Enabled:

Coffeeri commented 4 years ago

I also had a conflict with the following error-message:

> sudo -u www-data php occ log:tail

PHP Fatal error: Declaration of Symfony\Component\Console\Style\OutputStyle::write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL) must be compatible with Symfony\Component\Console\Output\OutputInterface::write($messages, $newline = false, $options = 0) in /var/www/nextcloud/apps/suspicious_login/vendor/symfony/console/Style/OutputStyle.php on line 52

I disabled the app via occ for now.

My enabled apps:

grimSBZ commented 4 years ago

I am trying to give a full bug report here. environment

steps to reproduce

The following error has been loggend 5 times in a row:

  Error    index              Exception: Argument 1 passed to                                2020-09-01T11:13:07+00:00
                              "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()"

                              must be an object, string given. at
                              lib/private/AppFramework/Http/Dispatcher.php line 109

                              0. .../App.php line 125
                                 OC\AppFramework\Http\Dispatcher->dispatch(
                                   OCA\Fil ... {},
                                   "index"
                                 )
                              1. .../RouteActionHandler.php line 47
                                 OC\AppFramework\App::main(
                                   "OCA\\Files\\Controller ... r",
                                   "index",
                                   OC\AppFramework\Depende ... {},
                                   {_route:"files.view.index"}
                                 )
                              2. <<closure>>
                                 OC\AppFramework\Routing\RouteActionHandler->__invoke(
                                   {_route:"files.view.ind ... "}
                                 )
                              3. lib/private/Route/Router.php line 299
                                 call_user_func(
                                   OC\AppFramework\Routing\RouteActio ... {},
                                   {_route:"files.view.index"}
                                 )
                              4. lib/base.php line 1013
                                 OC\Route\Router->match("\/apps\/files\/")
                              5. index.php line 38
                                 OC::handleRequest(

                                 )

further information for sudo -u www-data php occ app:list Enabled:

After occ app:disable suspicious_login its working again.

ChristophWurst commented 4 years ago

Okay thanks. In that case the conflict might be between Nextcloud and the app, which is … a bummer and really hard to fix. Let me see if I can delete the release, drop Nextcloud 18 support, and re-release.

Please downgrade to the previous version. Thanks.

HaleyACS commented 4 years ago

Can we downgrade on the CLI? I don't know how to actually do that.

ChristophWurst commented 4 years ago

You can't. Download the tarball, replace everything in the apps dir. Run the upgrade procedure. Done.

ChristophWurst commented 4 years ago

Interesting though, a pure installation of Nextcloud 17/18/19/20 with this app installed does not cause any errors. So I think it might be caused by one other app.

ChristophWurst commented 4 years ago

@Coffeeri @grimSBZ would you have a few mins to try disable all of your many apps, see if the problem remains and then re-endable them one after the other until your installation breaks?

grimSBZ commented 4 years ago

@Coffeeri @grimSBZ would you have a few mins to try disable all of your many apps, see if the problem remains and then re-endable them one after the other until your installation breaks?

As mentioned these are all default apps (and recommended). But just for fun i did disabled all enabled apps - at least those who can be disabled. I dont get any error page.

ChristophWurst commented 4 years ago

Got it. So it might the difference between default apps (the ones that are packaged) and shipped apps (the ones that live in https://github.com/nextcloud/server). Thanks for testing!

wienfuchs commented 4 years ago

Landed here because update of this app from 3.1.0 to 3.2.0 broke my nextcloud 18.0.8 installation raising the mentioned error in nextcloud log. Manually downgrading to 3.1.0 through download of tarball fixed it. So there's something obvious: Changes from 3.1.0 to 3.2.0 throws the Symphony execption and therefore breaks nextcloud 18.0.8 in total.

ChristophWurst commented 4 years ago

So there's something obvious

How is it obvious?

wienfuchs commented 4 years ago

So there's something obvious

How is it obvious?

When one has a working system (for years) and simply upgrades one (this) app and it does not work, then downgrades to previous version and it works again, this is what I would call "obvious". Don't agree?

HaleyACS commented 4 years ago

Well, if you only check the size of the archives 3.1 vs 3.2 - there is a substantial difference. smurphy@pandora:~/Downloads$ ls -lh suspicious_login-3.* -rw-rw-r-- 1 smurphy smurphy 1,2M sept. 2 09:51 suspicious_login-3.1.tar.gz -rw-rw-r-- 1 smurphy smurphy 1,8M sept. 2 09:51 suspicious_login-3.2.tar.gz 600K compressed in difference? And - 3.1 did not have the vendor/symfony inside.

Question: Which PHP Version are you folks running? Having PHP 7.3.21 (as provided by the official nextcloud docker image).

ChristophWurst commented 4 years ago

And - 3.1 did not have the vendor/symfony inside.

Bingo! There is a new dev dependency that was accidentally added as production dependency. Let me fix that …

ChristophWurst commented 4 years ago

See https://github.com/nextcloud/suspicious_login/pull/319. It also contains a test build without this dependency.

wienfuchs commented 4 years ago

See #319. It also contains a test build without this dependency.

This one works fine with me. Also show's as 3.2.0 so is confirmed to be proper installed :)

wienfuchs commented 4 years ago

Question: Which PHP Version are you folks running? Having PHP 7.3.21 (as provided by the official nextcloud docker image).

PHP 7.4.9 working as a charm

HaleyACS commented 4 years ago

@ChristophWurst Let us know when you released the last one in the official app-store :) Thx :)

ChristophWurst commented 4 years ago

v3.2.1 released: https://github.com/nextcloud/suspicious_login/releases/tag/v3.2.1

You can update via the apps settings of your Nextcloud, though due to caching of the latest releases you might not see the update immediately there.