Error: The secret passphrase in configuration (blowfish_secret) is too short.
I am on Ubuntu 16.04 with MySQL 5.7.13 and just upgraded to phpMyAdmin version 4.6.4. This error appears every time I log in to phpMyAdmin; in 4.6.3 it wasn't there. But otherwise, I can log in, and everything else seems to work.
I verified that my blowfish_secret has 24 characters. The file blowfish_secret.inc.php is located at /var/lib/phpmyadmin and belongs to group www-data. Permissions are properly set, ls -al shows:
-rw-r----- 1 root www-data 60 Mar 28 20:45 blowfish_secret.inc.php
-rw-r----- 1 root www-data 0 Mar 28 20:45 config.inc.php
Is there something in config.inc.php (located in /etc/phpmyadmin), or perhaps in the empty file shown in the above listing, that I should add? I do not have $cfg['blowfish_secret'] in the config.inc.php file.
If the secret needs to be longer, there should be some documentation about it somewhere... as a suggestion, maybe include a link to that next to the error message?
(EDIT: I wrapped the blowfish_secret in SHA1() which returns a 40-character hash, and the error disappeared, so I suppose 24 characters was just not long enough. But where is this change documented?)
If the secret needs to be longer, there should be some documentation about it somewhere
I had the same error. I found the suggestion on 4.6.4 config.sample.inc.php and at $cfg['blowfish_secret'] section on Docs, which says 'The secret should be 32 characters long.'
Thanks @o6asan for the link to documentation. Indeed, the change was made recently and was added to the documentation.
@bobhairgrove if you are satisfied, you can close this issue now.
There is a problem though, when there is no blowfish_secret set in config.inc.php, the one that is automatically generated is too short.
Indeed ... perhaps one could just wrap the auto-generated secret in SHA1() or some other hash function (or do that and truncate the result to 32 characters, or leave it at 40 characters)?
@ibennetch It's not too short, just the warning if it's too short is shown :-).
I had some problem with phpmyadmin, when i upgraded to new version of phpmyadmin 4.6.5.2. So, to decided this problem: mv /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php This works for me :-).
I just upgraded to 4.6.6 in order to deal with another issue (deprecation warnings w/ PHP 7 in Ubuntu 16.04), and after upgrading got the same error message about "blowfish_secret" being too short.
So this issue should be reopened.
(EDIT: the deprecation warnings are still there also, BTW)
Reopened.
@bobhairgrove could you confirm your current length of blowfish_secret in config.inc.php (or if it's not there so it's autogenerated)?
@ibennetch ... it has 24 characters, and it is in blowfish_secret.inc.php which is included by config.inc.php.
In the meantime, I just edited blowfish_secret.inc.php and wrapped it in SHA1() to make it longer (could have used base64_encode() just as well... :)
The secret should be 32 characters long, so if you have only 24, then it's really too short (it was not needed that long before).
What is actually reason for reopening this?
It seems that upgrading to 4.6.6 replaced the secret I had with one that was autogenerated (and too short). My old blowfish_secret.inc.php was OK because I had edited that in the past; the new one created by the update overwrites it, apparently.
How did you install phpMyAdmin? We certainly don't touch existing configuration on upgrade...
This fix worked for me:
$ sudo sha1sum /var/lib/phpmyadmin/blowfish_secret.inc.php 21248bbfbfbe7bf681ed6fee53abfa762d533398 /var/lib/phpmyadmin/blowfish_secret.inc.php $ sudo vi /var/lib/phpmyadmin/blowfish_secret.inc.php ... manually updated the $cfg['blowfish_secret'] value to the sha1sum value above. Logged back in to phpmyadmin and the error message was gone.
Shouldn't be closed, the blowfish generated by setup is giving this error by default.
@fjeddy Witch version of phpMyAdmin ?
@williamdes phpMyAdmin-4.8.5-english.zip
@fjeddy Can some examples of blowfish_secret that throws the error ?
And send the output of the following script ?
<?php
$result = '';
$length = 32;
if (class_exists('phpseclib\\Crypt\\Random')) {
$random_func = array('phpseclib\\Crypt\\Random', 'string');
} else {
$random_func = 'openssl_random_pseudo_bytes';
}
while (strlen($result) < $length) {
// Get random byte and strip highest bit
// to get ASCII only range
$byte = ord($random_func(1)) & 0x7f;
// We want only ASCII chars
if ($byte > 32) {
$result .= chr($byte);
}
}
echo $result;