HomeITAdmin / nextcloud_geoblocker

GNU Affero General Public License v3.0
39 stars 2 forks source link

All login attemps fails after setting up geoblocker #90

Closed luftaquila closed 1 year ago

luftaquila commented 2 years ago

I setup the geoblocker with MaxMind's Geolite2. After finishing setup put my id and pw and click 'Login', the page shows:

The application may only be invoked from a command line, got "fpm-fcgi"

What all I can see is only that message. There's no Nextcloud UI or other informations. Previous login session was maintained. But when I tried to logout and relogin, it shows the same message.

This is output of the php interaction mode command described in README:

$ sudo -u www-data php -a
Interactive mode enabled

php > include 'geoip2.phar'; use GeoIp2\Database\Reader; $reader = new Reader('/var/lib/GeoIP/GeoLite2-Country.mmdb'); print($reader->country('24.165.23.67')->country->isoCode);
PHP Warning:  Uncaught Error: Undefined constant "STDOUT" in phar:///home/luftaquila/nextcloud/apps/geoblocker/3rdparty/maxmind_geolite2/geoip2.phar/.box/src/IO.php:54
Stack trace:
#0 phar:///home/luftaquila/nextcloud/apps/geoblocker/3rdparty/maxmind_geolite2/geoip2.phar/.box/src/IO.php(20): HumbugBox3130\KevinGH\RequirementChecker\IO->checkInteractivity()
#1 phar:///home/luftaquila/nextcloud/apps/geoblocker/3rdparty/maxmind_geolite2/geoip2.phar/.box/src/Checker.php(12): HumbugBox3130\KevinGH\RequirementChecker\IO->__construct()
#2 phar:///home/luftaquila/nextcloud/apps/geoblocker/3rdparty/maxmind_geolite2/geoip2.phar/.box/bin/check-requirements.php(10): HumbugBox3130\KevinGH\RequirementChecker\Checker::checkRequirements()
#3 /home/luftaquila/nextcloud/apps/geoblocker/3rdparty/maxmind_geolite2/geoip2.phar(11): require('...')
#4 php shell code(1): include('...')
#5 {main}
  thrown in phar:///home/luftaquila/nextcloud/apps/geoblocker/3rdparty/maxmind_geolite2/geoip2.phar/.box/src/IO.php on line 54
HomeITAdmin commented 2 years ago

Hi, never saw this message before. My first thought is, that I have no idea how this can be connected to GeoBlocker.

So to double check, if you leave everything the same just deactivate and activate GeoBlocker is it then switching between working and not working? What if you choose the dummy service?

What versions are you using for Nextcloud, PHP, GeoBlocker, Maxmind? Are you using a PHP-FPM setup?

Regarding the test output, I would interpret "Undefined constant "STDOUT"" that there is a problem with accessing standard output. I do not know, where this can come from. What happens if you do print("Test"); in the interactive php shell?

luftaquila commented 2 years ago

First, thank you for your answer at all.

I think this problem is definitely caused by geoblocker and maxmind. All goes fine when deactivating geoblocker or rollback to dummy service, or even rename geoip2.phar to geoip2.phar0.

Versions I am using are Nextcloud v22.2.3 and newest GeoBlocker app. PHP 8.0.13 and maxmind 4.0.6-2(maybe geoipupdate). I am using PHP-FPM.

And php interactive shell prints well. Still in problem with STDOUT something when executing script in README. image

Status of the chosen service is undefined in Nextcloud settings. I think this would tell something. image

HomeITAdmin commented 2 years ago

Yes, I agree, that really points to the maxmind.

There must be something specific in the PHP-FPM setup, that the geoip2.phar script is not working and is throwing some unknown exception.

Usually when this is happening there is at least some log entry in the nextcloud logs. Do you see some? Maybe by increasing the log level?

HomeITAdmin commented 1 year ago

I close this due to inactivity.