Bug 25622: Use special chars in DB password (koha-create)

On bug 23250 we decided to generate a password without special chars
then add a '@' at the end to comply with MySQL policy.
That is wrong, we should handle correctly the special chars we don't
want to be part of the password.

Test plan:
1.
mysqlpwd=$(pwgen -s -y -r ":'&\\<>/" 16 1)
echo $mysqlpwd

Confirm that you don't see one of the following chars : ' & \ < > /

2.
Copy from src and edit /usr/sbin/koha-create to add an echo $mysqlpwd
Create several instances, like:
koha-create --create-db x
koha-create --create-db xx
koha-create --create-db xxx
...

When you see a password with a special chars, do:
koha-shell xxx
grep '<pass>' $KOHA_CONF
And make sure the password does not contain "__DB_PASS__"

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2020-05-29 16:10:58 +02:00 committed by Tomas Cohen Arazi
parent 3ed649a0e0
commit ffd3b4b7e3
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 2 additions and 2 deletions

View File

@ -752,8 +752,8 @@ if [ "$op" = create ] || [ "$op" = request ] || [ "$op" = use ]
then
if [ "$mysqlpwd" = "" ]
then
mysqlpwd="$(pwgen -s 15 1)"
mysqlpwd="$mysqlpwd@"
# Removing : ' & \ < > /
mysqlpwd=$(pwgen -s -y -r ":'&\\<>/" 16 1)
fi
else
mysqlpwd="$(getinstancemysqlpassword $name)"