Apurva Singh
Apurva Singh

Reputation: 5000

Inspect TCP packets from JVM to Database

I am using Java program with a database. I am doing in flight encryption feature provided by JDBC driver. Just to be sure, I need to examine the TCP packets going from Java(JVM actually at runtime) to database. How can this be done? Thanks.

Upvotes: 1

Views: 534

Answers (1)

Tasos P.
Tasos P.

Reputation: 4114

If you need to verify that traffic is encrypted between your application and the database host, you need to do that by examining the packets after they leave you app. The JDBC driver is the last layer before data packets enter the networking stack (i.e. OS TCP) and it's the part of your application which performs the encryption, so you can't verify encryption before that.

You can examine network traffic with special tools, such as Wireshark, as Levan pointed out, or any other packet analyzer/sniffer supported by your OS. On Linux, using tcpdump: tcpdump port 3306 -s 65535 -x -n -q -tttt > packets.out

As a final note, there are RDMS which can enforce encryption usage at user level, most notably MySQL: ALTER USER '...@...' REQUIRE SSL;

Upvotes: 3

Related Questions