Help, cannot make backups any more (**security**)

(roland w) #1

I can’t make a backup any more via Administration -> backup, the backup program will not run. And worse: the page displays an error message with the Mysql password in plain text for anyone to see !!

OpenEMR Version
I’m using OpenEMR version 5.0.1(6)

I’m using: Firefox 63

Operating System
I’m using: FreeBSD 11.1

Error message: Dumping OpenEMR database... "/usr/bin/mysqldump -u 'openvemr' -p'xxxxxxxxxxxxxxx' -h 'localhost' --port='3306' --opt --quote-names -r /tmp/openemr_web_backup/emr_backup/openemr.sql 'openvemr'" returned 127:

(replaced the mysql password with x’s obviously…)
What went wrong?
Roland :paw_prints:

(Stephen Waite) #2

hi @roland, can you check to see if this directory exists on your freebsd box?

(roland w) #3

hi @stephenwaite,
yes it does exist (owner www) but it is empty

(Stephen Waite) #4

and does mysqldump live here on freebsd?

(roland w) #5

no, it is at /usr/local/bin/mysqldump

(Stephen Waite) #6

ok @roland, maybe a symlink to /usr/bin then?

(roland w) #7

ok, I did that, but it still doesn’t work. It starts copying the database but then stalls again with another error:
Dumping OpenEMR database... Dumping OpenEMR web directory tree... "tar --same-owner --ignore-failed-read -zcphf /tmp/openemr_web_backup/emr_backup/openemr.tar.gz "version.php" "repositories" "contrib" "" "vendor" "services" "patients" "controller.php" "custom" "ci" "templates" "composer.lock" "portal" "interface" ".bowerrc" "controllers" "ccdaservice" "images" ".env.example" ".editorconfig" "config" "" "cloud" "myportal" "entities" "phpfhir" "composer.json" "ccr" "index.php" "library" "modules" "gacl" ".travis.yml" "public" "acknowledge_license_cert.html" "sql" "build.xml" "Documentation" "docker-compose.yml" "" ".github" "common" ".gitignore" "LICENSE" "sites/default" "bower.json"" returned 1:

now what?

(Stephen Waite) #8

must be due to bsd’s implementation of tar
try cd ing to your www document root, like /var/www/html/openemr and issuing the following at the command line to see more error details

(roland w) #9

it seems to be only part of the problem: did that too and it said:

tar: Option --ignore-failed-read is not supported

then I ran it again without that option, it then starts to copy the directories but after a while still hangs, now it seems to be unable to handle a patient file name:
Can't translate pathname 'sites/default/documents/38/Linus_Bl��ser.jpg' to UTF-8

The (cat) patiënt’s name is Linus Bläser. We have many patients with é,Ö,ǘ or c-cedilla’s in their name. Is this backup script specific? The rest of OpenEMR runs fine; it never was a problem except in the ACL list which does not accept these characters (see one of my other posts that was unanswered unfortunately).

(Stephen Waite) #10

hi @roland, what locale is your environment?

also, are you sure it hangs from the command line and it’s not writing the tar file? you could open another terminal and ls -lrt the file to see if it’s growing in size, it may take a little while to finish it’s work

forgot that instead of the symlink you could have changed the path to mysql binaries in Admin->Globals->Miscellaneous

(roland w) #11

ok, I forgot about the path to the mysql binaries in globals too and changed it, symlink removed. You were right about it taking some time, it took a while before it had completed tarring the directories. However, it still stops, leaving two gz files in tmp, it’s not combined into one file and not presented for download in the browser like it used to.
I doubt the locale (en_dk, which has the proper time/decimal/money format) has anything to do with it, since it always ran without problems in all versions, and the locale hasn’t changed.
I’ll forget the backup script for now and do manual backups…
Am I wrong or could this be a problem of OpenEMR’s inconsistent internationalization support? Forgive me if that sounds a bit harsh, it is frustration with past unanswered issues, and still present shortcomings with time entry, decimal separators and diacritical characters e.g. in the ACL.

(Stephen Waite) #12

hi @roland, this is mostly a freebsd issue since openemr is using the native operating system binaries and it seems like the locale prevents the filename completion

now that you’ve fixed the path you just need to edit the backup script to remove the --ignore-failed-read in openemr/backup.php at rel-501 · openemr/openemr · GitHub and it should work minus the patient file names mentioned previously

(roland w) #13

Well, I tried everything, but I still feel that a backup “minus some patient file names” is not a real backup. The locale hasn’t changed, as I said I never had this problem in 5.00 or earlier versions. No other software on the Freebsd box does this, just the OEMR 5.01 backup script. But I’ll use manual copying, that works.

(Stephen Waite) #14

it’s only those documents like the .jpg you mentioned previously that are not captured so you could rename those few

and we could work on escaping those special characters here

(roland w) #15

hi @stephenwaite,
thanks. Although the console complained about those document titles with ä and ü etc., and the script seemed to stall, I was surprised to find them in the tar archive with the filenames intact. It’s not an option to rename all the documents that have diacritical characters in them, too many and we never had to. But thanks for diving into the script code. I don’t understand, it’s not clear what you mean by we; should I change the lines in red in the code or are you working on some fix?
thanks for your time

(Stephen Waite) #16

hi @roland, sounds like we don’t need to fix it so you should be all set to run the backup inside openemr if you remove the --ignore-failed-read mentioned above :crossed_fingers: