WARNING: option --ssl-verify-server-cert is disabled, because of an insecure passwordless login. #1006
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#1006
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
I use borgmatic in a container to back up a containerized MariaDB 10.6.X database. I am currently still using borgmatic 1.8.X and am currently testing the update to borgmatic 1.9.X. During the tests I noticed the following warning during the backup:
I can't explain where this warning comes from, but I have the assumption that it is from “mariadb-dump”. Should I be worried? Can I get rid of the warning somehow?
Steps to reproduce
Well, nothing special if you ask me, but die database part looks like this:
Do you need the full config file?
Actual behavior
I create the backups with the following command:
The warning mentioned above can be found between the normal backup output. The backup itself does not throw any further errors.
Expected behavior
The backup function is not affected.
Other notes / implementation ideas
No response
borgmatic version
1.9.12
borgmatic installation method
Container
Borg version
1.4.0
Python version
3.13.2
Database version (if applicable)
MariaDB 10.6.21
Operating system and version
Ubuntu 22.04.5 LTS
This warning is coming from either the
mariadb-dumpor themariadbcommand (which borgmatic uses for listing databases). My guess is that the warning is showing up because you're making a non-TLS connection to your containerized database, and not anything to do with the password. But IMO you shouldn't need to use TLS for that internal connection—assuming everything's running on the same host. So my recommendation would be to suppress the warning with--skip-ssl-verify-server-cert. Unfortunately you'll need to add that to three different options, because borgmatic runs three different MariaDB commands and each can have different flags:As an enhancement, it may be a good idea to support this as a "native" borgmatic option like
verify_tlsor similar. That way you wouldn't need to modify the flags manually.Thanks again for the quick reply and I will definitely test the flags. However, I think I need to do some more research here. I find it very strange that the warning only appears during backup and not during restore. In addition, the warning is always displayed between the stats:
Maybe it has nothing to do with
mariadb-dump? I'll let you know if I can find out anything else.A quick and dirty test has shown that
--skip-ssl-verify-server-certis sufficient foroptions:, so that no more warnings are displayed during both backup and restore:However, I don't quite understand where the message has been coming from recently...
If adding
--skip-ssl-verify-server-certtooptions:suppresses the warning, then it's almost certainly coming frommariadb-dump. And yes, it's odd that MariaDB doesn't similarly complain during restore. But my guess as to why the warning is interleaved with the Borg output is because borgmatic runsmariadb-dumpand Borg simultaneously so as to stream MariaDB dump output directly to Borg without taking up any disk space. The part I don't understand is why the warning appears so late in the process; I would perhaps expect it to show up earlier, before the stats are displayed.FYI here's the code that issues that warning in MariaDB: https://github.com/MariaDB/server/blob/main/include/sslopt-vars.h#L61
And here's where it's "called': https://github.com/search?q=repo%3AMariaDB%2Fserver%20SET_SSL_OPTS_WITH_CHECK&type=code
If you wanted to try to reproduce the warning without borgmatic, you could first run borgmatic with
--verbosity 2, copy themariadb-dumpcommand, and then paste it manually into a shell—taking care to set your password into theMYSQL_PWDenvironment variable and maybe changing the dump filename so as not to interfere with actual borgmatic dumps.I followed your suggestion and extracted the
mariadb-dumpcommand. As the output shows, this is definitely where the warning comes from. It is still a mystery to me why the message appears so late in the output, but we can leave that aside for now.If I add the option
--skip-ssl-verify-server-cert, the warning no longer appears. I think this clearly shows that the error is not with borgmatic. I will continue to investigate whether this is a bug.Many thanks for your help!
Small addition: I have also tried the same command with other MariaDB containers in version 10.11 and 11.4, but here the same warning appears. The message is therefore not related to the MariaDB version used.
My current working theory: The command
mariadb-dumphas a bug and does not recognize that the password was passed via the environment variableMYSQL_PWD.EDIT: If I execute the command in the following form (with
--passwordoption), no warning is thrown:Looks like I'm on the right track...
I think you are probably right. Looking at the MariaDB code linked above, it appears that
opt_passwordcomes from a tty (so, interactive) password.Side note: I would be happy to enhance the MariaDB hook to use a mechanism more secure than an environment variable to get the password from borgmatic to MariaDB. I recently made a related change for the Borg encryption passphrase.
I think I've got a bingo:
github.com/MariaDB/server@853bdf576fandgithub.com/MariaDB/server@e951edd80bFor now I'm happy with the
--skip-ssl-verify-server-certoption, but apparently passing passwords via environment variables is no longer considered secure by the MariaDB community. Establishing a new mechanism certainly makes sense.Thanks again for your help. I think this issue can be closed.
I've created a ticket to come up with a better approach than environment variables for that: #1009.
Glad to hear the workaround is sufficient for now!