Commit 28f7fbf
authored
Set mysqldump SSL/TLS args based on 'tls' connection URL param. (#679)
It looks like the default for `--ssl-verify-server-cert` was changed
from `FALSE` to `TRUE` in MariaDB Connector/C in version 3.4,
corresponding to MariaDB 11.4:
mariadb-corporation/mariadb-connector-c@1287c90
> Since version 3.4 peer certificate verification is enabled by default.
https://mariadb.com/docs/server/security/securing-mariadb/securing-mariadb-encryption/data-in-transit-encryption/securing-connections-for-client-and-server#enabling-one-way-tls-for-mariadb-clients
> Starting from [MariaDB
11.4](https://mariadb.com/docs/release-notes/community-server/mariadb-11-4-series/what-is-mariadb-114)
(Connector/C version 3.4) this mode is enabled by default.
As `dbmate` uses the `go-sql-driver/mysql` driver for executing queries,
which sets
[tls=false](https://github.com/go-sql-driver/mysql?tab=readme-ov-file#tls)
by default, we don't see a change when applying migrations.
However, `dbmate` executes `mysqldump` to dump schemas, and that's where
the change in MariaDB hits us.
We should disable SSL/TLS when invoking `mysqldump` if `tls` is `false`,
and we should use `--ssl-verify-server-cert=false` if `tls` is
`skip-verify`.
This fixes the following CI test failures:
```
=== RUN TestMySQLDumpSchema
Dropping: dbmate_test
Creating: dbmate_test
mysql_test.go:202:
Error Trace: /src/pkg/driver/mysql/mysql_test.go:202
Error: Received unexpected error:
mysqldump: Got error: 2026: "TLS/SSL error: self-signed certificate in certificate chain" when trying to connect
Test: TestMySQLDumpSchema
--- FAIL: TestMySQLDumpSchema (0.04s)
=== RUN TestMySQLDumpSchemaContainsNoAutoIncrement
Dropping: dbmate_test
Creating: dbmate_test
mysql_test.go:246:
Error Trace: /src/pkg/driver/mysql/mysql_test.go:246
Error: Received unexpected error:
mysqldump: Got error: 2026: "TLS/SSL error: self-signed certificate in certificate chain" when trying to connect
Test: TestMySQLDumpSchemaContainsNoAutoIncrement
--- FAIL: TestMySQLDumpSchemaContainsNoAutoIncrement (0.04s)
```1 parent 3fe5366 commit 28f7fbf
2 files changed
+24
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
135 | 143 | | |
136 | 144 | | |
137 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
| |||
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
166 | 181 | | |
167 | 182 | | |
168 | 183 | | |
| |||
175 | 190 | | |
176 | 191 | | |
177 | 192 | | |
| 193 | + | |
178 | 194 | | |
179 | 195 | | |
180 | 196 | | |
| |||
0 commit comments