Bug 23250: Just use an @ in the password

Rather than try to use -y and symbols, since
older versions of pwgen don't have the -y,
Purposefully just shorten the generated
password to 15 characters and put @ on the end.
This avoids nasty shell globbing, fixes the
MySQL requiring a symbol by default in the
newer versions.

While @ at the end is less secure, the
password portion providing security is
still 15 characters long.

Before patch, password should have potentially
multiple ugly symbols in it.
After patch, when creating an instance, the
password will have an @ at the end of it.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Mark Tompsett 2019-07-04 00:29:01 +00:00 committed by Martin Renvoize
parent cbf605539a
commit 6a6866afa3
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 2 additions and 4 deletions

View File

@ -579,10 +579,8 @@ if [ "$op" = create ] || [ "$op" = request ] || [ "$op" = use ]
then
if [ "$mysqlpwd" = "" ]
then
# over-size, so when problematic chars are removed,
# still likely 16 characters left.
mysqlpwd="$(pwgen -s -y 32 1)"
mysqlpwd="$(echo $mysqlpwd | tr -d :\'\\\<\>\/ | cut -c1-16)"
mysqlpwd="$(pwgen -s 15 1)"
mysqlpwd="$mysqlpwd@"
fi
else
mysqlpwd="$(getinstancemysqlpassword $name)"