Bug 23250

Summary: koha-create generates broken mysql password
Product: Koha Reporter: Mirko Tietgen <mirko>
Component: Installation and upgrade (command-line installer)Assignee: Bugs List <koha-bugs>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: blocker    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, lucas, martin.renvoize, mtompset
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Who signed the patch off: Manual merge request:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.02,18.11.08
Bug Depends on: 23090    
Bug Blocks: 25622    
Attachments: Bug 23250: Just use an @ in the password
Bug 23250: Just use an @ in the password
Bug 23250: Just use an @ in the password

Description Mirko Tietgen 2019-07-02 07:08:08 UTC
Using koha-create with latest master generates a broken mysql password in koha-conf.xml, like this

> <pass>B6_uW%vW"__DB_PASS__`1l(Gm</pass>

The problem does not appear when I revert the changes from bug 23090.

This will make every new instance unusable. It's in the nightly, that means new devboxes will be broken too I guess.
Comment 1 Mark Tompsett 2019-07-03 23:27:52 UTC
What was the koha-create command used to generate that?!

Because:
sudo koha-create --create-db {instance name}
generally is working for me.
Comment 2 Mark Tompsett 2019-07-04 00:33:48 UTC Comment hidden (obsolete)
Comment 3 Mark Tompsett 2019-07-04 00:35:35 UTC
Created attachment 91251 [details] [review]
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.
Comment 4 Martin Renvoize 2019-07-04 08:32:20 UTC
Created attachment 91284 [details] [review]
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>
Comment 5 Martin Renvoize 2019-07-04 08:33:15 UTC
Simple patch that works well.

Thanks Mark, 

Going straight for PQA
Comment 6 Martin Renvoize 2019-07-04 08:33:43 UTC
Nice work!

Pushed to master for 19.11.00
Comment 7 Fridolin Somers 2019-07-23 12:49:12 UTC
Pushed to 19.05.x for 19.05.02
Comment 8 Lucas Gass 2019-07-23 14:54:37 UTC
backported to 18.11.x for 18.11.08
Comment 12 Jonathan Druart 2020-05-29 14:21:09 UTC
Ok, sorry, actually it was already without special chars prior to bug 23090!