Skip to content

Introduce support for pcap traffic capturing of network traffic#4260

Draft
geoand wants to merge 1 commit intoeclipse-vertx:masterfrom
geoand:pcap
Draft

Introduce support for pcap traffic capturing of network traffic#4260
geoand wants to merge 1 commit intoeclipse-vertx:masterfrom
geoand:pcap

Conversation

@geoand
Copy link
Contributor

@geoand geoand commented Jan 28, 2022

Motivation:

The idea here is to allow users to analyze HTTP traffic consumed and produced via Vert.x using Wireshark.
This capabity relies on Netty's io.netty.handler.pcap.PcapWriteHandler and has also been mentioned in vert-x3/issues#566.

P.S. I tested this by also patching Quarkus to use this change and tried an application that uses RESTEasy Reactive and the Reactive REST Client.
Here is what the Wireshark screenshot looks like:
Screenshot from 2022-01-28 16-51-38

@vietj
Copy link
Member

vietj commented Jan 28, 2022

we should have it also on NetSocket as it remains useful for other parts of vertx stack like MQTT or SQL client that use NetSocket

@geoand
Copy link
Contributor Author

geoand commented Jan 28, 2022

Good point. I'll have a look on Monday

@geoand geoand changed the title Introduce support for pcap traffic capturing of HTTP traffic Introduce support for pcap traffic capturing of network traffic Jan 31, 2022
@geoand
Copy link
Contributor Author

geoand commented Jan 31, 2022

Capturing also add to the NetClientImpl pipeline

@vietj
Copy link
Member

vietj commented Jan 31, 2022

I think that the option declaration could simply be in TCPSSLOptions or perhaps NetworkOptions since it could work for UDP as well ?

@vietj vietj added this to the 4.2.5 milestone Jan 31, 2022
@geoand
Copy link
Contributor Author

geoand commented Jan 31, 2022

Indeed, PR updated

@FroMage
Copy link
Contributor

FroMage commented Jan 31, 2022

Very cool!

@geoand
Copy link
Contributor Author

geoand commented Feb 1, 2022

@vietj is there anything else that this PR needs, or should I mark it ready for review?

@vietj
Copy link
Member

vietj commented Feb 3, 2022

I need to make a final review for this

@geoand geoand force-pushed the pcap branch 2 times, most recently from d9803c3 to 7f41d10 Compare February 3, 2022 14:48
geoand added a commit to geoand/netty that referenced this pull request Feb 7, 2022
While exploring how to introduce PCAP support into
Vert.x and Quarkus based on Netty's PcapWriteHandler,
I noticed that in server pipelines,
the capture has the source and destination ports
reversed for server pipelines.

This can be seen in the screenshot from eclipse-vertx/vert.x#4260 (comment), where a browser is requesting
data from a REST API built with Quarkus listening on port 8080.
In the screenshot you can see that initial HTTP request has the ports
reversed.
normanmaurer pushed a commit to netty/netty that referenced this pull request Feb 7, 2022
Motivation:

While exploring how to introduce PCAP support into
Vert.x and Quarkus based on Netty's PcapWriteHandler,
I noticed that in server pipelines,
the capture has the source and destination ports
reversed for server pipelines.

This can be seen in the screenshot from eclipse-vertx/vert.x#4260 (comment), where a browser is requesting
data from a REST API built with Quarkus listening on port 8080.
In the screenshot you can see that initial HTTP request has the ports
reversed.

Modification:

This change makes sure that source and destination ports are always properly determined no matter what type of pipeline is being used

Result:

Correct port is used
@vietj
Copy link
Member

vietj commented Feb 15, 2022

I did a quick review of the VertxPcapWriteHandler and I can see a few issues with the static metadata map and the pcap write handler.

  1. it seems to me that when a channel is closed it will close the underlying output stream and all other concurrent channel use will not be able to write anymore.

  2. the shared static map access seems to be racy, e.g two FileOutputStream could be created for the same file.

Overall this seems to come from the fact that we haven't properly defined the lifecycle of the pcap files and therefore we should first define how this should be used.

e.g the pcap file could be created when the HTTP server is starting and closed when the HTTP server is closed, etc...

@geoand
Copy link
Contributor Author

geoand commented Dec 4, 2024

One very large benefit is that you can use this to capture TLS traffic which is really hard to do with a normal capture

@yeikel
Copy link
Contributor

yeikel commented Dec 4, 2024

I can confirm that analysis of tls traffic is very difficult in production environments

@vietj vietj modified the milestones: 4.5.12, 4.5.13 Jan 23, 2025
@vietj vietj modified the milestones: 4.5.13, 4.5.14 Feb 10, 2025
@vietj vietj modified the milestones: 4.5.14, 4.5.15 Apr 3, 2025
@vietj vietj modified the milestones: 4.5.15, 4.5.16 May 16, 2025
@vietj vietj modified the milestones: 4.5.16, 4.5.17 Jun 19, 2025
@vietj vietj modified the milestones: 4.5.17, 4.5.18 Aug 5, 2025
@vietj vietj modified the milestones: 4.5.18, 4.5.19 Aug 13, 2025
@vietj vietj modified the milestones: 4.5.19, 4.5.20, 4.5.21 Aug 27, 2025
@vietj vietj modified the milestones: 4.5.21, 4.5.22 Sep 3, 2025
@vietj vietj modified the milestones: 4.5.22, 4.5.23 Oct 22, 2025
@vietj vietj modified the milestones: 4.5.23, 4.5.24 Dec 15, 2025
@vietj vietj modified the milestones: 4.5.24, 4.5.25 Jan 15, 2026
@vietj vietj modified the milestones: 4.5.25, 4.5.26 Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants