N°8638 - Adapt mysqldump calls to follow iTop SSL configuration#883
Conversation
|
| Filename | Overview |
|---|---|
| setup/backup.class.inc.php | Adds TLS/SSL options to mysqldump command; contains two P1 bugs: --skip-ssl is removed in MySQL 8.0+ (should be --ssl-mode=DISABLED), and the credential is shell-escaped before being written to a MySQL option file, corrupting its value. |
| core/cmdbsource.class.inc.php | Moves IsSslModeDBVersion() into CMDBSource so backup and other callers can use a shared implementation; logic is correct, minor doc comment says '5.7.0' while the actual threshold is 5.7.11. |
Comments Outside Diff (1)
-
setup/backup.class.inc.php, line 324 (link)Shell-escaped value written verbatim to MySQL option file
EscapeShellArg()surrounds the raw string with single quotes on Linux. That quoted string is then interpolated into the MySQL option file at line 368. MySQL 5.7 option-file parsing treats single quotes as literal characters rather than delimiters, so the effective credential stored in the file includes the surrounding quote characters, and authentication fails.Because this variable is only used in the option file (not on the shell command line), the
EscapeShellArgcall should be removed so the raw value is written directly to the option file.
Reviews (1): Last reviewed commit: "N°8638 - Adapt mysqldump calls to follow..." | Re-trigger Greptile
| $bDbTlsEnabled = $oConfig->Get('db_tls.enabled'); | ||
| if (!$bDbTlsEnabled) { | ||
| return ''; | ||
| return CMDBSource::IsSslModeDBVersion() ? ' --skip-ssl' : ''; |
There was a problem hiding this comment.
--skip-ssl removed in MySQL 8.0+
When TLS is disabled in iTop config and the DB vendor is MySQL ≥ 5.7.11 (i.e., IsSslModeDBVersion() returns true), this line emits --skip-ssl. That option was removed in MySQL 8.0 — the mysql/mysqldump client returns unknown option '--skip-ssl' and exits with a non-zero code, causing every backup to fail. The correct option for all versions where --ssl-mode is supported is --ssl-mode=DISABLED, which is consistent with how this method handles the enabled TLS paths above.
| return CMDBSource::IsSslModeDBVersion() ? ' --skip-ssl' : ''; | |
| return CMDBSource::IsSslModeDBVersion() ? ' --ssl-mode=DISABLED' : ''; |
Base information
Symptom (bug) / Objective (enhancement)
see related ticket