Skip to content

Commit 15daab8

Browse files
committed
Register TLS config when setting up master connection info
This ensures that the master's TLS config has been registered with the mysql driver before any connections are attempted. This is the second part of resolving the following TLS verify error: 2025-01-02 02:07:26 FATAL tls: failed to verify certificate: x509: certificate is valid for [old host], not [new host]
1 parent 79c15d2 commit 15daab8

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

go/logic/migrator.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,9 @@ func (this *Migrator) initiateInspector() (err error) {
790790
if this.migrationContext.CliMasterPassword != "" {
791791
this.migrationContext.ApplierConnectionConfig.Password = this.migrationContext.CliMasterPassword
792792
}
793+
if err := this.migrationContext.ApplierConnectionConfig.RegisterTLSConfig(); err != nil {
794+
return err
795+
}
793796
this.migrationContext.Log.Infof("Master forced to be %+v", *this.migrationContext.ApplierConnectionConfig.ImpliedKey)
794797
}
795798
// validate configs

go/mysql/utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ func GetMasterConnectionConfigSafe(connectionConfig *ConnectionConfig, visitedKe
128128
if !masterKey.IsValid() {
129129
return connectionConfig, nil
130130
}
131+
131132
masterConfig = connectionConfig.DuplicateCredentials(*masterKey)
133+
if err := masterConfig.RegisterTLSConfig(); err != nil {
134+
return nil, err
135+
}
132136

133137
log.Debugf("Master of %+v is %+v", connectionConfig.Key, masterConfig.Key)
134138
if visitedKeys.HasKey(masterConfig.Key) {

0 commit comments

Comments
 (0)