diff --git a/README.md b/README.md index 325cacc..8ce8616 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Databasus Logo

Backup tool for PostgreSQL, MySQL and MongoDB

-

Databasus is a free, open source and self-hosted tool to backup databases. Make backups with different storages (S3, Google Drive, FTP, etc.) and notifications about progress (Slack, Discord, Telegram, etc.). Previously known as Postgresus (see migration guide).

+

Databasus is a free, open source and self-hosted tool to backup databases (with focus on PostgreSQL). Make backups with different storages (S3, Google Drive, FTP, etc.) and notifications about progress (Slack, Discord, Telegram, etc.). Previously known as Postgresus (see migration guide).

[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-336791?logo=postgresql&logoColor=white)](https://www.postgresql.org/) diff --git a/backend/internal/features/databases/databases/mariadb/model.go b/backend/internal/features/databases/databases/mariadb/model.go index b80237d..65fe9ed 100644 --- a/backend/internal/features/databases/databases/mariadb/model.go +++ b/backend/internal/features/databases/databases/mariadb/model.go @@ -2,6 +2,7 @@ package mariadb import ( "context" + "crypto/tls" "database/sql" "errors" "fmt" @@ -14,7 +15,7 @@ import ( "databasus-backend/internal/util/encryption" "databasus-backend/internal/util/tools" - _ "github.com/go-sql-driver/mysql" + "github.com/go-sql-driver/mysql" "github.com/google/uuid" ) @@ -398,8 +399,16 @@ func HasPrivilege(privileges, priv string) bool { func (m *MariadbDatabase) buildDSN(password string, database string) string { tlsConfig := "false" + if m.IsHttps { - tlsConfig = "skip-verify" + err := mysql.RegisterTLSConfig("mariadb-skip-verify", &tls.Config{ + InsecureSkipVerify: true, + }) + if err != nil { + // Config might already be registered, which is fine + _ = err + } + tlsConfig = "mariadb-skip-verify" } return fmt.Sprintf( diff --git a/backend/internal/features/databases/databases/mysql/model.go b/backend/internal/features/databases/databases/mysql/model.go index 51d848c..ae7a53c 100644 --- a/backend/internal/features/databases/databases/mysql/model.go +++ b/backend/internal/features/databases/databases/mysql/model.go @@ -2,6 +2,7 @@ package mysql import ( "context" + "crypto/tls" "database/sql" "errors" "fmt" @@ -14,7 +15,7 @@ import ( "databasus-backend/internal/util/encryption" "databasus-backend/internal/util/tools" - _ "github.com/go-sql-driver/mysql" + "github.com/go-sql-driver/mysql" "github.com/google/uuid" ) @@ -399,8 +400,17 @@ func HasPrivilege(privileges, priv string) bool { func (m *MysqlDatabase) buildDSN(password string, database string) string { tlsConfig := "false" + if m.IsHttps { - tlsConfig = "skip-verify" + err := mysql.RegisterTLSConfig("mysql-skip-verify", &tls.Config{ + InsecureSkipVerify: true, + }) + if err != nil { + // Config might already be registered, which is fine + _ = err + } + + tlsConfig = "mysql-skip-verify" } return fmt.Sprintf(