Skip to content

134130/netty-dbgw

Repository files navigation

netty-dbgw

netty-dbgw is a proxy server for the MySQL protocol, built using the Netty framework. It acts as an intermediary between a MySQL client and a MySQL server, providing the capability to parse and handle protocol packets at a granular level.

How to Run

Prerequisites

  • Java 21 or higher
  • Run MySQL server with docker container:
    docker run --name mysql -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 -d mysql:latest

Run

./gradlew run --args='--port=3307 --upstream=localhost:3306'

or

./gradlew installDist
./app/build/install/app/bin/app --port=3307 --upstream=localhost:3306

Features & Roadmap

Security Features

  • Connection Rate Limiting
  • Modifying Server Capabilities
  • Authentication Modification
  • Preventing SQL Queries
  • Modifying SQL Queries
  • Query Logging and Auditing
  • Query Rate Limiting
  • Modifying Result Sets
  • Row-Level Security

MySQL Protocol Features

  • Connection Phase
    • Initial Handshake
      • Plain Handshake
      • SSL Handshake
        • TLS Handshake
        • mTLS Handshake
      • Capability Negotiation
    • Authentication Phase Fast Path
    • Authentication Method Mismatch
    • COM_CHANGE_USER
    • Authentication Methods
      • Old Password Authentication
      • caching_sha2_password
      • sha256_password
      • Clear text client plugin
      • Windows Native Authentication
      • authentication_webauthn
    • Multi-Factor Authentication (MFA)
  • Command Phase
    • Text Protocol: COM_QUERY
      • LOCAL INFILE Request
      • Text Resultset Response
    • Utility Commands
      • COM_QUIT
      • COM_INIT_DB
      • COM_FIELD_LIST
      • COM_STATISTICS
      • COM_DEBUG
      • COM_PING
      • COM_CHANGE_USER
      • COM_RESET_CONNECTION
      • COM_SET_OPTION
    • Prepared Statements
      • COM_STMT_PREPARE
      • COM_STMT_EXECUTE
      • COM_STMT_CLOSE
      • COM_STMT_RESET
      • COM_STMT_SEND_LONG_DATA
    • Stored Programs
      • Multi-Resultset
      • Multi-Statement
  • Replication Protocol
    • Binlog File
    • Binlog Network Stream
    • Binlog Version
    • Binlog Event
    • COM_BINLOG_DUMP

PostgreSQL Protocol Features

  • Connection Phase
    • Startup
    • Authentication
      • AuthenticationOk
      • MD5Password
      • SASL
  • Command Phase
    • Simple Query
    • Extended Query
      • Parse
      • Bind
      • Execute
      • Describe
      • Sync
      • Close
  • Security Features
    • Row-Level Security
    • Result Set Masking

Benchmarks

Handling a 4GB Result Set (1.4k rows / 3MB each)

  • Direct MySQL connection: ~37.75 seconds
  • With netty-dbgw proxy: ~38.61 seconds

About

Database Gateway with netty practice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •