-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-obvious connection error when tls is enabled on DSN without port #717
Comments
methane
added a commit
to methane/mysql
that referenced
this issue
Nov 30, 2017
5 tasks
methane
added a commit
to methane/mysql
that referenced
this issue
Nov 30, 2017
methane
added a commit
that referenced
this issue
Dec 4, 2017
bLamarche413
pushed a commit
to bLamarche413/mysql
that referenced
this issue
Mar 23, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue description
I believe the fix for issue #668 introduced a regression: now if DSN specifies host without a port along with a
tls=true
argument, connection fails with non-obvious message from crypto/tls package:Whereas it should either succeed provided that certificate is valid or fail with the proper error:
x509: certificate signed by unknown authority
.Here's the relevant code:
mysql/dsn.go
Lines 524 to 527 in cd4cb90
As
cfg.Addr
holds only hostname without port,net.SplitHostPort
returns non-nil error andcfg.tls.ServerName
left blank leading to errortls: either ServerName or InsecureSkipVerify must be specified in the tls.Config
returned from crypto/tls code:https://github.com/golang/go/blob/21672b36eb0ad3bf1e2220b247900b2c63664464/src/crypto/tls/handshake_client.go#L32-L35
Example code
Run this adjusting
-dsn
flag value as necessary — set host without port as address.Error log
Configuration
Driver version (or git SHA):
Go version: run
go version
in your consoleServer version: E.g. MySQL 5.6, MariaDB 10.0.20
Server OS: E.g. Debian 8.1 (Jessie), Windows 10
The text was updated successfully, but these errors were encountered: