What is a blowfish secret in phpMyAdmin?
Asked Answered
B

7

33

About setting up the config.inc.php, the official phpMyAdmin docs says

$cfg['blowfish_secret'] = 'theExampleWrites16ValuesHere';  // use here a value of your choice

What is a blowfish secret? How do I generate, or choose, a value?

Blake answered 23/1, 2016 at 8:3 Comment(0)
B
26

Simply use any random string of characters and/or numbers that you like. It is a value that will be unique to your instance and use of phpMyAdmin.

Berkin answered 23/1, 2016 at 11:57 Comment(4)
According to the docs "a key length of 32 is recommended." (link). If you use a string that is too short, an error message might show up on some versions of phpmyamdin.Overcash
Interestingly, if I put more than 32 characters, the PHP module dies with 'Bus Error' (on FreeBSD at least). Less than that, of course, triggers the 'Blowfish secret is too short' error.Bisk
@GwynethLlewelyn With what version of PHP and phpMyAdmin? Using PHP 7.3.rc6 and phpMyAdmin 4.8.3 mine is far more than 32 characters and doesn't have any issues.Berkin
PhpMyAdmin Blowfish generatorVuong
C
5

The doc describes what blowfish secret is in phpMyAdmin,

The “cookie” auth_type uses AES algorithm to encrypt the password. If you are using the “cookie” auth_type, enter here a random passphrase of your choice. It will be used internally by the AES algorithm: you won’t be prompted for this passphrase.

The secret should be 32 characters long. Using shorter will lead to weaker security of encrypted cookies, using longer will cause no harm.

So you can use any 32 or longer chain of characters for this purpose. Even though the doc says a longer key wouldn't cause any harm, it apparently expects a key exactly 32 chars long.

You can use,

$ openssl rand -base64 22 

or any other random string generator to generate random 32 chars long key. And use it as the value as in the following example,

$cfg['blow_secret'] = '7yRxkscr/SB4Sb729H7HdnbNqZxJOQ==';
Crevice answered 12/10, 2022 at 17:31 Comment(0)
S
3

Go to phpMyadmin Directory and open the config file >> /phpMyadmin/config.inc.php

Locate >> $cfg['blowfish_secret'] = ''; / YOU MUST FILL IN THIS FOR COOKIE AUTH! /

Enter a string which should be not less than 32 characters. {You can include Number, Characters&SpecialCharacters} Save and reload the page (//yourdomainname.*/phpmyadmin) and log in again. That should fix the error.

Ref: https://wiki.archlinux.org/index.php/PhpMyAdmin#Add_blowfish_secret_passphrase

Thanks and Regards

Saturate answered 23/7, 2017 at 3:53 Comment(0)
A
3

go to /var/lib/phpmyadmin/blowfish_secret.inc.php and add some caracters to be 32 in length like this:

$cfg['blow_secret'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

save file and refresh phpMyAdmin.

Arborescent answered 29/10, 2017 at 10:58 Comment(1)
on Debian 9.6 + Nginx, I had to chown it,too: chown -R nginx:nginx /var/lib/phpmyadminGremial
C
3

If you have PHP available, you can add this to a shell script to build out the phpMyAdmin installation:

export SECRET=`php -r 'echo base64_encode(random_bytes(24));'`
echo "\$cfg['blowfish_secret'] = '$SECRET';" \
    >> /path/to/phpmyadmin/config.inc.php
Counterpunch answered 14/11, 2020 at 2:50 Comment(0)
S
1

in /usr/share/phpmyadmin/libraries/vendor_config.php the config dir variable might either be empty or missing the trailing slash, change it into:

define('CONFIG_DIR', '/etc/phpmyadmin/'); 

The permission to this temporary directory needs to be set correctly in /usr/share/phpmyadmin/libraries/vendor_config.php. It solved it for me. define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');

Also if you are missing the Users tab in PhpMyAdmin, it is caused because of insufficient rights. Run GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' WITH GRANT OPTION; from the mysql console (your your own administrative username) while logged in with root privileges.

Stone answered 13/6, 2018 at 14:0 Comment(0)
L
0

HELP TO USERS WHICH FILESYSTEM DO NOT SET FILE PERMISSIONS.

The file /config.inc.php must be set with chmod 755 in order to be accepted. Unfortunatelly, some disks and mounted filesystems will not accept chmod, so this file must remain as a "sample" /config.sample.inc.php.

You have a workaround to set all the configs in /libraries/config.default.php They say you should not edit the file, but in my case was the unique option.

Labrecque answered 3/8, 2023 at 22:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.