Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

cppforlife/mysql-proxy

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mysql-proxy

MySQL proxy that terminates TLS before proxying connection to MySQL server (without TLS). It does not require any changes to server or clients.

$ go build proxy.go
$ ./proxy 3306 3307 ./server.crt ./server.key

Protocol

No TLS

Proxy forwards initial handshakes and auth results without any modifications.

Server     Proxy      Client
  <-----------------------        tcp connection initiated
  ----------------------->        server sends handshake packet
  <-----------------------        client responds with full handshake (with hashed password)
  ----------------------->        if password is correct, reply with auth ok
  (packet seq reset to 0)
  (copying both ways)

With TLS

Without proxy:

Server                Client
  <-----------------------        tcp connection initiated
  ----------------------->        server sends handshake packet
  <-----------------------        client responds with short handshake
  <-----------------------        tls connection initialized
  <-----------------------        client responds with full handshake
  ----------------------->        if password is correct, reply with auth ok
  (packet seq reset to 0)
  (copying both ways)

Proxy drops client's short handshake and rewrites full handshake packet to disable SSL.

Server     Proxy      Client
  <-----------------------        tcp connection initiated
  ----------------------->        server sends handshake packet
             <------------        client responds with short handshake
                                  proxy will drop short handshake
                                  proxy prepares to receive tls handshake from client
             <------------        tls connection initialized
  <-------- ~~~ <---------        client responds with full handshake
                                  proxy rewrites packet seq number
                                  proxy removes "client supports ssl" flag
  --------> ~~~ --------->        if password is correct, server replies with auth ok
                                  proxy rewrites packet seq number
  (packet seq reset to 0)
  (copying both ways)

Reference:

TODO

  • add connection deadlines
  • set connection tcp keepalive

About

MySQL proxy for terminating TLS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.