silverstripe / silverstripe-mfa

MultiFactor Authentication for Silverstripe CMS
BSD 3-Clause "New" or "Revised" License
11 stars 24 forks source link

PHP-GMP missing from requirements #373

Closed Firesphere closed 4 years ago

Firesphere commented 4 years ago

I can install this module, without having PHP-GMP installed. I don't think that should be the case, as the underlying modules rely on GMP

brynwhyman commented 4 years ago

I think the php-gmp requirement is actually for the WebAuthn module? This module, with TOTP installed as a single authenticator, should work fine without the requirement.

Will need to confirm this, but that's what I seem to remember!

robbieaverill commented 4 years ago

Yeah correct, the dependency comes from spomky-labs/cbor-php, which is a dependency of the webauthn module via web-auth/webauthn-lib.

We could add the requirement to the webauthn-authenticator's composer.json if that would help, but it won't have a functional difference for environments without the GMP module installed.

Previous context on @Firesphere's question: https://github.com/Spomky-Labs/cbor-php/issues/15

emteknetnz commented 4 years ago

requirements heirarchy: (visualising what @robbieaverill said above)

silverstripe/mfa

silverstripe/webauthn-authenticator
  -> web-auth/webauthn-lib 
       -> spomky-labs/cbor-php
            -> ext-gmp

@Firesphere so is what you're saying that composer is not clever enough to do nested platform requirements?

If that's the case, could you raise a PR to silverstripe/webauthn-authenticator to add in ext-gmp?

Firesphere commented 4 years ago

I honestly don't see why I would need to create a PR. I believe this is up to the team maintaining the module now.

ext-gmp is not detected as a dependency, and thus causing problems when attempting to install WebAuthN. There could be multiple factors in play here, but adding it as a requirement is a low-effort thing to do, imo.

robbieaverill commented 4 years ago

ext-gmp is not detected as a dependency, and thus causing problems when attempting to install WebAuthN.

I can't reproduce this behaviour. I've spun up a php:7.1.33-cli docker container with intl installed (because framework requires it), but without gmp, and I'm unable to install the webauthn module:

root@918585f4cc67:/public# php -i | grep gmp
root@918585f4cc67:/public#

