Introduction
This article is dedicated to the task of securing MySQL client-server connection using functionality provided by the Secure Shell (SSH) protocol. To be exact, the SSH tunneling concept is utilized. We will review the steps needed to build secure MySQL client applications and implement a sample one ourselves.
MySQL traffic is not the only kind of data that can be tunneled by the Secure Shell. SSH can be used to secure any application-layer TCP-based protocol, such as HTTP, SMTP and POP3. If your application needs to secure such a protocol by tunneling it through a protected SSH connection, this article will be useful to you.
Background
Let’s imagine that we are developing an enterprise application that needs to send requests to a number of SQL servers all over the world and get responses from them (let’s imagine that it’s a super-powerful bank system that stores information about millions of accounts).
All the data between the application and SQL servers are transferred via the Internet “as is”. As most protocols used by SQL servers do not provide data integrity and confidentiality (and those that do,...