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

Unable to load the login-password-less plugin #50

Closed
ghost opened this issue Mar 16, 2019 · 6 comments
Closed

Unable to load the login-password-less plugin #50

ghost opened this issue Mar 16, 2019 · 6 comments
Labels

Comments

@ghost
Copy link

ghost commented Mar 16, 2019

Hello !

We are trying to extend your image because we need to use the login-password-less plugin and it needs a custom file for the mandatory parameter.

Here is my Dockerfile :

FROM adminer:4.7.1-standalone
USER root
COPY login-password-less.php /var/www/html/plugins-enabled/login-password-less.php
USER adminer

And the content of login-password-less.php file :

<?php
require_once('plugins/login-password-less.php');

/** Set allowed password
	* @param string result of password_hash
	*/
return new AdminerLoginPasswordLess(
	$password_hash = "notthatvalue"
);

I set the env var ADMINER_PLUGINS to "login-password-less" but I still have this error on startup :

Unable to load plugin file "login-password-less", because it has required parameters: password_hash
Create a file "/var/www/html/plugins-enabled/login-password-less.php" with the following contents to load the plugin:

<?php
require_once('plugins/login-password-less.php');

/** Set allowed password
	* @param string result of password_hash
	*/
return new AdminerLoginPasswordLess(
	$password_hash = ???
);

Am I missing something ?

@TimWolla
Copy link
Owner

Am I missing something ?

Yes. The ADMINER_PLUGINS environment variable is needed for the “autoloader” that set's up the file in plugins-enabled automatically. If you create the file yourself you must not add the plugin to the environment, because it would be overridden.

@ps-feng
Copy link

ps-feng commented May 2, 2019

For the sake of completion, here's the login-password-less.php file that allows password-less access. For DBs without password, enter admin as the password.

<?php
require_once('plugins/login-password-less.php');

/** Set allowed password
	* @param string result of password_hash
	*/
return new AdminerLoginPasswordLess(
	$password_hash = password_hash("admin", PASSWORD_DEFAULT)
);

@Shurbeski
Copy link

is it USER adminer in your dockerfile necessary?
Because i did the same thing and it didnt work.
I used this scritp:

require_once('plugins/login-password-less.php');

/** Set allowed password
	* @param string result of password_hash
	*/
return new AdminerLoginPasswordLess(
	$password_hash = password_hash("admin", PASSWORD_DEFAULT)
);

I just didn't add USER in my dockerfile as you

@TimWolla
Copy link
Owner

is it USER adminer in your dockerfile necessary?

The USER within the Dockerfile is used to run the container as a restricted system user. It has nothing to do with the database user or a login username. So yes, the USER adminer is necessary.

@nerkn
Copy link

nerkn commented Feb 25, 2021

PASSWORD_DEFAULT is global php variable, or docker environment variable, or placeholder for us to change?

@TimWolla
Copy link
Owner

TimWolla commented Feb 25, 2021

PASSWORD_DEFAULT is global php variable, or docker environment variable, or placeholder for us to change?

That is a PHP constant to indicate the password hashing algorithm to use. Adminer expects a hashed password and that call will create a valid hash ad-hoc. As of right now PASSWORD_DEFAULT will result in a BCrypt hash:

php > var_dump(password_hash("admin", PASSWORD_DEFAULT));
php shell code:1:
string(60) "$2y$10$BsmC9NHuyjlOWyt9Q5FVA.WL/6lvZCZAdNF0wr9vLAA.s5SaU7xQq"

You must not replace that constant.

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

No branches or pull requests

4 participants