nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.56k stars 4.08k forks source link

[Bug]: Nextcloud asking for sodium although being installed #35593

Open atbest opened 1 year ago

atbest commented 1 year ago

⚠️ This issue respects the following points: ⚠️

Bug description

Following the discussion in https://github.com/nextcloud/server/issues/28398, Nextcloud will still complaint the missing of sodium module when sodium is installed but PHP is not compiled with --with-password-argon2. This information is misleading and diverts the users to a wrong direction.

Steps to reproduce

  1. Use php without --with-password-argon2.
  2. Install sodium module.

Expected behavior

Nextcloud should tell the users that PHP is not compiled with --with-password-argon2, not the missing of sodium module.

atbest commented 1 year ago

In addition, the argon2 algorithm provided by sodium are SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13 and SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13.

Thus, argon2 encryption can be done with either PHP built-in PASSWORD_ARGON2I or php-pecl-sodium SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13 algorithm, both of which are dependent on libsodium, and they are equivalent, just with different parameters.

So theoretically you don't need both of them, and requirement of both PHP with --with-password-argon2 and sodium module is unnecessary.

szaimen commented 1 year ago

Hi, which Nc version?

atbest commented 1 year ago

25.0.1

knight-of-ni commented 1 year ago

This affects me as well.

Nextcloud 25.02 Rocky Linux 9 php 8.0.20

Sodium packages installed:

$ rpm -qa |grep sodium
libsodium-1.0.18-8.el9.x86_64
php-pecl-libsodium2-2.0.23-1.el9.x86_64

Sodium enabled in php:

$ php -m | grep sodium
sodium

Argon2 support enabled through sodium module (only):

$ php -r 'print_r(get_defined_constants());' | grep -i argon
[SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13] => 1
[SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13] => 2
[SODIUM_CRYPTO_PWHASH_STRPREFIX] => $argon2id$