root@b2d375f9e73b:/tmp/gmp-test# composer require silverstripe/webauthn-authenticator
Using version ^4.0 for silverstripe/webauthn-authenticator
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - silverstripe/webauthn-authenticator 4.0.0 requires web-auth/webauthn-lib ^1.0 -> satisfiable by web-auth/webauthn-lib[v1.0.0, v1.0.1, v1.0.x-dev, v1.1.0, v1.1.0-alpha1, v1.1.x-dev, v1.2.0, v1.2.1, v1.2.2, v1.2.x-dev].
    - silverstripe/webauthn-authenticator 4.0.0-beta1 requires web-auth/webauthn-lib ^1.0 -> satisfiable by web-auth/webauthn-lib[v1.0.0, v1.0.1, v1.0.x-dev, v1.1.0, v1.1.0-alpha1, v1.1.x-dev, v1.2.0, v1.2.1, v1.2.2, v1.2.x-dev].
    - silverstripe/webauthn-authenticator 4.0.0-beta2 requires web-auth/webauthn-lib ^1.0 -> satisfiable by web-auth/webauthn-lib[v1.0.0, v1.0.1, v1.0.x-dev, v1.1.0, v1.1.0-alpha1, v1.1.x-dev, v1.2.0, v1.2.1, v1.2.2, v1.2.x-dev].
    - silverstripe/webauthn-authenticator 4.0.0-beta3 requires web-auth/webauthn-lib ^1.0 -> satisfiable by web-auth/webauthn-lib[v1.0.0, v1.0.1, v1.0.x-dev, v1.1.0, v1.1.0-alpha1, v1.1.x-dev, v1.2.0, v1.2.1, v1.2.2, v1.2.x-dev].
    - silverstripe/webauthn-authenticator 4.0.0-rc1 requires web-auth/webauthn-lib ^1.0 -> satisfiable by web-auth/webauthn-lib[v1.0.0, v1.0.1, v1.0.x-dev, v1.1.0, v1.1.0-alpha1, v1.1.x-dev, v1.2.0, v1.2.1, v1.2.2, v1.2.x-dev].
    - silverstripe/webauthn-authenticator 4.0.0-rc2 requires web-auth/webauthn-lib ^1.0 -> satisfiable by web-auth/webauthn-lib[v1.0.0, v1.0.1, v1.0.x-dev, v1.1.0, v1.1.0-alpha1, v1.1.x-dev, v1.2.0, v1.2.1, v1.2.2, v1.2.x-dev].
    - silverstripe/webauthn-authenticator 4.0.1 requires web-auth/webauthn-lib ^1.0 -> satisfiable by web-auth/webauthn-lib[v1.0.0, v1.0.1, v1.0.x-dev, v1.1.0, v1.1.0-alpha1, v1.1.x-dev, v1.2.0, v1.2.1, v1.2.2, v1.2.x-dev].
    - silverstripe/webauthn-authenticator 4.0.x-dev requires web-auth/webauthn-lib ^1.0 -> satisfiable by web-auth/webauthn-lib[v1.0.0, v1.0.1, v1.0.x-dev, v1.1.0, v1.1.0-alpha1, v1.1.x-dev, v1.2.0, v1.2.1, v1.2.2, v1.2.x-dev].
    - silverstripe/webauthn-authenticator 4.x-dev requires web-auth/webauthn-lib ^1.0 -> satisfiable by web-auth/webauthn-lib[v1.0.0, v1.0.1, v1.0.x-dev, v1.1.0, v1.1.0-alpha1, v1.1.x-dev, v1.2.0, v1.2.1, v1.2.2, v1.2.x-dev].
    - web-auth/webauthn-lib v1.0.0 requires spomky-labs/cbor-php ^1.0.2 -> satisfiable by spomky-labs/cbor-php[v1.0.x-dev, v1.0.2, v1.0.3, v1.0.4, v1.0.5, v1.0.6, v1.0.7, v1.0.8].
    - web-auth/webauthn-lib v1.0.1 requires spomky-labs/cbor-php ^1.0.2 -> satisfiable by spomky-labs/cbor-php[v1.0.x-dev, v1.0.2, v1.0.3, v1.0.4, v1.0.5, v1.0.6, v1.0.7, v1.0.8].
    - web-auth/webauthn-lib v1.0.x-dev requires spomky-labs/cbor-php ^1.0.2 -> satisfiable by spomky-labs/cbor-php[v1.0.x-dev, v1.0.2, v1.0.3, v1.0.4, v1.0.5, v1.0.6, v1.0.7, v1.0.8].
    - web-auth/webauthn-lib v1.1.0 requires spomky-labs/cbor-php ^1.0.2 -> satisfiable by spomky-labs/cbor-php[v1.0.x-dev, v1.0.2, v1.0.3, v1.0.4, v1.0.5, v1.0.6, v1.0.7, v1.0.8].
    - web-auth/webauthn-lib v1.1.0-alpha1 requires spomky-labs/cbor-php ^1.0.2 -> satisfiable by spomky-labs/cbor-php[v1.0.x-dev, v1.0.2, v1.0.3, v1.0.4, v1.0.5, v1.0.6, v1.0.7, v1.0.8].
    - web-auth/webauthn-lib v1.1.x-dev requires spomky-labs/cbor-php ^1.0.2 -> satisfiable by spomky-labs/cbor-php[v1.0.x-dev, v1.0.2, v1.0.3, v1.0.4, v1.0.5, v1.0.6, v1.0.7, v1.0.8].
    - web-auth/webauthn-lib v1.2.0 requires spomky-labs/cbor-php ^1.0.2 -> satisfiable by spomky-labs/cbor-php[v1.0.x-dev, v1.0.2, v1.0.3, v1.0.4, v1.0.5, v1.0.6, v1.0.7, v1.0.8].
    - web-auth/webauthn-lib v1.2.1 requires spomky-labs/cbor-php ^1.0.2 -> satisfiable by spomky-labs/cbor-php[v1.0.x-dev, v1.0.2, v1.0.3, v1.0.4, v1.0.5, v1.0.6, v1.0.7, v1.0.8].
    - web-auth/webauthn-lib v1.2.2 requires spomky-labs/cbor-php ^1.0.2 -> satisfiable by spomky-labs/cbor-php[v1.0.x-dev, v1.0.2, v1.0.3, v1.0.4, v1.0.5, v1.0.6, v1.0.7, v1.0.8].
    - web-auth/webauthn-lib v1.2.x-dev requires spomky-labs/cbor-php ^1.0.2 -> satisfiable by spomky-labs/cbor-php[v1.0.x-dev, v1.0.2, v1.0.3, v1.0.4, v1.0.5, v1.0.6, v1.0.7, v1.0.8].
    - spomky-labs/cbor-php v1.0.x-dev requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
    - spomky-labs/cbor-php v1.0.8 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
    - spomky-labs/cbor-php v1.0.7 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
    - spomky-labs/cbor-php v1.0.6 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
    - spomky-labs/cbor-php v1.0.5 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
    - spomky-labs/cbor-php v1.0.4 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
    - spomky-labs/cbor-php v1.0.3 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
    - spomky-labs/cbor-php v1.0.2 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
    - spomky-labs/cbor-php 1.0.x-dev requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
    - Installation request for silverstripe/webauthn-authenticator ^4.0 -> satisfiable by silverstripe/webauthn-authenticator[4.0.0, 4.0.0-beta1, 4.0.0-beta2, 4.0.0-beta3, 4.0.0-rc1, 4.0.0-rc2, 4.0.1, 4.0.x-dev, 4.x-dev].

  To enable extensions, verify that they are enabled in your .ini files:
    - 
    - /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-intl.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

Can you please provide more info to help us fix your problem?

Firesphere commented 4 years ago

Yes, I found the problem. Kinda.

The problem is, when the PHP terminal config differs from the Webserver config, which was the case for me. I understand, that's unavoidable and not relevant to the module.

Not sure why my config differs though. But that's my problem to solve.

robbieaverill commented 4 years ago

Glad we got that one ironed out! @Firesphere FYI you can use Composer's platform configuration settings to ensure your repositories install dependencies that are compatible with your production servers. See https://getcomposer.org/doc/06-config.md#platform.